Ejemplo n.º 1
0
 protected function getConfig()
 {
     if (!isset($this->_config)) {
         $this->_config = array();
         // Load the config
         foreach ($this->value as $config) {
             $datatable_config_dir = \Clips\clips_config('pagination_config_dir');
             if ($datatable_config_dir) {
                 $datatable_config_dir = $datatable_config_dir[0];
                 $p = \Clips\path_join($datatable_config_dir, $config . '.json');
                 if (file_exists($p)) {
                     $this->_config[$config] = \Clips\Pagination::fromJson(file_get_contents($p));
                 }
             }
         }
     }
     return $this->_config;
 }
Ejemplo n.º 2
0
 protected function getPagination($config)
 {
     $config_dir = config('pagination_config_dir');
     if ($config_dir) {
         $config_dir = $config_dir[0];
         $p = path_join($config_dir, $config . '.json');
         if (!file_exists($p) && func_num_args() >= 2) {
             $config = func_get_arg(1);
             // Try find the configuration by remove the first part
             $p = path_join($config_dir, $config . '.json');
         }
         if (file_exists($p)) {
             $pagination = Pagination::fromJson(file_get_contents($p));
             $pagination->name = $config;
             $pagination->security = $this->tool->load_class('securityEngine', true);
             $pagination->update($this->request->param());
             // Update the pagination using session where
             $conf = $this->request->session($config);
             if ($conf) {
                 $pagination->where[] = new Libraries\AndOperator($conf);
             }
             return $pagination;
         }
     }
     return null;
 }