本文整理汇总了PHP中ca_objects::getPrimaryRepresentationInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_objects::getPrimaryRepresentationInstance方法的具体用法?PHP ca_objects::getPrimaryRepresentationInstance怎么用?PHP ca_objects::getPrimaryRepresentationInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_objects
的用法示例。
在下文中一共展示了ca_objects::getPrimaryRepresentationInstance方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _renderMediaView
/**
* 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");
}
示例2: getSetsOverlay
/**
* 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");
}
示例3: getOccurrenceMediaOverlay
/**
* Returns content for overlay containing details for object representation linked to occurrence
*/
public function getOccurrenceMediaOverlay()
{
$pn_occurrence_id = $this->request->getParameter('occurrence_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->view->setVar('occurrence_id', $pn_occurrence_id);
$t_occurrence = new ca_occurrences($pn_occurrence_id);
$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_occurrence->getPrimaryKey()) {
die("Invalid occurrence_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_occurrence->get('access'), $va_access_values)) {
die("Invalid occurrence_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 poster frame URL
//$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']);
//$va_rep_display_info['viewer_base_url'] = $t_rep->getAppConfig()->get('ca_url_root');
// set other options
$this->view->setVar('display_options', $va_rep_display_info);
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';
}
$this->view->setVar("display_type", $ps_display_type);
$this->view->setVar("containerID", $ps_containerID);
// Get all objects asscoiated with this occurrence and show primary reps as icons for navigation
$va_exhibition_images = $t_occurrence->get("ca_objects", array('restrict_to_relationship_types' => array('describes'), "returnAsArray" => 1, 'checkAccess' => $va_access_values));
if (sizeof($va_exhibition_images) > 0) {
$t_image_objects = new ca_objects();
$i = 1;
foreach ($va_exhibition_images as $vn_rel_id => $va_info) {
$t_image_objects->load($va_info["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_tinyicon"] = $t_primary_rep->getMediaTag('media', 'tinyicon');
$va_temp["object_id"] = $va_info["object_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);
$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("Detail/ajax_ca_occurrences_media_overlay_html.php");
}
示例4: array
$t_occurrence = $this->getVar('t_item');
$vn_occurrence_id = $t_occurrence->getPrimaryKey();
$vs_title = $this->getVar('label');
$va_access_values = $this->getVar('access_values');
$vn_num_more_link = $this->request->config->get("num_items_before_more_link");
JavascriptLoadManager::register('panel');
if ($t_occurrence->get("status") != 0) {
# --- check for images of the exhibitions
$va_exhibition_images = array_slice($t_occurrence->get("ca_objects", array('restrict_to_relationship_types' => array('describes'), "returnAsArray" => 1, 'checkAccess' => $va_access_values)), 0, 9);
if (sizeof($va_exhibition_images) > 0) {
$vn_exhibition_image_id = "";
$va_reps = array();
foreach ($va_exhibition_images as $vn_rel_id => $va_info) {
$vn_exhibition_image_id = $va_info["object_id"];
$t_image_object = new ca_objects($vn_exhibition_image_id);
if ($t_rep = $t_image_object->getPrimaryRepresentationInstance()) {
if (!sizeof($va_access_values) || in_array($t_rep->get('access'), $va_access_values)) {
# --- build array of thumbnails on related images for display under main image
$va_temp = array();
$va_temp["representation_id"] = $t_rep->get("representation_id");
$va_temp["rep_tinyicon"] = $t_rep->getMediaTag('media', 'tinyicon');
$va_temp["object_id"] = $va_info["object_id"];
$va_reps[$va_info["object_id"]] = $va_temp;
# Media representations to display (objects only)
if (!$vn_first_rep_set) {
$vn_first_rep_set = 1;
$va_rep_display_info = caGetMediaDisplayInfo('detail', $t_rep->getMediaInfo('media', 'INPUT', 'MIMETYPE'));
$vs_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']);
示例5: foreach
// #$va_reps = $t_rel_object->getPrimaryRepresentation(array('small'), null, array('return_with_access' => $va_access_values));
// $va_reps = $t_rel_object->getPrimaryRepresentation(array('widepreview'));
// print caNavLink($this->request, $va_reps["tags"]["widepreview"], '', 'Detail', 'Object', 'Show', array('object_id' => $va_object_info['object_id']));
//
// }
// }
$vn_c = 0;
$vn_numCols = 4;
$vn_max_images = 12;
if (is_array($va_action["objects"]) && sizeof($va_action["objects"])) {
# --- if there is only one image, show a larger one - which is configured in media_display_conf under chronology. Otherwise show a grid of images
if (sizeof($va_action["objects"]) == 1) {
$t_rel_object = new ca_objects();
foreach ($va_action["objects"] as $vn_i => $va_object_info) {
$t_rel_object->load($va_object_info['object_id']);
$t_rep = $t_rel_object->getPrimaryRepresentationInstance(array('return_with_access' => $va_access_values));
# -- get version to display configured in media_display.conf
$va_chrono_display_info = caGetMediaDisplayInfo('chronology', $t_rep->getMediaInfo('media', 'INPUT', 'MIMETYPE'));
$vs_chrono_version = $va_chrono_display_info['display_version'];
$vn_object_id = $va_object_info['object_id'];
$va_opts = array('display' => 'detail', 'object_id' => $vn_object_id, 'containerID' => 'cont');
print "<div style='text-align:center;'>" . caNavLink($this->request, $t_rel_object->getLabelForDisplay() . ", ID:" . $t_rel_object->get('idno'), '', 'Detail', 'Object', 'Show', array('object_id' => $vn_object_id)) . "</div>";
print "<div id='contchrono'>" . $t_rep->getRepresentationViewerHTMLBundle($this->request, $va_opts) . "</div>";
}
} else {
?>
<table border="0" cellpadding="0px" cellspacing="0px" width="100%">
<?php
$t_rel_object = new ca_objects();
$vn_itemc = 0;
# --- only show the first 12 images then a link that says how many more there are
示例6: caGetLocalizedDate
}
print "<span class='headerText'>" . caGetLocalizedDate(null, array('dateFormat' => 'delimited')) . "</span>";
print "<span class='headerText'>" . ($vn_num_items == 1 ? _t('%1 item', $vn_num_items) : _t('%1 items', $vn_num_items)) . "</span>";
print "<span class='headerText'>" . mb_substr($vs_title, 0, 15) . (mb_strlen($vs_title) > 15 ? '...' : '') . "</span>";
#print "<span class='pagingText'>"._t("page [%1]/[%2]", "[page_cu]", "[page_nb]")."</span>";
?>
</div>
<table width="100%" cellpadding="0" cellspacing="0">
<?php
$i = 1;
$t_object = new ca_objects();
foreach ($va_items as $va_item) {
$vn_object_id = $va_item['object_id'];
$t_object->load($vn_object_id);
$t_rep = $t_object->getPrimaryRepresentationInstance();
if ($i == 1) {
print "<tr>";
}
print "<td><table class='imageTable' cellpadding='0' cellspacing='0'><tr><td>";
if ($t_rep) {
print "<img src='" . $t_rep->getMediaUrl("media", "medium") . "' width='" . $va_item["representation_width_thumbnail"] . "' height='" . $va_item["representation_height_thumbnail"] . "' border='0'>";
}
print "</td></tr></table>";
#print "<td><table class='imageTable' cellpadding='0' cellspacing='0'><tr><td>".((file_exists(str_replace($this->request->config->get("site_host"), $this->request->config->get("ca_base_dir"), $va_item["representation_url_thumbnail"]))) ? $va_item["representation_tag_thumbnail"] : "")."</td></tr></table>";
print "<div class='imageCaption'>" . $va_item["idno"] . "<br/>" . $t_object->get("ca_objects.altID") . "<br/>" . $t_object->get("ca_collections.preferred_labels", array("delimiter" => "; ")) . "</div></td>";
if ($i == 4) {
print "</tr>";
$i = 0;
}
$i++;