Exemplo n.º 1
0
 /**
  * Perform search and output results.
  *
  * @param string $sort_url		Base sort url.
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function show_results($sort_url)
 {
     // Setup the sort tool
     $this->sort->set_defaults($this->config['posts_per_page'])->request();
     // Do the search
     $results = $this->query_index();
     // Grab the users
     \users_overlord::load_users($results['user_ids']);
     $this->display->assign_global_vars();
     $this->assign_doc_vars($results['documents']);
     $this->assign_result_vars($this->sort->total);
     $parameters = array();
     $expected_parameters = array('versions' => array(array(''), false), 'c' => array(array(0), false), 'sc' => array(false, false), 'keywords' => array('', true), 'sf' => array('', false), 'author' => array('', true), 'u' => array(0, false), 'type' => array(0, false), 'contrib' => array(0, false));
     foreach ($expected_parameters as $name => $properties) {
         if ($this->request->is_set($name)) {
             list($default_value, $multibyte) = $properties;
             $value = $this->request->variable($name, $default_value, $multibyte);
             // Clean up URL by not including default values.
             if ($value !== $default_value) {
                 $parameters[$name] = $value;
             }
         }
     }
     $this->sort->build_pagination($sort_url, $parameters);
     return $this->helper->render('search_results.html', $this->user->lang['SEARCH']);
 }