user = $GLOBALS['user']; } // ***** SEARCH ***** /** * Entry point of the controller that displays the dashboard's * search page of Stud.IP. * * @SuppressWarnings(PHPMD.CamelCaseMethodName) */ public function search_action() { // FilesController::getRangeLink require_once 'app/controllers/files.php'; if (Navigation::hasItem('/contents/files/search')) { Navigation::activateItem('/contents/files/search'); } PageLayout::setTitle(_('Dokumentensuche')); $this->query = new Query(); $this->query ->setQuery($this->getQuery()) ->setPage($this->getPage()) ->setFilter($this->getFilter()) ->setSort(Query::SORT_RELEVANCE); $this->result = Search::query($this->query); $this->addSearchSidebar(); } private function getQuery() { return \Request::get('q', null); } /** * This method return the requested page. * * @return int the requested page. */ public function getPage() { return \Request::get('page', 0); } /** * This method creates a new Filter object from the request. * * @return Filter the new Filter object */ public function getFilter() { $filterArray = \Request::getArray('filter'); $filter = new Filter(); if (isset($filterArray['category'])) { $filter->setCategory($filterArray['category']); } if (isset($filterArray['semester'])) { $filter->setSemester(\Semester::find($filterArray['semester'])); } return $filter; } }