public function loadTypeSpecificValueFromRow($pa_value_array) { $this->opn_place_id = $pa_value_array['value_integer1']; require_once __CA_MODELS_DIR__ . '/ca_places.php'; $t_place = new ca_places($this->opn_place_id); $this->ops_text = $t_place->getLabelForDisplay() . ($t_place->get("idno") ? " [" . $t_place->get("idno") . "]" : ""); }
/** * Returns name of hierarchy for currently loaded place or, if specified, place with place_id = to optional $pn_id parameter */ public function getHierarchyName($pn_id = null) { $t_list = new ca_list_items(); if ($pn_id) { $t_place = new ca_places($pn_id); $vn_hierarchy_id = $t_place->get('hierarchy_id'); } else { $vn_hierarchy_id = $this->get('hierarchy_id'); } $t_list->load($vn_hierarchy_id); return $t_list->getLabelForDisplay(false); }
</div> <?php } else { ?> <!--<span class="listhead"><?php print $vs_facet_name; ?> </span>--> <ul> <?php if ($vs_facet_name == "place_facet") { # --- only show a few places - this list of place ids is configured in the plugin conf file $va_browse_place_ids = $this->getVar("browse_place_ids"); $t_place = new ca_places(); foreach ($va_browse_place_ids as $vn_place_id) { $t_place->load($vn_place_id); if ($t_place->get("place_id")) { print "<li><a href='#' class='abFacetOptionsList' id='abFacetOptionsList" . $t_place->get("place_id") . "' onclick='jQuery(\".abFacetOptionsList\").removeClass(\"selected\"); jQuery(\"#abFacetOptionsList" . $t_place->get("place_id") . "\").addClass(\"selected\"); jQuery(\"#contentBox\").load(\"" . caNavUrl($this->request, 'eastend', 'Map', 'clearAndAddCriteria', array('facet' => $vs_facet_name, 'id' => $t_place->get("place_id"), 'mod_id' => $vm_modify_id)) . "\"); return false;'>" . $t_place->getLabelForDisplay() . "</a></li>"; } } } else { foreach ($va_facet as $vn_i => $va_item) { $vs_label = caGetLabelForDisplay($va_facet, $va_item, $va_facet_info); #print "<div>".caNavLink($this->request, $vs_label, 'browseSelectPanelLink', $this->request->getModulePath(), $this->request->getController(), ((strlen($vm_modify_id)) ? 'modifyCriteria' : 'addCriteria'), array('facet' => $vs_facet_name, 'id' => $va_item['id'], 'mod_id' => $vm_modify_id))."</div>"; print "<li><a href='#' class='abFacetOptionsList' id='abFacetOptionsList" . $va_item['id'] . "' onclick='jQuery(\".abFacetOptionsList\").removeClass(\"selected\"); jQuery(\"#abFacetOptionsList" . $va_item['id'] . "\").addClass(\"selected\"); jQuery(\"#contentBox\").load(\"" . caNavUrl($this->request, 'eastend', 'Map', 'clearAndAddCriteria', array('facet' => $vs_facet_name, 'id' => $va_item['id'], 'mod_id' => $vm_modify_id)) . "\"); return false;'>" . $vs_label . "</a></li>"; } } ?> </ul> <?php }
* CollectiveAccess is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTIES whatsoever, including any implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * This source code is free and modifiable under the terms of * GNU General Public License. (http://www.gnu.org/copyleft/gpl.html). See * the "license.txt" file for details, or visit the CollectiveAccess web site at * http://www.CollectiveAccess.org * * ---------------------------------------------------------------------- */ $va_place_ids = $this->getVar("place_ids"); $t_place = new ca_places(); ?> <div id="chronologyMapBalloonContainer"> <?php foreach ($va_place_ids as $vn_place_id) { $t_place->load($vn_place_id); # --- display the entities related to the place - this is what we searched up on since that is the curent data available print "<H1>" . caNavLink($this->request, $t_place->getLabelForDisplay(), '', 'Detail', 'Place', 'Show', array('place_id' => $t_place->get("ca_places.place_id"))) . "</H1>"; # --- entities $va_entities = $t_place->get("ca_entities", array("returnAsArray" => 1, 'checkAccess' => $va_access_values, 'sort' => 'surname')); if (sizeof($va_entities) > 0) { foreach ($va_entities as $va_entity) { print "<div>" . ($this->request->config->get('allow_detail_for_ca_entities') ? caNavLink($this->request, $va_entity["label"], '', 'Detail', 'Entity', 'Show', array('entity_id' => $va_entity["entity_id"])) : $va_entity["label"]) . " (" . $va_entity['relationship_typename'] . ")</div>"; } } print "<p>" . caNavLink($this->request, _t("More") . " ›", '', 'Detail', 'Place', 'Show', array('place_id' => $t_place->get("ca_places.place_id"))) . "</p>"; } ?> </div><!-- end chronologyMapBalloonContainer -->
} if ($vs_thumb) { print "</div></div><!-- end row -->"; } else { print "<br/>"; } print "<br/>"; } } $va_places = $t_item->get("ca_places", array("returnAsArray" => true, "checkAccess" => $va_access_values)); if (sizeof($va_places)) { print "<H6>Related place" . (sizeof($va_places) > 1 ? "s" : "") . "</H6>"; $t_rel_place = new ca_places(); foreach ($va_places as $va_place) { $t_rel_place->load($va_place["place_id"]); $t_object_thumb->load($t_rel_place->get("ca_objects.object_id", array("restrictToRelationshipTypes" => array("cover"), "checkAccess" => $va_access_values))); $vs_thumb = $t_object_thumb->get("ca_object_representations.media.icon", array("checkAccess" => $va_access_values)); if ($vs_thumb) { print "<div class='row'><div class='col-sm-3 col-md-3 col-lg-3'>" . $vs_thumb . "</div>\n"; print "<div class='col-sm-9 col-md-9 col-lg-9'>\n"; } print $t_rel_place->getWithTemplate("<b><l>^ca_places.preferred_labels.name</l></b>"); if ($vs_brief_description = $t_rel_place->get("ca_places.brief_description")) { print "<br/>" . $vs_brief_description; } if ($vs_thumb) { print "</div></div><!-- end row -->"; } else { print "<br/>"; } print "<br/>";
$va_primary_venue_name = array(); foreach ($va_primary_venue as $vn_relation_id => $va_primary_venue_info) { $va_entities_output[] = $va_primary_venue_info["relation_id"]; $va_primary_venue_name[] = $va_primary_venue_info["displayname"]; $vn_venue_entity_id = $va_primary_venue_info["entity_id"]; } print "<div class='subtitle'>" . implode($va_primary_venue_name, ", ") . "</div><!-- end subtitle -->"; } if ($vn_venue_entity_id) { $t_venue = new ca_entities($vn_venue_entity_id); if ($va_primary_venue_location = $t_venue->get('ca_places', array('restrict_to_relationship_types' => array('location'), "returnAsArray" => 1, 'checkAccess' => $va_access_values))) { $va_primary_venue_location_name = array(); foreach ($va_primary_venue_location as $vn_relation_id => $va_primary_venue_location_info) { $t_place = new ca_places($va_primary_venue_location_info["place_id"]); $va_primary_venue_location_name[] = $t_place->getLabelForDisplay(); if ($t_place->get('ca_places.parent.preferred_labels')) { $va_primary_venue_location_name[] = $t_place->get('ca_places.parent.preferred_labels'); } #$va_primary_venue_location_name[] = $va_primary_venue_location_info["name"]; } print "<div class='subsubtitle'>" . implode($va_primary_venue_location_name, ", ") . "</div><!-- end subsubtitle -->"; } } if ($t_occurrence->get("ca_occurrences.date.display_date")) { $va_date_info = array_pop($t_occurrence->get("ca_occurrences.date.parsed_date", array("rawDate" => true, "returnAsArray" => true))); if (($vn_start_date = intval($va_date_info["start"])) && $vn_start_date >= 1904 && $vn_start_date <= 1988) { print "<div class='subsubtitle'>" . caNavLink($this->request, $t_occurrence->get("ca_occurrences.date.display_date"), '', 'Chronology', 'Detail', '', array('year' => $vn_start_date)) . "</div>"; } else { print "<div class='subsubtitle'>" . $t_occurrence->get("ca_occurrences.date.display_date") . "</div>"; } }
$vn_i++; } ?> </div><!-- end refineBrowse --> <?php } $vn_x = 0; print "<div id='browseCriteria'><span class='criteriaHeading'>" . _t("You browsed for: ") . "</span>"; $t_place = new ca_places(); foreach ($va_criteria as $vs_facet_name => $va_row_ids) { $vn_x++; $vn_row_c = 0; foreach ($va_row_ids as $vn_row_id => $vs_label) { if ($vs_facet_name == 'place_facet_hier') { $t_place->load($vn_row_id); $vs_label = $t_place->get('idno'); } print "{$vs_label}" . caNavLink($this->request, 'x', 'close', '', 'Browse', 'removeCriteria', array('facet' => $vs_facet_name, 'id' => $vn_row_id)) . "\n"; $vn_row_c++; } } print caNavLink($this->request, _t('start new search') . " ›", 'startOver', '', 'Browse', 'clearCriteria', array()); print "</div><!-- end browseCriteria -->\n"; print "</div><!-- end browseControls -->"; } else { print $this->render('Browse/browse_intro_text_html.php'); if (sizeof($va_facets)) { print "<div class='startBrowsingBy'>" . _t("Start browsing by:") . "</div>"; print "<div id='facetList'>"; $va_available_facets = $this->getVar('available_facets'); foreach ($va_available_facets as $vs_facet_code => $va_facet_info) {
} } # --- places $t_related_place = new ca_places(); $va_places = $t_entity->get("ca_places", array("returnAsArray" => 1, 'checkAccess' => $va_access_values)); if (sizeof($va_places) > 0) { $vs_places_for_display = ""; foreach ($va_places as $va_place) { $vs_effective_date = $va_place["effective_date"]; if (strstr($vs_effective_date, "after")) { $vs_effective_date = str_replace("after", "since", $vs_effective_date); } # --- if this is a street address, load parent so can show town instead if (is_numeric(substr($va_place["label"], 0, 1))) { $t_related_place->load($va_place["place_id"]); $vs_places_for_display .= "<li>" . $t_related_place->get('ca_places.parent.preferred_labels.name') . "<br/>(" . $va_place['relationship_typename'] . ($vs_effective_date ? ", " . $vs_effective_date : "") . ")</li>"; } else { $vs_places_for_display .= "<li>" . ($this->request->config->get('allow_detail_for_ca_places') ? caNavLink($this->request, $va_place["label"], '', 'Detail', 'Place', 'Show', array('place_id' => $va_place["place_id"])) : $va_place["label"]) . "<br/>(" . $va_place['relationship_typename'] . ($vs_effective_date ? ", " . $vs_effective_date : "") . ")</li>"; } } if ($vs_places_for_display) { ?> <div class="ad_col"><div> <span class="listhead caps"><?php print _t("Places"); ?> </span> <ul><?php print $vs_places_for_display; ?> </ul>
/** * */ public function get() { if (!is_object($t_entity = $this->_checkEntity())) { return $t_entity; } $vn_id = $t_entity->getPrimaryKey(); $t_list = new ca_lists(); $vn_yes_id = $t_list->getItemIDFromList("yes_no", "yes"); $vn_no_id = $t_list->getItemIDFromList("yes_no", "no"); $vn_male_id = $t_list->getItemIDFromList("genders", "male"); $vn_female_id = $t_list->getItemIDFromList("genders", "female"); // get victim info $va_data = array('id' => $vn_id, 'forename' => $t_entity->get('ca_entities.preferred_labels.forename'), 'other_forenames' => $t_entity->get('ca_entities.preferred_labels.other_forenames'), 'surname' => $t_entity->get('ca_entities.preferred_labels.surname'), 'middlename' => $t_entity->get('ca_entities.preferred_labels.middlename'), 'displayname' => $t_entity->get('ca_entities.preferred_labels.displayname'), 'prefix' => $t_entity->get('ca_entities.preferred_labels.prefix'), 'suffix' => $t_entity->get('ca_entities.preferred_labels.suffix'), 'gender' => $t_entity->get('ca_entities.gender') == $vn_male_id ? "M" : "F", 'pregnant' => $t_entity->get('ca_entities.pregnant') == $vn_yes_id ? 1 : 0, 'final_text_bio' => $t_entity->get('ca_entities.final_text_bio'), 'lifespan' => $t_entity->get('ca_entities.lifespan', array('dateFormat' => 'iso8601')), 'lifespan_as_text' => $t_entity->get('ca_entities.lifetime_text'), 'last_modification' => $t_entity->get('ca_entities.lastModified', array("dateFormat" => 'iso8601'))); $va_nonpreferred_labels = $t_entity->get('ca_entities.nonpreferred_labels', array('returnAsArray' => true, 'assumeDisplayField' => false)); foreach ($va_nonpreferred_labels as $va_label) { $va_data['alternate_names'][] = $va_label; } // add place info $va_places = $t_entity->getRelatedItems('ca_places'); $t_place = new ca_places(); $va_place_type_list = $t_place->getTypeList(); $va_place_type_idnos = array(); foreach ($va_place_type_list as $vn_type_id => $va_type) { if (!$va_type['is_enabled']) { continue; } $va_place_type_idnos[] = $va_type['idno']; } $va_data['place_types'] = $va_place_type_idnos; foreach ($va_places as $vn_relation_id => $va_rel_info) { if ($t_place->load($va_rel_info['place_id'])) { $va_place_ids = $t_place->get('ca_places.hierarchy.place_id', array('returnAsArray' => true)); array_shift($va_place_ids); $vn_i = 0; foreach ($va_place_ids as $vn_id) { if ($t_place->load($vn_id)) { if (!($vs_type_name = $va_place_type_list[$vn_place_type_id = $t_place->get('type_id')]['idno'])) { $vs_type_name = $vn_place_type_id; } $va_data['locations'][$va_rel_info['relationship_type_code']][$vs_type_name] = $t_place->get('ca_places.preferred_labels.name'); $vn_i++; } } } } // add affiliations $va_entities = $t_entity->getRelatedItems('ca_entities', array('restrict_to_relationship_types' => array('employer', 'affiliation'))); $t_rel_entity = new ca_entities(); $va_units = array(); foreach ($va_entities as $vn_relation_id => $va_rel_info) { if ($t_rel_entity->load($va_rel_info['entity_id'])) { $va_display_names = $t_rel_entity->get('ca_entities.hierarchy.preferred_labels.displayname', array('returnAsArray' => true)); if ($va_rel_info['relationship_type_code'] == 'affiliation') { if (sizeof($va_display_names) > 1) { $va_units[] = array_pop($va_display_names); } } else { if (sizeof($va_display_names) > 1) { array_pop($va_display_names); } } $va_data['affiliations'][$va_rel_info['relationship_type_code']][] = array('displayname' => $va_display_names, 'id' => $va_rel_info['entity_id'], 'aliases' => array_values($t_rel_entity->get('ca_entities.nonpreferred_labels.displayname', array('returnAsArray' => true)))); } } // add group $va_data['affiliations']['group'][] = array('displayname' => array($t_entity->get('ca_entities.groupName')), 'id' => -1, 'aliases' => array()); // Map bottom level of two level affiliation to fake "unit" relationship // This let's the Memorial Table CMS easily make the unit value searchable foreach ($va_units as $vs_unit) { $va_data['affiliations']['unit'][] = array('displayname' => array($vs_unit), 'id' => -1, 'aliases' => array()); } return $this->makeResponse($va_data); }