示例#1
0
 /**
  * Stored filters come in cookie
  */
 protected function prepare_grid_filters()
 {
     // import filters from params
     foreach ($this->collection->fields() as $key => $field) {
         if (isset($field['filter']) && $this->params->is_set($key)) {
             $this->grid_filters[$key] = $this->params->get($key);
         }
     }
     // grid-filters
     if (!empty($this->grid_filters)) {
         foreach ($this->grid_filters as $key => $value) {
             if ($this->params->offsetExists($key) && !$this->params->is_set($key)) {
                 // populate params, if not set
                 $this->params->set($key, $value);
             }
         }
         if (isset($this->grid_filters['limit'])) {
             $this->_limit = (int) $this->grid_filters['limit'];
         }
     }
 }
示例#2
0
 /**
  * Parse path
  * Set ident vars for editor controller
  * /module/controller/pname/pvalue/.../
  * 
  * Do not ovverride identvars with (pid,.. etc) URL, respect post data
  */
 function dispatch($path, ident_vars $params)
 {
     if (empty($path)) {
         return;
     }
     $path = explode('/', $path);
     $module = array_shift($path);
     if (isset($module)) {
         $params->m = $module;
     }
     $controller = array_shift($path);
     if (isset($controller)) {
         $params->c = $controller;
     }
     $post = core::lib('request')->post();
     if (!empty($path)) {
         while (1) {
             $pname = array_shift($path);
             $pvalue = array_shift($path);
             if (isset($pname) && isset($pvalue) && !isset($post[$pname])) {
                 $params->set($pname, $pvalue);
             } else {
                 break;
             }
         }
     }
 }