Location: PHPKode > projects > Monyet > controllers/managenews.php
<?php

Class ManageNews extends Management {

	private $news;

	public function __construct(){
		parent::__construct();
		$this->news = new News();
	}

	public function show(){
		parent::show();
	}

	public function remove(){
		parent::remove();
	}

	public function removeItem(){
		$this->news->remove($_POST['id']);
	}

	public function populateShowContent(){
		$arraytable = 	$this->news->select($this->offset,$this->pglimit);
		$array_column = array("Posttime","Author","Title","Content");	  
		$this->xml->addTable($arraytable,$array_column,'Table News',$this->navigator->getAccess($this),$this->offset,'rightcontent',0);
	}

	public function populateAddForm(){
		$this->xml->addTextField('Title',null,'title','text');
		$this->xml->addHTMLArea('Content','','content');
	}

	public function populateEditForm(){
		$this->news->selectByID($_POST['id']);	  
		$this->xml->addTextField('Title',$this->news->getTitle(),'title','text');
		$this->xml->addHTMLArea('Content',$this->news->getContent(),'content');
	}

	public function getTitle(){
		return SITENAME.' -news';
	}

	public function getTotal(){
		return $this->news->getTotal();
	}

	public function getKeyVar(){
		return 'title';
	}

	public function getFormPlace(){
		return 'rightcontent';
	}

	public function editItem(){
		$array = array('username'=>$this->session->get('user'),
				  'title'=>$_POST['title'],'content'=>$_POST['content'],'posttime'=>'NOW()');	 
		return $this->news->update($array,$_POST['id']);	  
	}
	public function addItem(){
		$array = array('NOW()',$this->session->get('user'),$_POST['title'],$_POST['content']);
		$this->news->add($array);
	}
	public function checkAdd(){}
	public function checkEdit(){}
}
?>
Return current item: Monyet