Пример #1
0
 /**
  * Pre-execute function for search functions
  *
  * @param framework\Request $request
  */
 public function preExecute(framework\Request $request, $action)
 {
     $this->forward403unless(framework\Context::getUser()->hasPageAccess('search') && framework\Context::getUser()->canSearchForIssues());
     if ($project_key = $request['project_key']) {
         $project = entities\Project::getByKey($project_key);
     } elseif (is_numeric($request['project_id']) && ($project_id = (int) $request['project_id'])) {
         $project = tables\Projects::getTable()->selectById($project_id);
     } else {
         $project = false;
     }
     if ($project instanceof entities\Project) {
         $this->forward403unless(framework\Context::getUser()->hasProjectPageAccess('project_issues', $project));
         framework\Context::getResponse()->setPage('project_issues');
         framework\Context::setCurrentProject($project);
     }
     $this->search_object = entities\SavedSearch::getFromRequest($request);
     $this->issavedsearch = $this->search_object instanceof entities\SavedSearch && $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 instanceof entities\SavedSearch ? $this->search_object->getSearchterm() : '';
     $this->searchtitle = $this->search_object instanceof entities\SavedSearch ? $this->search_object->getTitle() : '';
     if ($this->issavedsearch) {
         if (!($this->search_object instanceof entities\SavedSearch && framework\Context::getUser()->canAccessSavedSearch($this->search_object))) {
             framework\Context::setMessage('search_error', framework\Context::getI18n()->__("You don't have access to this saved search"));
         }
     }
 }
Пример #2
0
 public function componentResults_view()
 {
     if ($this->view->getType() == entities\DashboardView::VIEW_PREDEFINED_SEARCH) {
         $request = framework\Context::getRequest();
         $request->setParameter('predefined_search', $this->view->getDetail());
         $search = entities\SavedSearch::getFromRequest($request);
     } elseif ($this->view->getType() == entities\DashboardView::VIEW_SAVED_SEARCH) {
         $search = tables\SavedSearches::getTable()->selectById($this->view->getDetail());
     }
     $this->issues = $search->getIssues();
     $this->resultcount = $search->getTotalNumberOfIssues();
 }