/** Index page, listing all organisations
  * @access public
  * @return void
  */
 public function indexAction()
 {
     $paginator = $this->getOrganisations()->getOrganisations((array) $this->getAllParams());
     $this->view->paginator = $paginator;
     $form = new OrganisationFilterForm();
     $this->view->form = $form;
     $form->organisation->setValue($this->getParam('organisation'));
     $form->contact->setValue($this->getParam('contact'));
     $form->contactpersonID->setValue($this->getParam('contactpersonID'));
     $form->county->setValue($this->getParam('county'));
     if ($this->_request->isPost() && !is_null($this->getParam('submit'))) {
         $formData = $this->_request->getPost();
         if ($form->isValid($formData)) {
             $cleaner = new Pas_ArrayFunctions();
             $params = $cleaner->array_cleanup($formData);
             $where = array();
             foreach ($params as $key => $value) {
                 if (!is_null($value)) {
                     $where[] = $key . '/' . urlencode(strip_tags($value));
                 }
             }
             $whereString = implode('/', $where);
             $query = $whereString;
             $this->redirect(self::REDIRECT . 'index/' . $query . '/');
         } else {
             $form->populate($this->_request->getPost());
         }
     }
 }
Example #2
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();
 }
 /** Process the form data
  * @access public
  * @param array $data
  * void
  */
 public function processSummary(array $data)
 {
     $params = array_filter($data);
     $cleaned = $this->_cleaner->array_cleanup($params, array('finder', 'idby', 'recordby', 'idBy', 'recordername'));
     $this->getFlash()->addMessage('Your search is complete');
     $this->_helper->Redirector->gotoSimple('summaries', 'search', 'database', $cleaned);
 }
Example #4
0
 /** Setup the request via GET (only request type supported).
  * @access public
  * @return void
  * @throws Pas_Exception
  */
 public function requestAction()
 {
     $this->_helper->layout->disableLayout();
     $request = $this->_request;
     switch ($request) {
         case $request->isGet():
             // GET Query only
             $this->getResponse()->setHeader('Content-type', 'text/xml');
             $cleaner = new Pas_ArrayFunctions();
             $clean = $cleaner->array_cleanup($this->getAllParams());
             $this->view->response = new Pas_OaiPmhRepository_ResponseGenerator($clean);
             break;
         case $request->isPost():
             throw new Pas_Exception('Post requests are not valid', 401);
         default:
             throw new Pas_Exception('Error determining request type', 500);
     }
 }
Example #5
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();
 }
 /** Determine adviser to email
  * @access public
  * @param string $objecttype
  * @param type $broadperiod
  * @return array
  */
 private function _getAdviser($objecttype, $broadperiod)
 {
     $config = $this->_helper->config();
     $this->_romancoinsadviser = $config->findsadviser->romancoins;
     $this->_romancoinsadviseremail = $config->findsadviser->romcoins->email;
     $this->_medievalcoinsadviser = $config->findsadviser->medievalcoins;
     $this->_medievalcoinsadviseremail = $config->findsadviser->medcoins->email;
     $this->_romanobjects = $config->findsadviser->romanobjects;
     $this->_romanobjectsemail = $config->findsadviser->romobjects->email;
     $this->_medievalobjects = $config->findsadviser->medievalobjects;
     $this->_medievalobjectsemail = $config->findsadviser->medobjects->email;
     $this->_postmedievalobjects = $config->findsadviser->postmedievalobjects;
     $this->_postmedievalobjectsemail = $config->findsadviser->postmedobjects->email;
     $this->_earlymedievalobjects = $config->findsadviser->earlymedievalobjects;
     $this->_earlymedievalobjectsemail = $config->findsadviser->earlymedobjects->email;
     $this->_catchall = $config->findsadviser->default;
     $this->_catchallemail = $config->findsadviser->def->email;
     switch ($objecttype) {
         case in_array($objecttype, $this->_coinarray) && in_array($broadperiod, $this->_periodRomIA):
             $adviserdetails = $this->_romancoinsadviser;
             $adviseremail = $this->_romancoinsadviseremail;
             break;
         case in_array($objecttype, $this->_coinarray) && in_array($broadperiod, $this->_earlyMed):
             $adviserdetails = $this->_medievalcoinsadviser;
             $adviseremail = $this->_medievalcoinsadviseremail;
             break;
         case in_array($objecttype, $this->_coinarray) && in_array($broadperiod, $this->_medieval):
             $adviserdetails = $this->_medievalcoinsadviser;
             $adviseremail = $this->_medievalcoinsadviseremail;
             break;
         case in_array($objecttype, $this->_coinarray) && in_array($broadperiod, $this->_postMed):
             $adviserdetails = $this->_medievalcoinsadviser;
             $adviseremail = $this->_medievalcoinsadviseremail;
             break;
         case !in_array($objecttype, $this->_coinarray) && in_array($broadperiod, $this->_periodRomPrehist):
             $adviserdetails = $this->_romanobjects;
             $adviseremail = $this->_romanobjectsemail;
             break;
         case !in_array($objecttype, $this->_coinarray) && in_array($broadperiod, $this->_postMed):
             $adviserdetails = $this->_postmedievalobjects;
             $adviseremail = $this->_postmedievalobjectsemail;
             break;
         case !in_array($objecttype, $this->_coinarray) && in_array($broadperiod, $this->_medieval):
             $adviserdetails = $this->_medievalobjects;
             $adviseremail = $this->_medievalobjectsemail;
             break;
         case !in_array($objecttype, $this->_coinarray) && in_array($broadperiod, $this->_earlyMed):
             $adviserdetails = $this->_earlymedievalobjects;
             $adviseremail = $this->_earlymedievalobjectsemail;
             break;
         default:
             $adviserdetails = $this->_catchall;
             $adviseremail = $this->_catchallemail;
             break;
     }
     $combine = new Pas_ArrayFunctions();
     $people = $combine->combine($adviserdetails->toArray(), $adviseremail->toArray());
     $sendto = array();
     foreach ($people as $k => $v) {
         $sendto[] = array('email' => $v, 'name' => $k);
     }
     return $sendto;
 }
 /** 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
 /** Clean up parameters
  * @access public
  * @return array
  */
 public function cleanParameters()
 {
     $cleaner = new Pas_ArrayFunctions();
     return $cleaner->array_cleanup($this->getTheParameters());
 }
Example #11
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();
 }