/** * Returns a list of all victims */ public function listVictims() { $o_search = new EntitySearch(); $from = $this->opo_request->getParameter('from', pString); $until = $this->opo_request->getParameter('until', pString); if (!$until) { $until = date('c'); } $vs_range = $from && $until ? self::utcToDb($from) . ' to ' . self::utcToDb($until) : null; $qr_res = $o_search->search("ca_entities.type_id:" . $this->opn_victim_type_id, array('limitToModifiedOn' => $vs_range)); $skip = $this->opo_request->getParameter('skip', pInteger); $limit = $this->opo_request->getParameter('limit', pInteger); if ($skip > 0) { $qr_res->seek($skip); } if ($skip > $qr_res->numHits()) { return $this->makeResponse(array()); } $va_list = array(); while ($qr_res->nextHit()) { $va_list[$vn_id = $qr_res->get('ca_entities.entity_id')] = array('id' => $vn_id, 'forename' => $qr_res->get('ca_entities.preferred_labels.forename'), 'other_forenames' => $qr_res->get('ca_entities.preferred_labels.other_forenames'), 'surname' => $qr_res->get('ca_entities.preferred_labels.surname'), 'middlename' => $qr_res->get('ca_entities.preferred_labels.middlename'), 'displayname' => $qr_res->get('ca_entities.preferred_labels.displayname'), 'prefix' => $qr_res->get('ca_entities.preferred_labels.prefix'), 'suffix' => $qr_res->get('ca_entities.preferred_labels.suffix'), 'last_modification' => $qr_res->get('ca_entities.lastModified', array("dateFormat" => 'iso8601'))); if ($limit && sizeof($va_list) >= $limit) { break; } } return $this->makeResponse($va_list); }
/** * Displays map of all member inst */ public function Index() { $o_search = new EntitySearch(); #$o_search->setTypeRestrictions(array($this->opn_member_institution_id)); $o_search->addResultFilter("ca_entities.access", "IN", join(',', $this->opa_access_values)); //$qr_res = $o_search->search("*", array('sort' => 'ca_entity_labels.name', 'sort_direction' => 'asc')); $qr_res = $o_search->search("ca_entities.type_id:" . $this->opn_member_institution_id); // This is fastest $o_map = new GeographicMap(900, 500, 'map'); $va_map_stats = $o_map->mapFrom($qr_res, "georeference", array("ajaxContentUrl" => caNavUrl($this->request, "NovaMuse", "MemberMap", "getMapItemInfo"), "request" => $this->request, "checkAccess" => $this->opa_access_values)); $this->view->setVar("map", $o_map->render('HTML', array('delimiter' => "<br/>"))); $this->render('member_map_html.php'); }
/** * */ public function Index() { $ps_forename = $this->request->getParameter('forename', pString); $ps_surname = $this->request->getParameter('surname', pString); $ps_org = $this->request->getParameter('organization', pString); $va_fields = array('ca_entity_labels.forename' => 'forename', 'ca_entity_labels.surname' => 'surname', 'ca_entities.affiliation' => 'organization'); $va_search_terms = array(); foreach ($va_fields as $vs_qualifier => $vs_field) { if ($vs_term = $this->request->getParameter($vs_field, pString)) { $va_search_terms[] = "{$vs_qualifier}:\"{$vs_term}\""; } } if (sizeof($va_search_terms) > 0) { $o_search = new EntitySearch(); $this->view->setVar('results', $o_search->search(join(" AND ", $va_search_terms), array('sort' => 'ca_entity_labels.surname;ca_entity_labels.forename'))); } $this->render("index_html.php"); }
<?php require_once __CA_LIB_DIR__ . "/ca/Search/EntitySearch.php"; $o_entity_search = new EntitySearch(); $t_list = new ca_lists(); $vn_member_institution_id = $t_list->getItemIDFromList('entity_types', 'member_institution'); $qr_member_institutions = $o_entity_search->search("ca_entities.access:1 AND ca_entities.type_id:{$vn_member_institution_id}", array("sort" => "ca_entity_labels.displayname")); # -- put in an array based on the region $va_member_inst_by_region = array(); if ($qr_member_institutions->numHits() > 0) { while ($qr_member_institutions->nextHit()) { $va_member_inst_by_region[$qr_member_institutions->get("mem_inst_region", array('convertCodesToDisplayText' => true))][$qr_member_institutions->get("entity_id")] = caNavLink($this->request, join("; ", $qr_member_institutions->getDisplayLabels()), '', 'Detail', 'Entity', 'Show', array('entity_id' => $qr_member_institutions->get("entity_id"))); } } ksort($va_member_inst_by_region); ?> <div id='pageBody'> <div class="imageRightCol"> <?php print $this->render("About/sideNav.php"); ?> <img src="<?php print $this->request->getThemeUrlPath(); ?> /graphics/novamuse/hope-digby.jpg"> <div class="caption">Photo credit: Sheryl Stanton, Admiral Digby Museum</div><br/> <img src="<?php print $this->request->getThemeUrlPath(); ?> /graphics/novamuse/AntigonishHeritageMuseum.jpg"> <div class="caption">Antigonish Heritage Museum</div><br/>
/** * */ public function secondarySearch() { $pn_spage = (int) $this->request->getParameter('spage', pInteger); $ps_type = $this->request->getParameter('type', pString); $this->view->setVar('search_type', $ps_type); $va_access_values = caGetUserAccessValues($this->request); $ps_search = $this->opo_result_context->getSearchExpression(); switch ($ps_type) { case 'ca_entities': $o_search = new EntitySearch(); $qr_res = $o_search->search($ps_search, array('checkAccess' => $va_access_values)); break; case 'ca_places': $o_search = new PlaceSearch(); $qr_res = $o_search->search($ps_search, array('checkAccess' => $va_access_values)); break; case 'ca_occurrences': $o_search = new OccurrenceSearch(); $qr_res = $o_search->search($ps_search, array('checkAccess' => $va_access_values)); break; case 'ca_collections': $o_search = new CollectionSearch(); $qr_res = $o_search->search($ps_search, array('checkAccess' => $va_access_values)); break; default: $this->response->setRedirect($this->request->config->get('error_display_url') . '/n/' . _t('Invalid secondary search type') . '?r=' . urlencode($this->request->getFullUrlPath())); return; break; } $this->view->setVar('secondaryItemsPerPage', $this->opa_items_per_secondary_search_page); $this->view->setVar('page_' . $ps_type, $pn_spage); if ($pn_spage > 0) { $qr_res->seek($pn_spage * $this->opa_items_per_secondary_search_page); } $this->view->setVar('secondary_search_' . $ps_type, $qr_res); $this->render('Results/search_secondary_results/' . $ps_type . '_html.php'); }
* * @package CollectiveAccess * @subpackage Core * @license http://www.gnu.org/copyleft/gpl.html GNU Public License version 3 * * ---------------------------------------------------------------------- */ require_once __CA_LIB_DIR__ . "/ca/Search/EntitySearch.php"; $va_access_values = $this->getVar("access_values"); //$qr_res = $this->getVar('featured_set_items_as_search_result'); $o_config = $this->getVar("config"); //$vs_caption_template = $o_config->get("front_page_set_item_caption_template"); //if(!$vs_caption_template){ // $vs_caption_template = "<l>^ca_objects.preferred_labels.name</l>"; //} $o_entity_search = new EntitySearch(); $qr_res = $o_entity_search->search("ca_entities.tour_yn:957", array('sort' => 'ca_entities.preferred_labels.surname', 'sort_direction' => 'asc', 'checkAccess' => array(1))); if ($qr_res && $qr_res->numHits()) { ?> <div class="jcarousel-wrapper"> <!-- Carousel --> <div class="jcarousel"> <ul> <?php while ($qr_res->nextHit()) { $vs_image_tag = $qr_res->get('ca_entities.agentMedia', array('version' => 'mediumlarge')); $vn_entity_id = $qr_res->get('ca_entities.entity_id'); print "<li class='frontSlide'><div class='frontSlide'>"; print "<div style='margin:10px;' class='clearfix'><div class='frontSlideImage'>"; print caNavLink($this->request, $vs_image_tag, '', 'Itinera', 'Tours', 'Index', array('id' => $vn_entity_id));
private function _doSearch($ps_type, $ps_search, $ps_sort) { $va_access_values = caGetUserAccessValues($this->request); $vb_no_cache = (bool) $this->request->getParameter('no_cache', pInteger); if (!$this->request->user->canDoAction('can_search_' . ($ps_type == 'ca_tour_stops' ? 'ca_tours' : $ps_type))) { return ''; } switch ($ps_type) { case 'ca_objects': $o_object_search = new ObjectSearch(); return $o_object_search->search($ps_search, array('sort' => $ps_sort, 'search_source' => 'Quick', 'limit' => $this->opn_num_results_per_item_type, 'no_cache' => $vb_no_cache, 'checkAccess' => $va_access_values)); break; case 'ca_object_lots': $o_object_lots_search = new ObjectLotSearch(); return $o_object_lots_search->search($ps_search, array('sort' => $ps_sort, 'search_source' => 'Quick', 'limit' => $this->opn_num_results_per_item_type, 'no_cache' => $vb_no_cache, 'checkAccess' => $va_access_values)); break; case 'ca_entities': $o_entity_search = new EntitySearch(); return $o_entity_search->search($ps_search, array('sort' => $ps_sort, 'search_source' => 'Quick', 'limit' => $this->opn_num_results_per_item_type, 'no_cache' => $vb_no_cache, 'checkAccess' => $va_access_values)); break; case 'ca_places': $o_place_search = new PlaceSearch(); return $o_place_search->search($ps_search, array('sort' => $ps_sort, 'search_source' => 'Quick', 'limit' => $this->opn_num_results_per_item_type, 'no_cache' => $vb_no_cache, 'checkAccess' => $va_access_values)); break; case 'ca_occurrences': $o_occurrence_search = new OccurrenceSearch(); return $o_occurrence_search->search($ps_search, array('sort' => $ps_sort, 'search_source' => 'Quick', 'limit' => $this->opn_num_results_per_item_type, 'no_cache' => $vb_no_cache, 'checkAccess' => $va_access_values)); break; case 'ca_collections': $o_collection_search = new CollectionSearch(); return $o_collection_search->search($ps_search, array('sort' => $ps_sort, 'search_source' => 'Quick', 'limit' => $this->opn_num_results_per_item_type, 'no_cache' => $vb_no_cache, 'checkAccess' => $va_access_values)); break; case 'ca_storage_locations': $o_storage_location_search = new StorageLocationSearch(); return $o_storage_location_search->search($ps_search == '*' ? '(ca_storage_locations.is_enabled:1)' : '(' . $ps_search . ') AND (ca_storage_locations.is_enabled:1)', array('sort' => $ps_sort, 'search_source' => 'Quick', 'limit' => $this->opn_num_results_per_item_type, 'no_cache' => $vb_no_cache, 'checkAccess' => $va_access_values)); break; case 'ca_loans': $o_loan_search = new LoanSearch(); return $o_loan_search->search($ps_search, array('sort' => $ps_sort, 'search_source' => 'Quick', 'limit' => $this->opn_num_results_per_item_type, 'no_cache' => $vb_no_cache, 'checkAccess' => $va_access_values)); break; case 'ca_movements': $o_movement_search = new MovementSearch(); return $o_movement_search->search($ps_search, array('sort' => $ps_sort, 'search_source' => 'Quick', 'limit' => $this->opn_num_results_per_item_type, 'no_cache' => $vb_no_cache, 'checkAccess' => $va_access_values)); break; case 'ca_tours': $o_tour_search = new TourSearch(); return $o_tour_search->search($ps_search, array('sort' => $ps_sort, 'search_source' => 'Quick', 'limit' => $this->opn_num_results_per_item_type, 'no_cache' => $vb_no_cache, 'checkAccess' => $va_access_values)); break; case 'ca_tour_stops': $o_tour_stop_search = new TourStopSearch(); return $o_tour_stop_search->search($ps_search, array('sort' => $ps_sort, 'search_source' => 'Quick', 'limit' => $this->opn_num_results_per_item_type, 'no_cache' => $vb_no_cache, 'checkAccess' => $va_access_values)); break; default: return null; break; } }
<?php include_once __CA_LIB_DIR__ . "/core/Db.php"; include_once __CA_LIB_DIR__ . "/ca/Search/EntitySearch.php"; include_once __CA_MODELS_DIR__ . "/ca_lists.php"; include_once __CA_MODELS_DIR__ . "/ca_entities.php"; $t_list = new ca_lists(); $vn_entity_type_id = $t_list->getItemIDFromList("entity_types", "ind"); $vn_org_type_id = $t_list->getItemIDFromList("entity_types", "org"); $o_artist_search = new EntitySearch(); $qr_artists = $o_artist_search->search("ca_entities.artist_status:Top OR ca_entities.artist_status:Current Associated OR ca_entities.artist_status:Associated", array('sort' => 'ca_entities.preferred_labels.surname', 'sort_direction' => 'asc')); $o_org_search = new EntitySearch(); $qr_orgs = $o_org_search->search("ca_entities.artist_status:Top OR ca_entities.artist_status:Current Associated OR ca_entities.artist_status:Associated", array('sort' => 'ca_entities.preferred_labels.surname', 'sort_direction' => 'asc')); ?> <div class="artistDiv"> <h1 class="results">Artists</h1> <?php if ($qr_artists->numHits()) { while ($qr_artists->nextHit()) { if ($qr_artists->get('ca_entities.type_id') == 78 && $qr_artists->get('ca_entities.artist_status') && $qr_artists->get('ca_entities.artist_status') != 247) { $vn_entity_id = $qr_artists->get('ca_entities.entity_id'); print "<div class='artistList'>" . caNavLink($this->request, $qr_artists->get('ca_entities.preferred_labels'), '', 'Detail', 'Entity', 'Show', array('entity_id' => $vn_entity_id)) . "</div>"; } } } ?> </div> <div class="artistDiv"> <h1 class="results">Organizations</h1> <?php if ($qr_orgs->numHits()) {
<?php include_once __CA_LIB_DIR__ . "/core/Db.php"; include_once __CA_LIB_DIR__ . "/ca/Search/EntitySearch.php"; include_once __CA_MODELS_DIR__ . "/ca_lists.php"; include_once __CA_MODELS_DIR__ . "/ca_entities.php"; $t_list = new ca_lists(); $vn_entity_type_id = $t_list->getItemIDFromList("entity_types", "ind"); $vn_org_type_id = $t_list->getItemIDFromList("entity_types", "org"); $o_artist_search = new EntitySearch(); $qr_artists = $o_artist_search->search("ca_entities.type_id:{$vn_entity_type_id} AND ca_entities.artist_status:Top", array('sort' => 'ca_entities.preferred_labels.surname', 'sort_direction' => 'asc')); $o_org_search = new EntitySearch(); $qr_orgs = $o_org_search->search("ca_entities.type_id:{$vn_org_type_id} AND ca_entities.artist_status:Top", array('sort' => 'ca_entities.preferred_labels.surname', 'sort_direction' => 'asc')); ?> <h1 class="results">CURRENT BOOKLYN ARTISTS + ORGANIZATIONS</h1> <div class="artistDiv"> <?php if ($qr_artists->numHits()) { while ($qr_artists->nextHit()) { $vn_entity_id = $qr_artists->get('ca_entities.entity_id'); print "<div class='artistList'>" . caNavLink($this->request, $qr_artists->get('ca_entities.preferred_labels'), '', 'Detail', 'Entity', 'Show', array('entity_id' => $vn_entity_id)) . "</div>"; } } ?> </div> <div class="artistDiv"> <h1 class="results"></h1> <?php if ($qr_orgs->numHits()) { while ($qr_orgs->nextHit()) {
print "<li>" . ($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"]) . "<br/>(" . $va_entity['relationship_typename'] . ")</li>"; } ?> </ul> </div></div><!--end ad_col 2 --> <?php } # --- list of artists from the same movements if ($va_style_ids = caExtractValuesByUserLocale($t_entity->get("ca_entities.style_school", array('returnAsArray' => true, 'delimeter' => ', ', 'checkAccess' => $va_access_values)))) { $va_search_parts = ""; $vs_search_text = ""; foreach ($va_style_ids as $vn_style_id) { $va_search_parts[] = "ca_entities.style_school: " . $vn_style_id; } $vs_search_text = join(" OR ", $va_search_parts); $o_ent_search = new EntitySearch(); # -- exclude the current entity from list $o_ent_search->addResultFilter("ca_entities.entity_id", "!=", $vn_entity_id); #print_r($o_ent_search->getResultFilters()); $qr_entities = $o_ent_search->search($vs_search_text, array("sort" => "ca_entity_labels.lname", "checkAccess" => $va_access_values)); if ($qr_entities->numHits()) { print "<div class='ad_col'><div><span class='listhead caps'>" . _t("Artists from same movement") . "</span><br/><ul>"; while ($qr_entities->nextHit()) { print "<li>" . ($this->request->config->get('allow_detail_for_ca_entities') ? caNavLink($this->request, join(", ", $qr_entities->getDisplayLabels()), '', 'Detail', 'Entity', 'Show', array('entity_id' => $qr_entities->get("ca_entities.entity_id"))) : join(", ", $qr_entities->getDisplayLabels())) . "</li>"; } print "</ul></div></div><!--end ad_col 3 -->"; } } # --- places $t_related_place = new ca_places(); $va_places = $t_entity->get("ca_places", array("returnAsArray" => 1, 'checkAccess' => $va_access_values));
function Index() { $vn_y = $this->ops_date_range; $va_period_data = array(); // // Do browse for objects from period; we'll use the facets for related entities, occurrences and list items // from this browse to generate lists of which have related objects to show from it. // $vo_object_browse = new ObjectBrowse(); // we'll do a browse $vo_object_browse->addCriteria('_search', array('ca_objects.creation_date:"' . $vn_y . '"')); // criteria is a search for creation date $vo_object_browse->execute(); // execute the browse // // Get events & exhibitions (occurrences) // $o_occ_search = new OccurrenceSearch(); $qr_occs = $o_occ_search->search("ca_occurrences.event_date:\"" . $vn_y . "\"", array("sort" => "ca_occurrences.event_date", "no_cache" => !$this->opb_cache_searches, "checkAccess" => $this->opa_access_values)); $va_occ_ids = array(); while ($qr_occs->nextHit()) { $va_occ_ids[] = $qr_occs->get("ca_occurrences.occurrence_id"); } $qr_occs->seek(0); // result context for occ $o_search_result_context_occ = new ResultContext($this->request, "ca_occurrences", 'chronology'); $o_search_result_context_occ->setAsLastFind(); $o_search_result_context_occ->setResultList($va_occ_ids); $o_search_result_context_occ->setParameter("period", $this->opn_period); $o_search_result_context_occ->saveContext(); $va_period_data["occurrences"] = $qr_occs; // Get list of occurrences that have associated objects *from this period* $va_related_occs = $vo_object_browse->getFacet('occurrence_facet'); $va_period_data["occurrences_with_objects"] = is_array($va_related_occs) ? array_keys($vo_object_browse->getFacet('occurrence_facet')) : array(); // grab the related occurrences facet to get a list of occurrences with objects; the keys of the returned array are occurrence_ids // // Get entity list // $o_ent_search = new EntitySearch(); $qr_entities = $o_ent_search->search("ca_entities.arrival_date:\"" . $vn_y . "\"", array("sort" => "ca_entity_labels.surname", "no_cache" => !$this->opb_cache_searches, "checkAccess" => $this->opa_access_values)); $va_entity_ids = array(); while ($qr_entities->nextHit()) { $va_entity_ids[] = $qr_entities->get("ca_entities.entity_id"); } $qr_entities->seek(0); $this->opo_search_result_context_entity->setAsLastFind(); $this->opo_search_result_context_entity->setResultList($va_entity_ids); $this->opo_search_result_context_entity->setParameter("period", $this->opn_period); $this->opo_search_result_context_entity->saveContext(); $va_period_data["entities"] = $qr_entities; $va_related_entities = $vo_object_browse->getFacet('entity_facet'); $va_period_data["entities_with_objects"] = is_array($va_related_entities) ? array_keys($va_related_entities) : array(); // grab the related entities facet to get a list of entities with objects; the keys of the returned array are entity_ids // // Get styles/schools (list items) list // $o_styles_schools_search = new ListItemSearch(); $qr_styles_schools_search = $o_styles_schools_search->search("ca_list_items.term_date:\"" . $vn_y . "\"", array("sort" => "ca_list_item_labels.name_singular", "no_cache" => !$this->opb_cache_searches, "checkAccess" => $this->opa_access_values)); $va_period_data["styles_schools"] = $qr_styles_schools_search; $va_related_list_items = $vo_object_browse->getFacet('style'); $va_period_data["list_items_with_objects"] = is_array($va_related_list_items) ? array_keys($va_related_list_items) : array(); // grab the related list items facet to get a list of list items with objects; the keys of the returned array are item_ids # -- make array of entity_ids so can find places associated with these entities to map // $va_entities = array(); // if($qr_entities->numHits()){ // while($qr_entities->nextHit()){ // $va_entities[] = $qr_entities->get("entity_id"); // } // } // $qr_entities->seek(0); // $o_place_search = new PlaceSearch(); // $o_place_search->addResultFilter("ca_entities.entity_id", "IN", join(',', $va_entities)); // $qr_places = $o_place_search->search("*", array("no_cache" => !$this->opb_cache_searches, "checkAccess" => $this->opa_access_values)); // $o_map = new GeographicMap(450, 250, 'map'); // $va_map_stats = $o_map->mapFrom($qr_places, "georeference", array("ajaxContentUrl" => caNavUrl($this->request, "eastend", "Chronology", "getMapItemInfo"), "request" => $this->request, "checkAccess" => $this->opa_access_values)); // $va_period_data["map"] = $o_map->render('HTML', array('delimiter' => "<br/>")); // $va_period_data["places"] = $qr_places; $o_obj_search = new ObjectSearch(); $qr_objects = $o_obj_search->search("ca_objects.creation_date:\"" . $vn_y . "\" AND (ca_object.object_status:349 OR ca_object.object_status:347 OR ca_object.object_status:193)", array("sort" => "ca_objects.creation_date", "no_cache" => !$this->opb_cache_searches, "checkAccess" => $this->opa_access_values)); $va_period_data["objects"] = $qr_objects; $va_object_ids = array(); while ($qr_objects->nextHit()) { $va_object_ids[] = $qr_objects->get("ca_objects.object_id"); } $qr_objects->seek(0); $this->opo_result_context->setAsLastFind(); $this->opo_result_context->setResultList($va_object_ids); $this->opo_result_context->setParameter("period", $this->opn_period); $this->opo_result_context->saveContext(); $this->view->setVar('period_data', $va_period_data); $this->render('chronology_period_html.php'); }