/** * */ public function Index() { $o_cache = caGetCacheObject('MetabolicChronology', 3600); if (!is_array($va_silos = $o_cache->load('silo_list')) || $this->request->getParameter('nocache', pInteger) || !$this->opo_plugin_config->get('doCaching')) { $va_access_values = caGetUserAccessValues($this->request); $this->view->setVar('access_values', $va_access_values); // Get silos $t_list = new ca_lists(); $o_db = new Db(); $qr_ids = $o_db->query("SELECT collection_id FROM ca_collections WHERE type_id = ? AND deleted = 0 AND access IN (?)", $this->opn_silo_type_id, implode(", ", $this->opa_access_values)); $t_collection = new ca_collections(); $qr_silos = $t_collection->makeSearchResult('ca_collections', $qr_ids->getAllFieldValues('collection_id')); $o_search = new OccurrenceSearch(); $va_silos = array(); while ($qr_silos->nextHit()) { $vs_name = $qr_silos->get('ca_collections.preferred_labels.name'); $vn_collection_id = $qr_silos->get('collection_id'); if (strtolower($vs_name) == 'historical context') { $o_search->setTypeRestrictions(array($this->opn_context_type_id)); } else { $o_search->setTypeRestrictions(array($this->opn_action_type_id)); } $o_search->addResultFilter("ca_occurrences.access", "IN", join(',', $this->opa_access_values)); $qr_res = $o_search->search("ca_occurrences.includeChronology:" . $this->opn_yes_list_id . " AND ca_collections.collection_id:{$vn_collection_id} AND ca_occurrences.date.dates_value:\"after 1000\""); $va_silos[$vn_collection_id] = array('collection_id' => $vn_collection_id, 'name' => $vs_name, 'actions' => $this->_getActions($vn_collection_id, 0, 25, strtolower($vs_name) == 'historical context'), 'num_actions' => $qr_res->numHits(), 'actionmap' => $this->_getActionMap($vn_collection_id, strtolower($vs_name) == 'historical context')); } $o_cache->save($va_silos); } $this->view->setVar('silos', $va_silos); $this->render('chronology_html.php'); }