/** * Pre-execute function for search functions * * @param TBGRequest $request */ public function preExecute(TBGRequest $request, $action) { $this->forward403unless(TBGContext::getUser()->hasPageAccess('search') && TBGContext::getUser()->canSearchForIssues()); if ($project_key = $request['project_key']) { $project = TBGProject::getByKey($project_key); } elseif (is_numeric($request['project_id']) && ($project_id = (int) $request['project_id'])) { $project = TBGProjectsTable::getTable()->selectById($project_id); } else { $project = false; } if ($project instanceof TBGProject) { $this->forward403unless(TBGContext::getUser()->hasProjectPageAccess('project_issues', $project)); TBGContext::getResponse()->setPage('project_issues'); TBGContext::setCurrentProject($project); } $this->search_object = TBGSavedSearch::getFromRequest($request); $this->issavedsearch = $this->search_object instanceof TBGSavedSearch && $this->search_object->getB2DBID(); $this->show_results = $this->issavedsearch || $request->hasParameter('quicksearch') || $request->hasParameter('fs') || $request->getParameter('search', false) ? true : false; $this->searchterm = $this->search_object->getSearchterm(); $this->searchtitle = $this->search_object->getTitle(); if ($this->issavedsearch) { if (!($this->search_object instanceof TBGSavedSearch && TBGContext::getUser()->canAccessSavedSearch($this->search_object))) { TBGContext::setMessage('search_error', TBGContext::getI18n()->__("You don't have access to this saved search")); } } }
public function componentResults_view() { if ($this->view->getType() == TBGDashboardView::VIEW_PREDEFINED_SEARCH) { $request = TBGContext::getRequest(); $request->setParameter('predefined_search', $this->view->getDetail()); $search = TBGSavedSearch::getFromRequest($request); } elseif ($this->view->getType() == TBGDashboardView::VIEW_SAVED_SEARCH) { $search = TBGSavedSearchesTable::getTable()->selectById($this->view->getDetail()); } $this->issues = $search->getIssues(); $this->resultcount = $search->getTotalNumberOfIssues(); }