/** * * Contruct that checks you are loged in before nothing else happens! */ function __construct(Request $request, Response $response) { parent::__construct($request, $response); //filter fields filling the data for arrays foreach ($this->_filter_fields as $field => $value) { if (is_array($value) and isset($value['table']) and isset($value['type'])) { if ($value['type'] == 'DISTINCT') { $result = array(); $query = DB::select($value['field'])->distinct(TRUE)->from($value['table'])->execute(); foreach ($query->as_array() as $k => $v) { $result[current($v)] = current($v); } } elseif ($value['type'] == 'SELECT') { $key = $value['key']; $val = $value['value']; $result = array(); $query = DB::select($key)->select($val)->from($value['table'])->execute(); foreach ($query->as_array() as $k => $v) { $k = $v[$key]; $result[$k] = $v[$val]; } } $this->_filter_fields[$field] = $result; } } //get the filters foreach (array_merge($_GET, $_POST) as $key => $value) { //with values if (isset($value) and $value != '') { //date between if (strpos($key, 'filter__from__') !== FALSE) { $var = str_replace('filter__from__', '', $key); $from = Core::request('filter__from__' . $var); $to = Core::request('filter__to__' . $var); //add it to the filter if ($from != NULL and $to != NULL) { $this->_filter_post[$var] = array($from, $to); } } elseif (strpos($key, 'filter__') !== FALSE and strpos($key, 'filter__to__') === FALSE) { $this->_filter_post[str_replace('filter__', '', $key)] = $value; } } } }
public function __construct($request, $response) { parent::__construct($request, $response); Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Orders'))->set_url(Route::url('oc-panel', array('controller' => 'order')))); }
/** * * Loads a basic list info * @param string $view template to render */ public function action_index($view = NULL) { parent::action_index('oc-panel/pages/products/index'); }