Subversion-Projekte lars-tiefland.prado

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
/**
3
 * EditCategory 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: EditCategory.php 1398 2006-09-08 19:31:03Z xue $
10
 */
11
 
12
/**
13
 * EditCategory 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 EditCategory extends BlogPage
21
{
22
	private $_category;
23
 
24
	public function onInit($param)
25
	{
26
		parent::onInit($param);
27
		$id=TPropertyValue::ensureInteger($this->Request['id']);
28
		$this->_category=$this->DataAccess->queryCategoryByID($id);
29
		if($this->_category===null)
30
			throw new BlogException(500,'category_id_invalid',$id);
31
	}
32
 
33
	public function onLoad($param)
34
	{
35
		parent::onLoad($param);
36
		if(!$this->IsPostBack)
37
		{
38
			$this->CategoryName->Text=$this->_category->Name;
39
			$this->CategoryDescription->Text=$this->_category->Description;
40
		}
41
	}
42
 
43
	public function saveButtonClicked($sender,$param)
44
	{
45
		if($this->IsValid)
46
		{
47
			$this->_category->Name=$this->CategoryName->Text;
48
			$this->_category->Description=$this->CategoryDescription->Text;
49
			$this->DataAccess->updateCategory($this->_category);
50
			$this->gotoPage('Posts.ListPost',array('cat'=>$this->_category->ID));
51
		}
52
	}
53
 
54
	public function checkCategoryName($sender,$param)
55
	{
56
		$name=$this->CategoryName->Text;
57
		$param->IsValid=$this->DataAccess->queryCategoryByName($name)===null;
58
	}
59
}
60
 
61
?>