<?php
class Comment_Controller extends Base_Controller{
	function __construct(){
		parent::__construct();
		$this->comment	=	new Comment_Model();
	}
	function index($page=1,$showline=30){
		$pagecfg['total_items']	=	$this->comment->get($page)->count();
		$this->view				=	new View("comment/list");
		$this->view->comments	=	$this->comment->get($page)->result_array();
		$this->display();
	}
	function edit($Id=0){
		if($this->input->post()){
			$Id	=	$this->input->post("id");
			$data=	$this->input->post("comment");
			$this->comment->update($Id,$data);
			unset($_POST);
			$this->index();
		}
		else{
			$this->view				=	new View("comment/edit");
			$this->main->formAction	=	"comment/edit";
			$this->view->comment	=	$this->comment->getComment($Id);
			$this->display();
		}
	}
	function delete($id=0){
		if($this->input->post()){
			$licenceids	=	$this->input->post("select_id");
		}
		else{
			$licenceids	=	$licenceid;
		}
		$this->comment->delete($licenceids);
		unset($_POST);
		$this->index();
	}
	
}