/** The constructor * @access public * @param array $options * @return void */ public function __construct(array $options = null) { $finds = new Finds(); $schema = $finds->info(); $fields = array_flip($schema['cols']); $remove = array('id', 'secuid', 'old_findID', 'updated', 'created', 'updatedBy', 'createdBy', 'institution', 'secwfstage', 'secowner', 'sectag', 'old_candidate', 'old_finderID', 'objdate2subperiod_old', 'objdate1subperiod_old', 'finder2ID', 'datefound2flag', 'datefound1flag', 'hoardID'); $labels = array('finderID' => 'Finder name', 'smr_ref' => 'SMR reference', 'other_ref' => 'Other reference', 'datefound1qual' => 'First date found qualifier', 'datefound1' => 'First date found', 'datefound2' => 'Second date found', 'datefound2qual' => 'Second date found qualifier', 'culture' => 'Ascribed culture', 'discmethod' => 'Discovery method', 'disccircum' => 'Discovery circumstances', 'objecttype' => 'Object type', 'objecttypecert' => 'Object type certainty', 'subclass' => 'Sub-classification', 'objdate1cert' => 'Object period certainty from', 'objdate2cert' => 'Object period certainty to', 'objdate1period' => 'Object period from', 'objdate2period' => 'Object period to', 'objdate1subperiod' => 'Object sub-period from', 'objdate2subperiod' => 'Object sub-period to', 'numdate1qual' => 'Date from qualifier', 'numdate2qual' => 'Date to qualifier', 'numdate1' => 'Date from', 'numdate2' => 'Date to', 'material1' => 'Primary material', 'material2' => 'Secondary material', 'manmethod' => 'Manufacture method', 'decmethod' => 'Decoration method', 'surftreat' => 'Surface treatment', 'decstyle' => 'Decoration style', 'reuse_period' => 'Period of reuse', 'curr_loc' => 'Current location', 'recorderID' => 'Recorder', 'identifier1ID' => 'Primary identifier', 'identifier2ID' => 'Secondary identifier', 'musaccno' => 'Museum accession number', 'subs_action' => 'Subsequent action', 'findofnote' => 'Find of note', 'findofnotereason' => 'Find of note reasoning', 'treasureID' => 'Treasure ID number'); foreach ($remove as $rem) { unset($fields[$rem]); } parent::__construct($options); $this->setName('configureFindCopy'); $elements = array(); foreach (array_keys($fields) as $field) { $label = $field; $field = new Zend_Form_Element_Checkbox($field); if (array_key_exists($label, $labels)) { $clean = ucfirst($labels[$label]); } else { $clean = ucfirst($label); } $field->setLabel($clean)->setRequired(false)->addValidator('NotEmpty', 'boolean'); $elements[] = $field; $this->addElement($field); } $this->addDisplayGroup($elements, 'details'); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Submit find form configuration'); $this->addElement($submit); $this->details->setLegend('Choose fields: '); parent::init(); }
public function getRecordData($id) { $finds = new Finds(); $data = $finds->getSolrData($id); foreach ($data['0'] as $key => $value) { if (is_null($value) || $value === "") { unset($data['0'][$key]); } } if (array_key_exists('datefound1', $data['0'])) { $df1 = $this->todatestamp($data['0']['datefound1']); $data['0']['datefound1'] = $df1; } if (array_key_exists('datefound2', $data['0'])) { $df2 = $this->todatestamp($data['0']['datefound2']); $data['0']['datefound2'] = $df2; } if (array_key_exists('created', $data['0'])) { $created = $this->todatestamp($data['0']['created']); $data['0']['created'] = $created; } if (array_key_exists('updated', $data['0'])) { $updated = $this->todatestamp($data['0']['updated']); $data['0']['updated'] = $updated; } return $data; }
/** 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); } } }
/** Display details of a person */ public function personAction() { if ($this->_getParam('id', false)) { $this->view->peoples = $this->_peoples->getPersonDetails($this->_getParam('id')); $finds = new Finds(); $this->view->finds = $finds->getFindsToPerson($this->_getAllParams()); } else { throw new Exception($this->_missingParameter); } }
/** Display details of publication */ public function publicationAction() { if ($this->_getParam('id', false)) { $publications = new Publications(); $this->view->publications = $publications->getPublicationDetails($this->_getParam('id')); $finds = new Finds(); $this->view->finds = $finds->getFindtoPublication($this->_getParam('id')); } else { throw new Pas_Exception_Param($this->_missingParameter); } }
/** Set up view for individual contact */ public function profileAction() { if ($this->_getParam('id', false)) { $id = $this->_getParam('id'); $staffs = new Contacts(); $this->view->staffs = $staffs->getPersonDetails($id); $findstotals = new Finds(); $this->view->findstotals = $findstotals->getFindsFloQuarter($id); $periodtotals = new Finds(); $this->view->periodtotals = $periodtotals->getFindsFloPeriod($id); } else { throw new Pas_Exception_Param($this->_missingParameter); } }
/** Set up index page */ public function indexAction() { // If user isn't logged in, show login form if (null === $this->_auth->getIdentity()) { $this->_helper->redirector->gotoRouteAndExit(array('module' => 'users', 'controller' => 'index')); } else { $user = $this->_auth->getIdentity(); $id = $user->id; $this->view->users = $this->_users->getUserProfile($id); $finds = new Finds(); $this->view->finds = $finds->getFindsRecorded($id); $this->view->totals = $finds->getTotalFindsRecorded($id); } }
/** Set up the mint action * @todo move the config and key to view */ public function mintAction() { if ($this->_getParam('id', false)) { $id = $this->_getParam('id'); $rommints = new Romanmints(); $this->view->rommints = $rommints->getMintDetails($id); $actives = new Rulers(); $this->view->actives = $actives->getRomanMintRulerList($id); $counts = new Finds(); $this->view->counts = $counts->getCountMint($id); } else { throw new Pas_Exception_Param($this->_missingParameter); } }
/** Redirect old url pattern to new find number * @todo move the db call to finds model and cache. */ public function redirectAction() { $this->_helper->layout->disableLayout(); if ($this->getParam('id', false)) { $finds = new Finds(); $results = $finds->fetchRow($finds->select()->where('secuid = ?', $this->getParam('id'))); if (!is_null($results)) { $id = (int) $results->id; } else { throw new Pas_Exception_Param($this->_nothingFound); } $this->getFlash()->addMessage('You have been redirected from an outdated link'); $this->redirect(self::REDIRECT . $id); } else { throw new Pas_Exception_Param($this->_missingParameter, 500); } }
/** Set up the individual emperor */ public function emperorAction() { if ($this->_getParam('id', false)) { $this->view->inlineScript()->appendFile('http://maps.google.com/maps?file=api&v=2.x&key=' . $this->_googleapikey, $type = 'text/javascript'); $id = (int) $this->_getParam('id'); $emps = new Emperors(); $this->view->emps = $emps->getEmperorDetails($id); $denoms = new Denominations(); $this->view->denoms = $denoms->getEmperorDenom($id); $mints = new Mints(); $this->view->mints = $mints->getMintEmperorList($id); $counts = new Finds(); $this->view->counts = $counts->getCountEmperor($this->_getParam('id')); $images = new Slides(); $this->view->images = $images->getExamplesCoinsEmperors($id, 4); } else { throw new Pas_Exception_Param($this->_missingParameter); } }
/** Publish a comment * */ public function publishAction() { if ($this->_getParam('id', false)) { $form = new PublishCommentFindForm(); $form->submit->setLabel('Submit changes'); $this->view->form = $form; if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost())) { if ($form->isValid($form->getValues())) { $data = $form->getValues(); $data['comment_type'] = 'recordcomment'; $where = $this->_comments->getAdapter()->quoteInto('comment_ID = ?', $this->_getParam('id')); $update = $this->_comments->update($data, $where); $approvalstatus = $form->getValue('approval'); switch ($form->getValue('comment_approval')) { case 'approved': $finds = new Finds(); $find = $finds->getCreator($form->getValue('comment_findID')); break; } $this->_flashMessenger->addMessage('Comment data updated.'); $this->_redirect('/admin/comments/'); } else { $this->_flashMessenger->addMessage('There is a problem with the form, please check and resubmit'); $form->populate($formData); } } else { // find id is expected in $params['id'] $id = (int) $this->_request->getParam('id', 0); if ($id > 0) { $comment = $this->_comments->fetchRow('comment_ID =' . $id)->toArray(); if ($comment) { $form->populate($comment); } else { throw new Exception('No comment found with that ID'); } } } } else { throw new Pas_Exception_Param($this->_missingParameter); } }
/** Edit coin data * @throws Pas_Exception_Param */ public function editAction() { if ($this->_getParam('id', false)) { $finds = new Finds(); $this->view->finds = $finds->getFindNumbersEtc($this->_getParam('returnID')); $broadperiod = (string) $this->_getParam('broadperiod'); $form = $this->_helper->coinFormLoader($broadperiod); $this->view->form = $form; if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost())) { if ($form->isValid($form->getValues())) { $updateData = $form->getValues(); $oldData = $this->_coins->fetchRow('id=' . $this->_getParam('id'))->toArray(); $where = $this->_coins->getAdapter()->quoteInto('id = ?', $this->_getParam('id')); //Update the coins table $update = $this->_coins->update($updateData, $where); //Audit the changes $this->_helper->audit($updateData, $oldData, 'CoinsAudit', $this->_getParam('id'), $this->_getParam('returnID')); //Update solr index $this->_helper->solrUpdater->update('beowulf', $this->_getParam('returnID')); $this->_helper->flashMessenger->addMessage('Numismatic details updated.'); $this->_redirect(self::REDIRECT . 'record/id/' . $this->_getParam('returnID')); } else { $form->populate($form->getValues()); } } else { // find id is expected in $params['id'] $id = (int) $this->_getParam('id', 0); if ($id > 0) { $coin = $this->_coins->getCoinToEdit($id); $form->populate($coin['0']); $formLoader = $this->_helper->coinFormLoaderOptions($broadperiod, $coin); } } } else { throw new Pas_Exception_Param($this->_missingParameter); } }
/** Page rendering records recorded by institution * @access public * @return void */ public function institutionAction() { $datefrom = $this->getParam('datefrom') ? $this->getParam('datefrom') : Zend_Date::now()->toString('yyyy') . '-01-01'; $dateto = $this->getParam('dateto') ? $this->getParam('dateto') : Zend_Date::now()->toString('yyyy-MM-dd'); $institution = $this->getParam('institution'); $this->view->institution = $institution; if (!isset($institution)) { $this->view->institutions = $this->_finds->getInstitutions($datefrom, $dateto); } else { $this->view->instTotal = $this->_finds->getInstStat($datefrom, $dateto, $institution); $this->view->creators = $this->_finds->getUsersInstStat($datefrom, $dateto, $institution); $this->view->periods = $this->_finds->getPeriodTotalsInst($datefrom, $dateto, $institution); $this->view->finders = $this->_finds->getFinderTotalsInst($datefrom, $dateto, $institution); $this->view->averages = $this->_finds->getAverageMonthInst($datefrom, $dateto, $institution); $this->view->year = $this->_finds->getYearFoundInst($datefrom, $dateto, $institution); $this->view->discovery = $this->_finds->getDiscoveryMethodInst($datefrom, $dateto, $institution); $this->view->landuse = $this->_finds->getLandUseInst($datefrom, $dateto, $institution); $this->view->precision = $this->_finds->getPrecisionInst($datefrom, $dateto, $institution); } $this->view->datefrom = $datefrom; $this->view->dateto = $dateto; $form = $this->renderForm(); $this->view->form = $form; if ($this->_request->isPost()) { $data = $this->_request->getPost(); if ($form->isValid($data)) { $params = $this->getCleaner()->array_cleanup($this->_request->getPost()); $query = ''; foreach ($params as $key => $value) { $query .= $key . '/' . $value . '/'; } $this->redirect('/database/statistics/institution/' . $query); } else { $form->populate($data); } } }
public function timelineAction() { $this->_helper->layout->disableLayout(); if ($this->getParam('id', false)) { $finds = new Finds(); $this->view->data = $finds->getAllData($this->getParam('id')); } else { $this->view->data = 'Error'; } }
/** Edit jetton data * @todo rewrite for audit etc */ public function editAction() { if ($this->_getParam('id', false)) { $finds = new Finds(); $this->view->finds = $finds->getFindNumbersEtc($this->_getParam('returnID')); $broadperiod = (string) $this->_getParam('broadperiod'); switch ($broadperiod) { case 'MEDIEVAL': $form = new TokenJettonForm(); $form->details->setLegend('Edit Medieval jetton data'); $form->submit->setLabel('Save data'); $this->view->headTitle('Edit a Medieval jetton\'s details'); break; case 'POST MEDIEVAL': $form = new TokenJettonForm(); $form->details->setLegend('Edit Post Medieval jetton data'); $form->submit->setLabel('Save data'); $this->view->headTitle('Edit a Post Medieval jetton\'s details'); break; default: throw new Exception('You cannot have a jetton for that period.'); break; } $this->view->form = $form; if ($this->getRequest()->isPost() && $form->isValid($_POST)) { if ($form->isValid($form->getValues())) { $updateData = $form->getValues(); $oldData = $this->_coins->fetchRow('id=' . $this->_getParam('id'))->toArray(); $where = $this->_coins->getAdapter()->quoteInto('id = ?', $this->_getParam('id')); $update = $this->_coins->update($updateData, $where); $this->_helper->audit($updateData, $oldData, 'CoinsAudit', $this->_getParam('id'), $this->_getParam('returnID')); $this->_flashMessenger->addMessage('Numismatic details updated.'); $this->_redirect(self::REDIRECT . 'record/id/' . $this->_getParam('returnID')); $this->_helper->solrUpdater->update('beowulf', $this->_getParam('returnID')); } else { $this->_flashMessenger->addMessage('Please check your form for errors'); $form->populate($_POST); } } else { // find id is expected in $params['id'] $id = (int) $this->_getParam('id', 0); if (is_int($id)) { $coin = $this->_coins->fetchRow('id=' . $this->_getParam('id'))->toArray(); $form->populate($coin); } } } else { throw new Pas_Exception_Param($this->_missingParameter); } }
/** Get the data for each comment * @return string * @throws Zend_Exception * @access public */ public function getData() { switch ($this->getType()) { case 'findComment': $finds = new Finds(); $data = $finds->fetchRow($finds->select()->where('id = ?', $this->getId())); break; case 'newsComment': $news = new News(); $data = $news->fetchRow($news->select()->where('id = ?', $this->getId())); break; default: throw new Zend_Exception('That type of comment is not a choice'); } return $data; }
/** Look up the find to image and return it * * @param integer $id The image ID number */ public function FindToImage($id) { $finds = new Finds(); $imageData = $finds->getImageToFind($id); return $this->buildHtml($imageData); }
/** Link an image to a record */ public function linkAction() { if ($this->_getParam('imageID', false)) { $form = new ImageLinkForm(); $this->view->form = $form; if ($this->_request->isPost()) { $formData = $this->_request->getPost(); if ($form->isValid($formData)) { $updateData = array(); $updateData['image_id'] = $this->_getParam('imageID'); $updateData['find_id'] = $form->getValue('findID'); $updateData['secuid'] = $this->secuid(); $updateData['created'] = $this->getTimeForForms(); $updateData['createdBy'] = $this->getIdentityForForms(); foreach ($updateData as $key => $value) { if (is_null($value) || $value == "") { unset($updateData[$key]); } } $images = new FindsImages(); $insert = $images->insert($updateData); $findID = $form->getValue('findID'); $finds = new Finds(); $returns = $finds->fetchRow($finds->select()->where('secuid = ?', $findID)); $returnID = $returns->id; $this->_helper->cache->remove('findtoimage' . $returnID); $this->_flashMessenger->addMessage('You just linked an image to this record'); $this->_redirect('/database/artefacts/record/id/' . $returnID); } } } else { throw new Pas_Exception_Param($this->_missingParameter); } }
/** Get old find ID as json * @access public * @return mixed */ public function oldfindidAction() { $finds = new Finds(); $findsjson = $finds->getOldFindID($this->getParam('q')); echo Zend_Json::encode($findsjson); }
/** Copy the last find */ public function copyfindAction() { $finds = new Finds(); $finddata = $finds->getLastRecord($this->getIdentityForForms()); $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); echo Zend_Json::encode($finddata); }
public function workflowchangeAction() { $finds = new Finds(); $updatedata = array('secwfstage' => $this->_getParam('wfstage'), 'updated' => $this->getTimeForForms(), 'updatedBy' => $this->getIdentityForForms()); $where = array(); $where[] = $finds->getAdapter()->quoteInto('id = ?', $this->_getParam('id')); $finds->update($updatedata, $where); }
/** Get map data for news map * @access public * @return void * @throws Pas_Exception_Param */ public function mapAction() { if ($this->getParam('constituency', false)) { $finds = new Finds(); $this->view->finds = $finds->getFindsConstituencyMap($this->getParam('constituency')); } else { throw new Pas_Exception_Param($this->_missingParameter); } }
/** Get finds data from the model * @access public * @param type $id * @return type */ public function getFindsData($id) { $finds = new Finds(); return $finds->getImageToFind($id); }
/** Set up the index list */ public function indexAction() { $finds = new Finds(); $this->view->finds = $finds->getRecordsByUserAcct($this->getAccount()->id, $this->_getParam('page')); }
/** Add and resize images * @access public * @param array $imageData */ public function addAndResize($imageData) { // Loop through the array of objects to add foreach ($imageData as $data) { $finds = new Finds(); $findID = $finds->fetchRow($finds->select()->where('id = ?', $data->findID))->secuid; // Create the image data array $images = array('secuid' => $data->secuid, 'filesize' => $data->size, 'filename' => $data->name, 'mimetype' => $data->mimetype, 'filecreated' => $this->timeCreation(), 'institution' => $this->getInstitution(), 'created' => $this->timeCreation(), 'createdBy' => $this->getUserNumber(), 'ccLicense' => 4, 'imagerights' => $this->getCopyright()); // Create the linking data $linkData = array('find_id' => $findID, 'image_id' => $data->secuid, 'created' => $this->timeCreation(), 'createdBy' => $this->getUserNumber(), 'secuid' => $this->generateSecuId()); // Insert the image data to slides table $slideID = parent::insert($images); // Create the links in the link table $links = new FindsImages(); // Insert that data $links->insert($linkData); // Now process the images $processor = new Pas_Image_Magick(); // Set the path $processor->setImage($data->path); // Set the thumbnail image number from slide insertion - must be an integer $processor->setImageNumber((int) $slideID); // Resize loop $processor->resize(); return $slideID; } }
/** Get the totals for a user * @access public * @param string $username * @return array */ public function getData($username) { $users = new Users(); $ids = $users->getUserID($username); $finds = new Finds(); return $finds->getCountFinds($ids['0']['id']); }