public function action_index() { if ($this->_isPost()) { $params = ['offset' => $this->request->post('offset'), 'search' => $this->request->post('search'), 'pagination' => true]; list($messages, $more) = Model_Message::getList($params); if (empty($messages)) { $this->jsonResult(false); } $this->jsonResult(true, ['items' => $messages, 'more' => $more]); } $search = $this->request->query('m_search'); $this->tpl->bind('mSearch', $search); }
/** * прописываем глобальные конфиги * * @throws Kohana_Exception */ public function after() { $this->_appendFiles(); if (!$this->request->is_ajax()) { $this->_appendFilesAfter(); } View::set_global('user', Auth_Oracle::instance()->get_user()); $config = Kohana::$config->load('main')->as_array(); foreach ($config as $k => $v) { View::set_global($k, $v); } View::set_global('title', implode(" :: ", $this->title)); View::set_global('errors', $this->errors); if (Auth::instance()->logged_in()) { View::set_global('notices', Model_Message::getList(['not_read' => true])); } $this->template->content = $this->tpl; parent::after(); }