public function Index() { JavascriptLoadManager::register('imageScroller'); $va_access_values = caGetUserAccessValues($this->request); // get sets for public display $t_list = new ca_lists(); $vn_public_set_type_id = $t_list->getItemIDFromList('set_types', $t_list->getAppConfig()->get('features_set_type')); // get value for public access status value $va_tmp = $t_list->getItemFromList('access_statuses', 'public_access'); $vn_public_access = $va_tmp['item_value']; $t_set = new ca_sets(); $va_sets = caExtractValuesByUserLocale($t_set->getSets(array('table' => 'ca_objects', 'checkAccess' => $va_access_values, 'setType' => $vn_public_set_type_id))); $va_set_ids = array(); foreach ($va_sets as $va_set) { $va_set_ids[] = $va_set['set_id']; } $this->view->setVar('sets', $va_sets); $this->view->setVar('set_ids', $va_set_ids); $this->view->setVar('set_display_items', ca_sets::getFirstItemsFromSets($va_set_ids, array("version" => "preview160"))); $this->render('features_landing_html.php'); }
$va_user_favorites_collections = $t_collections->getHighestRated(null, 5, $va_access_values); if (is_array($va_user_favorites_collections) && sizeof($va_user_favorites_collections) > 0) { $va_most_popular_collections = array(); foreach ($va_user_favorites_collections as $vn_fav_collection_id) { $t_collection = new ca_collections($vn_fav_collection_id); if ($t_collection->get("access") == 1) { $va_most_popular_collections[$vn_fav_collection_id] = $t_collection->getLabelForDisplay(); } } } # - get staff picks sets // get sets for public display $t_list = new ca_lists(); $vn_public_set_type_id = $t_list->getItemIDFromList('set_types', 'Staff Pick'); // get value for public access status value $va_tmp = $t_list->getItemFromList('access_statuses', 'public_access'); $vn_public_access = $va_tmp['item_value']; $t_set = new ca_sets(); $va_staff_picks_sets = array(); #$va_staff_picks_sets = caExtractValuesByUserLocale($t_set->getSets('ca_collections', null, $va_access_values, null, $vn_public_set_type_id)); $va_staff_picks_sets = caExtractValuesByUserLocale($t_set->getSets(array('table' => 'ca_collections', 'checkAccess' => $va_access_values, "setType" => $vn_public_set_type_id))); if (is_array($va_most_popular_collections) && sizeof($va_most_popular_collections) > 0) { ?> <div class="unit"> <div class="heading">Most Popular Collections:</div> <ul class="crossList"> <?php foreach ($va_most_popular_collections as $vn_pop_coll_id => $vs_pop_coll) { print "<li>" . caNavLink($this->request, $vs_pop_coll, '', 'Detail', 'Collection', 'Show', array('collection_id' => $vn_pop_coll_id)) . "</li>"; } ?>
/** * Returns list of all valid facet names * * @return array() */ public function getFacetList() { if (!is_array($this->opa_browse_settings)) { return null; } // Facets can be restricted such that they are applicable only to certain types when browse type restrictions are in effect. // These restrictions are distinct from per-facet 'restrict_to_type' and 'restrict_to_relationship_types' settings, which affect // what items and *included* in the browse. 'restrict_to_type' restricts a browse to specific types of items (eg. only entities of type "individual" are returned in the facet); // 'restrict_to_relationship_types' restricts authority facets to items related to the browse subject by specific relationship types. By contrast, the // 'type_restrictions' setting indicates that a facet is only valid for specific types when a browse is limited to specific types (eg. there is a browse type // restriction in effect. Browse type restrictions apply to the browse result, not the facet content (eg. on an object browse, a type restriction of "documents" would limit // the browse to only consider and return object of that type). $va_type_restrictions = $this->getTypeRestrictionList(); $t_list = new ca_lists(); $t_subject = $this->opo_datamodel->getInstanceByTableNum($this->opn_browse_table_num, true); $vs_type_list_code = $t_subject->getTypeListCode(); $va_criteria_facets = is_array($va_tmp = $this->getCriteria()) ? array_keys($this->getCriteria()) : array(); // if (is_array($va_type_restrictions) && sizeof($va_type_restrictions)) { $va_facets = array(); foreach ($this->opa_browse_settings['facets'] as $vs_facet_name => $va_facet_info) { if (in_array($vs_facet_name, $va_criteria_facets) && caGetOption('type', $va_facet_info, null) == 'field') { continue; } // fields can only appear once if (isset($va_facet_info['requires']) && !is_array($va_facet_info['requires']) && $va_facet_info['requires']) { $va_facet_info['requires'] = array($va_facet_info['requires']); } // // enforce "requires" setting, which allows one to specify that a given facet should only appear if any one // of the specified "required" facets is present in the criteria // $vb_facet_is_meets_requirements = true; if (isset($va_facet_info['requires']) && is_array($va_facet_info['requires'])) { $vb_facet_is_meets_requirements = false; foreach ($va_facet_info['requires'] as $vs_req_facet) { if (in_array($vs_req_facet, $va_criteria_facets)) { $vb_facet_is_meets_requirements = true; break; } } } if ($vb_facet_is_meets_requirements) { if (isset($va_facet_info['type_restrictions']) && is_array($va_facet_restrictions = $va_facet_info['type_restrictions']) && sizeof($va_facet_restrictions)) { foreach ($va_facet_restrictions as $vs_code) { if ($va_item = $t_list->getItemFromList($vs_type_list_code, $vs_code)) { if (in_array($va_item['item_id'], $va_type_restrictions)) { $va_facets[] = $vs_facet_name; break; } } } } else { $va_facets[] = $vs_facet_name; } } } return $va_facets; } else { // // enforce "requires" setting, which allows one to specify that a given facet should only appear if any one // of the specified "required" facets is present in the criteria // $va_facets = array(); foreach ($this->opa_browse_settings['facets'] as $vs_facet_name => $va_facet_info) { if (isset($va_facet_info['requires']) && !is_array($va_facet_info['requires']) && $va_facet_info['requires']) { $va_facet_info['requires'] = array($va_facet_info['requires']); } if (isset($va_facet_info['requires']) && is_array($va_facet_info['requires'])) { foreach ($va_facet_info['requires'] as $vs_req_facet) { if (in_array($vs_req_facet, $va_criteria_facets)) { $va_facets[] = $vs_facet_name; continue; } } } else { $va_facets[] = $vs_facet_name; } } return $va_facets; } }
private function getModelInfoForType($ps_type) { $t_instance = $this->_getTableInstance($this->getTableName()); $t_list = new ca_lists(); $va_return = array(); $vs_type_list_code = $t_instance->getTypeListCode(); // type info $va_item = $t_list->getItemFromList($vs_type_list_code, $ps_type); $va_return["type_info"] = $va_item; $va_return["type_info"]["display_label"] = $t_list->getItemFromListForDisplay($vs_type_list_code, $ps_type); // applicable element codes and related info $va_elements = array(); $va_codes = $t_instance->getApplicableElementCodes($va_item["item_id"]); $va_codes = array_flip($va_codes); foreach ($va_codes as $vs_code => $va_junk) { // subelements $t_element = $t_instance->_getElementInstance($vs_code); foreach ($t_element->getElementsInSet() as $va_element_in_set) { if ($va_element_in_set["datatype"] == 0) { continue; } // don't include sub-containers $va_element_in_set["datatype"] = ca_metadata_elements::getAttributeNameForTypeCode($va_element_in_set["datatype"]); $va_elements[$vs_code]["elements_in_set"][$va_element_in_set["element_code"]] = $va_element_in_set; } // element label and description $va_label = $t_instance->getAttributeLabelAndDescription($vs_code); $va_elements[$vs_code]["name"] = $va_label["name"]; if (isset($va_label["description"])) { $va_elements[$vs_code]["description"] = $va_label["description"]; } } $va_return["elements"] = $va_elements; // possible relationships with "valid tables" (i.e. those that are accessible via services) $t_rel_types = new ca_relationship_types(); foreach ($this->opa_valid_tables as $vs_table) { $vs_rel_table = $t_rel_types->getRelationshipTypeTable($this->getTableName(), $vs_table); $va_info = $t_rel_types->getRelationshipInfo($vs_rel_table); foreach ($va_info as $va_tmp) { $va_return["relationship_types"][$vs_table][$va_tmp["type_code"]] = $va_tmp; } } return $va_return; }