require_once __CA_LIB_DIR__ . '/core/Parsers/TimeExpressionParser.php'; $t_set = $this->getVar('t_set'); $o_tep = new TimeExpressionParser(); // we use this to normalize exhibition dates to years // The "set_chronology_type" set attribute is the ca_list_items.item_id of the occurrence type // for which we need to list out occurrences (aka "subject programs" in Perry-speak) $va_chronology_types = $t_set->getAttributesByElement("set_chronology_type"); // Pull the raw item_id of the type out of the first value (it doesn't repeat) $va_values = $va_chronology_types[0]->getValues(); $vn_chronology_type_id = $va_values[0]->getDisplayValue(); // Ok... now generate an object browse on the occurrence facet for the specified type // This will give us a complete list of occurrences with the date attached (since the // facet supports grouping by year - yay!). It's also pretty fast since the BrowseEngine // does caching. Yay again! $o_browse = new ObjectBrowse(); $va_facet = $o_browse->getFacet('occurrence_facet_' . $vn_chronology_type_id); ?> <div id="featuresTitle"><?php print $t_set->getLabelForDisplay(); ?> </div> <div id="featuresDescription"><?php print $t_set->getSimpleAttributeValue('set_introduction'); ?> </div> <div style="clear: both;"><!-- empty --></div> <div> <?php // Run through the facet and sort out occurrences by year $va_exhibition_list_by_year = array(); foreach ($va_facet as $vn_id => $va_item) {
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'); }