Exemplo n.º 1
0
 /** Index page of all people on the database
  * @access public
  * @return void
  */
 public function indexAction()
 {
     $form = new SolrForm();
     $form->removeElement('thumbnail');
     $form->q->setLabel('Search people: ');
     $form->q->setAttrib('placeholder', 'Try Bland for example');
     $this->view->form = $form;
     $search = new Pas_Solr_Handler();
     $search->setCore('people');
     $search->setFields(array('*'));
     $search->setFacets(array('county', 'organisation', 'activity'));
     if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost()) && !is_null($this->getParam('submit'))) {
         $cleaner = new Pas_ArrayFunctions();
         $params = $cleaner->array_cleanup($form->getValues());
         $this->_helper->Redirector->gotoSimple('index', 'people', 'database', $params);
     } else {
         $params = $this->getAllParams();
         $params['sort'] = 'surname';
         $params['direction'] = 'asc';
         $form->populate($this->getAllParams());
     }
     if (!isset($params['q']) || $params['q'] == '') {
         $params['q'] = '*';
     }
     $search->setParams($params);
     $search->execute();
     $this->view->paginator = $search->createPagination();
     $this->view->results = $search->processResults();
     $this->view->facets = $search->processFacets();
 }
Exemplo n.º 2
0
 /** The index action
  * @access public
  * @return void
  */
 public function indexAction()
 {
     $content = new Content();
     $this->view->contents = $content->getFrontContent('index');
     $form = new SolrForm();
     $form->setAttrib('class', 'form-inline');
     $this->view->form = $form;
     $form->removeElement('thumbnail');
     $form->removeElement('3D');
     $form->q->removeDecorator('label');
     $form->q->setAttrib('class', 'input-large');
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($this->_request->getPost())) {
             $params = array_filter($form->getValues());
             unset($params['csrf']);
             $this->getFlash()->addMessage('Your search is complete');
             $this->_helper->Redirector->gotoSimple('results', 'search', 'database', $params);
         } else {
             $form->populate($form->getValues());
         }
     }
 }
Exemplo n.º 3
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.º 4
0
 /** List of the papers available
  * @access public
  * @return void
  */
 public function indexAction()
 {
     $ping = $this->_solr->createPing();
     if (!$this->_solr->ping($ping)) {
         echo '<h2>Search engine system error</h2>';
         echo '<p>Solr service not responding.</p>';
     } else {
         $form = new SolrForm();
         $form->removeElement('thumbnail');
         $this->view->form = $form;
         if ($this->_request->isPost()) {
             $data = $this->getAllParams();
             if ($form->isValid($data)) {
                 $this->redirect($this->view->url(array('module' => 'search', 'controller' => 'results', 'action' => 'index', 'q' => $data['q'])));
             } else {
                 $form->populate($form->getValues());
             }
         }
     }
 }
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 all images that a user has added.
  * @access public
  * @return void
  */
 public function myimagesAction()
 {
     $form = new SolrForm();
     $form->removeElement('thumbnail');
     $this->view->form = $form;
     $params = $this->getAllParams();
     $search = $this->getSolr();
     $search->setCore('images');
     $search->setFields(array('id', 'identifier', 'objecttype', 'title', 'broadperiod', 'imagedir', 'filename', 'thumbnail', 'old_findID', 'county', 'licenseAcronym', 'findID', 'objecttype', 'institution', 'updated', 'created', 'findIdentifier'));
     $search->setFacets(array('broadperiod', 'county', 'objecttype', 'institution'));
     if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost()) && !is_null($this->getParam('submit'))) {
         if ($form->isValid($form->getValues())) {
             $params = $this->getCleaner()->array_cleanup($form->getValues());
             $this->_helper->Redirector->gotoSimple('myimages', 'myscheme', 'database', $params);
         } else {
             $form->populate($form->getValues());
             $params = $form->getValues();
         }
     } else {
         $params = $this->getAllParams();
         $form->populate($this->getAllParams());
     }
     $params['show'] = 18;
     if (!isset($params['q']) || $params['q'] == '') {
         $params['q'] = '*';
     }
     $params['createdBy'] = $this->getIdentityForForms();
     $search->setParams($params);
     $search->execute();
     $search->processFacets();
     $this->view->paginator = $search->createPagination();
     $this->view->results = $search->processResults();
     $this->view->facets = $search->processFacets();
 }
Exemplo n.º 7
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();
 }