From 2ea02214b2fb6bedb58dbbd318ef171a9e146524 Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 29 May 2006 03:08:07 +0000 Subject: Merge from 3.0 branch till 1099. --- demos/blog/protected/Pages/Posts/ListPost.php | 44 +++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 demos/blog/protected/Pages/Posts/ListPost.php (limited to 'demos/blog/protected/Pages/Posts/ListPost.php') diff --git a/demos/blog/protected/Pages/Posts/ListPost.php b/demos/blog/protected/Pages/Posts/ListPost.php new file mode 100644 index 00000000..6d56b543 --- /dev/null +++ b/demos/blog/protected/Pages/Posts/ListPost.php @@ -0,0 +1,44 @@ +Request['time']))>0) + { + $year=(integer)($time/100); + $month=$time%100; + $startTime=mktime(0,0,0,$month,1,$year); + if(++$month>12) + { + $month=1; + $year++; + } + $endTime=mktime(0,0,0,$month,1,$year); + $timeFilter="create_time>=$startTime AND create_time<$endTime"; + } + if(($catID=$this->Request['cat'])!==null) + { + $catID=TPropertyValue::ensureInteger($catID); + $catFilter="category_id=$catID"; + } + if(($offset=TPropertyValue::ensureInteger($this->Request['offset']))<=0) + $offset=0; + if(($limit=TPropertyValue::ensureInteger($this->Request['limit']))<=0) + $limit=self::DEFAULT_LIMIT; + return $this->DataAccess->queryPosts('',$timeFilter,$catFilter,'ORDER BY create_time DESC',"LIMIT $offset,$limit"); + } + + public function onLoad($param) + { + parent::onLoad($param); + $this->PostList->DataSource=$this->getPosts(); + $this->PostList->dataBind(); + } +} + +?> \ No newline at end of file -- cgit v1.2.3