Subversion-Projekte lars-tiefland.prado

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
/**
3
 * PostMan class file
4
 *
5
 * @author Qiang Xue <qiang.xue@gmail.com>
6
 * @link http://www.pradosoft.com/
7
 * @copyright Copyright &copy; 2006 PradoSoft
8
 * @license http://www.pradosoft.com/license/
9
 * @version $Id: PostMan.php 1398 2006-09-08 19:31:03Z xue $
10
 */
11
 
12
/**
13
 * PostMan class
14
 *
15
 * @author Qiang Xue <qiang.xue@gmail.com>
16
 * @link http://www.pradosoft.com/
17
 * @copyright Copyright &copy; 2006 PradoSoft
18
 * @license http://www.pradosoft.com/license/
19
 */
20
class PostMan extends BlogPage
21
{
22
	protected function bindData()
23
	{
24
		$offset=$this->PostGrid->CurrentPageIndex*$this->PostGrid->PageSize;
25
		$limit=$this->PostGrid->PageSize;
26
		$this->PostGrid->DataSource=$this->DataAccess->queryPosts('','','ORDER BY a.status DESC, modify_time DESC',"LIMIT $offset,$limit");
27
		$this->PostGrid->VirtualItemCount=$this->DataAccess->queryPostCount('','');
28
		$this->PostGrid->dataBind();
29
	}
30
 
31
	public function onLoad($param)
32
	{
33
		parent::onLoad($param);
34
		if(!$this->IsPostBack)
35
			$this->bindData();
36
	}
37
 
38
	public function changePage($sender,$param)
39
	{
40
		$this->PostGrid->CurrentPageIndex=$param->NewPageIndex;
41
		$this->bindData();
42
	}
43
 
44
	public function pagerCreated($sender,$param)
45
	{
46
		$param->Pager->Controls->insertAt(0,'Page: ');
47
	}
48
 
49
	public function editItem($sender,$param)
50
	{
51
		$this->PostGrid->EditItemIndex=$param->Item->ItemIndex;
52
		$this->bindData();
53
	}
54
 
55
	public function saveItem($sender,$param)
56
	{
57
		$item=$param->Item;
58
		$postID=$this->PostGrid->DataKeys[$item->ItemIndex];
59
		$postRecord=$this->DataAccess->queryPostByID($postID);
60
		$postRecord->Status=TPropertyValue::ensureInteger($item->Cells[2]->PostStatus->SelectedValue);
61
		$this->DataAccess->updatePost($postRecord);
62
		$this->PostGrid->EditItemIndex=-1;
63
		$this->bindData();
64
	}
65
 
66
	public function cancelItem($sender,$param)
67
	{
68
		$this->PostGrid->EditItemIndex=-1;
69
		$this->bindData();
70
	}
71
}
72
 
73
?>