function __construct() { parent::__construct(); //set name-spaces for session-storage of each controller-method pair. $this->namespace = strtolower($this->uri->segment(1, 'admin') . '_' . $this->uri->segment(2, 'index') . '_' . $this->uri->segment(3, 'index')); //echo '<pre>';print_r($this->session->all_userdata()); //get all session keys $sess_keys = array_keys($this->session->all_userdata()); /*unset session-data stored by using namespaces.But except the current controller-methos pair's data. There are list of methods if current method is one of those, dont unset the session.*/ $current_method = $this->uri->segment(3, 'index'); $methods_list = array('index', 'price_list', 'test'); // these are the methods which are having grid-view if (in_array($current_method, $methods_list)) { $keys = array('search_conditions', 'search_narrow_conditions', 'fields', 'per_page', 'order_field', 'direction'); foreach ($sess_keys as $key => $value) { foreach ($keys as $key) { $position1 = strpos($value, $key); $position2 = strpos($value, $this->namespace); if ($position2 !== 0 && $position1 !== false && $position1 != 0) { $this->session->unset_userdata($value); } } } } }
/** * Check to see if in testing mode, if not, redirect to root * * @access public */ public function __construct() { parent::__construct(); //if (!$this->testing()) //{ // $this->redirect('/'); //} //$this->redirect('/admin/login'); }