Beispiel #1
0
 public function resultsAction()
 {
     $total = $this->engine->getHits($this->query)->getTotal();
     // user is not logged in, and has no temporary saved records, so nothing to show here;
     // force them to login
     if (!$this->request->getUser()->isAuthenticated() && $total == 0) {
         // link back here, but minus any username
         $folder_link = $this->request->url_for(array('controller' => 'folder'));
         // auth link, with return back to here
         $params = array('controller' => 'authenticate', 'action' => 'login', 'return' => $folder_link);
         // redirect them out
         $redirect = $this->request->url_for($params);
         $this->redirect()->toUrl($redirect);
     }
     return parent::resultsAction();
 }
 /**
  * Main page of results
  */
 public function resultsAction()
 {
     // ensure we've got the right user
     if ($this->request->getParam('username') != $this->request->getSessionData('username')) {
         $params = array('controller' => 'folder', 'action' => 'results', 'username' => $this->request->getSessionData('username'));
         return $this->redirectTo($params);
     }
     $total = $this->engine->getHits($this->query);
     // user is not logged in, and has no temporary saved records, so nothing to show here;
     // force them to login
     if (!$this->request->getUser()->isAuthenticated() && $total == 0 && $this->request->getSessionData('folder_visited') == null) {
         // link back here, but minus any username
         $folder_link = $this->request->url_for(array('controller' => 'folder'), true);
         // auth link, with return back to here
         $params = array('controller' => 'authenticate', 'action' => 'login', 'return' => $folder_link);
         return $this->redirectTo($params);
         // redirect them out
     }
     $this->request->setSessionData('folder_visited', true);
     return parent::resultsAction();
 }
Beispiel #3
0
 /**
  * This is called by searchAction once the search has been initiated and
  * again by javascript via ajaxstatusAction once the search has ended
  * Uses parent (SearchController) resultsAction
  */
 public function resultsAction()
 {
     //Debug::dump($this->query);
     $sid = $_SESSION[$this->id]['sid'];
     try {
         $status = $this->engine->getSearchStatus($sid);
     } catch (\Exception $e) {
         // Exception probably a session timeout; go back to front page
         $fm = new FlashMessenger();
         $fm->addMessage('Session timeout: ' . $e->getMessage());
         $params = $this->query->getAllSearchParams();
         $params['lang'] = $this->request->getParam('lang');
         $params['controller'] = $this->request->getParam('controller');
         $params['action'] = 'index';
         $url = $this->request->url_for($params);
         return $this->redirect()->toUrl($url);
     }
     // keep the session number for the AJAX code in the output HTML
     $this->request->setSessionData('pz2session', $sid);
     // tell jquery whether to start the timer
     $this->request->setSessionData('completed', (string) $status->isFinished());
     $this->request->setSessionData('targetnames', $this->query->getTargetNames());
     //Debug::dump($this->request); exit;
     // do the same with the query string
     $params = $this->query->getAllSearchParams();
     $pairs = array();
     foreach ($params as $k => $v) {
         if (is_array($v)) {
             foreach ($v as $e) {
                 $pairs[] = "{$k}={$e}";
             }
         } else {
             $pairs[] = "{$k}={$v}";
         }
     }
     $query_string = implode('&', $pairs);
     // needed for the javascript redirect
     $this->request->setSessionData('querystring', $query_string);
     $this->query->fillTargetInfo();
     if ($status->isFinished()) {
         $result = parent::resultsAction();
     } else {
         $result = array();
     }
     $result['status'] = $status->getTargetStatuses($this->query->getTargets());
     $result['externalLinks'] = $this->helper->addExternalLinks($this->config);
     return $result;
 }
 /**
  * ResultsAction is called by statusAction once the search has completed
  * Uses parent (SearchController) resultsAction
  */
 public function resultsAction()
 {
     //var_dump($this->request); exit;
     $uo = new UserOptions($this->request);
     $sid = $uo->getSessionData('pz2session');
     try {
         // force restoration of client from cache
         $status = $this->engine->getSearchStatus($sid);
         // fetch the search results
         $result = parent::resultsAction();
     } catch (\Exception $e) {
         // Exception probably a session timeout; go back to front page
         $this->flashMessenger->addMessage('Error|Session timeout: ' . $e->getMessage());
         $params = $this->query->getAllSearchParams();
         $params['controller'] = 'pazpar2';
         $params['action'] = 'index';
         $params['Submit'] = '';
         $url = $this->request->url_for($params);
         return $this->redirect()->toUrl($url);
     }
     // keep the session number for the AJAX code in the output HTML
     $this->request->setSessionData('pz2session', $sid);
     $targets = $uo->getSessionData('targets');
     $type = $uo->getSessionData('source_type');
     $targets = new Targets($type, $targets);
     $result->setVariable('useroptions', $uo);
     $result->setVariable('targets', $targets->getTargetNames());
     // needed for the facets
     //$result['status'] = $status->getTargetStatuses($this->query->getTargets());
     //$result['externalLinks'] = $this->helper->addExternalLinks($this->config);
     return $result;
 }
 /**
  * Records that are in this reading list
  */
 public function resultsAction()
 {
     if ($this->readinglist()->hasRecords()) {
         return parent::resultsAction();
     }
 }
 /**
  * ResultsAction is called by statusAction once the search has completed
  * Uses parent (SearchController) resultsAction
  */
 public function resultsAction()
 {
     $uo = new UserOptions($this->request);
     $sid = $uo->getSessionData('pz2session');
     try {
         // force restoration of client from cache
         $status = $this->engine->getSearchStatus($sid);
         // fetch the search results
         $result = parent::resultsAction();
     } catch (\Exception $e) {
         // Exception probably a session timeout; go back to front page
         $this->flashMessenger->addMessage('Error|Session timeout: ' . $e->getMessage());
         $params = $this->query->getAllSearchParams();
         $params['controller'] = 'pazpar2';
         $params['action'] = 'index';
         $params['Submit'] = '';
         $url = $this->request->url_for($params);
         return $this->redirect()->toUrl($url);
     }
     // keep the session number for the AJAX code in the output HTML
     $this->request->setSessionData('pz2session', $sid);
     $params = $this->query->getAllSearchParams();
     $pairs = array();
     foreach ($params as $k => $v) {
         if (is_array($v)) {
             foreach ($v as $e) {
                 $pairs[] = "{$k}={$e}";
             }
         } else {
             $pairs[] = "{$k}={$v}";
         }
     }
     $query_string = implode('&', $pairs);
     // needed by javascript (currently only for aim25)
     $this->request->setSessionData('querystring', $query_string);
     $targets = $uo->getSessionData('targets');
     $type = $uo->getSessionData('source_type');
     $targets = new Targets($type, $targets);
     $result->setVariable('externalLinks', $this->helper->addExternalLinks($this->config));
     $result->setVariable('useroptions', $uo);
     $result->setVariable('targets', $targets->getTargetNames());
     // needed for the facets
     //$result['status'] = $status->getTargetStatuses($this->query->getTargets());
     //$result['externalLinks'] = $this->helper->addExternalLinks($this->config);
     return $result;
 }