| 1 |
lars |
1 |
<?php
|
|
|
2 |
/**
|
|
|
3 |
* MyPost class file
|
|
|
4 |
*
|
|
|
5 |
* @author Qiang Xue <qiang.xue@gmail.com>
|
|
|
6 |
* @link http://www.pradosoft.com/
|
|
|
7 |
* @copyright Copyright © 2006 PradoSoft
|
|
|
8 |
* @license http://www.pradosoft.com/license/
|
|
|
9 |
* @version $Id: MyPost.php 1398 2006-09-08 19:31:03Z xue $
|
|
|
10 |
*/
|
|
|
11 |
|
|
|
12 |
/**
|
|
|
13 |
* MyPost class
|
|
|
14 |
*
|
|
|
15 |
* @author Qiang Xue <qiang.xue@gmail.com>
|
|
|
16 |
* @link http://www.pradosoft.com/
|
|
|
17 |
* @copyright Copyright © 2006 PradoSoft
|
|
|
18 |
* @license http://www.pradosoft.com/license/
|
|
|
19 |
*/
|
|
|
20 |
class MyPost extends BlogPage
|
|
|
21 |
{
|
|
|
22 |
protected function bindData()
|
|
|
23 |
{
|
|
|
24 |
$author=$this->User->ID;
|
|
|
25 |
$offset=$this->PostGrid->CurrentPageIndex*$this->PostGrid->PageSize;
|
|
|
26 |
$limit=$this->PostGrid->PageSize;
|
|
|
27 |
$this->PostGrid->DataSource=$this->DataAccess->queryPosts("author_id=$author",'','ORDER BY a.status DESC, create_time DESC',"LIMIT $offset,$limit");
|
|
|
28 |
$this->PostGrid->VirtualItemCount=$this->DataAccess->queryPostCount("author_id=$author",'');
|
|
|
29 |
$this->PostGrid->dataBind();
|
|
|
30 |
}
|
|
|
31 |
|
|
|
32 |
public function onLoad($param)
|
|
|
33 |
{
|
|
|
34 |
parent::onLoad($param);
|
|
|
35 |
if(!$this->IsPostBack)
|
|
|
36 |
$this->bindData();
|
|
|
37 |
}
|
|
|
38 |
|
|
|
39 |
public function changePage($sender,$param)
|
|
|
40 |
{
|
|
|
41 |
$this->PostGrid->CurrentPageIndex=$param->NewPageIndex;
|
|
|
42 |
$this->bindData();
|
|
|
43 |
}
|
|
|
44 |
|
|
|
45 |
public function pagerCreated($sender,$param)
|
|
|
46 |
{
|
|
|
47 |
$param->Pager->Controls->insertAt(0,'Page: ');
|
|
|
48 |
}
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
?>
|