예제 #1
0
 /**
  * @brief Search in the activities and return search results
  * @param $query
  * @return search results
  */
 function search($query)
 {
     $data = Data::search($query, 100);
     $results = array();
     foreach ($data as $d) {
         $file = $d['file'];
         $results[] = new \OC_Search_Result(basename($file), $d['subject'] . ' (' . \OCP\Util::formatDate($d['timestamp']) . ')', \OC_Helper::linkTo('activity', 'index.php'), 'Activity');
     }
     return $results;
 }
예제 #2
0
 public function keywordAction()
 {
     // Action parameters
     $search = $this->getRequest()->getParam("search");
     // A bit of filtering
     $search = substr($search, 0, 50);
     // Get all the items; if we are an admin, we also get the hidden one
     $data = new Data();
     $sourcesTable = new Sources();
     $sources = $sourcesTable->getSources();
     $items = array();
     foreach ($sources as $source) {
         $s = SourceModel::newInstance($source['service'], $source);
         $index = $s->getSearchIndex();
         $prefix = $s->getServicePrefix();
         $id = $s->getID();
         if ($index != '') {
             $r = $data->search($id, $prefix, $index, $search, $this->_admin);
             if ($r) {
                 $items = array_merge($items, $r);
             }
         }
     }
     // Sort the result of the search
     $sorter = new Stuffpress_SortItems();
     $sorter->sort($items, 1);
     // Prepare the common elements
     $this->common();
     // Add specifics entries
     $this->view->search = $search;
     $this->view->items = $items;
     $this->view->models = $this->getModels();
     // Set page title
     $title = $this->_properties->getProperty('title');
     $subtitle = $this->_properties->getProperty('subtitle');
     $separator = $title ? "|" : "";
     $this->view->headTitle("{$title} {$separator} Search results for {$search}");
     // Add specific styles and javascripts
     $this->view->headScript()->appendFile('js/controllers/timeline.js');
     $this->view->headLink()->appendStylesheet('style/lightbox.css');
     // Render the index
     $this->render('index');
 }
 public function getTopics($count, $offset)
 {
     return $this->dataModel->search($this->request, $count, $offset);
 }
예제 #4
0
 public function searchAction()
 {
     // Action parameters
     $search = $this->getRequest()->getParam("search");
     $output = $this->getRequest()->getParam("output");
     // A bit of filtering
     $search = substr($search, 0, 50);
     // Get all the items; if we are an admin, we also get the hidden one
     $data = new Data();
     $sourcesTable = new Sources();
     $sources = $sourcesTable->getSources();
     $items = array();
     foreach ($sources as $source) {
         $s = SourceModel::newInstance($source['service'], $source);
         $index = $s->getSearchIndex();
         $prefix = $s->getServicePrefix();
         $id = $s->getID();
         if ($index != '') {
             $r = $data->search($id, $prefix, $index, $search, $this->_admin);
             if ($r) {
                 $items = array_merge($items, $r);
             }
         }
     }
     // Sort the result of the search
     $sorter = new Stuffpress_SortItems();
     $sorter->sort($items, 1);
     // Set page title
     $title = $this->_properties->getProperty('title');
     $subtitle = $this->_properties->getProperty('subtitle');
     $separator = $title ? "|" : "";
     $page_title = "{$title} {$separator} Search results for {$search}";
     $this->view->headTitle($page_title);
     // If rss, we stop here
     //		if ($output == "rss") {
     //			$key = "search_$search";
     //			$this->generateRss($key, $items, $page_title);
     //		}
     // Prepare the common elements
     $this->common();
     // Add specifics entries
     $this->view->search = $search;
     $this->view->items = $items;
     $this->view->models = $this->getModels();
     // Add specific styles and javascripts
     $this->view->headScript()->appendFile('js/controllers/timeline.js');
     $this->view->headLink()->appendStylesheet('style/lightbox.css');
     // Set link to RSS of page
     //		$host 		= trim(Zend_Registry::get("host"), '/');
     //		$rss_link   = "http://$host/search/" . urlencode($search) . "?output=rss";
     //		$this->view->headLink()->appendAlternate($rss_link, "application/rss+xml", "RSS Stream");
     // Render the index
     $this->render('index');
 }