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();
 }
Exemplo n.º 3
0
 /** The index action
  * @access public
  * @return void
  */
 public function indexAction()
 {
     $search = new Pas_Solr_Handler();
     $search->setCore('content');
     $search->setFields(array('*'));
     $search->setFacets(array('section'));
     $search->setParams($this->getAllParams());
     $search->execute();
     $this->view->query = $this->getParam('q');
     $this->view->facets = $search->processFacets();
     $this->view->paginator = $search->createPagination();
     $this->view->results = $search->processResults();
 }
Exemplo n.º 4
0
 /** Set up the index list
  * @access public
  * @return void
  */
 public function indexAction()
 {
     $person = $this->getAccount();
     if (!is_null($person->peopleID)) {
         $params = $this->getAllParams();
         $params['finderID'] = $person->peopleID;
         $params['-createdBy'] = $person->id;
         $search = new Pas_Solr_Handler();
         $search->setCore('objects');
         $search->setFields(array('id', 'identifier', 'objecttype', 'title', 'broadperiod', 'imagedir', 'filename', 'thumbnail', 'old_findID', 'description', 'county', 'workflow'));
         $search->setFacets(array('objectType', 'county', 'broadperiod', 'institution'));
         $search->setParams($params);
         $search->execute();
         $this->view->paginator = $search->createPagination();
         $this->view->finds = $search->processResults();
         $this->view->facets = $search->processFacets();
     } else {
         $this->redirect('/error/accountconnection');
     }
 }
Exemplo n.º 5
0
 /** Display a paginated list of OS data points
  */
 public function indexAction()
 {
     $form = new SolrForm();
     $form->removeElement('thumbnail');
     $form->q->setLabel('Search OS open data: ');
     $form->q->setAttribs(array('placeholder' => 'Try barrow for instance'));
     $this->view->form = $form;
     $params = $this->getAllParams();
     $search = new Pas_Solr_Handler();
     $search->setCore('geodata');
     $search->setFields(array('*'));
     $search->setFacets(array('county'));
     if ($this->getRequest()->isPost() && !is_null($this->getParam('submit'))) {
         if ($form->isValid($this->_request->getPost())) {
             $params = $form->getValues();
             unset($params['csrf']);
             $this->_helper->Redirector->gotoSimple('index', 'osdata', 'datalabs', $params);
         } else {
             $form->populate($form->getValues());
             $params = $form->getValues();
         }
     } else {
         $form->populate($this->_request->getPost());
     }
     $q = $this->getParam('q');
     if (is_null($q)) {
         $params['q'] = 'type:R OR type:A';
     } else {
         $params['q'] = 'type:R || type:A && ' . $q;
     }
     $params['source'] = 'osdata';
     $params['sort'] = 'id';
     $params['direction'] = 'asc';
     $search->setParams($params);
     $search->execute();
     $this->view->paginator = $search->createPagination();
     $this->view->results = $search->processResults();
     $this->view->facets = $search->processFacets();
 }
Exemplo n.º 6
0
 /** Display of publications with filtration
  * @access public
  * @return void
  */
 public function indexAction()
 {
     $form = new SolrForm();
     $form->removeElement('thumbnail');
     $form->removeElement('3D');
     $form->q->setLabel('Search the publications: ');
     $form->q->setAttrib('placeholder', 'Try Geake for example');
     $this->view->form = $form;
     $cleaner = new Pas_ArrayFunctions();
     $params = $cleaner->array_cleanup($this->getAllParams());
     $search = new Pas_Solr_Handler();
     $search->setCore('publications');
     $search->setFields(array('*'));
     $search->setFacets(array('publisher', 'yearPublished'));
     if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost()) && !is_null($this->getParam('submit'))) {
         if ($form->isValid($form->getValues())) {
             // ensure that the URL contains the value in the 'q' textbox (it might change) so
             // that it can be bookmarked etc.
             $params['q'] = $form->q->getValue();
             $this->_helper->Redirector->gotoSimple('index', 'publications', 'database', $params);
         } else {
             $form->populate($form->getValues());
             $params = $form->getValues();
         }
     } else {
         $params = $this->getAllParams();
         $form->populate($params);
     }
     if (!isset($params['q']) || $params['q'] == '') {
         $params['q'] = '*';
     }
     $params['sort'] = 'title';
     $params['direction'] = 'asc';
     $search->setParams($params);
     $search->execute();
     $this->view->facets = $search->processFacets();
     $this->view->paginator = $search->createPagination();
     $this->view->results = $search->processResults();
 }
Exemplo n.º 7
0
 public function taggedAction()
 {
     if ($this->getParam('term', false)) {
         $params = $this->getAllParams();
         $search = new Pas_Solr_Handler();
         $search->setCore('tags');
         $context = $this->_helper->contextSwitch->getCurrentContext();
         if ($context) {
             $params['format'] = $context;
         }
         $search->setParams($params);
         $search->execute();
         $this->view->paginator = $search->createPagination();
         $this->view->results = $search->processResults();
         $this->view->server = $search->getLoadBalancerKey();
     } else {
         throw new Pas_Exception_Param($this->_missingParameter, 500);
     }
 }
Exemplo n.º 8
0
 /** Display details of a person
  * @access public
  * @return void
  */
 public function personAction()
 {
     if ($this->getParam('id', false)) {
         $params = array();
         $person = $this->getPeople()->getPersonDetails($this->getParam('id'));
         if ($this->_helper->contextSwitch()->getCurrentContext() !== 'vcf') {
             $search = new Pas_Solr_Handler();
             $search->setCore('objects');
             $fields = new Pas_Solr_FieldGeneratorFinds($this->getCurrentContext());
             $search->setFields($fields->getFields());
             $params['finderID'] = $person['0']['secuid'];
             $params['page'] = $this->getParam('page');
             $search->setParams($params);
             $search->execute();
             $this->view->paginator = $search->createPagination();
             $this->view->finds = $search->processResults();
         }
         $this->view->peoples = $person;
     } else {
         throw new Pas_Exception_Param($this->_missingParameter, 500);
     }
 }
Exemplo n.º 9
0
 /** Display index page of images
  * @access public
  * @return void
  */
 public function indexAction()
 {
     $form = new SolrForm();
     $form->removeElement('thumbnail');
     $form->removeElement('3D');
     $this->view->form = $form;
     $search = new Pas_Solr_Handler();
     $search->setCore('images');
     $search->setFields(array('id', 'identifier', 'objecttype', 'title', 'broadperiod', 'imagedir', 'filename', 'thumbnail', 'old_findID', 'county', 'licenseAcronym', 'findID', 'institution'));
     $search->setFacets(array('licenseAcronym', 'broadperiod', 'county', 'objecttype', 'institution'));
     if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost()) && !is_null($this->getParam('submit'))) {
         //Check if valid
         if ($form->isValid($form->getValues())) {
             $params = $this->_arrayTools->array_cleanup($form->getValues());
             $this->_helper->Redirector->gotoSimple('index', 'images', 'database', $params);
         } else {
             //if failed, refill form
             $form->populate($this->_request->getPost());
             $params = $form->getValues();
         }
     } else {
         $params = $this->getAllParams();
         $form->populate($this->getAllParams());
     }
     //If q parameter is not set or is '', set default query
     if (!isset($params['q']) || $params['q'] == '') {
         $params['q'] = '*';
     }
     $params['show'] = 18;
     //Set the search params
     $search->setParams($params);
     //Execute the search
     $search->execute();
     //Process the facets
     $search->processFacets();
     //Send pagination to view
     $this->view->paginator = $search->createPagination();
     //Send results to view
     $this->view->results = $search->processResults();
     //Send facets to view
     $this->view->facets = $search->processFacets();
 }
Exemplo n.º 10
0
 /** The people action
  * @access public
  * @return void
  */
 public function peopleAction()
 {
     $params = $this->getAllParams();
     $params['show'] = 5000;
     $params['format'] = 'json';
     $params['sort'] = 'id';
     $search = new Pas_Solr_Handler();
     $search->setCore('people');
     $search->setParams($params);
     $search->setFields(array('*'));
     $search->execute();
     $this->view->results = $search->processResults();
 }