Exemplo n.º 1
0
 /**
  * return list
  *
  * @param object $lc 
  * @return array
  * @author Andy Bennett
  */
 public function get_list()
 {
     $data = array('action' => 'list', 'name' => $this->name, 'role' => Steamauth::instance()->get_role());
     Event::run('steamcore.aclcheck', $data);
     $tdata = array();
     $limit = 10;
     $total = $this->model->get_total();
     // query the model
     $pagination = pagination_helper::get_pagination($limit, $total);
     $l = steamcore::array_object(array('limit' => $limit, 'offset' => $pagination->sql_offset()));
     $o = $this->get_order();
     $data['query'] = $this->model->get_list($w = null, $o, $l);
     $data['controller'] = Kohana::instance()->uri->segment(1);
     $data['pagination'] = $total <= $limit ? '' : $pagination->render();
     // pass the order direction
     // $data['od'] = (!isset($lc->query_config->order_dir) || $lc->query_config->order_dir == 'DESC')?'ASC':'DESC';
     // merge any passed data and the data returned from the model
     $tdata = array_merge($tdata, $data);
     // return the result
     return $tdata;
 }
Exemplo n.º 2
0
 /**
  * get the list of gallery items
  *
  * @param int $gid 
  * @return array
  * @author Andy Bennett
  */
 function get_list($gid)
 {
     $data = array('action' => 'list', 'name' => $this->name, 'role' => Steamauth::instance()->get_role());
     Event::run('steamcore.aclcheck', $data);
     // which model are we using? one passed through or the default?
     $model = $this->model;
     $controller = Kohana::instance()->uri->segment(1);
     $tdata = array();
     $limit = 10;
     $where = null;
     if ($this->uri->segment(3)) {
         $where = array('gallery' => $gid);
     }
     // query the model
     $pagination = pagination_helper::get_pagination($limit, $model->get_total($where));
     $l = steamcore::array_object(array('limit' => $limit, 'offset' => $pagination->sql_offset()));
     $data['query'] = $model->get_list($where, $order = null, $limit = $l);
     $data['controller'] = $controller;
     $data['pagination'] = $pagination->render();
     // pass the order direction
     // $data['od'] = (!isset($lc->query_config->order_dir) || $lc->query_config->order_dir == 'DESC')?'ASC':'DESC';
     // merge any passed data and the data returned from the model
     $tdata = array_merge($tdata, $data);
     // return the result
     return $tdata;
 }