Пример #1
0
 protected function filteredSearch()
 {
     $q = $this->input->get('q', null, 'default');
     try {
         $current_source = \Search\Models\Source::current();
         $paginated = \Search\Models\Source::paginate($current_source, $q);
         $count = 0;
         foreach (\Search\Factory::sources() as $key => $source) {
             $count = $count + \Search\Models\Source::count($source, $q);
         }
     } catch (\Exception $e) {
         $this->app->error(404, 'Search Type Not Found');
         return;
     }
     $this->app->set('current_source', $current_source);
     $this->app->set('paginated', $paginated);
     $this->app->set('count', $count);
     $this->app->set('q', $q);
     $this->app->set('meta.title', trim('Search ' . $current_source['title']));
     echo $this->theme->render('Search/Admin/Views::search/index.php');
 }
Пример #2
0
 /**
  * Searches All sources get two results per section 
  * TODO maybe the number of results is configurable in settings?
  */
 protected function allSearch()
 {
     $results = array();
     $q = trim($this->input->get('q', null, 'default'));
     try {
         if (!empty($q)) {
             $sources = \Search\Factory::sources();
             foreach ($sources as $key => $source) {
                 $paginated = \Search\Models\Source::paginate($source, $q);
                 if (!empty($paginated->items)) {
                     $results[$source['title']] = array_slice($paginated->items, 0, 2);
                 }
             }
             \Dsc\Activities::track('Performed Search', array('Search Term' => $q, 'Search Source' => 'All', 'page_number' => '1', 'app' => 'search'));
         }
     } catch (\Exception $e) {
         \Dsc\System::addMessage($e->getMessage(), 'error');
     }
     $this->app->set('current_source', 'all');
     $this->app->set('results', $results);
     $this->app->set('q', $q);
     $this->app->set('meta.title', trim('Search All'));
     echo $this->theme->render('Search/Site/Views::search/all.php');
 }
Пример #3
0
<h3 class="">Search Settings</h3>
<hr />

<div class="">

   
    
    <div class="form-group">
        <label>Source</label>
        
         <div class="col-md-7">
                            <select name="search[source]">
                            <?php 
$options[] = array('text' => 'All', 'value' => 'all');
$sources = \Search\Factory::sources();
foreach ($sources as $source) {
    $options[] = array('text' => $source['title'], 'value' => (string) $source['id']);
}
?>
                            <?php 
echo \Dsc\Html\Select::options($options, $flash->old('search.source'));
?>
                            </select>
                                                       
                        </div>
    </div>
    <!-- /.form-group -->
        
</div>
Пример #4
0
    <div class="col-sm-2 col-md-2">
        <ul class="nav nav-pills nav-stacked">
            <li class="active">
                <a href="./admin/search?q=<?php 
echo $q;
?>
">
                    Global Search
                    <span class="badge pull-right"><?php 
echo (int) $count;
?>
</span>
                </a>
            </li>
            <?php 
foreach (\Search\Factory::sources() as $source) {
    ?>
            <li>
                <a href="./admin/search?q=<?php 
    echo $q;
    ?>
&filter[search]=<?php 
    echo $source['id'];
    ?>
">
                    <span class="badge pull-right"><?php 
    echo (int) $counts[$source['title']];
    ?>
</span>
                    <?php 
    echo $source['title'];