/** 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();
 }
 /** Setup index page
  */
 public function indexAction()
 {
     $content = new Content();
     $this->view->contents = $content->getFrontContent('database');
     $thumbs = new Slides();
     $this->view->thumbs = $thumbs->getLast10Thumbnails(4);
     $finds = new Finds();
     $this->view->counts = $finds->getCountAllFinds();
     $recent = new Logins();
     $this->view->logins = $recent->todayVisitors();
     $form = new SolrForm();
     $form->setMethod('post');
     $this->view->form = $form;
     $values = $form->getValues();
     if ($this->getRequest()->isPost() && $form->isValid($_POST)) {
         if ($form->isValid($form->getValues())) {
             $params = array_filter($form->getValues());
             $params = $this->array_cleanup($params);
             $this->_flashMessenger->addMessage('Your search is complete');
             $this->_helper->Redirector->gotoSimple('results', 'search', 'database', $params);
         } else {
             $form->populate($data);
         }
     }
 }
 /** List of the papers available
  */
 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();
         $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());
             }
         }
     }
 }
Example #4
0
 /** Setup index page
  * @access public
  * @return void
  */
 public function indexAction()
 {
     $content = new Content();
     $this->view->contents = $content->getFrontContent('database');
     $recent = new Logins();
     $this->view->logins = $recent->todayVisitors();
     $form = new SolrForm();
     $form->q->setLabel('Search our database: ');
     $form->setMethod('post');
     $this->view->form = $form;
     if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost())) {
         $functions = new Pas_ArrayFunctions();
         $params = $functions->array_cleanup($form->getValues());
         $params = $this->process($params);
         $this->getFlash()->addMessage('Your search is complete');
         $this->_helper->Redirector->gotoSimple('results', 'search', 'database', $params);
     } else {
         $form->populate($this->_request->getPost());
     }
 }
 /** 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();
 }
 /** 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();
 }
Example #7
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());
         }
     }
 }
 /** 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();
 }
 /** Display a list of hoards recorded with pagination
  * This redirects to just the search results as there is nothing else here.
  * @access public
  * @return void
  */
 public function indexAction()
 {
     if ($this->_user) {
         $role = $this->_user->role;
     } else {
         $role = NULL;
     }
     if (!in_array($role, array('admin', 'fa', 'hoard'))) {
         $this->getFlash()->addMessage('No access to that resource');
         $this->getResponse()->setHttpResponseCode(301)->setRawHeader('HTTP/1.1 301 Moved Permanently');
         $this->redirect('database/search/results/');
     } else {
         $form = new SolrForm();
         $form->q->setLabel('Search our database: ');
         $form->setMethod('post');
         $this->view->form = $form;
         if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost())) {
             $functions = new Pas_ArrayFunctions();
             $params = $functions->array_cleanup($form->getValues());
             $params['objectType'] = 'HOARD';
             $this->getFlash()->addMessage('Your search is complete');
             $this->_helper->Redirector->gotoSimple('results', 'search', 'database', $params);
         } else {
             $form->populate($this->_request->getPost());
         }
     }
 }
Example #10
0
 /** Display the solr form
  */
 public function solrAction()
 {
     $form = new SolrForm();
     $this->view->form = $form;
     if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost())) {
         if ($form->isValid($form->getValues())) {
             $this->process($form->getValues());
         } else {
             $form->populate($form->getValues());
         }
     }
 }
 /** Get all treasure cases for a user
  * @access public
  * @return void
  */
 public function mytreasurecasesAction()
 {
     $form = new SolrForm();
     $this->view->form = $form;
     $params = $this->getAllParams();
     $search = $this->getSolr();
     $search->setCore('objects');
     $search->setFields(array('id', 'identifier', 'objecttype', 'title', 'broadperiod', 'imagedir', 'filename', 'thumbnail', 'old_findID', 'description', 'county', 'workflow', 'updated', 'created', 'findIdentifier'));
     $search->setFacets(array('objectType', 'county', 'broadperiod', 'discovered', 'institution', 'workflow'));
     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('mytreasurecases', 'myscheme', 'database', $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['finderID'] = $this->getAccount()->peopleID;
     $params['treasure'] = 1;
     $search->setParams($params);
     $search->execute();
     $this->view->paginator = $search->createPagination();
     $this->view->results = $search->processResults();
     $this->view->facets = $search->processFacets();
 }