}
}
if (!$vs_placeholder) {
    $vs_placeholder = $this->request->getThemeUrlPath() . "/graphics/novamuse/placeholders/placeholder.png";
}
# --- get similar items by category
$va_categories = explode(",", $t_object->get('ns_category'));
$va_sim_items = array();
if (sizeof($va_categories)) {
    $vn_category = trim($va_categories[0]);
    require_once __CA_LIB_DIR__ . '/ca/Browse/ObjectBrowse.php';
    $o_browse = new ObjectBrowse();
    $o_browse->removeAllCriteria();
    $o_browse->addCriteria("category_facet", $vn_category);
    $o_browse->addCriteria("has_media_facet", 1);
    $o_browse->execute(array('checkAccess' => $va_access_values));
    $qr_sim_items = $o_browse->getResults();
    if ($qr_sim_items->numHits()) {
        # --- grab the first 50 items and shuffle array to randomize a bit
        $i = 0;
        while ($qr_sim_items->nextHit() && $i < 50) {
            if ($qr_sim_items->get("ca_objects.object_id") != $vn_object_id) {
                $va_labels = array();
                $va_labels = $qr_sim_items->getDisplayLabels($this->request);
                $vs_label = join("; ", $va_labels);
                $va_media_info = array();
                $va_media_info = $qr_sim_items->getMediaInfo('ca_object_representations.media', 'icon', null, array('checkAccess' => $va_access_values));
                $vn_padding_top_bottom = (120 - $va_media_info["HEIGHT"]) / 2;
                $va_sim_items[] = array("object_id" => $qr_sim_items->get("ca_objects.object_id"), "label" => $vs_label, "media" => $qr_sim_items->getMediaTag('ca_object_representations.media', 'icon', array('checkAccess' => $va_access_values)), "idno" => $qr_sim_items->get("ca_objects.idno"), "padding" => $vn_padding_top_bottom);
                $i++;
            }
 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');
 }