<?php
class PagesModel extends CmlModel {
	public function addpage($ptitle,$pkeywords,$pdescription,$pcontent,$poname){
		$pageok=$this->db()->set('pages', array('title'=>$ptitle,'keywords'=>$pkeywords,'description'=>$pdescription,'content'=>$pcontent,'oname'=>$poname),true);
		return $pageok;
	}
	
	public function editpagesave($pid,$ptitle,$pkeywords,$pdescription,$pcontent,$poname){
		$pageok=$this->db()->update('pages-id-'.$pid, array('title'=>$ptitle,'keywords'=>$pkeywords,'description'=>$pdescription,'content'=>$pcontent,'oname'=>$poname),true);
		return $pageok;
	}
	
	public function delpage($pid){
		$pageok=$this->db()->delete('pages-id-'.$pid);
		return $pageok;
	}
	
	public function editpage($pid){
		$pagedata=$this->db()->get('pages-id-'.$pid);
		return $pagedata;
	}
	
	public function indexpage(){
		$pagedata=$this->db()->table('pages')->orderBy('id', 'ASC')->select();
		return $pagedata;
	}
	
}