<?php 
class Orderform_Controller extends Base_Controller{
	function __construct(){
		parent::__construct();
		$this->orderform	=	new Orderform_Model();
		$this->db			=	new Database();
	}
	function index($page=1){
		$this->view					=	new View("orderform/list");
		$sum						=	$this->orderform->get()->count();
		$pagecfg['total_items']		=	$sum;
		$pagecfg['current_page']	=	$page;
		$pagecfg['items_per_page']	=	30;
		$pagecfg['base_url']		=	BASEURI."orderform/index";
		$this->pagination			=	new Pagination($pagecfg);
		$this->view->orders			=	$this->orderform->get(false,$page)->result_array();
		$this->display();
	}
	function delete($orderid=false){
		if($this->input->post()){
			$orderids	=	$this->input->post("select_id");
		}
		else{
			$orderids[]	=	$orderid;
		}
		$this->orderform->delete($orderids);
		$this->index();
	}
	function view($orderid){
		$order					=	$this->orderform->get($orderid)->current();
		$this->view				=	new View("orderform/view");
		eval("\$a=".$order->data.";");
		$this->view->orders		=	$a;
		$this->display();
	}
}