예제 #1
0
 private function fetchData(SearchableModel $searchable, ARSelectFilter $filter)
 {
     $class = $searchable->getClassName();
     $ret = array();
     $ret['records'] = ActiveRecordModel::getRecordSetArray($class, $filter);
     $ret['count'] = ActiveRecordModel::getRecordCount($class, $filter);
     $ret['meta'] = $searchable->toArray();
     return $ret;
 }
예제 #2
0
 private function fetchData(SearchableModel $searchable, ARSelectFilter $filter)
 {
     $class = $searchable->getClassName();
     $ret = array();
     $ret['records'] = ActiveRecordModel::getRecordSetArray($class, $filter, true);
     $ret['count'] = ActiveRecordModel::getRecordCount($class, $filter);
     // calculate form and to
     $ret['from'] = $filter->getOffset();
     $ret['to'] = $filter->getLimit() + $ret['from'];
     $diff = $ret['to'] - $ret['from'];
     $c = count($ret['records']);
     if ($diff != $c) {
         $ret['to'] = $ret['from'] + $c;
     }
     $ret['from']++;
     $ret['meta'] = $searchable->toArray();
     if (method_exists($this, 'toArray_' . $searchable->getClassName())) {
         call_user_func_array(array($this, 'toArray_' . $searchable->getClassName()), array(&$ret['records']));
     }
     return $ret;
 }
예제 #3
0
 private function getProductsFromSearchQuery($query)
 {
     ClassLoader::import('application.model.searchable.SearchableModel');
     $request = $this->getRequest();
     $searchable = SearchableModel::getInstanceByModelClass('Product', SearchableModel::BACKEND_SEARCH_MODEL);
     $searchable->setOption('BACKEND_QUICK_SEARCH', true);
     return ActiveRecordModel::getRecordSet('Product', $searchable->getSelectFilter($query));
 }