示例#1
0
 /**
  * getList
  *
  * @param Query    $query
  * @param integer  $start
  * @param integer  $limit
  *
  * @return  \stdClass[]
  */
 public function getList(Query $query, $start = null, $limit = null)
 {
     $query->limit($start, $limit);
     if (WINDWALKER_DEBUG) {
         $profiler = Ioc::getProfiler();
         $profiler->mark(uniqid() . ' - ' . (string) $query->dump());
     }
     $select = $query->select;
     $select = str_replace('SELECT ', 'SQL_CALC_FOUND_ROWS ', $select);
     $query->clear('select')->select($select);
     return $this->db->getReader($query)->loadObjectList();
 }
 /**
  * Execute the controller.
  *
  * @return  mixed Return executed result.
  *
  * @throws  \LogicException
  * @throws  \RuntimeException
  */
 public function execute()
 {
     $model = new BlogsModel();
     $model['user.id'] = User::get()->id;
     $data['activeMenu'] = $this->input->get('activeMenu', 'none');
     $data['hideMenu'] = $this->input->get('hideMenu', 0);
     $data['widget'] = new Data();
     // $data['widget']['sidebar'] = (new SidebarController($this->input, $this->app))->execute();
     $data['blog'] = Blog::get();
     $data['blogs'] = $model->getItems();
     $data['user'] = User::get();
     $data['profiler'] = WINDWALKER_DEBUG ? Ioc::getProfiler() : null;
     $this->data = $data;
     return $this->doExecute();
 }