public function Index() { $t_occurrence = new ca_occurrences(); if ($this->request->config->get("dont_enforce_access_settings")) { $va_access_values = array(); } else { $va_access_values = caGetUserAccessValues($this->request); } # --- get the most viewed occ records $va_occ_info = array(); $va_most_viewed_occs = $t_occurrence->getMostViewedItems(3, array('checkAccess' => $va_access_values)); foreach ($va_most_viewed_occs as $vn_occurrence_id => $va_occ_info) { $t_occurrence->load($vn_occurrence_id); $va_occ_info['title'] = $t_occurrence->getLabelForDisplay(); $va_preview_stills = $t_occurrence->get('ca_occurrences.ic_stills.ic_stills_media', array('version' => "widepreview", "showMediaInfo" => false, "returnAsArray" => true)); if (sizeof($va_preview_stills) > 0) { $va_occ_info["mediaPreview"] = array_shift($va_preview_stills); } $va_medium_stills = $t_occurrence->get('ca_occurrences.ic_stills.ic_stills_media', array('version' => "medium", "showMediaInfo" => false, "returnAsArray" => true)); if (sizeof($va_medium_stills) > 0) { $va_occ_info["mediaMedium"] = array_shift($va_medium_stills); } $va_occ_info["repository"] = $t_occurrence->get("CLIR2_institution", array('convertCodesToDisplayText' => true)); $va_most_viewed_occs[$vn_occurrence_id] = $va_occ_info; } $this->view->setVar('most_viewed_occs', $va_most_viewed_occs); $this->render('Engage/engage_index_html.php'); }
public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { $this->ops_theme = __CA_THEME__; // get current theme if (!is_dir(__CA_APP_DIR__ . '/plugins/eastend/themes/' . $this->ops_theme . '/views')) { // if theme is not defined for this plugin, try to use "default" theme $this->ops_theme = 'default'; } parent::__construct($po_request, $po_response, array(__CA_APP_DIR__ . '/plugins/eastend/themes/' . $this->ops_theme . '/views')); MetaTagManager::addLink('stylesheet', $po_request->getBaseUrlPath() . "/app/plugins/eastend/themes/" . $this->ops_theme . "/css/eastend.css", 'text/css'); $this->opo_plugin_config = Configuration::load($this->request->getAppConfig()->get('application_plugins') . '/eastend/conf/eastend.conf'); if (!(bool) $this->opo_plugin_config->get('enabled')) { die(_t('eastend plugin is not enabled')); } // redirect user if not logged in if ($this->request->config->get('pawtucket_requires_login') && !$this->request->isLoggedIn()) { $this->response->setRedirect(caNavUrl($this->request, "", "LoginReg", "form")); } if ($this->request->config->get("dont_enforce_access_settings")) { $this->opa_access_values = array(); } else { $this->opa_access_values = caGetUserAccessValues($this->request); } $this->view->setVar('access_values', $va_access_values); $this->opo_result_context = new ResultContext($po_request, 'ca_objects', ResultContext::getLastFind($po_request, 'ca_objects')); JavascriptLoadManager::register('cycle'); }
function recentlyAdded() { // redirect user if not logged in if ($this->request->config->get('pawtucket_requires_login') && !$this->request->isLoggedIn() || $this->request->config->get('show_bristol_only') && !$this->request->isLoggedIn()) { $this->response->setRedirect(caNavUrl($this->request, "", "LoginReg", "form")); } elseif ($this->request->config->get('show_bristol_only') && $this->request->isLoggedIn()) { $this->response->setRedirect(caNavUrl($this->request, "bristol", "Show", "Index")); } $t_object = new ca_objects(); if (($vn_num_items = (int) $this->request->config->get('rss_number_of_items')) <= 0) { $vn_num_items = 10; } $va_recently_added_objects = $t_object->getRecentlyAddedItems($vn_num_items, array('checkAccess' => caGetUserAccessValues($this->request))); $va_entries = array(); $va_object_ids = array(); foreach ($va_recently_added_objects as $va_object) { $va_object_ids[] = $va_object['object_id']; } $qr_res = $t_object->makeSearchResult('ca_objects', $va_object_ids); $vs_description_bundle = $this->request->config->get('rss_description'); while ($qr_res->nextHit()) { $vn_object_id = $qr_res->get('ca_objects.object_id'); if (!($vn_creation_time = $t_object->getCreationTimestamp($vn_object_id, array('timestampOnly' => true)))) { $vn_creation_time = time(); } if (!($vn_update_time = $t_object->getLastChangeTimestamp($vn_object_id, array('timestampOnly' => true)))) { $vn_update_time = time(); } $va_entries[] = array('title' => $qr_res->get('ca_objects.preferred_labels.name'), 'link' => $vs_link = $this->request->config->get('site_host') . caNavUrl($this->request, '', 'Detail/Object', 'Index', array('object_id' => $vn_object_id)), 'guid' => $vs_link, 'lastUpdate' => $vn_update_time, 'description' => $vs_description_bundle ? $qr_res->getMediaTag("ca_object_representations.media", "preview") . "\n" . $qr_res->get($vs_description_bundle) : '', 'pubDate' => $vn_creation_time); } $va_feed_data = array('title' => _t('Recently added'), 'link' => $this->request->getRequestUrl(true), 'charset' => 'UTF-8', 'entries' => $va_entries); $o_feed = Zend_Feed::importArray($va_feed_data, 'rss'); $this->view->setVar('feed', $o_feed); $this->render('Feed/feed_recently_added_xml.php'); }
function recentlyAdded() { // redirect user if not logged in if ($this->request->config->get('pawtucket_requires_login') && !$this->request->isLoggedIn() || $this->request->config->get('show_bristol_only') && !$this->request->isLoggedIn()) { $this->response->setRedirect(caNavUrl($this->request, "", "LoginReg", "form")); } elseif ($this->request->config->get('show_bristol_only') && $this->request->isLoggedIn()) { $this->response->setRedirect(caNavUrl($this->request, "bristol", "Show", "Index")); } $t_object = new ca_objects(); $va_recently_added_objects = $t_object->getRecentlyAddedItems(25, array('checkAccess' => caGetUserAccessValues($this->request))); $va_entries = array(); $va_object_ids = array(); foreach ($va_recently_added_objects as $va_object) { $va_object_ids[] = $va_object['object_id']; } $va_labels = $t_object->getPreferredDisplayLabelsForIDs($va_object_ids); // TODO: Need to get object descriptions and last update times properly foreach ($va_labels as $vn_object_id => $vs_label) { $va_entries[] = array('title' => $vs_label, 'link' => $vs_link = $this->request->config->get('site_host') . caNavUrl($this->request, '', 'Detail/Object', 'Index', array('object_id' => $vn_object_id)), 'guid' => $vs_link, 'lastUpdate' => time(), 'description' => '', 'pubDate' => time()); } $va_feed_data = array('title' => _t('Recently added'), 'link' => $this->request->getRequestUrl(true), 'charset' => 'UTF-8', 'entries' => $va_entries); $o_feed = Zend_Feed::importArray($va_feed_data, 'rss'); $this->view->setVar('feed', $o_feed); $this->render('Feed/feed_recently_added_xml.php'); }
public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { $this->ops_theme = __CA_THEME__; // get current theme if (!is_dir(__CA_APP_DIR__ . '/plugins/NovaMuse/themes/' . $this->ops_theme . '/views')) { // if theme is not defined for this plugin, try to use "default" theme $this->ops_theme = 'default'; } parent::__construct($po_request, $po_response, array(__CA_APP_DIR__ . '/plugins/NovaMuse/themes/' . $this->ops_theme . '/views')); $this->opo_plugin_config = Configuration::load($this->request->getAppConfig()->get('application_plugins') . '/NovaMuse/conf/NovaMuse.conf'); if (!(bool) $this->opo_plugin_config->get('enabled')) { die(_t('NovaMuse plugin is not enabled')); } MetaTagManager::addLink('stylesheet', $po_request->getBaseUrlPath() . "/app/plugins/NovaMuse/themes/" . $this->ops_theme . "/css/dashboard.css", 'text/css'); $this->opo_result_context = new ResultContext($po_request, 'ca_objects', 'dashboard'); $t_list = new ca_lists(); $this->opn_member_institution_id = $t_list->getItemIDFromList('entity_types', 'member_institution'); $this->opn_individual_id = $t_list->getItemIDFromList('entity_types', 'ind'); $this->opn_family_id = $t_list->getItemIDFromList('entity_types', 'fam'); $this->opn_organization_id = $t_list->getItemIDFromList('entity_types', 'org'); $t_object = new ca_objects(); $this->opn_objectTableNum = $t_object->tableNum(); $va_access_values = caGetUserAccessValues($this->request); $this->opa_access_values = $va_access_values; $this->view->setVar('access_values', $va_access_values); }
/** * Ajax action that returns info on a mapped location based upon the 'id' request parameter. * 'id' is a list of object_ids to display information before. Each integer id is separated by a semicolon (";") * The "ca_objects_results_map_balloon_html" view in Results/ is used to render the content. */ public function getMapItemInfo() { $pa_object_ids = explode(';', $this->request->getParameter('id', pString)); $va_access_values = caGetUserAccessValues($this->request); $this->view->setVar('ids', $pa_object_ids); $this->view->setVar('access_values', $va_access_values); $this->render("Results/ca_objects_results_map_balloon_html.php"); }
public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { parent::__construct($po_request, $po_response, $pa_view_paths); if ($this->request->config->get('pawtucket_requires_login') && !$this->request->isLoggedIn()) { $this->response->setRedirect(caNavUrl($this->request, "", "LoginReg", "LoginForm")); } $this->opa_access_values = caGetUserAccessValues($po_request); caSetPageCSSClasses(array("listing")); }
public function displaySet() { $pn_set_id = $this->request->getParameter('set_id', pInteger); $t_set = new ca_sets($pn_set_id); $t_list = new ca_lists(); $va_access_values = caGetUserAccessValues($this->request); $this->view->setVar('t_set', $t_set); $this->view->setVar('set_presentation_types', caExtractValuesByUserLocale($t_list->getItemsForList('set_presentation_types'))); $this->view->setVar('access_values', $va_access_values); $this->render('features_contents_html.php'); }
/** * */ public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { parent::__construct($po_request, $po_response, $pa_view_paths); if (!$this->request->isAjax() && $this->request->config->get('pawtucket_requires_login') && !$this->request->isLoggedIn()) { $this->response->setRedirect(caNavUrl($this->request, "", "LoginReg", "LoginForm")); } $this->opa_access_values = caGetUserAccessValues($po_request); $this->view->setVar("access_values", $this->opa_access_values); $this->view->setVar("find_type", $this->ops_find_type); caSetPageCSSClasses(array("browse", "results")); }
public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { parent::__construct($po_request, $po_response, $pa_view_paths); if ($this->request->config->get('pawtucket_requires_login') && !$this->request->isLoggedIn()) { $this->response->setRedirect(caNavUrl($this->request, "", "LoginReg", "LoginForm")); } $this->opa_access_values = caGetUserAccessValues($this->request); $this->view->setVar("access_values", $this->opa_access_values); $t_user_groups = new ca_user_groups(); $this->opa_user_groups = $t_user_groups->getGroupList("name", "desc", $this->request->getUserID()); $this->view->setVar("user_groups", $this->opa_user_groups); $this->opo_config = caGetSetsConfig(); caSetPageCSSClasses(array("sets")); }
/** * */ public function __call($ps_function, $pa_args) { AssetLoadManager::register("carousel"); $va_access_values = caGetUserAccessValues($this->request); $this->view->setVar('access_values', $va_access_values); # # --- if there is a set configured to show on the front page, load it now # $va_featured_ids = array(); if ($vs_set_code = $this->config->get("front_page_set_code")) { $t_set = new ca_sets(); $t_set->load(array('set_code' => $vs_set_code)); # Enforce access control on set if (sizeof($va_access_values) == 0 || sizeof($va_access_values) && in_array($t_set->get("access"), $va_access_values)) { $this->view->setVar('featured_set_id', $t_set->get("set_id")); $this->view->setVar('featured_set', $t_set); $va_featured_ids = array_keys(is_array($va_tmp = $t_set->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 1))) ? $va_tmp : array()); $this->view->setVar('featured_set_item_ids', $va_featured_ids); $this->view->setVar('featured_set_items_as_search_result', caMakeSearchResult('ca_objects', $va_featured_ids)); } } # # --- no configured set/items in set so grab random objects with media # if (sizeof($va_featured_ids) == 0) { $t_object = new ca_objects(); $va_featured_ids = array_keys($t_object->getRandomItems(10, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1))); $this->view->setVar('featured_set_item_ids', $va_featured_ids); $this->view->setVar('featured_set_items_as_search_result', caMakeSearchResult('ca_objects', $va_featured_ids)); } $this->view->setVar('config', $this->config); $o_result_context = new ResultContext($this->request, 'ca_objects', 'front'); $this->view->setVar('result_context', $o_result_context); $o_result_context->setAsLastFind(); // // Try to load selected page if it exists in Front/, otherwise load default Front/front_page_html.php // $ps_function = preg_replace("![^A-Za-z0-9_\\-]+!", "", $ps_function); $vs_path = "Front/{$ps_function}_html.php"; if (file_exists(__CA_THEME_DIR__ . "/views/{$vs_path}")) { $this->render($vs_path); } else { $this->render("Front/front_page_html.php"); } }
public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { parent::__construct($po_request, $po_response, $pa_view_paths); $this->config = Configuration::load(__CA_THEME_DIR__ . '/conf/search.conf'); $this->opa_search_blocks = $this->config->getAssoc('multisearchTypes'); // Create result context for each block $va_tables = array(); foreach ($this->opa_search_blocks as $vs_block => $va_block_info) { $va_tables[$va_block_info['table']] = 1; $this->opa_result_contexts[$vs_block] = new ResultContext($po_request, $va_block_info['table'], $this->ops_find_type, $vs_block); $this->opa_result_contexts[$vs_block]->setAsLastFind(); } // Create generic contexts for each table in multisearch (no specific block); used to house search history and overall counts // when there is more than one block for a given table foreach (array_keys($va_tables) as $vs_table) { $this->opa_result_contexts["_multisearch_{$vs_table}"] = new ResultContext($po_request, $vs_table, $this->ops_find_type); } $this->opa_access_values = caGetUserAccessValues($po_request); }
public function getFacet() { $va_access_values = caGetUserAccessValues($this->request); $ps_facet_name = $this->request->getParameter('facet', pString); if ($this->request->getParameter('clear', pInteger)) { $this->opo_browse->removeAllCriteria(); $this->opo_browse->execute(array('checkAccess' => $va_access_values)); $this->opo_result_context->setSearchExpression($this->opo_browse->getBrowseID()); $this->opo_result_context->saveContext(); } else { if ($this->request->getParameter('modify', pString)) { $vm_id = $this->request->getParameter('id', pString); $this->opo_browse->removeCriteria($ps_facet_name, array($vm_id)); $this->opo_browse->execute(array('checkAccess' => $va_access_values)); $this->view->setVar('modify', $vm_id); } } $va_facet = $this->opo_browse->getFacet($ps_facet_name, array('sort' => 'name', 'checkAccess' => $va_access_values)); $this->view->setVar('facet', $va_facet); // leave as is for old pawtucket views $this->view->setVar('facet_info', $va_facet_info = $this->opo_browse->getInfoForFacet($ps_facet_name)); $this->view->setVar('facet_name', $ps_facet_name); $this->view->setVar('grouping', $vs_grouping = $this->request->getParameter('grouping', pString)); // this should be 'facet' but we don't want to render all old 'ajax_refine_facet_html' views (pawtucket themes) unusable $this->view->setVar('grouped_facet', $this->opo_browse->getFacetWithGroups($ps_facet_name, $va_facet_info["group_mode"], $vs_grouping, array('sort' => 'name', 'checkAccess' => $va_access_values))); // generate type menu and type value list for related authority table facet if ($va_facet_info['type'] === 'authority') { $t_model = $this->opo_datamodel->getTableInstance($va_facet_info['table']); if (method_exists($t_model, "getTypeList")) { $this->view->setVar('type_list', $t_model->getTypeList()); } $t_rel_types = new ca_relationship_types(); $this->view->setVar('relationship_type_list', $t_rel_types->getRelationshipInfo($va_facet_info['relationship_table'])); $this->view->setVar('t_item', $t_model); $this->view->setVar('t_subject', $this->opo_datamodel->getInstanceByTableName($this->ops_tablename, true)); } $this->render('Search/ajax_refine_facet_html.php'); }
public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { parent::__construct($po_request, $po_response, $pa_view_paths); if ($this->request->config->get('pawtucket_requires_login') && !$this->request->isLoggedIn()) { $this->response->setRedirect(caNavUrl($this->request, "", "LoginReg", "LoginForm")); } $this->config = caGetGalleryConfig(); $this->opo_datamodel = Datamodel::load(); $va_access_values = caGetUserAccessValues($this->request); $this->opa_access_values = $va_access_values; # --- what is the section called - title of page if (!($vs_section_name = $this->config->get('gallery_section_name'))) { $vs_section_name = _t("Featured Galleries"); } $this->view->setVar("section_name", $vs_section_name); if (!($vs_section_item_name = $this->config->get('gallery_section_item_name'))) { $vs_section_item_name = _t("gallery"); } $this->view->setVar("section_item_name", $vs_section_item_name); caSetPageCSSClasses(array("gallery")); AssetLoadManager::register("panel"); AssetLoadManager::register("mediaViewer"); AssetLoadManager::register("carousel"); }
public function setItemInfo() { $va_access_values = caGetUserAccessValues($this->request); $pn_set_id = $this->request->getParameter('set_id', pInteger); $t_set = new ca_sets($pn_set_id); $this->view->setVar('set_id', $pn_set_id); $pn_set_item_id = $this->request->getParameter('set_item_id', pInteger); $t_set_item = new ca_set_items($pn_set_item_id); $va_set_item_info = array(); $va_items = $t_set->getItemIDs(array("checkAccess" => $va_access_values)); $pn_previous_id = ""; foreach ($va_items as $vn_item_id => $va_item_info) { if ($va_set_item_info["item_id"]) { $va_set_item_info["next_id"] = $vn_item_id; break; } if ($pn_set_item_id == $vn_item_id) { $va_set_item_info["previous_id"] = $pn_previous_id; $va_set_item_info["item_id"] = $vn_item_id; } $pn_previous_id = $vn_item_id; } $va_set_item_info["item_id"] = $t_set_item->get("item_id"); $va_set_item_info["info"] = $va_rep[0]['info']; $va_set_item_info["label"] = $t_set_item->getLabelForDisplay(); $va_set_item_info["description"] = $t_set_item->get($this->opo_plugin_config->get('set_description_element_code'), array('convertLineBreaks' => true)); $va_set_item_info["row_id"] = $t_set_item->get("row_id"); $t_occurrence = new ca_occurrences($t_set_item->get("row_id")); $va_set_item_info["label"] = $t_occurrence->getLabelForDisplay(); $va_mediumlarge_stills = $t_occurrence->get('ca_occurrences.ic_stills.ic_stills_media', array('version' => "mediumlarge", "showMediaInfo" => false, "returnAsArray" => true)); if (sizeof($va_mediumlarge_stills) > 0) { $va_set_item_info["media_still"] = array_shift($va_mediumlarge_stills); $va_image_caption = $t_occurrence->get('ca_occurrences.ic_stills.ic_stills_credit', array("returnAsArray" => true)); $vs_image_caption = array_shift($va_image_caption); if ($vs_image_caption) { $va_set_item_info["media_still_caption"] = $vs_image_caption; } } if ($vs_video = $t_occurrence->get('ca_occurrences.ic_moving_images.ic_moving_images_media', array('version' => 'original', 'showMediaInfo' => false, 'viewer_width' => 580, 'viewer_height' => 450, 'poster_frame_version' => 'mediumlarge'))) { $va_set_item_info["media_video"] = $vs_video; if ($vs_video_caption = $t_occurrence->get('ca_occurrences.ic_moving_images.ic_moving_images_credit')) { $va_set_item_info["media_video_caption"] = $vs_video_caption; } } $this->view->setVar('item_info', $va_set_item_info); $this->render('Exhibits/ajax_item_info_html.php'); }
/** * Given a item_id (request parameter 'id') returns a list of direct children for use in the hierarchy browser * Returned data is JSON format */ public function getFacetHierarchyLevel() { $va_access_values = caGetUserAccessValues($this->request); $ps_facet_name = $this->request->getParameter('facet', pString); $this->opo_browse->setTypeRestrictions(array($this->opn_type_restriction_id)); if (!is_array($va_facet_info = $this->opo_browse->getInfoForFacet($ps_facet_name))) { return null; } $va_facet = $this->opo_browse->getFacet($ps_facet_name, array('sort' => 'name', 'checkAccess' => $va_access_values)); $pa_ids = explode(";", $ps_ids = $this->request->getParameter('id', pString)); if (!sizeof($pa_ids)) { $pa_ids = array(null); } $va_level_data = array(); if (($vn_max_items_per_page = $this->request->getParameter('max', pInteger)) < 1 || $vn_max_items_per_page > 1000) { $vn_max_items_per_page = null; } $t_model = $this->opo_datamodel->getInstanceByTableName($this->ops_tablename, true); $o_config = Configuration::load(); if (!is_array($va_sorts = $o_config->getList($this->ops_tablename . '_hierarchy_browser_sort_values')) || !sizeof($va_sorts)) { $va_sorts = array(); } foreach ($va_sorts as $vn_i => $vs_sort_fld) { $va_tmp = explode(".", $vs_sort_fld); if ($va_tmp[1] == 'preferred_labels') { $va_tmp[0] = $vs_label_table_name; if (!($va_tmp[1] = $va_tmp[2])) { $va_tmp[1] = $vs_label_display_field_name; } unset($va_tmp[2]); $va_sorts[$vn_i] = join(".", $va_tmp); } } if (!in_array($vs_sort_dir = strtolower($o_config->get($this->ops_tablename . '_hierarchy_browser_sort_direction')), array('asc', 'desc'))) { $vs_sort_dir = 'asc'; } $va_expanded_facet = array(); $t_item = new ca_list_items(); foreach ($va_facet as $vn_id => $va_facet_item) { $va_expanded_facet[$vn_id] = true; $va_ancestors = $t_item->getHierarchyAncestors($vn_id, array('idsOnly' => true)); if (is_array($va_ancestors)) { foreach ($va_ancestors as $vn_ancestor_id) { $va_expanded_facet[$vn_ancestor_id] = true; } } } foreach ($pa_ids as $pn_id) { $va_json_data = array('_primaryKey' => 'item_id'); $va_tmp = explode(":", $pn_id); $vn_id = $va_tmp[0]; $vn_start = (int) $va_tmp[1]; if ($vn_start < 0) { $vn_start = 0; } switch ($va_facet_info['type']) { case 'attribute': // is it a list attribute? $t_element = new ca_metadata_elements(); if ($t_element->load(array('element_code' => $va_facet_info['element_code']))) { if ($t_element->get('datatype') == 3) { // 3=list $t_list = new ca_lists(); if (!$vn_id) { $vn_id = $t_list->getRootListItemID($t_element->get('list_id')); } $t_item = new ca_list_items($vn_id); $va_children = $t_item->getHierarchyChildren(null, array('idsOnly' => true)); $va_child_counts = $t_item->getHierarchyChildCountsForIDs($va_children); $qr_res = caMakeSearchResult('ca_list_items', $va_children); $vs_pk = $t_model->primaryKey(); if ($qr_res) { while ($qr_res->nextHit()) { $vn_parent_id = $qr_res->get('ca_list_items.parent_id'); $vn_item_id = $qr_res->get('ca_list_items.item_id'); if (!isset($va_expanded_facet[$vn_item_id])) { continue; } $va_item = array(); $va_item['item_id'] = $vn_item_id; $va_item['name'] = $qr_res->get('ca_list_items.preferred_labels'); $va_item['children'] = isset($va_child_counts[$vn_item_id]) && $va_child_counts[$vn_item_id] ? $va_child_counts[$vn_item_id] : 0; $va_json_data[$vn_item_id] = $va_item; } } } } break; case 'label': // label facet $va_facet_info['table'] = $this->ops_tablename; // fall through to default case // fall through to default case default: if (!$vn_id) { $va_hier_ids = $this->opo_browse->getHierarchyIDsForFacet($ps_facet_name, array('checkAccess' => $va_access_values)); $t_item = $this->opo_datamodel->getInstanceByTableName($va_facet_info['table']); $t_item->load($vn_id); $vn_id = $vn_root = $t_item->getHierarchyRootID(); $va_hierarchy_list = $t_item->getHierarchyList(true); $vn_last_id = null; $vn_c = 0; foreach ($va_hierarchy_list as $vn_i => $va_item) { if (!in_array($vn_i, $va_hier_ids)) { continue; } // only show hierarchies that have items in browse result if ($vn_start <= $vn_c) { $va_item['item_id'] = $va_item[$t_item->primaryKey()]; if (!isset($va_facet[$va_item['item_id']]) && $vn_root == $va_item['item_id']) { continue; } unset($va_item['parent_id']); unset($va_item['label']); $va_json_data[$va_item['item_id']] = $va_item; $vn_last_id = $va_item['item_id']; } $vn_c++; if (!is_null($vn_max_items_per_page) && $vn_c >= $vn_max_items_per_page + $vn_start) { break; } } if (sizeof($va_json_data) == 2) { // if only one hierarchy root (root + _primaryKey in array) then don't bother showing it $vn_id = $vn_last_id; unset($va_json_data[$vn_last_id]); } } if ($vn_id) { $vn_c = 0; foreach ($va_facet as $vn_i => $va_item) { if ($va_item['parent_id'] == $vn_id) { if ($vn_start <= $vn_c) { $va_item['item_id'] = $va_item['id']; $va_item['name'] = $va_item['label']; $va_item['children'] = $va_item['child_count']; unset($va_item['label']); unset($va_item['child_count']); unset($va_item['id']); $va_json_data[$va_item['item_id']] = $va_item; } $vn_c++; if (!is_null($vn_max_items_per_page) && $vn_c >= $vn_max_items_per_page + $vn_start) { break; } } } } break; } $vs_rank_fld = $t_item->getProperty('RANK'); $va_sorted_items = array(); foreach ($va_json_data as $vn_id => $va_node) { if (!is_array($va_node)) { continue; } $vs_key = preg_replace('![^A-Za-z0-9]!', '_', $va_node['name']); if (isset($va_node['sort']) && $va_node['sort']) { $va_sorted_items[$va_node['sort']][$vs_key] = $va_node; } else { if ($vs_rank_fld && ($vs_rank = (int) sprintf("%08d", $va_node[$vs_rank_fld]))) { $va_sorted_items[$vs_rank][$vs_key] = $va_node; } else { $va_sorted_items[$vs_key][$vs_key] = $va_node; } } } ksort($va_sorted_items); if ($vs_sort_dir == 'desc') { $va_sorted_items = array_reverse($va_sorted_items); } $va_json_data = array(); $va_sorted_items = array_slice($va_sorted_items, $vn_start, $vn_max_items_per_page); foreach ($va_sorted_items as $vs_k => $va_v) { ksort($va_v); if ($vs_sort_dir == 'desc') { $va_v = array_reverse($va_v); } $va_json_data = array_merge($va_json_data, $va_v); } $va_json_data['_itemCount'] = sizeof($va_json_data); $va_json_data['_sortOrder'] = array_keys($va_json_data); $va_json_data['_primaryKey'] = $t_model->primaryKey(); // pass the name of the primary key so the hierbrowser knows where to look for item_id's $va_level_data[$pn_id] = $va_json_data; } if (!trim($this->request->getParameter('init', pString))) { $this->opo_result_context->setParameter($ps_facet_name . '_browse_last_id', $pn_id); $this->opo_result_context->saveContext(); } $this->view->setVar('facet_list', $va_level_data); return $this->render('Browse/facet_hierarchy_level_json.php'); }
public function setItemInfo() { $va_access_values = caGetUserAccessValues($this->request); $pn_set_id = $this->request->getParameter('set_id', pInteger); $t_set = new ca_sets($pn_set_id); $this->view->setVar('set_id', $pn_set_id); $pn_set_item_id = $this->request->getParameter('set_item_id', pInteger); $t_set_item = new ca_set_items($pn_set_item_id); $va_set_item_info = array(); $va_items = $t_set->getItemIDs(array("checkAccess" => $va_access_values)); $pn_previous_id = ""; foreach ($va_items as $vn_item_id => $va_item_info) { if ($va_set_item_info["item_id"]) { $va_set_item_info["next_id"] = $vn_item_id; break; } if ($pn_set_item_id == $vn_item_id) { $va_set_item_info["previous_id"] = $pn_previous_id; $va_set_item_info["item_id"] = $vn_item_id; } $pn_previous_id = $vn_item_id; } $va_set_item_info["item_id"] = $t_set_item->get("item_id"); $va_reps = $t_set_item->getRepresentations(array("mediumlarge", "small"), null, array("return_with_access" => $va_access_values)); $va_rep = array_shift($va_rep); $this->view->setVar('t_object_representation', $t_rep = new ca_object_representations($va_rep['representation_id'])); $va_rep_display_info = caGetMediaDisplayInfo('cropped_gallery_media_overlay', $t_rep->getMediaInfo('media', 'INPUT', 'MIMETYPE')); $this->view->setVar('rep_display_version', $va_rep_display_info['display_version']); unset($va_display_info['display_version']); $va_rep_display_info['poster_frame_url'] = $t_rep->getMediaUrl('media', $va_rep_display_info['poster_frame_version']); unset($va_display_info['poster_frame_version']); $this->view->setVar('rep_display_options', $va_rep_display_info); $va_set_item_info["info"] = $va_rep['info']; $va_set_item_info["label"] = $t_set_item->getLabelForDisplay(); $va_set_item_info["description"] = $t_set_item->get($this->opo_plugin_config->get('set_description_element_code'), array('convertLineBreaks' => true)); $va_set_item_info["item_description"] = $t_set_item->get($this->opo_plugin_config->get('set_item_description_element_code'), array('convertLineBreaks' => true)); $va_set_item_info["row_id"] = $t_set_item->get("row_id"); $va_set_item_info["lesson"] = $t_set_item->get('set_item_description'); $t_object = new ca_objects($t_set_item->get("row_id")); $va_set_item_info["object_label"] = $t_object->getLabelForDisplay(); $this->view->setVar('item_info', $va_set_item_info); $this->render($this->ops_theme . '/ajax_item_info_html.php'); }
/** * Search handler (returns search form and results, if any) * Most logic is contained in the BaseSearchController->Index() method; all you usually * need to do here is instantiate a new subject-appropriate subclass of BaseSearch * (eg. ObjectSearch for objects, EntitySearch for entities) and pass it to BaseSearchController->Index() */ public function Index($pa_options = null) { $pa_options['search'] = $this->opo_browse; AssetLoadManager::register('imageScroller'); AssetLoadManager::register('tabUI'); AssetLoadManager::register('panel'); // get request data $va_relation_ids = explode(';', $this->getRequest()->getParameter('ids', pString)); $vs_rel_table = $this->getRequest()->getParameter('relTable', pString); $vs_interstitial_prefix = $this->getRequest()->getParameter('interstitialPrefix', pString); $vs_primary_table = $this->getRequest()->getParameter('primaryTable', pString); $vn_primary_id = $this->getRequest()->getParameter('primaryID', pInteger); $va_access_values = caGetUserAccessValues($this->getRequest()); if (!($vs_sort = $this->opo_result_context->getCurrentSort())) { $va_tmp = array_keys($this->opa_sorts); $vs_sort = array_shift($va_tmp); } // we need the rel table to translate the incoming relation_ids to object ids for the list search result $o_interstitial_res = caMakeSearchResult($vs_rel_table, $va_relation_ids); $va_ids = array(); $va_relation_id_map = array(); while ($o_interstitial_res->nextHit()) { $va_ids[$o_interstitial_res->get('relation_id')] = $o_interstitial_res->get('ca_objects.object_id'); $va_relation_id_map[$o_interstitial_res->get('ca_objects.object_id')] = array('relation_id' => $o_interstitial_res->get('relation_id'), 'relationship_typename' => $o_interstitial_res->getWithTemplate('^relationship_typename')); } $this->getView()->setVar('relationIdMap', $va_relation_id_map); $this->getView()->setVar('interstitialPrefix', $vs_interstitial_prefix); $this->getView()->setVar('relTable', $vs_rel_table); $this->getView()->setVar('primaryTable', $vs_primary_table); $this->getView()->setVar('primaryID', $vn_primary_id); $vs_sort_direction = $this->opo_result_context->getCurrentSortDirection(); $va_search_opts = array('sort' => $vs_sort, 'sortDirection' => $vs_sort_direction, 'checkAccess' => $va_access_values, 'no_cache' => true, 'resolveLinksUsing' => $vs_primary_table, 'primaryIDs' => array($vs_primary_table => array($vn_primary_id))); $o_res = caMakeSearchResult('ca_objects', array_values($va_ids), $va_search_opts); $pa_options['result'] = $o_res; $pa_options['view'] = 'Search/ca_objects_table_html.php'; // override render $this->getView()->setVar('noRefine', true); return parent::Index($pa_options); }
$vs_display_type = $this->getVar('display_type'); $va_display_options = $this->getVar('display_options'); $vs_show_version = $this->getVar('version'); // Get filename of originally uploaded file $va_media_info = $t_rep->getMediaInfo('media'); $vs_original_filename = $va_media_info['ORIGINAL_FILENAME']; $vs_container_id = $this->getVar('containerID'); $va_pages = $va_sections = array(); $vb_use_book_reader = false; $vn_open_to_page = 1; $vb_should_use_book_viewer = isset($va_display_options['use_book_viewer']) && (bool) $va_display_options['use_book_viewer']; $vs_book_viewer_content_mode = null; $vn_object_id = $vn_rep_id = null; if ($vb_should_use_book_viewer && isset($va_display_options['use_book_viewer_when_number_of_representations_exceeds']) && (int) $va_display_options['use_book_viewer_when_number_of_representations_exceeds'] < sizeof($va_reps)) { // Create book viewer from multiple representations $va_reps = $t_object->getRepresentations(array('thumbnail', 'large', 'page'), null, array('return_with_access' => caGetUserAccessValues($this->request))); $vn_object_id = $t_object->getPrimaryKey(); $vn_c = 1; foreach ($va_reps as $vn_id => $va_file) { $va_pages[] = array('object_id' => $vn_object_id, 'representation_id' => $vn_id, 'thumbnail_url' => $va_file['urls']['thumbnail'], 'thumbnail_path' => $va_file['paths']['thumbnail'], 'thumbnail_width' => $va_file['info']['thumbnail']['WIDTH'], 'thumbnail_height' => $va_file['info']['thumbnail']['HEIGHT'], 'thumbnail_mimetype' => $va_file['info']['thumbnail']['MIMETYPE'], 'normal_url' => $va_file['urls']['large'], 'normal_path' => $va_file['paths']['large'], 'normal_width' => $va_file['info']['large']['WIDTH'], 'normal_height' => $va_file['info']['large']['HEIGHT'], 'normal_mimetype' => $va_file['info']['large']['MIMETYPE'], 'large_url' => $va_file['urls']['page'], 'large_path' => $va_file['paths']['page'], 'large_width' => $va_file['info']['page']['WIDTH'], 'large_height' => $va_file['info']['page']['HEIGHT'], 'large_mimetype' => $va_file['info']['page']['MIMETYPE']); $vs_title = isset($va_file['label']) && trim($va_file['label']) ? $va_file['label'] : _t('Page %1', $vn_c); $va_sections[] = array('title' => $vs_title, 'page' => $vn_c, 'object_id' => $vn_object_id, 'representation_id' => $vn_id, 'editUrl' => null, 'downloadUrl' => caObjectsDisplayDownloadLink($this->request) ? caNavUrl($this->request, 'Detail', 'Object', 'DownloadRepresentation', array('object_id' => $vn_object_id, 'representation_id' => $vn_representation_id, 'version' => 'original')) : ""); $vn_c++; } $vn_object_id = $t_object->getPrimaryKey(); $vs_book_viewer_content_mode = 'multiple_representations'; $vb_use_book_reader = true; } else { if ($vb_should_use_book_viewer && sizeof($va_reps) == 1 && (isset($va_display_options['show_hierarchy_in_book_viewer']) && (bool) $va_display_options['show_hierarchy_in_book_viewer'] || isset($va_display_options['show_subhierarchy_in_book_viewer']) && (bool) $va_display_options['show_subhierarchy_in_book_viewer']) && ($va_ancestor_ids = $t_object->getHierarchyAncestors(null, array('idsOnly' => true)))) { $vn_parent_id = array_pop($va_ancestor_ids); $vn_page_id = $t_object->getPrimaryKey();
/** * Returns content for overlay containing details for object representation linked to occurrence */ public function getSetsOverlay() { $this->view->setVar('display_type', 'media_overlay'); $pn_set_id = $this->request->getParameter('set_id', pInteger); $pn_object_id = $this->request->getParameter('object_id', pInteger); $this->view->setVar('object_id', $pn_object_id); $pn_representation_id = $this->request->getParameter('representation_id', pInteger); $this->opo_plugin_config = Configuration::load($this->request->getAppConfig()->get('application_plugins') . '/simpleGallery/conf/simpleGallery.conf'); $this->view->setVar('set_id', $pn_set_id); $t_set = new ca_sets($pn_set_id); $pn_set_item_id = $this->request->getParameter('set_item_id', pInteger); $this->view->setVar('set_item_id', $pn_set_item_id); $ps_set_item_description_code = $this->opo_plugin_config->get('set_item_description_element_code'); $this->view->setVar('set_item_description', $ps_set_item_description_code); $this->view->setVar('object_id', $pn_object_id); $t_object = new ca_objects($pn_object_id); $this->view->setVar('t_object', $t_object); $t_rep = new ca_object_representations($pn_representation_id); $this->view->setVar('representation_id', $pn_representation_id); $this->view->setVar('t_object_representation', $t_rep); if ($this->request->config->get("dont_enforce_access_settings")) { $va_access_values = array(); } else { $va_access_values = caGetUserAccessValues($this->request); } if (!$t_set->getPrimaryKey()) { die("Invalid set_id"); } if (!$t_object->getPrimaryKey()) { die("Invalid object_id"); } if (!$t_rep->getPrimaryKey()) { die("Invalid representation_id"); } if (sizeof($va_access_values) && !in_array($t_set->get('access'), $va_access_values)) { die("Invalid set_id"); } if (sizeof($va_access_values) && !in_array($t_object->get('access'), $va_access_values)) { die("Invalid object_id"); } if (sizeof($va_access_values) && !in_array($t_rep->get('access'), $va_access_values)) { die("Invalid rep_id"); } // Get media for display using configured rules $va_rep_display_info = caGetMediaDisplayInfo("media_overlay", $t_rep->getMediaInfo('media', 'INPUT', 'MIMETYPE')); // set version $this->view->setVar('version', $va_rep_display_info['display_version']); unset($va_display_info['display_version']); // set other options $this->view->setVar('display_options', $va_rep_display_info); if (!($ps_containerID = trim($this->request->getParameter('containerID', pString)))) { $ps_containerID = 'caMediaPanelContentArea'; } $this->view->setVar("containerID", $ps_containerID); // Get all objects asscoiated with this set and show primary reps as icons for navigation $va_set_items = $t_set->getItems(array("checkAccess" => $va_access_values)); #print "<pre>"; #print_r($va_set_items); #print "</pre>"; if (sizeof($va_set_items) > 0) { $t_image_objects = new ca_objects(); $i = 1; foreach ($va_set_items as $vn_rel_id => $va_inter) { foreach ($va_inter as $id => $va_info) { $t_image_objects->load($va_info["row_id"]); if ($t_primary_rep = $t_image_objects->getPrimaryRepresentationInstance()) { $va_temp = array(); if (!sizeof($va_access_values) || in_array($t_primary_rep->get('access'), $va_access_values)) { $va_temp["representation_id"] = $t_primary_rep->get("representation_id"); $va_temp["rep_icon"] = $t_primary_rep->getMediaTag('media', 'icon'); $va_temp["rep_tinyicon"] = $t_primary_rep->getMediaTag('media', 'tinyicon'); $va_temp["object_id"] = $va_info["object_id"]; $va_temp["set_item_id"] = $va_info['item_id']; $va_thumbnails[$va_info["object_id"]] = $va_temp; if ($vn_getNext == 1) { $this->view->setVar("next_object_id", $va_info["object_id"]); $this->view->setVar("next_representation_id", $t_primary_rep->get("representation_id")); $vn_getNext = 0; } if ($va_info["object_id"] == $pn_object_id) { $this->view->setVar("representation_index", $i); $this->view->setVar("previous_object_id", $vn_prev_obj_id); $this->view->setVar("previous_representation_id", $vn_prev_rep_id); $this->view->setVar("set_item_id", $va_info['item_id']); $vn_getNext = 1; } $vn_prev_obj_id = $va_info["object_id"]; $vn_prev_rep_id = $t_primary_rep->get("representation_id"); $i++; } } } } } $this->view->setVar('reps', $va_thumbnails); return $this->render($this->ops_theme . "/ajax_ca_sets_media_overlay_html.php"); }
<div class='col-xs-12 col-sm-12 col-md-12 col-lg-12'> <div class="container"> <?php if (!$this->request->isAjax()) { ?> <hr> <H6>Related Artworks</H6> <div class="archivesBlock"> <div class="blockResults"> <div id="archivesscrollButtonPrevious" class="scrollButtonPrevious"><i class="fa fa-angle-left"></i></div> <div id="archivesscrollButtonNext" class="scrollButtonNext"><i class="fa fa-angle-right"></i></div> <div id="archiveResults"> <div id="blockResultsScroller"> <?php } $va_object_ids = $t_object->get('ca_objects.related.object_id', array('checkAccess' => caGetUserAccessValues($this->request), 'returnAsArray' => true, 'restrictToTypes' => array('artwork'))); if (is_array($va_object_ids) && sizeof($va_object_ids)) { $qr_res = caMakeSearchResult('ca_objects', $va_object_ids); //foreach ($va_object_ids as $obj_key => $vn_object_id) { while ($qr_res->nextHit()) { //$t_object = new ca_objects($vn_object_id); print "<div class='archivesResult'>"; print "<div class='resultImg'>" . caNavLink($this->request, $qr_res->get('ca_object_representations.media.widepreview'), '', '', 'Detail', 'artworks/' . $vn_object_id) . "</div>"; print "<p>" . caNavLink($this->request, $qr_res->get('ca_objects.preferred_labels.name'), '', '', 'Detail', 'artworks/' . $qr_res->get('ca_objects.object_id')) . "</p>"; print "<p class='artist'>" . $qr_res->get('ca_entities.preferred_labels', array('restrictToRelationshipTypes' => 'artist')) . "</p>"; print "<p>" . $qr_res->get('ca_objects.object_dates') . "</p>"; print "</div><!-- archivesResult -->"; } } if (!$this->request->isAjax()) { ?>
<div class="detailNavBgRight"> {{{nextLink}}} </div><!-- end detailNavBgLeft --> </div><!-- end col --> </div> <div class="row"> <div class='col-md-12 col-lg-12'> <H4>Loan</H4> <H6></H6> </div><!-- end col 12--> </div><!-- end row --> <div class="row"> <div class='col-xs-12 col-sm-7 col-md-6 col-lg-6'> <div class="row"> <?php $va_related_artworks = $t_item->get('ca_objects.object_id', array('checkAccess' => caGetUserAccessValues($this->request), 'returnAsArray' => true)); foreach ($va_related_artworks as $vn_id => $va_related_artwork) { $t_object = new ca_objects($va_related_artwork); $va_reps = $t_object->getPrimaryRepresentation(array('versions' => 'medium'), null, array("checkAccess" => $va_access_values, 'scaleCSSHeightTo' => '260px', 'scaleCSSWidthTo' => '220px')); print "<div class='col-xs-12 col-sm-6 col-md-6 col-lg-6 relatedLoan'>"; print "<div class='loanImg'>" . caNavLink($this->request, $va_reps['tags']['medium'], '', '', 'Detail', 'artworks/' . $va_related_artwork) . "</div>"; print "<div class='lotCaption'>"; print "<p>" . caNavLink($this->request, $t_object->get('ca_entities.preferred_labels', array('restrictToRelationshipTypes' => array('artist'))), '', '', 'Detail', 'artworks/' . $va_related_artwork) . "</p>"; print "<p>" . caNavLink($this->request, "<i>" . $t_object->get('ca_objects.preferred_labels') . "</i>, " . $t_object->get('ca_objects.creation_date'), '', '', 'Detail', 'artworks/' . $va_related_artwork) . "</p>"; print "<p>" . $t_object->get('ca_objects.medium') . "</p>"; print "<p>" . $t_object->get('ca_objects.dimensions.display_dimensions') . "</p>"; if ($this->request->user->hasUserRole("founders_new") || $this->request->user->hasUserRole("admin") || $this->request->user->hasUserRole("curatorial_all_new") || $this->request->user->hasUserRole("curatorial_basic_new") || $this->request->user->hasUserRole("archives_new") || $this->request->user->hasUserRole("library_new")) { print "<p>" . $t_object->get('ca_objects.idno') . "</p>"; } print "</div><!-- end lotCaption -->"; print "</div>";
public function lookup() { $vs_search = $this->request->getParameter('q', pString); $t_list = new ca_lists(); $va_data = array(); $va_access_values = caGetUserAccessValues($this->request); # # Do "quicksearches" on so-configured tables # if ($this->request->config->get('quicksearch_return_ca_objects')) { $va_results = caExtractValuesByUserLocale(SearchEngine::quickSearch($vs_search, 'ca_objects', 57, array('limit' => 3, 'checkAccess' => $va_access_values))); // break found objects out by type foreach ($va_results as $vn_id => $va_match_info) { $vs_type = unicode_ucfirst($t_list->getItemFromListForDisplayByItemID('object_types', $va_match_info['type_id'], true)); $va_data['ca_objects'][$vs_type][$vn_id] = $va_match_info; } } if ($this->request->config->get('quicksearch_return_ca_entities')) { $va_data['ca_entities'][_t('Entities')] = caExtractValuesByUserLocale(SearchEngine::quickSearch($vs_search, 'ca_entities', 20, array('limit' => 10, 'checkAccess' => $va_access_values))); } if ($this->request->config->get('quicksearch_return_ca_places')) { $va_data['ca_places'][_t('Places')] = caExtractValuesByUserLocale(SearchEngine::quickSearch($vs_search, 'ca_places', 72, array('limit' => 10, 'checkAccess' => $va_access_values))); } if ($this->request->config->get('quicksearch_return_ca_occurrences')) { $va_results = caExtractValuesByUserLocale(SearchEngine::quickSearch($vs_search, 'ca_occurrences', 67, array('limit' => 10, 'checkAccess' => $va_access_values))); // break found occurrences out by type foreach ($va_results as $vn_id => $va_match_info) { $vs_type = unicode_ucfirst($t_list->getItemFromListForDisplayByItemID('occurrence_types', $va_match_info['type_id'], true)); $va_data['ca_occurrences'][$vs_type][$vn_id] = $va_match_info; } } if ($this->request->config->get('quicksearch_return_ca_collections')) { $va_data['ca_collections'][_t('Collections')] = caExtractValuesByUserLocale(SearchEngine::quickSearch($vs_search, 'ca_collections', 13, array('limit' => 10, 'checkAccess' => $va_access_values))); } $this->view->setVar('matches', $va_data); $this->render('Search/ajax_search_lookup_json.php'); }
/** * */ public function GetRelatedObjectsAsJSON() { $va_access_values = caGetUserAccessValues($this->request); $pn_collection_id = $this->request->getParameter('collection_id', pInteger); $pn_start = $this->request->getParameter('s', pInteger); $pn_num_items = $this->request->getParameter('n', pInteger); if ($pn_num_items < 1) { $pn_num_items = 1; } $vn_items_per_page = $this->request->config->get("objects_per_page_for_detail_pages"); $va_sort = array(); if ($vs_sort = $this->request->config->get('sort_browse_within_detail_for_' . $this->ops_tablename)) { $va_sort = array('sort' => $vs_sort); } $qr_hits = $this->opo_browse->getResults($va_sort); $vn_num_pages = ceil($qr_hits->numHits() / $vn_items_per_page); $qr_hits->seek(($pn_start - 1) * $vn_items_per_page); $va_related_objects = array(); $i = 0; while ($qr_hits->nextHit() && $i < $vn_items_per_page) { $va_related_objects[$qr_hits->get("object_id")] = array("widethumbnail" => $qr_hits->getMediaTag('ca_object_representations.media', 'widethumbnail', array('checkAccess' => $va_access_values)), "small" => $qr_hits->getMediaTag('ca_object_representations.media', 'small', array('checkAccess' => $va_access_values)), "object_id" => $qr_hits->get("object_id"), "label" => join($qr_hits->getDisplayLabels(), ", "), "idno" => $qr_hits->get("idno")); $i++; } $this->view->setVar('related_objects', $va_related_objects); $this->render('ajax_related_objects_json.php'); }
/** * Returns content for overlay containing details for object representation * * Expects the following request parameters: * object_id = the id of the ca_objects record to display * representation_id = the id of the ca_object_representations record to display; the representation must belong to the specified object * * Optional request parameters: * version = The version of the representation to display. If omitted the display version configured in media_display.conf is used * order_item_id = ca_commerce_order_items.item_id value to limit representation display to * */ public function GetRepresentationInfo() { $pn_object_id = $this->request->getParameter('object_id', pInteger); $pn_representation_id = $this->request->getParameter('representation_id', pInteger); if (!($ps_display_type = trim($this->request->getParameter('display_type', pString)))) { $ps_display_type = 'media_overlay'; } if (!($ps_containerID = trim($this->request->getParameter('containerID', pString)))) { $ps_containerID = 'caMediaPanelContentArea'; } if (!$pn_object_id) { $pn_object_id = 0; } $t_rep = new ca_object_representations($pn_representation_id); if (!$t_rep->getPrimaryKey()) { $this->postError(1100, _t('Invalid object/representation'), 'DetailController->GetRepresentationInfo'); return; } $va_opts = array('display' => $ps_display_type, 'object_id' => $pn_object_id, 'containerID' => $ps_containerID, 'access' => caGetUserAccessValues($this->request)); if (strlen($vs_use_book_viewer = $this->request->getParameter('use_book_viewer', pInteger))) { $va_opts['use_book_viewer'] = (bool) $vs_use_book_viewer; } $vs_output = $t_rep->getRepresentationViewerHTMLBundle($this->request, $va_opts); if ($this->request->getParameter('include_tool_bar', pInteger)) { $vs_output = "<div class='repViewerContCont'><div id='cont{$vn_rep_id}' class='repViewerCont'>" . $vs_output . caRepToolbar($this->request, $t_rep, $pn_object_id) . "</div></div>"; } $this->response->addContent($vs_output); }
require_once __CA_MODELS_DIR__ . "/ca_sets.php"; include_once __CA_LIB_DIR__ . "/ca/Search/OccurrenceSearch.php"; include_once __CA_MODELS_DIR__ . "/ca_occurrences.php"; $va_access_values = caGetUserAccessValues($this->request); if ($vs_set_code = $this->request->config->get("featured_art_set")) { AssetLoadManager::register("carousel"); $t_set = new ca_sets(); $t_set->load(array('set_code' => $vs_set_code)); # Enforce access control on set if (sizeof($va_access_values) == 0 || sizeof($va_access_values) && in_array($t_set->get("access"), $va_access_values)) { $va_item_ids = array_keys(is_array($va_tmp = $t_set->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 0))) ? $va_tmp : array()); } if (is_array($va_item_ids) && sizeof($va_item_ids)) { $t_object = new ca_objects(); $va_item_media = $t_object->getPrimaryMediaForIDs($va_item_ids, array("slideshowsmall"), array('checkAccess' => caGetUserAccessValues($this->request))); } } ?> <div class="container"> <div class="row collection"> <div class="col-sm-6"> <div class="advSearch"> <h1>Search Collection</h1> {{{form}}} <div class="advancedSearchField"> Title:<br/> {{{ca_objects.preferred_labels.name%width=220px}}} </div> <div class="advancedSearchField">
/** * Format artwork caption * * @param RequestHTTP $po_request * @param ca_objects object of record */ function sefaFormatCaption($o_request, $o_object = null) { $va_access_values = caGetUserAccessValues($o_request); $va_caption_parts = array(); if (is_object($o_object) && $o_object->get("object_id")) { $vs_name = $vs_title = $vs_year = $vs_medium = $vs_dimensions = ""; if ($vs_name = $o_object->getWithTemplate("^ca_entities.preferred_labels.display_name", array("restrictToRelationshipTypes" => array("creator", "creator_website"), "checkAccess" => $va_access_values))) { $va_caption_parts[] = $vs_name; } if ($o_object->get("ca_objects.preferred_labels.name")) { $vs_title = "<i>" . $o_object->get("ca_objects.preferred_labels.name") . "</i> "; } if ($vs_year = $o_object->get("ca_objects.date_created")) { $vs_title .= "(" . $vs_year . ")"; } if ($vs_title) { $va_caption_parts[] = $vs_title; } # -- medium/materials if ($o_object->get("materials_notes")) { $va_caption_parts[] = $o_object->get("materials_notes"); } else { if ($o_object->get("sculpture_material", array('convertCodesToDisplayText' => true)) && $o_object->get("sculpture_material", array('convertCodesToDisplayText' => true)) != " ") { $va_medium = $o_object->get("sculpture_material", array('convertCodesToDisplayText' => true, 'returnAsArray' => true)); $va_tmp = array(); foreach ($va_medium as $va_media) { $va_tmp[] = $va_media["sculpture_material"]; } if (sizeof($va_medium) == 2) { $vs_medium = implode(" and ", $va_tmp); } else { $vs_medium = implode(", ", $va_tmp); } } elseif ($o_object->get("mixed_media_material", array('convertCodesToDisplayText' => true)) && $o_object->get("mixed_media_material", array('convertCodesToDisplayText' => true)) != " ") { $va_medium = $o_object->get("mixed_media_material", array('convertCodesToDisplayText' => true, 'returnAsArray' => true)); $va_tmp = array(); foreach ($va_medium as $va_media) { $va_tmp[] = $va_media["mixed_media_material"]; } if (sizeof($va_medium) == 2) { $vs_medium = implode(" and ", $va_tmp); } else { $vs_medium = implode(", ", $va_tmp); } } elseif ($o_object->get("photography_material", array('convertCodesToDisplayText' => true)) && $o_object->get("photography_material", array('convertCodesToDisplayText' => true)) != " ") { $va_medium = $o_object->get("photography_material", array('convertCodesToDisplayText' => true, 'returnAsArray' => true)); $va_tmp = array(); foreach ($va_medium as $va_media) { $va_tmp[] = $va_media["photography_material"]; } if (sizeof($va_medium) == 2) { $vs_medium = implode(" and ", $va_tmp); } else { $vs_medium = implode(", ", $va_tmp); } } elseif ($o_object->get("works_paper_medium", array('convertCodesToDisplayText' => true)) && $o_object->get("works_paper_medium", array('convertCodesToDisplayText' => true)) != " ") { $va_medium = $o_object->get("works_paper_medium", array('convertCodesToDisplayText' => true, 'returnAsArray' => true)); $va_tmp = array(); foreach ($va_medium as $va_media) { $va_tmp[] = $va_media["works_paper_medium"]; } if (sizeof($va_medium) == 2) { $vs_medium = implode(" and ", $va_tmp); } else { $vs_medium = implode(", ", $va_tmp); } } elseif ($o_object->get("painting_medium", array('convertCodesToDisplayText' => true)) && $o_object->get("painting_medium", array('convertCodesToDisplayText' => true)) != " ") { $va_medium = $o_object->get("painting_medium", array('convertCodesToDisplayText' => true, 'returnAsArray' => true)); $va_tmp = array(); foreach ($va_medium as $va_media) { $va_tmp[] = $va_media["painting_medium"]; } if (sizeof($va_medium) == 2) { $vs_medium = implode(" and ", $va_tmp); } else { $vs_medium = implode(", ", $va_tmp); } if ($o_object->get("painting_material", array('convertCodesToDisplayText' => true)) && $o_object->get("painting_material", array('convertCodesToDisplayText' => true)) != " ") { $vs_medium .= " on " . $o_object->get("painting_material", array('convertCodesToDisplayText' => true, 'delimiter' => ', ')); } } elseif ($o_object->get("print_medium", array('convertCodesToDisplayText' => true)) && $o_object->get("print_medium", array('convertCodesToDisplayText' => true)) != " ") { $va_medium = $o_object->get("print_medium", array('convertCodesToDisplayText' => true, 'returnAsArray' => true)); $va_tmp = array(); foreach ($va_medium as $va_media) { $va_tmp[] = $va_media["print_medium"]; } if (sizeof($va_medium) == 2) { $vs_medium = implode(" and ", $va_tmp); } else { $vs_medium = implode(", ", $va_tmp); } if ($o_object->get("print_material")) { $vs_medium .= " on " . $o_object->get("print_material", array('convertCodesToDisplayText' => true, 'delimiter' => ', ')); } } if ($vs_medium) { $va_caption_parts[] = $vs_medium; } } # -- dimensions if ($vs_dimensions = $o_object->get("ca_objects.dimensions.display_dimensions")) { $va_caption_parts[] = $vs_dimensions; } return implode(", ", $va_caption_parts); } else { return null; } }
/** * Returns content for overlay containing details for object representation */ private function _renderMediaView($ps_view_name, $ps_media_context) { $pn_object_id = $this->request->getParameter('object_id', pInteger); $pn_representation_id = $this->request->getParameter('representation_id', pInteger); $pn_year = $this->request->getParameter('year', pInteger); $this->view->setVar("year", $pn_year); $va_periods = $this->ops_periods; $this->view->setVar('object_id', $pn_object_id); $t_object = new ca_objects($pn_object_id); # --- get caption and photocredit $this->view->setVar("caption", $t_object->get("description")); $this->view->setVar("photographer", $t_object->get("provenance")); $t_rep = new ca_object_representations($pn_representation_id); $this->view->setVar('representation_id', $pn_representation_id); $this->view->setVar('t_object_representation', $t_rep); if ($this->request->config->get("dont_enforce_access_settings")) { $va_access_values = array(); } else { $va_access_values = caGetUserAccessValues($this->request); } if (!$t_object->getPrimaryKey()) { die("Invalid object_id"); } if (!$t_rep->getPrimaryKey()) { die("Invalid representation_id"); } if (sizeof($va_access_values) && !in_array($t_object->get('access'), $va_access_values)) { die("Invalid object_id"); } if (sizeof($va_access_values) && !in_array($t_rep->get('access'), $va_access_values)) { die("Invalid rep_id"); } $this->view->setVar('t_display_rep', $t_rep); // Get media for display using configured rules $va_rep_display_info = caGetMediaDisplayInfo($ps_media_context, $t_rep->getMediaInfo('media', 'INPUT', 'MIMETYPE')); // set version $this->view->setVar('display_version', $va_rep_display_info['display_version']); // set other options $this->view->setVar('display_options', $va_rep_display_info); // Get all representation as icons for navigation # --- do a search for all chronology image objects # --- determine the period from the year foreach ($va_periods as $i => $va_per_info) { if ($pn_year >= $va_per_info["start"] && $pn_year <= $va_per_info["end"]) { $vn_period = $i; break; } } # --- what is year to search by? $vn_y = ""; if ($va_periods[$vn_period]["displayAllYears"] == 1) { $vn_y = $va_periods[$vn_period]["start"] . "-" . $va_periods[$vn_period]["end"]; } else { $vn_y = $pn_year; } # --- get type is for chron images $t_list = new ca_lists(); $vn_chron_images_type_id = $t_list->getItemIDFromList('object_types', 'chronology_image'); $o_obj_search = new ObjectSearch(); $qr_chron_images = $o_obj_search->search("ca_objects.access:1 AND ca_objects.date.parsed_date:\"" . $vn_y . "\" AND ca_objects.type_id:{$vn_chron_images_type_id}", array("sort" => "ca_objects.date.parsed_date", "no_cache" => !$this->opb_cache_searches)); $va_thumbnails = array(); if ($qr_chron_images->numHits() > 0) { $t_image_objects = new ca_objects(); $i = 1; while ($qr_chron_images->nextHit()) { $t_image_objects->load($qr_chron_images->get("ca_objects.object_id")); if ($t_primary_rep = $t_image_objects->getPrimaryRepresentationInstance()) { $va_temp = array(); if (!sizeof($va_access_values) || in_array($t_primary_rep->get('access'), $va_access_values)) { $va_temp["representation_id"] = $t_primary_rep->get("representation_id"); $va_temp["rep_icon"] = $t_primary_rep->getMediaTag('media', 'icon'); $va_temp["rep_tiny"] = $t_primary_rep->getMediaTag('media', 'tinyicon'); $va_temp["object_id"] = $qr_chron_images->get("ca_objects.object_id"); $va_thumbnails[$qr_chron_images->get("ca_objects.object_id")] = $va_temp; if ($vn_getNext == 1) { $this->view->setVar("next_object_id", $qr_chron_images->get("object_id")); $this->view->setVar("next_representation_id", $t_primary_rep->get("representation_id")); $vn_getNext = 0; } if ($qr_chron_images->get("object_id") == $pn_object_id) { $this->view->setVar("representation_index", $i); $this->view->setVar("previous_object_id", $vn_prev_obj_id); $this->view->setVar("previous_representation_id", $vn_prev_rep_id); $vn_getNext = 1; } $vn_prev_obj_id = $qr_chron_images->get("object_id"); $vn_prev_rep_id = $t_primary_rep->get("representation_id"); $i++; } } } } $this->view->setVar('reps', $va_thumbnails); return $this->render("Chronology/{$ps_view_name}.php"); }
* the terms of the provided license as published by Whirl-i-Gig * * CollectiveAccess is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTIES whatsoever, including any implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * This source code is free and modifiable under the terms of * GNU General Public License. (http://www.gnu.org/copyleft/gpl.html). See * the "license.txt" file for details, or visit the CollectiveAccess web site at * http://www.CollectiveAccess.org * * ---------------------------------------------------------------------- */ JavascriptLoadManager::register("cycle"); $t_object = new ca_objects(); $va_access_values = caGetUserAccessValues($this->request); $t_featured = new ca_sets(); $t_featured->load(array('set_code' => $this->request->config->get('featured_set_name'))); # Enforce access control on set if (sizeof($va_access_values) == 0 || sizeof($va_access_values) && in_array($t_featured->get("access"), $va_access_values)) { $va_featured_ids = array_keys(is_array($va_tmp = $t_featured->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 0))) ? $va_tmp : array()); // These are the object ids in the set } $va_item_ids = $va_featured_ids; $va_item_media = $t_object->getPrimaryMediaForIDs($va_item_ids, array("mediumlarge", "widepreview", "splashpic")); $va_item_labels = $t_object->getPreferredDisplayLabelsForIDs($va_item_ids); $title_id = array_shift(array_keys($va_item_media)); $t_object = new ca_objects($title_id); $va_artist_name = $t_object->get('ca_entities.preferred_labels.displayname', array('restrictToRelationshipTypes' => array('artist'), 'delimiter' => ' and ')); ?>
/** * Given a item_id (request parameter 'id') returns a list of ancestors for use in the hierarchy browser * Returned data is JSON format */ public function getFacetHierarchyAncestorList() { $pn_id = $this->request->getParameter('id', pInteger); $ps_facet_name = $this->request->getParameter('facet', pString); if (!is_array($va_facet_info = $this->opo_browse->getInfoForFacet($ps_facet_name))) { return null; } $va_ancestors = array(); switch ($va_facet_info['type']) { case 'attribute': // is it a list attribute? $t_element = new ca_metadata_elements(); if ($t_element->load(array('element_code' => $va_facet_info['element_code']))) { if ($t_element->get('datatype') == 3) { // 3=list if (!$pn_id) { $t_list = new ca_lists(); $pn_id = $t_list->getRootListItemID($t_element->get('list_id')); } $t_item = new ca_list_items($pn_id); if ($t_item->getPrimaryKey()) { $va_ancestors = array_reverse($t_item->getHierarchyAncestors(null, array('includeSelf' => true, 'idsOnly' => true))); array_shift($va_ancestors); } } } break; case 'label': // label facet $va_facet_info['table'] = $this->ops_tablename; // fall through to default case // fall through to default case default: $t_item = $this->opo_datamodel->getInstanceByTableName($va_facet_info['table']); $t_item->load($pn_id); if (method_exists($t_item, "getHierarchyList")) { $va_access_values = caGetUserAccessValues($this->request); $va_facet = $this->opo_browse->getFacet($ps_facet_name, array('sort' => 'name', 'checkAccess' => $va_access_values)); $va_hierarchy_list = $t_item->getHierarchyList(true); $vn_hierarchies_in_use = 0; foreach ($va_hierarchy_list as $vn_i => $va_item) { if (isset($va_facet[$va_item[$t_item->primaryKey()]])) { $vn_hierarchies_in_use++; if ($vn_hierarchies_in_use > 1) { break; } } } } if ($t_item->getPrimaryKey()) { $va_ancestors = array_reverse($t_item->getHierarchyAncestors(null, array('includeSelf' => true, 'idsOnly' => true))); if (!is_array($va_ancestors)) { $va_ancestors = array(); } } if ($vn_hierarchies_in_use <= 1) { array_shift($va_ancestors); } break; } $this->view->setVar('ancestors', $va_ancestors); return $this->render('Browse/facet_hierarchy_ancestors_json.php'); }