Пример #1
0
 /**
  * Maps to Correct Search Method
  */
 public function index()
 {
     $filter = $this->input->get('filter', '', 'array');
     $source = \Search\Factory::defaultSource();
     if (empty($filter) && $source == 'all') {
         $this->allSearch();
     } else {
         $this->filteredSearch();
     }
 }
Пример #2
0
 /**
  * Gets the current selected source
  * 
  * @throws \Exception
  * @return unknown
  */
 public static function current()
 {
     // Get the default source
     $default_source = \Search\Factory::defaultSource();
     // Get the current selected source (use the state), fallback = default
     $current_source = (new \Search\Models\Source())->populateState()->getState('filter.search', $default_source);
     // find the source
     if ($source_exists = \Search\Factory::source($current_source)) {
         $class = $source_exists['class'];
     } elseif ($source_exists = \Search\Factory::source($default_source)) {
         $class = $source_exists['class'];
     }
     if (empty($class) || !class_exists($class)) {
         throw new \Exception('Search Type Not Found');
     }
     return $source_exists;
 }