Beispiel #1
0
 /** Get search results
  * @param array $params
  * @param string $role 
  * @return Array $options
  */
 public function getSearchResultsAdvanced($params, $role)
 {
     $finds = $this->getAdapter();
     $select = $finds->select()->from($this->_name, array('id', 'old_findID', 'uniqueID' => 'secuid', 'objecttype', 'classification', 'subclass', 'length', 'height', 'width', 'thickness', 'diameter', 'quantity', 'other_ref', 'treasureID', 'broadperiod', 'numdate1', 'numdate2', 'culture', 'description', 'notes', 'reuse', 'created' => 'finds.created', 'updated', 'treasureID', 'secwfstage', 'secuid', 'findofnote', 'objecttypecert', 'datefound1', 'datefound2', 'inscription', 'secuid', 'disccircum', 'museumAccession' => 'musaccno', 'subsequentAction' => 'subs_action', 'objectCertainty' => 'objecttypecert', 'dateFromCertainty' => 'numdate1qual', 'dateToCertainty' => 'numdate2qual', 'dateFoundFromCertainty' => 'datefound1qual', 'dateFoundToCertainty' => 'datefound2qual', 'subPeriodFrom' => 'objdate1subperiod', 'subPeriodTo' => 'objdate2subperiod'))->joinLeft('coins', 'finds.secuid = coins.findID', array('obverse_description', 'obverse_inscription', 'reverse_description', 'reverse_inscription', 'denomination', 'degree_of_wear', 'allen_type', 'va_type', 'mack' => 'mack_type', 'reeceID', 'die' => 'die_axis_measurement', 'wearID' => 'degree_of_wear', 'moneyer', 'revtypeID', 'categoryID', 'typeID', 'tribeID' => 'tribe', 'status', 'rulerQualifier' => 'ruler_qualifier', 'denominationQualifier' => 'denomination_qualifier', 'mintQualifier' => 'mint_qualifier', 'dieAxisCertainty' => 'die_axis_certainty', 'initialMark' => 'initial_mark', 'reverseMintMark' => 'reverse_mintmark', 'statusQualifier' => 'status_qualifier'))->joinLeft('findofnotereasons', 'finds.findofnotereason = findofnotereasons.id', array('reason' => 'term'))->joinLeft('users', 'users.id = finds.createdBy', array('username', 'fullname', 'institution'))->joinLeft(array('users2' => 'users'), 'users2.id = finds.updatedBy', array('usernameUpdate' => 'username', 'fullnameUpdate' => 'fullname'))->joinLeft(array('mat' => 'materials'), 'finds.material1 = mat.id', array('primaryMaterial' => 'term'))->joinLeft(array('mat2' => 'materials'), 'finds.material2 = mat2.id', array('secondaryMaterial' => 'term'))->joinLeft('decmethods', 'finds.decmethod = decmethods.id', array('decoration' => 'term'))->joinLeft('decstyles', 'finds.decstyle = decstyles.id', array('style' => 'term'))->joinLeft('manufactures', 'finds.manmethod = manufactures.id', array('manufacture' => 'term'))->joinLeft('surftreatments', 'finds.surftreat = surftreatments.id', array('surfaceTreatment' => 'term'))->joinLeft('completeness', 'finds.completeness = completeness.id', array('completeness' => 'term'))->joinLeft('preservations', 'finds.preservation = preservations.id', array('preservation' => 'term'))->joinLeft('certaintytypes', 'certaintytypes.id = finds.objecttypecert', array('cert' => 'term'))->joinLeft('periods', 'finds.objdate1period = periods.id', array('periodFrom' => 'term'))->joinLeft(array('p' => 'periods'), 'finds.objdate2period = p.id', array('periodTo' => 'term'))->joinLeft('cultures', 'finds.culture = cultures.id', array('culture' => 'term'))->joinLeft('discmethods', 'discmethods.id = finds.discmethod', array('discmethod' => 'method'))->joinLeft('ironagetribes', 'coins.tribe = ironagetribes.id', array('tribe'))->joinLeft('geographyironage', 'geographyironage.id = coins.geographyID', array('region', 'area'))->joinLeft('denominations', 'denominations.id = coins.denomination', array('denomination'))->joinLeft('rulers', 'rulers.id = coins.ruler_id', array('ruler1' => 'issuer'))->joinLeft(array('rulers2' => 'rulers'), 'rulers2.id = coins.ruler2_id', array('ruler2' => 'issuer'))->joinLeft('reeceperiods', 'coins.reeceID = reeceperiods.id', array('period_name', 'date_range'))->joinLeft('mints', 'mints.id = coins.mint_ID', array('mint_name'))->joinLeft('weartypes', 'coins.degree_of_wear = weartypes.id', array('wear' => 'term'))->joinLeft('medievalcategories', 'medievalcategories.id = coins.categoryID', array('category'))->joinLeft('medievaltypes', 'medievaltypes.id = coins.typeID', array('type'))->joinLeft('moneyers', 'moneyers.id = coins.moneyer', array('moneyer' => 'name'))->joinLeft('revtypes', 'coins.revtypeID = revtypes.id', array('reverseType' => 'type'))->joinLeft('statuses', 'coins.status = statuses.id', array('status' => 'term'))->limit(10000);
     $conSwitch = Zend_Controller_Action_HelperBroker::getExistingHelper('contextSwitch');
     $context = $conSwitch->getCurrentContext();
     //Set Up access to finds by workflow
     if (in_array($role, $this->_restricted)) {
         if ($context == 'kml') {
             $select->joinLeft('findspots', 'finds.secuid = findspots.findID', array('county', 'district', 'knownas', 'lat' => 'declat', 'lon' => 'declong', 'fourFigure'))->joinLeft('finds_images', 'finds.secuid = finds_images.find_id', array())->joinLeft('slides', 'slides.secuid = finds_images.image_id', array('i' => 'imageID', 'f' => 'filename'))->joinLeft('people', 'finds.finderID = people.secuid', array());
         } elseif (in_array($role, $this->_research)) {
             $select->joinLeft('findspots', 'finds.secuid = findspots.findID', array('county', 'parish', 'district', 'knownas', 'gridref', 'fourFigure', 'easting', 'northing', 'map25k', 'map10k', 'accuracy', 'gridlen', 'address', 'postcode', 'findspotdescription' => 'description', 'lat' => 'declat', 'lon' => 'declong'))->joinLeft('gridrefsources', 'gridrefsources.ID = findspots.gridrefsrc', array('source' => 'term'))->where('finds.secwfstage > ?', (int) 2);
         } else {
             $select->joinLeft('findspots', 'finds.secuid = findspots.findID', array('county', 'district', 'knownas'))->joinLeft('finds_images', 'finds.secuid = finds_images.find_id', array())->joinLeft('slides', 'slides.secuid = finds_images.image_id', array('i' => 'imageID', 'f' => 'filename'));
         }
         $select->joinLeft('gridrefsources', 'gridrefsources.ID = findspots.gridrefsrc', array('gridRefSource' => 'term'))->where('finds.secwfstage > ?', (int) 2);
     } else {
         $select->joinLeft('people', 'finds.finderID = people.secuid', array('finder' => 'CONCAT(people.title," ",people.forename," ",people.surname)'))->joinLeft(array('ident1' => 'people'), 'finds.identifier1ID = ident1.secuid', array('identifier' => 'CONCAT(ident1.title," ",ident1.forename," ",ident1.surname)'))->joinLeft(array('ident2' => 'people'), 'finds.identifier2ID = ident2.secuid', array('secondaryIdentifier' => 'CONCAT(ident2.title," ",ident2.forename," ",ident2.surname)'))->joinLeft(array('record' => 'people'), 'finds.recorderID = record.secuid', array('recorder' => 'CONCAT(record.title," ",record.forename," ",record.surname)'))->joinLeft('findspots', 'finds.secuid = findspots.findID', array('county', 'parish', 'district', 'gridref', 'fourFigure', 'easting', 'northing', 'map25k', 'map10k', 'gridlength' => 'gridlen', 'accuracy', 'address', 'postcode', 'findspotdescription' => 'description', 'lat' => 'declat', 'lon' => 'declong'))->joinLeft('gridrefsources', 'gridrefsources.ID = findspots.gridrefsrc', array('source' => 'term'));
     }
     if (isset($params['regionID']) && $params['regionID'] != "") {
         $select->joinLeft('regions', 'findspots.regionID = regions.id', array('region'));
     }
     if (isset($params['typeID']) && $params['typeID'] != "") {
         $typeID = $params['typeID'];
         $select->where('coins.typeID = ?', $typeID);
     }
     if (isset($params['activity']) && !s_null($params['activity'])) {
         $activity = $params['activity'];
         $select->where('people.primary_activity = ?', $activity);
     }
     if (isset($params['complete']) && $params['complete'] != "") {
         $complete = $params['complete'];
         $select->where('finds.completeness = ?', $complete);
     }
     ## Find specific query formation
     //Old_findID
     if (isset($params['old_findID']) && $params['old_findID'] != "") {
         $old_findID = $params['old_findID'];
         $select->where('old_findID = ?', $old_findID);
     }
     //Objecttype
     if (isset($params['objecttype']) && $params['objecttype'] != "") {
         $objecttype = $params['objecttype'];
         $select->where('objecttype = ?', $objecttype);
     }
     //wear for coins
     if (isset($params['wear']) && $params['wear'] != "") {
         $wear = $params['wear'];
         $select->where('degree_of_wear = ?', $wear);
     }
     //Description
     if (isset($params['description']) && $params['description'] != "") {
         $description = $params['description'];
         $select->where('finds.description LIKE ?', '%' . $description . '%');
     }
     //Notes
     if (isset($params['notes']) && $params['notes'] != "") {
         $notes = $params['notes'];
         $select->where('finds.notes LIKE ?', '%' . $notes . '%');
     }
     //Broadperiod
     if (isset($params['broadperiod']) && $params['broadperiod'] != "") {
         $broadperiod = $params['broadperiod'];
         $select->where('broadperiod = ?', (string) $broadperiod);
     }
     //Period From date
     if (isset($params['periodfrom']) && $params['periodfrom'] != "") {
         $periodfrom = $params['periodfrom'];
         $select->where('finds.objdate1period = ?', (int) $periodfrom);
     }
     //culture
     if (isset($params['culture']) && $params['culture'] != "") {
         $culture = $params['culture'];
         $select->where('finds.culture = ?', (int) $culture);
     }
     if (isset($params['woeid']) && $params['woeid'] != '') {
         $select->where('findspots.woeid = ?', $params['woeid']);
     }
     //From date
     if (isset($params['from']) && $params['from'] != "") {
         $from = $params['from'];
         $select->where('finds.numdate1 >= ?', $from)->where('finds.numdate1 IS NOT NULL');
     }
     if (isset($params['fromend']) && $params['fromend'] != "") {
         $fromend = $params['fromend'];
         $select->where('finds.numdate1 <= ?', $fromend)->where('finds.numdate1 IS NOT NULL');
     }
     //Early mid late
     if (isset($params['tosubperiod']) && $params['tosubperiod'] != "") {
         $tosubperiod = $params['tosubperiod'];
         $select->where('finds.objdate2subperiod = ?', $tosubperiod);
     }
     //Period to date
     if (isset($params['periodto']) && $params['periodto'] != "") {
         $periodto = $params['periodto'];
         $select->where('finds.objdate2period = ?', $periodto);
     }
     //Early Mid/late
     if (isset($params['fromsubperiod']) && $params['fromsubperiod'] != "") {
         $fromsubperiod = $params['fromsubperiod'];
         $select->where('finds.objdate1subperiod = ?', $fromsubperiod);
     }
     //Discmethod
     if (isset($params['discmethod']) && $params['discmethod'] != "") {
         $discmethod = $params['discmethod'];
         $select->where('finds.discmethod = ?', $discmethod);
     }
     //To date
     if (isset($params['to']) && $params['to'] != "") {
         $to = $params['to'];
         $select->where('finds.numdate2 <= ?', $to);
     }
     //Primary material
     if (isset($params['material']) && $params['material'] != "") {
         $material = $params['material'];
         $select->where('finds.material1 = ?', $material);
     }
     //Created by
     if (isset($params['createdby']) && $params['createdby'] != "") {
         $createdby = $params['createdby'];
         $select->where('finds.createdBy = ?', $createdby);
     }
     //Finder
     if (isset($params['finderID']) && $params['finderID'] != "") {
         $finder = $params['finderID'];
         $select->where('finds.finderID = ?', $finder);
     }
     //Identifier
     if (isset($params['idby']) && $params['idby'] != "") {
         $idby = $params['idby'];
         $select->where('finds.identifier1ID = ?', $idby);
     }
     if (isset($params['idby2']) && $params['idby2'] != "") {
         $idby2 = $params['idby2'];
         $select->where('finds.identifier2ID = ?', $idby2);
     }
     //Recorded by
     if (isset($params['recorderID']) && $params['recorderID'] != "") {
         $recordby = $params['recorderID'];
         $select->where('finds.recorderID = ?', $recordby);
     }
     //Created on exactly
     if (isset($params['created']) && $params['created'] != "") {
         $created = $params['created'];
         $select->where('DATE(finds.created) = ?', $created);
     }
     //Created on
     if (isset($params['createdAfter']) && $params['createdAfter'] != "") {
         $createdAfter = $params['createdAfter'];
         $select->where('finds.created >=?', $createdAfter . ' 00:00:00');
     }
     //Created before
     if (isset($params['createdBefore']) && $params['createdBefore'] != "") {
         $createdBefore = $params['createdBefore'];
         $select->where('finds.created <= ?', $createdBefore);
     }
     //Workflow
     if (isset($params['workflow']) && $params['workflow'] != "") {
         $workflow = $params['workflow'];
         $select->where('finds.secwfstage = ?', $workflow);
     }
     //Decoration method
     if (isset($params['decoration']) && $params['decoration'] != "") {
         $decoration = $params['decoration'];
         $select->where('finds.decmethod = ?', $decoration);
     }
     //Decoration style
     if (isset($params['decstyle']) && $params['decstyle'] != "") {
         $decstyle = $params['decstyle'];
         $select->where('finds.decstyle = ?', $decstyle);
     }
     //Manufacture method
     if (isset($params['manufacture']) && $params['manufacture'] != "") {
         $manufacture = $params['manufacture'];
         $select->where('finds.manmethod = ?', $manufacture);
     }
     //Surface treatment
     if (isset($params['surface']) && $params['surface'] != "") {
         $surface = $params['surface'];
         $select->where('finds.surftreat = ?', $surface);
     }
     //Classification
     if (isset($params['class']) && $params['class'] != "") {
         $class = $params['class'];
         $select->where('finds.classification LIKE ?', '%' . $class . '%');
     }
     //Subclassification
     if (isset($params['subclass']) && $params['subclass'] != "") {
         $subclass = $params['subclass'];
         $select->where('finds.subclass LIKE ?', '%' . $subclass . '%');
     }
     //Treasure
     if (isset($params['treasure']) && $params['treasure'] != "") {
         $treasure = $params['treasure'];
         $select->where('finds.treasure = ?', $treasure);
     }
     //Treasure number
     if (isset($params['TID']) && $params['TID'] != "") {
         $treasureID = $params['TID'];
         $select->where('finds.treasureID = ?', $treasureID);
     }
     //Hoard
     if (isset($params['hoard']) && $params['hoard'] != "") {
         $hoard = $params['hoard'];
         $select->where('finds.hoard = ?', $hoard);
     }
     //Hoard name
     if (isset($params['hID']) && $params['hID'] != "") {
         $hoard = $params['hID'];
         $select->where('finds.hoardID = ?', $hoard);
     }
     //Rally
     if (isset($params['rally']) && $params['rally'] != "") {
         $rally = $params['rally'];
         $select->where('finds.rally = ?', $rally);
     }
     //Rally name
     if (isset($params['rallyID']) && $params['rallyID'] != "") {
         $rallyID = $params['rallyID'];
         $select->joinLeft('rallies', 'finds.rallyID = rallies.id', array('rally_name'))->where('finds.rallyID = ?', $rallyID);
     }
     //find of note
     if (isset($params['note']) && $params['note'] != "") {
         $note = $params['note'];
         $select->where('finds.findofnote = ?', $note);
     }
     //find of note reason
     if (isset($params['reason']) && $params['reason'] != "") {
         $reason = $params['reason'];
         $select->where('finds.findofnotereason = ?', $reason);
     }
     //Other reference
     if (isset($params['otherref']) && $params['otherref'] != "") {
         $otherref = $params['otherref'];
         $select->where('finds.other_ref = ?', $otherref);
     }
     ##Coin specific query formation
     //Primary ruler
     if (isset($params['ruler']) && $params['ruler'] != "") {
         $ruler = $params['ruler'];
         $select->where('coins.ruler_id = ?', $ruler);
     }
     //Secondary ruler
     if (isset($params['ruler2']) && $params['ruler2'] != "") {
         $ruler2 = $params['ruler2'];
         $select->where('coins.ruler2_id = ?', $ruler2);
     }
     //Denomination
     if (isset($params['denomination']) && $params['denomination'] != "") {
         $denomname = $params['denomination'];
         $select->where('coins.denomination = ?', $denomname);
     }
     //Mint
     if (isset($params['mint']) && $params['mint'] != "") {
         $mint = $params['mint'];
         $select->where('coins.mint_id = ?', $mint);
     }
     //Die axis
     if (isset($params['axis']) && $params['axis'] != "") {
         $axis = $params['axis'];
         $select->where('coins.die_axis_measurement = ?', $axis);
     }
     //Moneyer
     if (isset($params['moneyer']) && $params['moneyer'] != "") {
         $moneyer = $params['moneyer'];
         $select->where('coins.moneyer = ?', $moneyer);
     }
     //Obverse inscription
     if (isset($params['obinsc']) && $params['obinsc'] != "") {
         $obinsc = $params['obinsc'];
         $select->where('coins.obverse_inscription LIKE ?', '%' . $obinsc . '%');
     }
     //Obverse description
     if (isset($params['obdesc']) && $params['obdesc'] != "") {
         $obdesc = $params['obdesc'];
         $select->where('coins.obverse_description LIKE ?', '%' . $obdesc . '%');
     }
     //Reverse inscription
     if (isset($params['revinsc']) && $params['revinsc'] != "") {
         $revinsc = $params['revinsc'];
         $select->where('coins.reverse_inscription LIKE ?', '%' . $revinsc . '%');
     }
     //Reverse description
     if (isset($params['revdesc']) && $params['revdesc'] != "") {
         $revdesc = $params['revdesc'];
         $select->where('coins.reverse_description LIKE ?', '%' . $revdesc . '%');
     }
     ##Iron age specific
     //Mack type
     if (isset($params['mack']) && $params['mack'] != "") {
         $mack = $params['mack'];
         $select->where('coins.mack_type = ?', $mack);
     }
     //Allen type
     if (isset($params['allen']) && $params['allen'] != "") {
         $allen = $params['allen'];
         $select->where('coins.allen_type = ?', $allen);
     }
     //Rudd type
     if (isset($params['rudd']) && $params['rudd'] != "") {
         $rudd = $params['rudd'];
         $select->where('coins.rudd_type = ?', $rudd);
     }
     //Van Arsdell type
     if (isset($params['va']) && $params['va'] != "") {
         $va = $params['va'];
         $select->where('coins.va_type = ?', $va);
     }
     //Geographical region
     if (isset($params['geoIA']) && $params['geoIA'] != "") {
         $geography = $params['geoIA'];
         $select->where('coins.geographyID = ?', $geography);
     }
     //Tribe
     if (isset($params['tribe']) && $params['tribe'] != "") {
         $tribe = $params['tribe'];
         $select->where('coins.tribe = ?', $tribe);
     }
     #####
     ##Roman specific
     #####
     //ReeceID
     if (isset($params['reeceID']) && $params['reeceID'] != "") {
         $reeceID = $params['reeceID'];
         $select->where('coins.reeceID = ?', $reeceID);
     }
     //Reverse type
     if (isset($params['reverse']) && $params['reverse'] != "") {
         $reverse = $params['reverse'];
         $select->where('coins.revtypeID = ?', $reverse);
     }
     ####
     ##Medieval specific
     ####
     //Medieval type
     if (isset($params['medtype']) && $params['medtype'] != "") {
         $typeID = $params['medtype'];
         $select->where('coins.typeID = ?', $typeID);
     }
     //Medieval category
     if (isset($params['category']) && $params['category'] != "") {
         $categoryID = $params['category'];
         $select->where('coins.categoryID = ?', $categoryID);
     }
     ####
     ##Greek and roman prov specific
     ####
     //Greek state ID
     if (isset($params['greekID']) && $params['greekID'] != "") {
         $greekstateID = $params['greekID'];
         $select->where('coins.greekstateID = ?', $greekstateID);
     }
     ##Spatial specific query formation
     //County
     if (isset($params['county']) && $params['county'] != "") {
         $county = $params['county'];
         $select->where('findspots.county = ?', $county);
     }
     //District
     if (isset($params['district']) && $params['district'] != "") {
         $district = $params['district'];
         $select->where('findspots.district = ?', $district);
     }
     //Parish
     if (isset($params['parish']) && $params['parish'] != "" && in_array($role, $this->restricted)) {
         $parish = $params['parish'];
         $select->where('findspots.parish = ?', $parish)->where('findspots.knownas IS NULL');
     } else {
         if (isset($params['parish']) && $params['parish'] != "" && in_array($role, $this->higherlevel)) {
             $parish = $params['parish'];
             $select->where('findspots.parish = ?', $parish);
         }
     }
     //Region
     if (isset($params['regionID']) && $params['regionID'] != "") {
         $region = $params['regionID'];
         $select->where('findspots.regionID = ?', $region);
     }
     //Landuse
     if (isset($params['landuse']) && $params['landuse'] != "") {
         $landuse = $params['landuse'];
         $select->where('findspots.landusecode = ?', $landuse);
     }
     //Secondary landuse
     if (isset($params['value']) && $params['value'] != "") {
         $value = $params['value'];
         $select->where('findspots.landusevalue = ?', $value);
     }
     //Comments
     if (isset($params['fourfigure']) && $params['fourfigure'] != "") {
         $fourfigure = $params['fourfigure'];
         $select->where('findspots.fourFigure = ?', $fourfigure);
     }
     //Known as
     if (isset($params['knownas']) && $params['knownas'] != "") {
         $knownas = $params['knownas'];
         $select->where('findspots.knownas = ?', $knownas);
     }
     if (isset($params['preservation']) && $params['preservation'] != "") {
         $preservation = $params['preservation'];
         $select->where('finds.preservation = ?', $preservation);
     }
     //Known as
     if (isset($params['discovered']) && $params['discovered'] != "") {
         $discovered = $params['discovered'];
         $select->where('finds.datefound1 >= ?', $discovered . '-01-01')->where('finds.datefound1 <= ?', $discovered . '-12-31')->where('finds.datefound1 IS NOT NULL');
     }
     return $finds = $finds->fetchAll($select);
 }
Beispiel #2
0
 public function SearchParams($params = NULL)
 {
     $html = '';
     if (!is_null($params)) {
         $html .= '<p>You searched for: </p>';
         $html .= '<ul>';
         //Objecttype
         if (array_key_exists('objecttype', $params)) {
             if (!s_null($params['objecttype'])) {
                 $html .= '<li>Object type: ' . $this->view->escape($params['objecttype']) . '</li>';
                 $this->view->headTitle(' > Object type: ' . $this->view->escape($params['objecttype']));
             }
         }
         //	Broadperiod
         if (array_key_exists('broadperiod', $params)) {
             if (!is_null($params['broadperiod'])) {
                 $html .= '<li>Broadperiod: ' . $this->view->escape($params['broadperiod']) . '</li>';
                 $this->view->headTitle(' > Broadperiod: ' . $this->view->escape($params['broadperiod']));
             }
         }
         //County
         if (array_key_exists('county', $params)) {
             if (!is_null($params['county'])) {
                 $html .= '<li>County: ' . $this->view->escape($params['county']) . '</li>';
                 $this->view->headTitle(' > County: ' . $this->view->escape($params['county']));
             }
         }
         //region
         if (array_key_exists('regionID', $params)) {
             if (!is_null($params['regionID'])) {
                 $region = $params['regionID'];
                 $regions = new Regions();
                 $regions = $regions->getRegion($region);
                 $this->regions = $regions;
                 foreach ($this->regions as $region) {
                     $html .= '<li>Region: ' . $this->view->escape($region['region']) . '</li>';
                     $this->view->headTitle(' > Region: ' . $this->view->escape($region['region']));
                 }
             }
         }
         if (array_key_exists('material', $params)) {
             if (!is_null($params['material'])) {
                 $mat = $params['material'];
                 $materials = new Materials();
                 $materials = $materials->getMaterialName($mat);
                 $this->materials = $materials;
                 foreach ($this->materials as $material) {
                     $html .= '<li>Primary material: ' . $this->view->escape($material['term']) . '</li>';
                     $this->view->headTitle(' > Primary material: ' . $this->view->escape($material['term']));
                 }
             }
         }
         if (array_key_exists('parish', $params)) {
             if (!is_null($params['parish'])) {
                 $html .= '<li>Parish: ' . $this->view->escape($params['parish']) . '</li>';
                 $this->view->headTitle(' > Parish: ' . $this->view->escape($params['parish']));
             }
         }
         if (array_key_exists('district', $params)) {
             if (!is_null($params['district'])) {
                 $html .= '<li>District: ' . $this->view->escape($params['district']) . '</li>';
                 $this->view->headTitle(' > District: ' . $this->view->escape($params['district']));
             }
         }
         if (array_key_exists('denomination', $params)) {
             $denomname = $params['denomination'];
             $denoms = new Denominations();
             $denoms = $denoms->getDenomName($denomname);
             $this->denoms = $denoms;
             foreach ($this->denoms as $denom) {
                 $html .= '<li>Denomination type: ' . $this->view->escape($denom['denomination']) . '</li>';
                 $this->view->headTitle(' > Denomination: ' . $this->view->escape($denom['denomination']));
             }
         }
         if (array_key_exists('description', $params)) {
             if (!is_null($params['description'])) {
                 $html .= '<li>Description contained: ' . $this->view->escape($params['description']) . '</li>';
                 $this->view->headTitle(' > Description contained: ' . $this->view->escape($params['description']));
             }
         }
         if (array_key_exists('fourFigure', $params)) {
             if (!is_null($params['fourFigure'])) {
                 $html .= '<li>Four figure grid reference: ' . $this->view->escape($params['fourFigure']) . '</li>';
                 $this->view->headTitle(' > Four figure NGR: ' . $this->view->escape($params['fourFigure']));
             }
         }
         if (array_key_exists('old_findID', $params)) {
             if (!is_null($params['old_findID'])) {
                 $html .= '<li>Find reference number: ' . $this->view->escape($params['old_findID']) . '</li>';
                 $this->view->headTitle(' > Find ID: ' . $this->view->escape($params['old_findID']));
             }
         }
         if (array_key_exists('fromsubperiod', $params)) {
             if (!is_null($params['fromsubperiod'])) {
                 $sub = $params['fromsubperiod'];
                 if ($sub == 1) {
                     $html .= '<li>Subperiod: Early</li>';
                     $this->view->headTitle(' > Subperiod: Early');
                 } else {
                     if ($sub == 2) {
                         $html .= '<li>Subperiod: Middle</li>';
                         $this->view->headTitle(' > Subperiod: Middle');
                     } else {
                         if ($sub == 3) {
                             $html .= '<li>Subperiod: Late</li>';
                             $this->view->headTitle(' > Subperiod: Late');
                         }
                     }
                 }
             }
         }
         if (array_key_exists('tosubperiod', $params)) {
             if (!is_null($params['tosubperiod'])) {
                 $sub = $params['tosubperiod'];
                 if ($sub == 1) {
                     $html .= '<li>Subperiod: Early</li>';
                     $this->view->headTitle(' > Subperiod: Early');
                 } else {
                     if ($sub == 2) {
                         $html .= '<li>Subperiod: Middle</li>';
                         $this->view->headTitle(' > Subperiod: Middle');
                     } else {
                         if ($sub == 3) {
                             $html .= '<li>Subperiod: Late</li>';
                             $this->view->headTitle(' > Subperiod: Late');
                         }
                     }
                 }
             }
         }
         if (array_key_exists('periodfrom', $params)) {
             if (!is_null($params['periodfrom'])) {
                 $period = $params['periodfrom'];
                 $periods = new Periods();
                 $periods = $periods->getPeriodName($period);
                 $this->periods = $periods;
                 foreach ($this->periods as $period) {
                     $html .= '<li>Period from: ' . $this->view->escape($period['term']) . '</li>';
                     $this->view->headTitle(' > Period from: ' . $this->view->escape($period['term']));
                 }
             }
         }
         //Period to key
         if (array_key_exists('periodto', $params)) {
             if (!is_null($params['periodto'])) {
                 $period = $params['periodto'];
                 $periods = new Periods();
                 $periods = $periods->getPeriodName($period);
                 $this->periods = $periods;
                 foreach ($this->periods as $period) {
                     $html .= '<li>Period to: ' . $this->view->escape($period['term']) . '</li>';
                     $this->view->headTitle(' > Period to: ' . $this->view->escape($params['period']));
                 }
             }
         }
         //
         if (array_key_exists('surface', $params)) {
             if (!is_null($params['surface'])) {
                 $surfaceterm = $params['surface'];
                 $surfaces = new Surftreatments();
                 $surfaces = $surfaces->getSurfaceTerm($surfaceterm);
                 $this->surfaces = $surfaces;
                 foreach ($this->surfaces as $surface) {
                     $html .= '<li>Surface treatment: ' . $this->view->escape($surface['term']) . '</li>';
                     $this->view->headTitle(' > Surface treatment: ' . $this->view->escape($surface['term']));
                 }
             }
         }
         if (array_key_exists('class', $params)) {
             if (!is_null($params['class'])) {
                 $html .= '<li>Classification term like: ' . $this->view->escape($params['class']) . '</li>';
                 $this->view->headTitle(' > Classification: ' . $this->view->escape($params['class']));
             }
         }
         //Date from starts
         if (array_key_exists('from', $params)) {
             if (!is_null($params['from'])) {
                 $from = $params['from'];
                 $suffix = "BC";
                 $prefix = "AD";
                 if ($from < 0) {
                     $date = abs($from) . ' ' . $suffix;
                 } else {
                     if ($from > 0) {
                         $date = $prefix . ' ' . abs($from);
                     }
                 }
                 $html .= '<li>Date from greater or equal to: ' . (int) $date . '</li>';
                 $this->view->headTitle(' > Date from starts: ' . (int) $date);
             }
         }
         //Date from ends
         if (array_key_exists('fromend', $params)) {
             if (!is_null($params['fromend'])) {
                 $from = $params['fromend'];
                 $suffix = "BC";
                 $prefix = "AD";
                 if ($from < 0) {
                     $date = abs($from) . ' ' . $suffix;
                 } else {
                     if ($from > 0) {
                         $date = $prefix . ' ' . abs($from);
                     }
                 }
                 $html .= '<li>Date from smaller or equal to: ' . $date . '</li>';
                 $this->view->headTitle(' > Date from ends: ' . $date);
             }
         }
         //Date to starts
         //Date to ends
         //Year found
         if (array_key_exists('discovered', $params)) {
             if (!is_null($params['discovered'])) {
                 $html .= '<li>Year of discovery where known: ' . $this->view->escape($params['discovered']) . '</li>';
                 $this->view->headTitle(' > Discovery year: ' . $this->view->escape($params['discovered']));
             }
         }
         //Found by
         if (array_key_exists('finder', $params)) {
             if (!is_null($params['finder'])) {
                 $finder = $params['finder'];
                 $peoples = new Peoples();
                 $peoples = $peoples->getName($finder);
                 $this->peoples = $peoples;
                 foreach ($this->peoples as $people) {
                     $html .= '<li>Item found by: ' . $this->view->escape($people['term']) . '</li>';
                     $this->view->headTitle(' > Finder: ' . $this->view->escape($people['term']));
                 }
             }
         }
         //Identified by
         if (array_key_exists('idby', $params)) {
             if (!is_null($params['idby'])) {
                 $finder = $params['idby'];
                 $peoples = new Peoples();
                 $peoples = $peoples->getName($finder);
                 $this->peoples = $peoples;
                 foreach ($this->peoples as $people) {
                     $html .= '<li>Identified by: ' . $this->view->escape($people['term']) . '</li>';
                     $this->view->headTitle(' > Identified by: ' . $this->view->escape($people['term']));
                 }
             }
         }
         //Recorded by
         //Identified by
         if (array_key_exists('recordby', $params)) {
             if (!is_null($params['recordby'])) {
                 $finder = $params['recordby'];
                 $peoples = new Peoples();
                 $peoples = $peoples->getName($finder);
                 $this->peoples = $peoples;
                 foreach ($this->peoples as $people) {
                     $html .= '<li>Recorded by: ' . $this->view->escape($people['term']) . '</li>';
                     $this->view->headTitle(' > Recorded by: ' . $this->view->escape($people['term']));
                 }
             }
         }
         //Issuer
         if (array_key_exists('ruler', $params)) {
             if (!is_null($params['ruler'])) {
                 $ruler = $params['ruler'];
                 $rulers = new Rulers();
                 $rulers = $rulers->getRulersName($ruler);
                 $this->rulers = $rulers;
                 foreach ($this->rulers as $ruler) {
                     $html .= '<li>Coin issued by: ' . $this->view->escape($ruler['issuer']) . '</li>';
                     $this->view->headTitle(' > Coin issued by: ' . $this->view->escape($ruler['issuer']));
                 }
             }
         }
         if (array_key_exists('note', $params)) {
             if ($params['note'] == (int) 1) {
                 $html .= '<li>Object is a find of note';
                 $this->view->headTitle(' > Object is a find of note');
             }
         }
         if (array_key_exists('treasure', $params)) {
             if ($params['treasure'] == (int) 1) {
                 $html .= '<li>Object is Treasure or potential Treasure';
                 $this->view->headTitle(' > Object is Treasure');
             }
         }
         if (array_key_exists('TID', $params)) {
             if (!is_null($params['TID'])) {
                 $html .= '<li>Treasure case number: ' . $this->view->escape($params['TID']);
                 $this->view->headTitle(' > Treasure case number: ' . $this->view->escape($params['TID']));
             }
         }
         if (array_key_exists('created', $params)) {
             if (!is_null($params['created'])) {
                 $html .= '<li>Finds entered on: ' . $this->view->escape($params['created']);
                 $this->view->headTitle(' > finds entered on: ' . $this->view->escape($params['created']));
             }
         }
         if (array_key_exists('createdBefore', $params)) {
             if (!is_null($params['createdBefore'])) {
                 $html .= '<li>Finds entered on or before: ' . $this->view->niceShortDate($this->view->escape($params['createdBefore'])) . '</li>';
                 $this->view->headTitle(' > finds entered on or before: ' . $this->view->niceShortDate($this->view->escape($params['createdAfter'])));
             }
         }
         if (array_key_exists('createdAfter', $params)) {
             if (!is_null($params['createdAfter'])) {
                 $html .= '<li>Finds entered on or after: ' . $this->view->niceShortDate($this->view->escape($params['createdAfter'])) . '</li>';
                 $this->view->headTitle(' > finds entered on or after: ' . $this->view->niceShortDate($this->view->escape($params['createdAfter'])));
             }
         }
         if (array_key_exists('hoard', $params)) {
             if ((int) $params['hoard'] == (int) 1) {
                 $html .= '<li>Object is part of a hoard.</li>';
                 $this->view->headTitle(' > Object is part of a hoard.');
             }
         }
         if (array_key_exists('hID', $params)) {
             if ((int) $params['hID']) {
                 $hID = $params['hID'];
                 $hIDs = new Hoards();
                 $hIDsList = $hIDs->getHoardDetails((int) $hID);
                 $this->hids = $hIDsList;
                 foreach ($this->hids as $hid) {
                     $html .= '<li>Part of the ' . $this->view->escape($hid['term']) . ' hoard.</li>';
                     $this->view->headTitle(' > Part of the ' . $this->view->escape($hid['term']) . ' hoard.');
                 }
             }
         }
         if (array_key_exists('otherref', $params)) {
             if (!is_null($params['otherref'])) {
                 $html .= '<li>Other reference: ' . $this->view->escape($params['otherref']);
                 $this->view->headTitle(' > Other reference: ' . $this->view->escape($params['otherref']));
             }
         }
         //Workflow
         if (array_key_exists('workflow', $params)) {
             if (!is_null($params['workflow'])) {
                 $stage = $params['workflow'];
                 $stages = new Workflows();
                 $stages = $stages->getStageName($stage);
                 $this->stages = $stages;
                 foreach ($this->stages as $stage) {
                     $html .= '<li>Workflow stage: ' . $this->view->escape($stage['workflowstage']) . '</li>';
                     $this->view->headTitle(' > Workflow stage: ' . $this->view->escape($stage['workflowstage']));
                 }
             }
         }
         if (array_key_exists('manufacture', $params)) {
             if (!is_null($params['manufacture'])) {
                 $manufacture = $params['manufacture'];
                 $manufactures = new Manufactures();
                 $manufactures = $manufactures->getManufactureDetails((int) $manufacture);
                 $this->manufactures = $manufactures;
                 foreach ($this->manufactures as $man) {
                     $html .= '<li>Manufacture type: ' . $this->view->escape($man['term']) . '</li>';
                     $this->view->headTitle(' > Manufacture type: ' . $this->view->escape($man['term']));
                 }
             }
         }
         if (array_key_exists('decoration', $params)) {
             if (!is_null($params['decoration'])) {
                 $decoration = $params['decoration'];
                 $decorations = new Decmethods();
                 $decorations = $decorations->getDecorationDetails((int) $decoration);
                 $this->decorations = $decorations;
                 foreach ($this->decorations as $dec) {
                     $html .= '<li>Decoration type: ' . $this->view->escape($dec['term']) . '</li>';
                     $this->view->headTitle(' > Decoration type: ' . $this->view->escape($dec['term']));
                 }
             }
         }
         //Mint
         if (array_key_exists('mint', $params)) {
             if (!is_null($params['mint'])) {
                 $id = $params['mint'];
                 $mints = new Mints();
                 $mints = $mints->getMintName($id);
                 $this->mints = $mints;
                 foreach ($this->mints as $mint) {
                     $html .= '<li>Mint issuing coins: ' . $this->view->escape($mint['mint_name']) . ' (' . $mint['term'] . ')</li>';
                     $this->view->headTitle(' > Mint issuing coins: ' . $this->view->escape($mint['mint_name']));
                 }
             }
         }
         //Category
         if (array_key_exists('category', $params)) {
             if (!is_null($params['category'])) {
                 $id = $params['category'];
                 $cats = new CategoriesCoins();
                 $cats = $cats->getCategory($id);
                 $this->cats = $cats;
                 foreach ($this->cats as $cat) {
                     $html .= '<li>Coin category: ' . $this->view->escape($cat['term']) . '</li>';
                     $this->view->headTitle(' > Coin category: ' . $this->view->escape($cat['term']));
                 }
             }
         }
         $html .= '</ul>';
     }
     return $html;
 }