Пример #1
0
 /**
  * Try to cache the list data
  */
 public function onBeforeListRender()
 {
     if (!$this->params->get('pivot_cache')) {
         return;
     }
     $cache = FabrikWorker::getCache();
     $cache->setCaching(1);
     $res = $cache->call(array(get_class($this), 'cacheResults'), $this->model->getId());
     $this->model->set('data', $res);
 }
Пример #2
0
 /**
  * Get a single column of data from the table, test for element filters
  *
  * @param   mixed  $col       Column to grab. Element full name or id
  * @param   bool   $distinct  Select distinct values only
  * @param   array  $opts      Options: filterLimit bool - should limit to filter_list_max global param (default true)
  *                                     where - additional where filter to apply to query (@since 3.0.8)
  *
  * @return  array  Values for the column - empty array if no results found
  */
 public function getColumnData($col, $distinct = true, $opts = array())
 {
     if (!array_key_exists($col, $this->columnData)) {
         $fbConfig = JComponentHelper::getParams('com_fabrik');
         $cache = FabrikWorker::getCache($this);
         $opts['filters'] = $this->filters;
         $res = $cache->call(array(get_class($this), 'columnData'), $this->getId(), $col, $distinct, $opts);
         if (is_null($res)) {
             $this->app->enqueueMessage('list model getColumn Data for ' . $col . ' failed', 'notice');
             $res = array();
         }
         if ((int) $fbConfig->get('filter_list_max', 100) == count($res)) {
             $this->app->enqueueMessage(JText::sprintf('COM_FABRIK_FILTER_LIST_MAX_REACHED', $col), 'notice');
         }
         $this->columnData[$col] = $res;
     }
     return $this->columnData[$col];
 }
Пример #3
0
 /**
  * Get a single column of data from the table, test for element filters
  *
  * @param   string  $col  column to get
  *
  * @return  array  values for the column - empty array if no results found
  */
 public function getColumnData($col)
 {
     if (!array_key_exists($col, $this->columnData)) {
         $fbConfig = JComponentHelper::getParams('com_fabrik');
         $cache = FabrikWorker::getCache();
         $res = $cache->call(array(get_class($this), 'columnData'), $this->getId(), $col);
         if (is_null($res)) {
             JError::raiseNotice(500, 'list model getColumn Data for ' . $col . ' failed');
         }
         if ((int) $fbConfig->get('filter_list_max', 100) == count($res)) {
             JError::raiseNotice(500, JText::sprintf('COM_FABRIK_FILTER_LIST_MAX_REACHED', $col));
         }
         if (is_null($res)) {
             $res = array();
         }
         $this->columnData[$col] = $res;
     }
     return $this->columnData[$col];
 }
Пример #4
0
 /**
  * Ajax call to get auto complete options (now caches results)
  *
  * @return  string  json encoded options
  */
 public function onAutocomplete_options()
 {
     // Needed for ajax update (since we are calling this method via dispatcher element is not set)
     $this->setId(JRequest::getInt('element_id'));
     $this->getElement(true);
     $cache = FabrikWorker::getCache();
     $search = JRequest::getVar('value');
     echo $cache->call(array(get_class($this), 'cacheAutoCompleteOptions'), $this, $search);
 }
Пример #5
0
 /**
  * Ajax call to get auto complete options (now caches results)
  *
  * @return  string  json encoded options
  */
 public function onAutocomplete_options()
 {
     // Needed for ajax update (since we are calling this method via dispatcher element is not set)
     $input = $this->app->input;
     $this->setId($input->getInt('element_id'));
     $this->loadMeForAjax();
     $cache = FabrikWorker::getCache();
     $search = $input->get('value', '', 'string');
     echo $cache->call(array(get_class($this), 'cacheAutoCompleteOptions'), $this, $search);
 }