Exemplo n.º 1
0
 /** Display an index of news stories
  * @access public
  * @return void
  */
 public function indexAction()
 {
     $form = new ContentSearchForm();
     $form->submit->setLabel('Search content');
     $this->view->form = $form;
     $cleaner = new Pas_ArrayFunctions();
     $params = $cleaner->array_cleanup($this->getAllParams());
     $search = new Pas_Solr_Handler();
     $search->setCore('content');
     $search->setFields(array('updated', 'updatedBy', 'publishState', 'title', 'created', 'createdBy', 'id'));
     if ($this->getRequest()->isPost() && !is_null($this->getParam('submit'))) {
         if ($form->isValid($this->_request->getPost())) {
             $params = $cleaner->array_cleanup($form->getValues());
             $this->_helper->Redirector->gotoSimple('index', 'news', 'admin', $params);
         } else {
             $form->populate($form->getValues());
             $params = $form->getValues();
         }
     } else {
         $params = $this->getAllParams();
         $form->populate($this->getAllParams());
     }
     if (!isset($params['q']) || $params['q'] == '') {
         $params['q'] = '*';
     }
     $params['type'] = 'news';
     $search->setParams($params);
     $search->execute();
     $this->view->paginator = $search->createPagination();
     $this->view->news = $search->processResults();
 }
Exemplo n.º 2
0
 /** Display index page
  * Display all content in the system Solr indexed
  * @access public
  * @return void
  */
 public function indexAction()
 {
     $form = new ContentSearchForm();
     $form->submit->setLabel('Search content');
     $this->view->form = $form;
     $params = $this->getCleaner()->array_cleanup($this->getAllParams());
     $search = new Pas_Solr_Handler();
     $search->setCore('content');
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($this->_request->getPost())) {
             $params = $this->getCleaner()->array_cleanup($form->getValues());
             $this->_helper->Redirector->gotoSimple('index', 'content', 'admin', $params);
         } else {
             $form->populate($form->getValues());
             $params = $form->getValues();
         }
     } else {
         $form->populate($this->getAllParams());
     }
     if (!isset($params['q']) || $params['q'] == '') {
         $params['q'] = '*';
     }
     $params['type'] = 'sitecontent';
     $params['page'] = $this->getParam('page');
     $search->setParams($params);
     $search->execute();
     $this->view->paginator = $search->createPagination();
     $this->view->contents = $search->processResults();
 }