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();
 }
 /** Set up the index page
  * @access public
  * @return void
  */
 public function indexAction()
 {
     $select = array('query' => 'reeceID:[* TO *]');
     $params = $this->getAllParams();
     $search = new Pas_Solr_Handler();
     $search->setCore('objects');
     $context = $this->_helper->contextSwitch->getCurrentContext();
     $fields = new Pas_Solr_FieldGeneratorFinds($context);
     $params['format'] = $context;
     $search->setFields($fields->getFields());
     $search->setFacets(array('reeceID'));
     $search->setParams($params);
     $search->execute();
     $statistics = $search->processFacets();
     $stats = array();
     foreach ($statistics['reeceID'] as $k => $v) {
         $stats[$k] = (string) $v;
     }
     ksort($stats);
     $cleaned = array();
     foreach ($stats as $k => $v) {
         $cleaned[] = array('period_name' => 'Reece period ' . $k, 'description' => $v, 'id' => $k);
     }
     $this->view->reeces = $cleaned;
 }
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 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.º 6
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.º 7
0
 /** Display the index page.
  */
 public function summariesAction()
 {
     $params = $this->getAllParams();
     $search = new Pas_Solr_Handler();
     $search->setCore('coinsummary');
     $search->setFields('quantity,hoardID,broadperiod,ruler,mint,geography,denomination,hoard');
     $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();
     if (array_key_exists('submit', $params)) {
         $queries = new Searches();
         $queries->insertResults(serialize($params));
     }
 }
Exemplo n.º 8
0
 /** Get the data from the solr index
  * @access public
  * @param  string $constituency
  * @return int
  */
 public function getSolr($constituency)
 {
     $geometry = $this->getGeometry($constituency);
     $bbox = array($geometry->min_lat, $geometry->min_lon, $geometry->max_lat, $geometry->max_lon);
     $search = new Pas_Solr_Handler();
     $search->setCore('objects');
     $search->setFields(array('id', 'identifier', 'objecttype', 'title', 'broadperiod', 'imagedir', 'filename', 'thumbnail', 'old_findID', 'description', 'county'));
     $search->setParams(array('bbox' => implode(',', $bbox)));
     $search->execute();
     $this->_geometry = implode(',', $bbox);
     return $search->getNumber();
 }
Exemplo n.º 9
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.º 10
0
 /** Display all images that a user has added.
  * 
  */
 public function myimagesAction()
 {
     $search = new Pas_Solr_Handler('beowulf');
     $search->setFields(array('id', 'identifier', 'objecttype'));
     $search->setFacets(array('period' => 'broadperiod', 'object' => 'objectType'));
     Zend_Debug::dump($search->execute(array('createdBy' => 56)));
     exit;
     $config = array('adapteroptions' => array('host' => '127.0.0.1', 'port' => 8983, 'path' => '/solr/', 'core' => 'beoimages'));
     $select = array('query' => '*:*', 'start' => $this->getStart(), 'rows' => $this->getLimit(), 'fields' => array('*'), 'sort' => array('created' => 'desc'), 'filterquery' => array());
     $client = new Solarium_Client($config);
     // get a select query instance based on the config
     $query = $client->createSelect($select);
     if (!is_null($d) && !is_null($lon) && !is_null($lat)) {
         $helper = $query->getHelper();
         $query->createFilterQuery('geo')->setQuery($helper->geofilt($lat, $lon, 'coordinates', $d));
     }
     $query->createFilterQuery('myimages')->setQuery('createdBy:' . $this->getIdentityForForms());
     $resultset = $client->select($query);
     $this->view->paginator = $this->createPagination($resultset);
     $this->view->results = $this->processResults($resultset);
 }
Exemplo n.º 11
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.º 12
0
 /** My images facet overlay
  * @access public
  * @return void
  */
 public function myimagesfacetAction()
 {
     $search = new Pas_Solr_Handler();
     $search->setCore('images');
     $context = $this->_helper->contextSwitch->getCurrentContext();
     $fields = new Pas_Solr_FieldGeneratorFinds($context);
     $search->setFields($fields->getFields());
     $search->setFacets(array('licenseAcronym', 'broadperiod', 'county', 'objecttype', 'institution'));
     $params = $this->getAllParams();
     $params['createdBy'] = $this->getIdentityForForms();
     $search->setParams($params);
     $search->execute();
     $data = array('facets' => $search->processFacets());
     $this->view->data = $data;
     $this->view->facetName = $this->getParam('facetType');
 }