Example #1
0
 /**
  * Display search form and results (if any)
  *
  * @return  void
  */
 public function displayTask()
 {
     Plugin::import('search');
     // Set breadcrumbs
     Pathway::append(Lang::txt('COM_SEARCH'), 'index.php?option=com_search');
     $terms = new Terms(Request::getString('terms'));
     // Set the document title
     Document::setTitle($terms->is_set() ? Lang::txt('COM_SEARCH_RESULTS_FOR', $this->view->escape($terms->get_raw())) : 'Search');
     // Get search results
     $results = new Set($terms);
     $results->set_limit(Request::getState('global.list.limit', 'limit', Config::get('list_limit'), 'int'));
     $results->set_offset(Request::getInt('limitstart', 0));
     $results->collect(Request::getBool('force-generic'));
     $this->view->url_terms = urlencode($terms->get_raw_without_section());
     @(list($plugin, $section) = $terms->get_section());
     if ($plugin) {
         foreach ($results->get_result_counts() as $cat => $def) {
             if ($plugin == $cat) {
                 $total = $def['count'];
                 break;
             }
         }
     } else {
         $total = $results->get_total_count();
     }
     $this->view->terms = $terms;
     $this->view->results = $results;
     $this->view->total = $total;
     $this->view->plugin = $plugin;
     $this->view->section = $section;
     $this->view->display();
 }