/**
  * Get the options for the node field
  * @return array Array with nodes which contain a search result widget. The array has the node id as key and the node name as value.
  */
 private function getSearchableContentTypeOptions()
 {
     $types = SearchFacade::getInstance()->getTypes();
     $options = array();
     foreach ($types as $type) {
         $options[$type] = $type;
     }
     return $options;
 }
Ejemplo n.º 2
0
 /**
  * Action to perform a search on a specified type
  * @param string $type name of the content type
  * @param string $query url encoded search query
  * @param string $action action for pagination
  * @param string $actionParameter action parameter for pagination
  * @return null
  */
 public function moreAction($type, $query, $action = null, $actionParameter = null)
 {
     $pageUrl = $this->request->getBasePath();
     $pageUrl .= '/' . self::ACTION_MORE . '/' . $type . '/' . $query . '/' . self::ACTION_PAGE . '/%page%';
     $query = urldecode($query);
     $numItems = $this->getNumberItemsPage();
     $page = 1;
     if ($action == self::ACTION_PAGE && $actionParameter) {
         $page = $actionParameter;
     }
     $result = SearchFacade::getInstance()->searchContent($type, $query, $numItems, $page);
     $pages = ceil($result->getTotalNumResults() / $numItems);
     $view = new SearchResultMoreView($type, $query, $result, $pageUrl, $page, $pages);
     $this->response->setView($view);
 }