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); } } } } }
public function before() { parent::before(); $this->render->title = 'Join Us'; $this->render->layout = 'framed'; }
/** * Call a REST method if authorized, then render the REST service view * * @param String $view the view to render (ignored) * @param Array $options an array of rendering options (ignored) * @return String the contents to render (REST data in a content type) */ public function render($view = NULL, $options = array()) { $method = $this->request_method(); $options['type'] = $this->request_type(); $options['folder'] = 'REST'; // to use the "yawf/views/en/REST" folder return parent::render($method, $options); }
/** * 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'); }
/** * Render the requested view by using the cache * * @return String the view contents to render */ public function render($view = null, $options = array()) { // First look for cached contents $this->set_cache_path(); $contents = $this->read_cache(); if ($contents) { if ($type = $this->request_type()) { if ($content_type = array_key(self::$content_types, $type)) { header("Content-Type: {$content_type}"); } } return $contents; } // If not found or expired, write new cached contents $contents = parent::render(); if ($this->cache_secs) { $this->write_cache($contents); } return $contents; }
public function before() { parent::before(); load_models('User'); $this->render->user_email = $this->cookie->user_email; }
public function before() { load_helper('Twitter'); load_plugin('Twitter/OAuth'); parent::before(); }
public function before() { parent::before(); }
public function before() { parent::before(); load_models('Note'); Note::set_database_for($this->username); }
public function before() { parent::before(); $this->create_database(); }