/**
  * Return representation image center editor
  *
  * Expects the following request parameters: 
  *		representation_id = the id of the ca_object_representations record for which to edit annotations
  *
  *	Optional request parameters:
  *		none (yet)
  */
 public function GetImageCenterEditor()
 {
     list($pn_representation_id, $t_rep) = $this->_initView();
     $va_display_info = caGetMediaDisplayInfo('image_center_editor', $t_rep->getMediaInfo("media", "original", "MIMETYPE"));
     $this->view->setVar('image', $t_rep->getMediaTag('media', $va_display_info['display_version'], array('id' => 'caImageCenterEditorImage', 'class' => 'caImageCenterEditor')));
     $va_media_info = $t_rep->getMediaInfo('media', $va_display_info['display_version']);
     $this->view->setVar('image_width', caGetOption('WIDTH', $va_media_info, null));
     $this->view->setVar('image_height', caGetOption('HEIGHT', $va_media_info, null));
     $va_center = $t_rep->getMediaCenter('media');
     $this->view->setVar('center_x', $va_center['x']);
     $this->view->setVar('center_y', $va_center['y']);
     $this->view->setVar('image_info', $va_media_info);
     return $this->render('ajax_representation_image_center_editor_html.php');
 }
コード例 #2
0
            ?>
					</div><!-- end caMediaOverlayRepThumbs -->
<?php 
        }
        ?>
	<!-- Controls - only for media overlay -->
	<div class="caMediaOverlayControls">
			<div class='close'><a href="#" onclick="caMediaPanel.hidePanel(); return false;" title="close">&nbsp;&nbsp;&nbsp;</a></div>
<?php 
        if (caObjectsDisplayDownloadLink($this->request)) {
            ?>

				<div class='download'>
<?php 
            # -- get version to download configured in media_display.conf
            $va_download_display_info = caGetMediaDisplayInfo('download', $t_rep->getMediaInfo('media', 'INPUT', 'MIMETYPE'));
            $vs_download_version = $va_download_display_info['display_version'];
            print caNavLink($this->request, "<img src='" . $this->request->getThemeUrlPath() . "/graphics/buttons/downloadWhite.png' border='0' title='" . _t("Download Media") . "'>", '', 'Detail', 'Object', 'DownloadRepresentation', array('representation_id' => $t_rep->getPrimaryKey(), "object_id" => $t_object->getPrimaryKey(), "download" => 1, "version" => $vs_download_version));
            ?>
				
				</div>
<?php 
        }
        ?>
			<div class='objectInfo'>
<?php 
        $vs_label = $t_object->getLabelForDisplay();
        print mb_strlen($vs_label) > 80 ? mb_substr($vs_label, 0, 80) . "..." : $vs_label;
        if ($t_object->get("idno")) {
            print " [" . $t_object->get("idno") . "]";
        }
コード例 #3
0
 /**
  * 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");
 }
コード例 #4
0
 /**
  *
  */
 public function SendShare()
 {
     $va_errors = array();
     $ps_tablename = $this->request->getParameter('tablename', pString);
     $pn_item_id = $this->request->getParameter('item_id', pInteger);
     if (!($t_item = $this->opo_datamodel->getInstanceByTableName($ps_tablename, true))) {
         die("Invalid table name " . $ps_tablename . " for detail");
         // shouldn't happen
     }
     if (!$t_item->load($pn_item_id)) {
         $this->view->setVar("message", _t("ID does not exist"));
         $this->render("Form/reload_html.php");
         return;
     }
     $o_purifier = new HTMLPurifier();
     $ps_to_email = $o_purifier->purify($this->request->getParameter('to_email', pString));
     $ps_from_email = $o_purifier->purify($this->request->getParameter('from_email', pString));
     $ps_from_name = $o_purifier->purify($this->request->getParameter('from_name', pString));
     $ps_subject = $o_purifier->purify($this->request->getParameter('subject', pString));
     $ps_message = $o_purifier->purify($this->request->getParameter('message', pString));
     $pn_security = $this->request->getParameter('security', pInteger);
     $pn_sum = $this->request->getParameter('sum', pInteger);
     # --- check vars are set and email addresses are valid
     $va_to_email = array();
     $va_to_email_process = array();
     if (!$ps_to_email) {
         $va_errors["to_email"] = _t("Please enter a valid email address or multiple addresses separated by commas");
     } else {
         # --- explode on commas to support multiple addresses - then check each one
         $va_to_email_process = explode(",", $ps_to_email);
         foreach ($va_to_email_process as $vs_email_to_verify) {
             $vs_email_to_verify = trim($vs_email_to_verify);
             if (caCheckEmailAddress($vs_email_to_verify)) {
                 $va_to_email[$vs_email_to_verify] = "";
             } else {
                 $ps_to_email = "";
                 $va_errors["to_email"] = _t("Please enter a valid email address or multiple addresses separated by commas");
             }
         }
     }
     if (!$ps_from_email || !caCheckEmailAddress($ps_from_email)) {
         $ps_from_email = "";
         $va_errors["from_email"] = _t("Please enter a valid email address");
     }
     if (!$ps_from_name) {
         $va_errors["from_name"] = _t("Please enter your name");
     }
     if (!$ps_subject) {
         $va_errors["subject"] = _t("Please enter a subject");
     }
     if (!$ps_message) {
         $va_errors["message"] = _t("Please enter a message");
     }
     if (!$this->request->isLoggedIn()) {
         # --- check for security answer if not logged in
         if (!$pn_security) {
             $va_errors["security"] = _t("Please answer the security question.");
         } else {
             if ($pn_security != $pn_sum) {
                 $va_errors["security"] = _t("Your answer was incorrect, please try again");
             }
         }
     }
     $this->view->setVar('t_item', $t_item);
     $this->view->setVar('item_id', $pn_item_id);
     $this->view->setVar('tablename', $ps_tablename);
     if (sizeof($va_errors) == 0) {
         $o_view = new View($this->request, array($this->request->getViewsDirectoryPath()));
         $o_view->setVar("item", $t_item);
         $o_view->setVar("item_id", $pn_item_id);
         $o_view->setVar("from_name", $ps_from_name);
         $o_view->setVar("message", $ps_message);
         $o_view->setVar("detailConfig", $this->config);
         # -- generate mail text from template - get both html and text versions
         if ($ps_tablename == "ca_objects") {
             $vs_mail_message_text = $o_view->render("mailTemplates/share_object_email_text.tpl");
         } else {
             $vs_mail_message_text = $o_view->render("mailTemplates/share_email_text.tpl");
         }
         if ($ps_tablename == "ca_objects") {
             $vs_mail_message_html = $o_view->render("/mailTemplates/share_object_email_html.tpl");
         } else {
             $vs_mail_message_html = $o_view->render("/mailTemplates/share_email_html.tpl");
         }
         $va_media = null;
         if ($ps_tablename == "ca_objects") {
             # --- get media for attachment
             $vs_media_version = "";
             # Media representation to email
             # --- version is set in media_display.conf.
             if (method_exists($t_item, 'getPrimaryRepresentationInstance')) {
                 if ($t_primary_rep = $t_item->getPrimaryRepresentationInstance()) {
                     if (!sizeof($this->opa_access_values) || in_array($t_primary_rep->get('access'), $this->opa_access_values)) {
                         // check rep access
                         $va_media = array();
                         $va_rep_display_info = caGetMediaDisplayInfo('email', $t_primary_rep->getMediaInfo('media', 'INPUT', 'MIMETYPE'));
                         $vs_media_version = $va_rep_display_info['display_version'];
                         $va_media['path'] = $t_primary_rep->getMediaPath('media', $vs_media_version);
                         $va_media_info = $t_primary_rep->getFileInfo('media', $vs_media_version);
                         if (!($va_media['name'] = $va_media_info['ORIGINAL_FILENAME'])) {
                             $va_media['name'] = $va_media_info[$vs_media_version]['FILENAME'];
                         }
                         # --- this is the mimetype of the version being downloaded
                         $va_media["mimetype"] = $va_media_info[$vs_media_version]['MIMETYPE'];
                     }
                 }
             }
         }
         if (caSendmail($va_to_email, array($ps_from_email => $ps_from_name), $ps_subject, $vs_mail_message_text, $vs_mail_message_html, null, null, $va_media)) {
             $this->view->setVar("message", _t("Your email was sent"));
             $this->render("Form/reload_html.php");
             return;
         } else {
             $va_errors["general"] = _t("Your email could not be sent");
         }
     }
     if (sizeof($va_errors)) {
         # --- there were errors in the form data, so reload form with errors displayed - pass params to preload form
         $this->view->setVar('to_email', $ps_to_email);
         $this->view->setVar('from_email', $ps_from_email);
         $this->view->setVar('from_name', $ps_from_name);
         $this->view->setVar('subject', $ps_subject);
         $this->view->setVar('message', $ps_message);
         $this->view->setVar('errors', $va_errors);
         $va_errors["general"] = _t("There were errors in your form");
         $this->ShareForm();
     } else {
         $this->view->setVar("message", _t("Your message was sent"));
         $this->render("Form/reload_html.php");
         return;
     }
 }
コード例 #5
0
 /**
  * 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");
 }
コード例 #6
0
			H2 { font-weight:bold; font-size: 11px; font-family: Helvetica, sans-serif; margin-bottom:2px; }
			.media { float:right; padding:0px 0px 10px 10px; width:400px; }
			.pageHeader { margin: 0px 10px 20px 0px; padding: 0px 5px 0px 5px; width: 100%; font-family: Helvetica, sans-serif; }
			.pageHeader img{ vertical-align:middle;  }
			.notes { font-style:italic; color:#828282; margin-top:20px; }
			-->
		</style>
	</HEAD>
	<BODY>
		
<?php 
if (file_exists($this->request->getThemeDirectoryPath() . '/graphics/CAlogo.gif')) {
    print '<div class="pageHeader"><img src="' . $this->request->getThemeDirectoryPath() . '/graphics/CAlogo.gif"/></div>';
}
if ($t_rep = $t_item->getPrimaryRepresentationInstance(array('return_with_access' => $va_access_values))) {
    $va_rep_display_info = caGetMediaDisplayInfo("summary", $t_rep->getMediaInfo('media', 'INPUT', 'MIMETYPE'));
    if (!($vs_version = $va_rep_display_info['display_version'])) {
        $vs_version = "large";
    }
    ?>
			<div class="media"><img src="<?php 
    print $t_rep->getMediaPath("media", $vs_version);
    ?>
"></div>
<?php 
}
print "<H1>" . $o_purifier->purify($t_item->getLabelForDisplay()) . "</H1>";
# --- identifier
if ($t_item->get('idno')) {
    print "<div class='unit'><b>" . _t("Identifier") . ":</b> " . $o_purifier->purify($t_item->get('idno')) . "</div><!-- end unit -->";
}
コード例 #7
0
$vn_image_rep_id = "";
$va_image_rep = array();
$va_image_media_display_info = array();
$va_annotations = array();
if (sizeof($va_videos)) {
    $va_audio_video_rep = array_shift($va_videos);
    $vn_audio_video_rep_id = $va_audio_video_rep["representation_id"];
    $va_audio_video_media_display_info = caGetMediaDisplayInfo('detail', $va_audio_video_rep["mimetype"]);
} elseif (sizeof($va_audios)) {
    $va_audio_video_rep = array_shift($va_audios);
    $vn_audio_video_rep_id = $va_audio_video_rep["representation_id"];
    $va_audio_video_media_display_info = caGetMediaDisplayInfo('detail', $va_audio_video_rep["mimetype"]);
    if (sizeof($va_images)) {
        $va_image_rep = array_shift($va_images);
        $vn_image_rep_id = $va_image_rep["representation_id"];
        $va_image_media_display_info = caGetMediaDisplayInfo('detail', $va_image_rep["mimetype"]);
    }
}
if ($vn_image_rep_id) {
    $t_rep->load($vn_image_rep_id);
    print "<div id='cont'>" . $t_rep->getMediaTag("media", $va_image_media_display_info["display_version"], $va_image_media_display_info) . "</div>";
}
if ($vn_audio_video_rep_id) {
    $t_rep->load($vn_audio_video_rep_id);
    print $t_rep->getMediaTag("media", $va_audio_video_media_display_info["display_version"], $va_audio_video_media_display_info, array("id" => "caPlayer"));
    # --- get the annotations for this audio/video rep
    $va_annotations = $t_rep->getAnnotations(array("checkAccess" => $this->getVar("access_values")));
}
?>
				</div><!-- end col -->
				<div class='col-sm-6 col-md-6 col-lg-6'>
コード例 #8
0
ファイル: displayHelpers.php プロジェクト: ffarago/pawtucket2
/**
 * 
 *
 * @param RequestHTTP $po_request
 * @param array $pa_options
 * @param array $pa_additional_display_options
 * @return string HTML output
 */
function caRepresentationViewerHTMLBundleForSearchResult($po_data, $po_request, $pa_options = null, $pa_additional_display_options = null)
{
    $ps_version = $po_request->getParameter('version', pString);
    $va_access_values = isset($pa_options['access']) && is_array($pa_options['access']) ? $pa_options['access'] : array();
    $vs_display_type = isset($pa_options['display']) && $pa_options['display'] ? $pa_options['display'] : 'media_overlay';
    $vs_container_dom_id = isset($pa_options['containerID']) && $pa_options['containerID'] ? $pa_options['containerID'] : null;
    $vn_object_id = isset($pa_options['object_id']) && $pa_options['object_id'] ? $pa_options['object_id'] : null;
    $vn_item_id = isset($pa_options['item_id']) && $pa_options['item_id'] ? $pa_options['item_id'] : null;
    $vn_order_item_id = isset($pa_options['order_item_id']) && $pa_options['order_item_id'] ? $pa_options['order_item_id'] : null;
    $vb_media_editor = isset($pa_options['mediaEditor']) && $pa_options['mediaEditor'] ? true : false;
    $vb_no_controls = isset($pa_options['noControls']) && $pa_options['noControls'] ? true : false;
    $vn_item_id = isset($pa_options['item_id']) && $pa_options['item_id'] ? $pa_options['item_id'] : null;
    $t_object = new ca_objects($vn_object_id);
    //if (!$t_object->getPrimaryKey()) { return false; }
    if (!$po_data->getPrimaryKey() && $t_object->getPrimaryKey() && method_exists($po_data, 'load')) {
        $po_data->load($t_object->getPrimaryRepresentationID(array('checkAccess' => $va_access_values)));
    }
    $t_set_item = new ca_set_items();
    if ($vn_item_id) {
        $t_set_item->load($vn_item_id);
    }
    $t_order_item = new ca_commerce_order_items();
    if ($vn_order_item_id) {
        $t_order_item->load($vn_order_item_id);
    }
    $o_view = new View($po_request, $po_request->getViewsDirectoryPath() . '/bundles/');
    $o_view->setVar('t_object', $t_object);
    $o_view->setVar('t_set_item', $t_set_item);
    $o_view->setVar('t_order_item', $t_order_item);
    $o_view->setVar('use_media_editor', $vb_media_editor);
    $o_view->setVar('noControls', $vb_no_controls);
    $va_rep_display_info = array();
    if (isset($pa_options['use_book_viewer'])) {
        $va_rep_display_info['use_book_viewer'] = (bool) $pa_options['use_book_viewer'];
    }
    if ($t_object->getPrimaryKey()) {
        $o_view->setVar('reps', $va_reps = $t_object->getRepresentations(array('icon'), null, array("return_with_access" => $va_access_values)));
    }
    $t_media = new Media();
    $va_buf = array();
    while ($po_data->nextHit()) {
        if (method_exists($po_data, 'numFiles')) {
            $o_view->setVar('num_multifiles', $po_data->numFiles());
        }
        $o_view->setVar('t_object_representation', $po_data);
        if (($vn_representation_id = $po_data->getPrimaryKey()) && (!sizeof($va_access_values) || in_array($po_data->get('access'), $va_access_values))) {
            // check rep access
            $va_rep_display_info = caGetMediaDisplayInfo($vs_display_type, $vs_mimetype = $po_data->getMediaInfo('media', 'INPUT', 'MIMETYPE'));
            $va_rep_display_info['poster_frame_url'] = $po_data->getMediaUrl('media', $va_rep_display_info['poster_frame_version']);
            $va_additional_display_options = array();
            if (is_array($pa_additional_display_options) && isset($pa_additional_display_options[$vs_mimetype]) && is_array($pa_additional_display_options[$vs_mimetype])) {
                $va_additional_display_options = $pa_additional_display_options[$vs_mimetype];
            }
            $o_view->setVar('display_options', caGetMediaDisplayInfo('detail', $vs_mimetype));
            $o_view->setVar('display_type', $vs_display_type);
            $o_view->setVar('representation_id', $vn_representation_id);
            $o_view->setVar('t_object_representation', $po_data);
            $o_view->setVar('versions', $va_versions = $po_data->getMediaVersions('media'));
            $o_view->setVar('containerID', $vs_container_dom_id . $vn_representation_id);
            $o_view->setVar('version_type', $t_media->getMimetypeTypename($po_data->getMediaInfo('media', 'original', 'MIMETYPE')));
            if ($t_object->getPrimaryKey()) {
                $vn_next_rep = $vn_prev_rep = null;
                $va_rep_list = array_values($va_reps);
                foreach ($va_rep_list as $vn_i => $va_rep) {
                    if ($va_rep['representation_id'] == $vn_representation_id) {
                        if (isset($va_rep_list[$vn_i - 1])) {
                            $vn_prev_rep = $va_rep_list[$vn_i - 1]['representation_id'];
                        }
                        if (isset($va_rep_list[$vn_i + 1])) {
                            $vn_next_rep = $va_rep_list[$vn_i + 1]['representation_id'];
                        }
                        $o_view->setVar('representation_index', $vn_i + 1);
                    }
                }
                $o_view->setVar('previous_representation_id', $vn_prev_rep);
                $o_view->setVar('next_representation_id', $vn_next_rep);
            }
            if (!in_array($ps_version, $va_versions)) {
                if (!($ps_version = $va_rep_display_info['display_version'])) {
                    $ps_version = null;
                }
            }
            $o_view->setVar('version_info', $po_data->getMediaInfo('media', $ps_version));
            $o_view->setVar('version', $ps_version);
        }
        $va_buf[$vn_representation_id] = $o_view->render('representation_viewer_html.php');
    }
    return $va_buf;
}
コード例 #9
0
$va_failed_inserts = array();
foreach ($this->request->getActionErrorSubSources('ca_representation_annotations') as $vs_error_subsource) {
    if (substr($vs_error_subsource, 0, 4) === 'new_') {
        $va_action_errors = $this->request->getActionErrors('ca_representation_annotations', $vs_error_subsource);
        foreach ($va_action_errors as $o_error) {
            $va_failed_inserts[] = array_merge($va_init_props, array('_errors' => array(array('errorDescription' => $o_error->getErrorDescription(), 'errorCode' => $o_error->getErrorNumber()))));
        }
    }
}
print caEditorBundleShowHideControl($this->request, $vs_id_prefix . $t_item->tableNum() . '_annotations');
print caEditorBundleMetadataDictionary($this->request, $vs_id_prefix . $t_item->tableNum() . '_annotations', $va_settings);
?>
<!-- BEGIN Media Player -->
<div class="bundleContainer" style="text-align:center; padding:5px;">
<?php 
$va_media_player_config = caGetMediaDisplayInfo('annotation_editor', $t_subject->getMediaInfo('media', $o_properties->getDisplayMediaVersion(), 'MIMETYPE'));
?>
	<div class="caAnnotationMediaPlayerContainer">
		<?php 
print $t_subject->getMediaTag('media', $o_properties->getDisplayMediaVersion(), array('class' => 'caAnnotationMediaPlayer', 'viewer_width' => $va_media_player_config['viewer_width'], 'viewer_height' => $va_media_player_config['viewer_height'], 'id' => 'annotation_media_player', 'poster_frame_url' => $t_subject->getMediaUrl('media', 'medium')));
?>
	</div>
</div>
<!-- END Media Player -->

<!-- BEGIN Annotation List -->
<div id="<?php 
print $vs_id_prefix . $t_item->tableNum() . '_annotations';
?>
">
<?php 
コード例 #10
0
 $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']);
                 $va_display_options = $va_rep_display_info;
                 $vs_display_rep = $t_rep->getMediaTag('media', $vs_display_version, $va_display_options);
                 $vn_display_rep_id = $t_rep->get("representation_id");
                 $vn_display_object_id = $va_info["object_id"];
                 $vn_display_caption = $t_rep->get("image_credit_line");
                 $va_display_media_info = $t_rep->getMediaInfo('media', $vs_display_version);
                 $vn_display_media_width = $va_display_media_info["WIDTH"];
             }
         }
     }
 }
コード例 #11
0
 /**
  * Generates detail detail. Will use a view named according to the following convention:
  *		<table_name>_<type_code>_detail_html.php
  *
  * So for example, the detail for objects of type 'artwork' (where 'artwork' is the type code for the artwork object type)
  * the view would be named "ca_objects_artwork_detail_html.php
  *
  * If the type specific view does not exist, then Show() will attemp to use a generic table-wide view name like this:
  *		<table_name>_detail_html.php
  *
  * For example: "ca_objects_detail_html.php"
  *
  * In general you should always have the table wide views defined. Then you can define type-specific views for your
  * application on an as-needed basis.
  */
 public function Show()
 {
     JavascriptLoadManager::register('browsable');
     JavascriptLoadManager::register('imageScroller');
     JavascriptLoadManager::register('maps3');
     $va_access_values = caGetUserAccessValues($this->request);
     $this->view->setVar('access_values', $va_access_values);
     if (!($t_item = $this->opo_datamodel->getInstanceByTableName($this->ops_tablename, true))) {
         die("Invalid table name " . $this->ops_tablename . " for detail");
     }
     if (!($vn_item_id = $this->request->getParameter($t_item->primaryKey(), pInteger))) {
         $this->notification->addNotification(_t("Invalid ID"), "message");
         $this->response->setRedirect(caNavUrl($this->request, "", "", "", ""));
         return;
     }
     if (!$t_item->load($vn_item_id)) {
         $this->notification->addNotification(_t("ID does not exist"), "message");
         $this->response->setRedirect(caNavUrl($this->request, "", "", "", ""));
         return;
     }
     #
     # Enforce access control
     #
     if (sizeof($va_access_values) && !in_array($t_item->get("access"), $va_access_values)) {
         $this->notification->addNotification(_t("This item is not available for view"), "message");
         $this->response->setRedirect(caNavUrl($this->request, "", "", "", ""));
         return;
     }
     //
     // In-detail browsing of objects - limited to object linked to the item being displayed
     //
     if ($this->request->config->get('allow_browse_within_detail_for_' . $this->ops_tablename) && is_object($this->opo_browse)) {
         // set browse context for controller
         $this->setContext($this->opo_browse->getContext());
         $t_table = $this->opo_datamodel->getTableInstance($this->ops_tablename);
         if ($this->request->session->getVar($this->ops_tablename . '_' . $this->ops_appname . '_detail_current_item_id') != $vn_item_id) {
             $this->opo_browse->removeAllCriteria();
         }
         // look for 'authority' facet for current detail table type so we can limit the object browse to the currently displayed item
         $vs_limit_facet_name = null;
         foreach ($this->opo_browse->getInfoForFacets() as $vs_facet_name => $va_facet_info) {
             if ($va_facet_info['type'] === 'authority' && $va_facet_info['table'] === $this->ops_tablename) {
                 $vs_limit_facet_name = $vs_facet_name;
                 break;
             }
         }
         if ($vs_limit_facet_name) {
             $this->opo_browse->addCriteria($vs_limit_facet_name, array($vn_item_id));
             $this->opo_browse->execute(array('checkAccess' => $va_access_values));
             $this->request->session->setVar($this->ops_tablename . '_' . $this->ops_appname . '_detail_current_browse_id', $this->opo_browse->getBrowseID());
             $this->view->setVar('show_browse', true);
             //
             // Browse paging
             //
             $vn_items_per_page = $this->request->config->get("objects_per_page_for_detail_pages");
             if (!$vn_items_per_page) {
                 $vn_items_per_page = 12;
             }
             $this->view->setVar('page', ($vn_p = $this->request->getParameter('page', pInteger)) ? $vn_p : 1);
             if ($this->opo_browse) {
                 $qr_hits = $this->opo_browse->getResults();
                 $vn_num_pages = ceil($qr_hits->numHits() / $vn_items_per_page);
                 $qr_hits->seek(($vn_p - 1) * $vn_items_per_page);
             } else {
                 $vn_num_pages = 0;
             }
             $this->view->setVar('browse_results', $qr_hits);
             $this->view->setVar('num_pages', $vn_num_pages);
             $this->view->setVar('items_per_page', $vn_items_per_page);
             $this->view->setVar('opo_browse', $this->opo_browse);
             $this->view->setVar('sorts', $this->opa_sorts);
             // supported sorts for the object browse
             // browse criteria in an easy-to-display format
             $va_browse_criteria = array();
             foreach ($this->opo_browse->getCriteriaWithLabels() as $vs_facet_code => $va_criteria) {
                 $va_facet_info = $this->opo_browse->getInfoForFacet($vs_facet_code);
                 $va_criteria_list = array();
                 foreach ($va_criteria as $vn_criteria_id => $vs_criteria_label) {
                     $va_criteria_list[] = $vs_criteria_label;
                 }
                 $va_browse_criteria[$va_facet_info['label_singular']] = join('; ', $va_criteria_list);
             }
             $this->view->setVar('browse_criteria', $va_browse_criteria);
         } else {
             // not configured for browse
             $this->request->session->setVar($this->ops_tablename . '_' . $this->ops_appname . '_detail_current_browse_id', null);
             $this->view->setVar('show_browse', false);
         }
     }
     $this->request->session->setVar($this->ops_tablename . '_' . $this->ops_appname . '_detail_current_item_id', $vn_item_id);
     # Next and previous navigation
     $opo_result_context = new ResultContext($this->request, $this->ops_tablename, ResultContext::getLastFind($this->request, $this->ops_tablename));
     $this->view->setVar('next_id', $opo_result_context->getNextID($vn_item_id));
     $this->view->setVar('previous_id', $opo_result_context->getPreviousID($vn_item_id));
     # Item instance and id
     $this->view->setVar('t_item', $t_item);
     $this->view->setVar($t_item->getPrimaryKey(), $vn_item_id);
     # Item  - preferred
     $this->view->setVar('label', $t_item->getLabelForDisplay());
     # Item  - nonpreferred
     $this->view->setVar('nonpreferred_labels', caExtractValuesByUserLocale($t_item->getNonPreferredLabels()));
     # Item timestamps (creation and last change)
     if ($va_entry_info = $t_item->getCreationTimestamp()) {
         $this->view->setVar('date_of_entry', date('m/d/Y', $va_entry_info['timestamp']));
     }
     if ($va_last_change_info = $t_item->getLastChangeTimestamp()) {
         $this->view->setVar('date_of_last_change', date('m/d/Y', $va_last_change_info['timestamp']));
     }
     # Media representations to display (objects only)
     if (method_exists($t_item, 'getPrimaryRepresentationInstance')) {
         if ($t_primary_rep = $t_item->getPrimaryRepresentationInstance()) {
             if (!sizeof($va_access_values) || in_array($t_primary_rep->get('access'), $va_access_values)) {
                 // check rep access
                 $va_info = $t_primary_rep->getMediaInfo('media', 'original');
                 $this->view->setVar('t_primary_rep', $t_primary_rep);
                 $va_rep_display_info = caGetMediaDisplayInfo('detail', $t_primary_rep->getMediaInfo('media', 'original', 'MIMETYPE'));
                 $this->view->setVar('primary_rep_display_version', $va_rep_display_info['display_version']);
                 unset($va_display_info['display_version']);
                 $va_rep_display_info['poster_frame_url'] = $t_primary_rep->getMediaUrl('media', $va_rep_display_info['poster_frame_version']);
                 unset($va_display_info['poster_frame_version']);
                 $this->view->setVar('primary_rep_display_options', $va_rep_display_info);
             }
         }
     }
     #
     # User-generated comments, tags and ratings
     #
     $va_user_comments = $t_item->getComments(null, true);
     $va_comments = array();
     if (is_array($va_user_comments)) {
         foreach ($va_user_comments as $va_user_comment) {
             $va_comment = array();
             if ($va_user_comment["comment"]) {
                 $va_comment["comment"] = $va_user_comment["comment"];
                 # TODO: format date based on local
                 $va_comment["date"] = date("n/j/Y", $va_user_comment["created_on"]);
                 $va_comment["created_on"] = $va_user_comment["created_on"];
                 # -- get name of commenter
                 $t_user = new ca_users($va_user_comment["user_id"]);
                 $va_comment["author"] = $t_user->getName();
                 $va_comment["email"] = $va_user_comment["email"];
                 $va_comment["name"] = $va_user_comment["name"];
                 $va_comments[] = $va_comment;
             }
         }
     }
     $this->view->setVar('comments', $va_comments);
     $va_user_tags = $t_item->getTags(null, true);
     $va_tags = array();
     if (is_array($va_user_tags)) {
         foreach ($va_user_tags as $va_user_tag) {
             if (!in_array($va_user_tag["tag"], $va_tags)) {
                 $va_tags[] = $va_user_tag["tag"];
             }
         }
     }
     $this->view->setVar('tags_array', $va_tags);
     $this->view->setVar('tags', implode(", ", $va_tags));
     # -- get average user ranking
     $this->view->setVar('ranking', $t_item->getAverageRating(null));
     // null makes it ignore moderation status
     # -- get number of user rankings
     $this->view->setVar('numRankings', $t_item->getNumRatings(null));
     // null makes it ignore moderation status
     # --- get related objects - explicit relationships
     $va_related_objects = array();
     if (method_exists($this, 'getRelatedObjects')) {
         $va_related_objects = $this->getRelatedObjects();
     }
     $this->view->setVar('related_objects', $va_related_objects);
     #
     # get suggested objects - you may be interested in
     #
     $va_suggested_objects = array();
     if (method_exists($this, 'getSuggestedItems')) {
         $va_suggested_objects = $this->getSuggestedItems();
     }
     $this->view->setVar('suggested_objects', $va_suggested_objects);
     #
     # Miscellaneous useful information
     #
     $this->view->setVar('t_relationship_types', new ca_relationship_types());
     // relationship types object - used for displaying relationship type of related authority information
     if (method_exists($t_item, 'getTypeName')) {
         $this->view->setVar('typename', $t_item->getTypeName());
     }
     # Hierarchy
     //  			if($t_occurrence->get("parent_id")){
     //  				$t_parent = new ca_occurrences($t_occurrence->get("parent_id"));
     //  				$this->view->setVar('parent_title', $t_parent->getLabelForDisplay());
     //  				$this->view->setVar('parent_id', $t_occurrence->get("parent_id"));
     //  			}
     // 	$va_occurrence_children = $t_occurrence->getHierarchyChildren();
     //  			if(is_array($va_occurrence_children) && (sizeof($va_occurrence_children) > 0)){
     //  				$this->view->setVar('num_children', sizeof($va_occurrence_children));
     //  			}
     // Record view
     $t_item->registerItemView($this->request->getUserID());
     //
     // Render view
     //
     if ($this->getView()->viewExists($this->ops_tablename . '_' . $t_item->getTypeCode() . '_detail_html.php')) {
         $this->render($this->ops_tablename . '_' . $t_item->getTypeCode() . '_detail_html.php');
     } else {
         $this->render($this->ops_tablename . '_detail_html.php');
     }
 }
コード例 #12
0
// 			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
        foreach ($va_action["objects"] as $vn_i => $va_object_info) {
            $t_rel_object->load($va_object_info['object_id']);
コード例 #13
0
 /**
  * 
  */
 public function getMediaAttributeViewerHTMLBundle($po_request, $pa_options = null)
 {
     $va_access_values = isset($pa_options['access']) && is_array($pa_options['access']) ? $pa_options['access'] : array();
     $vs_display_type = isset($pa_options['display']) && $pa_options['display'] ? $pa_options['display'] : 'media_overlay';
     $vs_container_dom_id = isset($pa_options['containerID']) && $pa_options['containerID'] ? $pa_options['containerID'] : null;
     $pn_value_id = isset($pa_options['value_id']) && $pa_options['value_id'] ? $pa_options['value_id'] : null;
     $t_attr_val = new ca_attribute_values();
     $t_attr_val->load($pn_value_id);
     $t_attr_val->useBlobAsMediaField(true);
     $o_view = new View($po_request, $po_request->getViewsDirectoryPath() . '/bundles/');
     $o_view->setVar('containerID', $vs_container_dom_id);
     $va_rep_display_info = caGetMediaDisplayInfo('media_overlay', $t_attr_val->getMediaInfo('value_blob', 'INPUT', 'MIMETYPE'));
     $va_rep_display_info['poster_frame_url'] = $t_attr_val->getMediaUrl('value_blob', $va_rep_display_info['poster_frame_version']);
     $o_view->setVar('display_options', $va_rep_display_info);
     $o_view->setVar('representation_id', $pn_representation_id);
     $o_view->setVar('t_attribute_value', $t_attr_val);
     $o_view->setVar('versions', $va_versions = $t_attr_val->getMediaVersions('value_blob'));
     $t_media = new Media();
     $ps_version = $po_request->getParameter('version', pString);
     if (!in_array($ps_version, $va_versions)) {
         if (!($ps_version = $va_rep_display_info['display_version'])) {
             $ps_version = null;
         }
     }
     $o_view->setVar('version', $ps_version);
     $o_view->setVar('version_info', $t_attr_val->getMediaInfo('value_blob', $ps_version));
     $o_view->setVar('version_type', $t_media->getMimetypeTypename($t_attr_val->getMediaInfo('value_blob', $ps_version, 'MIMETYPE')));
     $o_view->setVar('version_mimetype', $t_attr_val->getMediaInfo('value_blob', $ps_version, 'MIMETYPE'));
     $o_view->setVar('mimetype', $t_attr_val->getMediaInfo('value_blob', 'INPUT', 'MIMETYPE'));
     return $o_view->render('media_attribute_viewer_html.php');
 }
コード例 #14
0
 /**
  * 
  */
 public function GetPageListAsJSON()
 {
     $pn_object_id = $this->request->getParameter('object_id', pInteger);
     $pn_representation_id = $this->request->getParameter('representation_id', pInteger);
     $ps_content_mode = $this->request->getParameter('content_mode', pString);
     $this->view->setVar('object_id', $pn_object_id);
     $this->view->setVar('representation_id', $pn_representation_id);
     $this->view->setVar('content_mode', $ps_content_mode);
     $t_rep = new ca_object_representations($pn_representation_id);
     $va_download_display_info = caGetMediaDisplayInfo('download', $t_rep->getMediaInfo('media', 'INPUT', 'MIMETYPE'));
     $vs_download_version = $va_download_display_info['display_version'];
     $this->view->setVar('download_version', $vs_download_version);
     $va_page_list_cache = $this->request->session->getVar('caDocumentViewerPageListCache');
     $va_pages = $va_page_list_cache[$pn_object_id . '/' . $pn_representation_id];
     if (!isset($va_pages)) {
         // Page cache not set?
         $this->postError(1100, _t('Invalid object/representation'), 'ObjectEditorController->GetPage');
         return;
     }
     $va_section_cache = $this->request->session->getVar('caDocumentViewerSectionCache');
     $this->view->setVar('pages', $va_pages);
     $this->view->setVar('sections', $va_section_cache[$pn_object_id . '/' . $pn_representation_id]);
     $this->view->setVar('is_searchable', MediaContentLocationIndexer::hasIndexing('ca_object_representations', $pn_representation_id));
     $this->render('object_representation_page_list_json.php');
 }
コード例 #15
0
ファイル: themeHelpers.php プロジェクト: kai-iak/pawtucket2
function caRepToolbar($po_request, $t_representation, $pn_object_id)
{
    $o_set_config = caGetSetsConfig();
    $vs_lightbox_icon = $o_set_config->get("add_to_lightbox_icon");
    if (!$vs_lightbox_icon) {
        $vs_lightbox_icon = "<i class='fa fa-suitcase'></i>";
    }
    $va_lightbox_display_name = caGetSetDisplayName($o_set_config);
    $vs_lightbox_display_name = $va_lightbox_display_name["singular"];
    $vs_lightbox_display_name_plural = $va_lightbox_display_name["plural"];
    $va_rep_display_info = caGetMediaDisplayInfo('detail', $t_representation->getMediaInfo('media', 'INPUT', 'MIMETYPE'));
    $va_rep_display_info['poster_frame_url'] = $t_representation->getMediaUrl('media', $va_rep_display_info['poster_frame_version']);
    $vs_tool_bar = "<div class='detailMediaToolbar'>";
    if (!$va_rep_display_info["no_overlay"]) {
        $vs_tool_bar .= "<a href='#' class='zoomButton' onclick='caMediaPanel.showPanel(\"" . caNavUrl($po_request, '', 'Detail', 'GetRepresentationInfo', array('object_id' => $pn_object_id, 'representation_id' => $t_representation->getPrimaryKey(), 'overlay' => 1)) . "\"); return false;' title='" . _t("Zoom") . "'><span class='glyphicon glyphicon-zoom-in'></span></a>\n";
    }
    if (!$po_request->config->get("disable_my_collections")) {
        if ($po_request->isLoggedIn()) {
            $vs_tool_bar .= " <a href='#' class='setsButton' onclick='caMediaPanel.showPanel(\"" . caNavUrl($po_request, '', 'Sets', 'addItemForm', array("object_id" => $pn_object_id)) . "\"); return false;' title='" . _t("Add item to %1", $vs_lightbox_display_name) . "'>" . $vs_lightbox_icon . "</a>\n";
        } else {
            $vs_tool_bar .= " <a href='#' class='setsButton' onclick='caMediaPanel.showPanel(\"" . caNavUrl($po_request, '', 'LoginReg', 'LoginForm') . "\"); return false;' title='" . _t("Login to add item to %1", $vs_lightbox_display_name) . "'>" . $vs_lightbox_icon . "</a>\n";
        }
    }
    if (caObjectsDisplayDownloadLink($po_request)) {
        # -- get version to download configured in media_display.conf
        $va_download_display_info = caGetMediaDisplayInfo('download', $t_representation->getMediaInfo('media', 'INPUT', 'MIMETYPE'));
        $vs_download_version = $va_download_display_info['display_version'];
        $vs_tool_bar .= caNavLink($po_request, " <span class='glyphicon glyphicon-download-alt'></span>", 'dlButton', 'Detail', 'DownloadRepresentation', '', array('representation_id' => $t_representation->getPrimaryKey(), "object_id" => $pn_object_id, "download" => 1, "version" => $vs_download_version), array("title" => _t("Download")));
    }
    $vs_tool_bar .= "</div><!-- end detailMediaToolbar -->\n";
    return $vs_tool_bar;
}
コード例 #16
0
ファイル: ShowController.php プロジェクト: guaykuru/pawtucket
 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');
 }
コード例 #17
0
 /**
  * Generates detail detail. Will use a view named according to the following convention:
  *		<table_name>_<type_code>_detail_html.php
  *
  * So for example, the detail for objects of type 'artwork' (where 'artwork' is the type code for the artwork object type)
  * the view would be named "ca_objects_artwork_detail_html.php
  *
  * If the type specific view does not exist, then Show() will attemp to use a generic table-wide view name like this:
  *		<table_name>_detail_html.php
  *
  * For example: "ca_objects_detail_html.php"
  *
  * In general you should always have the table wide views defined. Then you can define type-specific views for your
  * application on an as-needed basis.
  */
 public function Show($pa_options = null)
 {
     JavascriptLoadManager::register('viz');
     JavascriptLoadManager::register("ca", "panel");
     JavascriptLoadManager::register("jit");
     JavascriptLoadManager::register('browsable');
     JavascriptLoadManager::register('imageScroller');
     JavascriptLoadManager::register('jquery', 'expander');
     $va_access_values = caGetUserAccessValues($this->request);
     $this->view->setVar('access_values', $va_access_values);
     if (!($t_item = $this->opo_datamodel->getInstanceByTableName($this->ops_tablename, true))) {
         die("Invalid table name " . $this->ops_tablename . " for detail");
         // shouldn't happen
     }
     if (!($vn_item_id = $this->request->getParameter($t_item->primaryKey(), pInteger))) {
         $this->notification->addNotification(_t("Invalid ID"), "message");
         $this->response->setRedirect(caNavUrl($this->request, "", "", "", ""));
         return;
     }
     if (!$t_item->load($vn_item_id)) {
         $this->notification->addNotification(_t("ID does not exist"), "message");
         $this->response->setRedirect(caNavUrl($this->request, "", "", "", ""));
         return;
     }
     if ($t_item->hasField('deleted') && $t_item->get('deleted')) {
         $this->notification->addNotification(_t("ID has been deleted"), "message");
         $this->response->setRedirect(caNavUrl($this->request, "", "", "", ""));
         return;
     }
     // Check if item conforms to any configured display type restrictions
     if (method_exists($t_item, "getTypeID")) {
         $va_types = caMergeTypeRestrictionLists($t_item, array());
         if (is_array($va_types) && sizeof($va_types) && !in_array($t_item->getTypeID(), $va_types)) {
             $this->notification->addNotification(_t("This item is not viewable"), "message");
             $this->response->setRedirect(caNavUrl($this->request, "", "", "", ""));
             return;
         }
     }
     #
     # Enforce access control
     #
     if (sizeof($va_access_values) && !in_array($t_item->get("access"), $va_access_values)) {
         $this->notification->addNotification(_t("This item is not available for view"), "message");
         $this->response->setRedirect(caNavUrl($this->request, "", "", "", ""));
         return;
     }
     //
     // In-detail browsing of objects - limited to object linked to the item being displayed
     //
     if (($vs_browse_for_table = $this->request->config->get('allow_browse_within_detail_for_' . $this->ops_tablename)) && is_object($this->opo_browse)) {
         // set browse context for controller
         $this->setContext($this->opo_browse->getContext());
         //
         // Restrict facets to specific group for refine browse (if set in app.conf config)
         //
         if ($vs_facet_group = $this->request->config->get('ca_objects_refine_facet_group')) {
             $this->opo_browse->setFacetGroup($vs_facet_group);
         }
         $t_table = $this->opo_datamodel->getInstanceByTableName($this->ops_tablename, true);
         if ($this->request->session->getVar($this->ops_tablename . '_' . $this->ops_appname . '_detail_current_item_id') != $vn_item_id) {
             $this->opo_browse->removeAllCriteria();
         }
         // look for 'authority' facet for current detail table type so we can limit the object browse to the currently displayed item
         //$vs_limit_facet_name = null;
         //foreach($this->opo_browse->getInfoForFacets() as $vs_facet_name => $va_facet_info) {
         //	if (($va_facet_info['type'] === 'authority') && ($va_facet_info['table'] === $this->ops_tablename)) {
         //		$vs_limit_facet_name = $vs_facet_name;
         //		break;
         //	}
         //}
         $this->opo_browse->addFacetConfiguration($vs_limit_facet_name = '_detail_browse_' . $this->ops_tablename, array('type' => 'authority', 'table' => $this->ops_tablename, 'relationship_table' => 'ca_objects_x_entities', 'restrict_to_types' => array(), 'restrict_to_relationship_types' => array(), 'label_singular' => 'Detail browse by ' . $this->ops_tablename, 'label_plural' => 'Detail browse by ' . $this->ops_tablename, 'group_mode' => 'none', 'indefinite_article' => 'a'));
         if ($vs_limit_facet_name) {
             if (($va_configured_type_restrictions = $this->request->config->getList($this->ops_tablename . '_detail_browse_type_restrictions')) && is_array($va_configured_type_restrictions)) {
                 $this->opo_browse->setTypeRestrictions($va_configured_type_restrictions, array('includeChildren' => false));
             }
             $this->opo_browse->addCriteria($vs_limit_facet_name, array($vn_item_id));
             $this->opo_browse->execute(array('checkAccess' => $va_access_values));
             $this->request->session->setVar($this->ops_tablename . '_' . $this->ops_appname . '_detail_current_browse_id', $this->opo_browse->getBrowseID());
             $this->view->setVar('show_browse', true);
             //
             // Browse paging
             //
             $vn_items_per_page = $this->request->config->get("objects_per_page_for_detail_pages");
             if (!$vn_items_per_page) {
                 $vn_items_per_page = 12;
             }
             $this->view->setVar('page', ($vn_p = $this->request->getParameter('page', pInteger)) ? $vn_p : 1);
             $qr_hits = null;
             if ($this->opo_browse) {
                 $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(($vn_p - 1) * $vn_items_per_page);
             } else {
                 $vn_num_pages = 0;
             }
             $this->view->setVar('browse_results', $qr_hits);
             $this->view->setVar('num_pages', (int) $vn_num_pages);
             $this->view->setVar('items_per_page', (int) $vn_items_per_page);
             $this->view->setVar('opo_browse', $this->opo_browse);
             $this->view->setVar('sorts', $this->opa_sorts);
             // supported sorts for the object browse
             // browse criteria in an easy-to-display format
             $va_browse_criteria = array();
             foreach ($this->opo_browse->getCriteriaWithLabels() as $vs_facet_code => $va_criteria) {
                 $va_facet_info = $this->opo_browse->getInfoForFacet($vs_facet_code);
                 $va_criteria_list = array();
                 foreach ($va_criteria as $vn_criteria_id => $vs_criteria_label) {
                     $va_criteria_list[] = $vs_criteria_label;
                 }
                 $va_browse_criteria[$va_facet_info['label_singular']] = join('; ', $va_criteria_list);
             }
             $this->view->setVar('browse_criteria', $va_browse_criteria);
         } else {
             // not configured for browse
             $this->request->session->setVar($this->ops_tablename . '_' . $this->ops_appname . '_detail_current_browse_id', null);
             $this->view->setVar('show_browse', false);
         }
     }
     $this->request->session->setVar($this->ops_tablename . '_' . $this->ops_appname . '_detail_current_item_id', $vn_item_id);
     # Next and previous navigation
     $opo_result_context = new ResultContext($this->request, $this->ops_tablename, ResultContext::getLastFind($this->request, $this->ops_tablename));
     $this->view->setVar('next_id', $opo_result_context->getNextID($vn_item_id));
     $this->view->setVar('previous_id', $opo_result_context->getPreviousID($vn_item_id));
     # Is the item we're show details for in the result set?
     $this->view->setVar('is_in_result_list', $opo_result_context->getIndexInResultList($vn_item_id) != '?');
     # Item instance and id
     $this->view->setVar('t_item', $t_item);
     $this->view->setVar($t_item->getPrimaryKey(), $vn_item_id);
     # Item  - preferred
     $this->view->setVar('label', $t_item->getLabelForDisplay());
     # Item  - nonpreferred
     $this->view->setVar('nonpreferred_labels', caExtractValuesByUserLocale($t_item->getNonPreferredLabels()));
     # Item timestamps (creation and last change)
     if ($va_entry_info = $t_item->getCreationTimestamp()) {
         $this->view->setVar('date_of_entry', date('m/d/Y', $va_entry_info['timestamp']));
     }
     if ($va_last_change_info = $t_item->getLastChangeTimestamp()) {
         $this->view->setVar('date_of_last_change', date('m/d/Y', $va_last_change_info['timestamp']));
     }
     # Media representations to display (objects only)
     if (method_exists($t_item, 'getPrimaryRepresentationInstance')) {
         if ($t_primary_rep = $t_item->getPrimaryRepresentationInstance()) {
             if (!sizeof($va_access_values) || in_array($t_primary_rep->get('access'), $va_access_values)) {
                 // check rep access
                 $this->view->setVar('t_primary_rep', $t_primary_rep);
                 $va_rep_display_info = caGetMediaDisplayInfo('detail', $t_primary_rep->getMediaInfo('media', 'INPUT', 'MIMETYPE'));
                 $this->view->setVar('primary_rep_display_version', $va_rep_display_info['display_version']);
                 unset($va_display_info['display_version']);
                 $va_rep_display_info['poster_frame_url'] = $t_primary_rep->getMediaUrl('media', $va_rep_display_info['poster_frame_version']);
                 unset($va_display_info['poster_frame_version']);
                 $this->view->setVar('primary_rep_display_options', $va_rep_display_info);
             }
         }
     }
     #
     # User-generated comments, tags and ratings
     #
     $va_user_comments = $t_item->getComments(null, true);
     $va_comments = array();
     if (is_array($va_user_comments)) {
         foreach ($va_user_comments as $va_user_comment) {
             if ($va_user_comment["comment"] || $va_user_comment["media1"] || $va_user_comment["media2"] || $va_user_comment["media3"] || $va_user_comment["media4"]) {
                 # TODO: format date based on locale
                 $va_user_comment["date"] = date("n/j/Y", $va_user_comment["created_on"]);
                 # -- get name of commenter
                 $t_user = new ca_users($va_user_comment["user_id"]);
                 $va_user_comment["author"] = $t_user->getName();
                 $va_comments[] = $va_user_comment;
             }
         }
     }
     $this->view->setVar('comments', $va_comments);
     $va_user_tags = $t_item->getTags(null, true);
     $va_tags = array();
     if (is_array($va_user_tags)) {
         foreach ($va_user_tags as $va_user_tag) {
             if (!in_array($va_user_tag["tag"], $va_tags)) {
                 $va_tags[] = $va_user_tag["tag"];
             }
         }
     }
     $this->view->setVar('tags_array', $va_tags);
     $this->view->setVar('tags', implode(", ", $va_tags));
     $this->view->setVar('result_context', $opo_result_context);
     # -- get average user ranking
     $this->view->setVar('ranking', $t_item->getAverageRating(null));
     // null makes it ignore moderation status
     # -- get number of user rankings
     $this->view->setVar('numRankings', $t_item->getNumRatings(null));
     // null makes it ignore moderation status
     #
     # Miscellaneous useful information
     #
     $this->view->setVar('t_relationship_types', new ca_relationship_types());
     // relationship types object - used for displaying relationship type of related authority information
     if (method_exists($t_item, 'getTypeName')) {
         $this->view->setVar('typename', $t_item->getTypeName());
     }
     // Record view
     $t_item->registerItemView($this->request->getUserID());
     //
     // Render view
     //
     if (isset($pa_options['view']) && $pa_options['view']) {
         $this->render($pa_options['view']);
     } else {
         if ($this->getView()->viewExists($this->ops_tablename . '_' . $t_item->getTypeCode() . '_detail_html.php')) {
             $this->render($this->ops_tablename . '_' . $t_item->getTypeCode() . '_detail_html.php');
         } else {
             $this->render($this->ops_tablename . '_detail_html.php');
         }
     }
 }
コード例 #18
0
				<div class='repNav'>
<?php 
        if ($vn_id = $this->getVar('previous_representation_id')) {
            print "<a href='#' onClick='jQuery(\"#{$vs_container_id}\").load(\"" . caNavUrl($this->request, '*', '*', $this->request->getAction(), array('representation_id' => (int) $vn_id, $t_subject->primaryKey() => (int) $t_subject->getPrimaryKey())) . "\");'>←</a>";
        }
        if (sizeof($va_reps) > 1) {
            print ' ' . _t("%1 of %2", $this->getVar('representation_index'), sizeof($va_reps)) . ' ';
        }
        if ($vn_id = $this->getVar('next_representation_id')) {
            print "<a href='#' onClick='jQuery(\"#{$vs_container_id}\").load(\"" . caNavUrl($this->request, '*', '*', $this->request->getAction(), array('representation_id' => (int) $vn_id, $t_subject->primaryKey() => (int) $t_subject->getPrimaryKey())) . "\");'>→</a>";
        }
        ?>
				</div>
<?php 
        if ($vb_use_media_editor) {
            $va_display_info = caGetMediaDisplayInfo($vs_display_type, $t_rep->getMediaInfo('media', 'INPUT', 'MIMETYPE'));
            if (isset($va_display_info['editing_tools']) && is_array($va_tool_views = $va_display_info['editing_tools'])) {
                foreach ($va_tool_views as $vs_tool_view) {
                    $this->addViewPath($this->request->getThemeDirectoryPath() . "/bundles");
                    print $this->render("representation_media_editor/{$vs_tool_view}_html.php");
                }
            }
            ?>

<?php 
        }
    }
    ?>
	</div><!-- end caMediaOverlayControls -->
<?php 
}
コード例 #19
0
ファイル: displayHelpers.php プロジェクト: kai-iak/providence
/**
 * Return rendered HTML for media viewer for both re
 *
 * @param RequestHTTP $po_request
 * @param array $pa_options
 * @param array $pa_additional_display_options
 * @return string HTML output
 */
function caGetMediaViewerHTMLBundle($po_request, $pa_options = null, $pa_additional_display_options = null)
{
    $va_access_values = isset($pa_options['access']) && is_array($pa_options['access']) ? $pa_options['access'] : array();
    $vs_display_type = isset($pa_options['display']) && $pa_options['display'] ? $pa_options['display'] : 'media_overlay';
    $vs_container_dom_id = isset($pa_options['containerID']) && $pa_options['containerID'] ? $pa_options['containerID'] : null;
    $t_subject = isset($pa_options['t_subject']) && $pa_options['t_subject'] ? $pa_options['t_subject'] : null;
    $t_rep = isset($pa_options['t_representation']) && $pa_options['t_representation'] ? $pa_options['t_representation'] : null;
    $vn_representation_id = $t_rep ? $t_rep->getPrimaryKey() : null;
    $t_attr_val = isset($pa_options['t_attribute_value']) && $pa_options['t_attribute_value'] ? $pa_options['t_attribute_value'] : null;
    $vn_value_id = $t_attr_val ? $t_attr_val->getPrimaryKey() : null;
    $vn_item_id = isset($pa_options['item_id']) && $pa_options['item_id'] ? $pa_options['item_id'] : null;
    $vn_order_item_id = isset($pa_options['order_item_id']) && $pa_options['order_item_id'] ? $pa_options['order_item_id'] : null;
    $vb_media_editor = isset($pa_options['mediaEditor']) && $pa_options['mediaEditor'] ? true : false;
    $vb_no_controls = isset($pa_options['noControls']) && $pa_options['noControls'] ? true : false;
    $vn_item_id = isset($pa_options['item_id']) && $pa_options['item_id'] ? $pa_options['item_id'] : null;
    $vn_subject_id = $t_subject ? $t_subject->getPrimaryKey() : null;
    if (!$vn_value_id && !$vn_representation_id) {
        $t_rep->load($t_subject->getPrimaryRepresentationID(array('checkAccess' => $va_access_values)));
    }
    $o_view = new View($po_request, $po_request->getViewsDirectoryPath() . '/bundles/');
    $t_set_item = new ca_set_items();
    if ($vn_item_id) {
        $t_set_item->load($vn_item_id);
    }
    $t_order_item = new ca_commerce_order_items();
    if ($vn_order_item_id) {
        $t_order_item->load($vn_order_item_id);
    }
    $o_view->setVar('containerID', $vs_container_dom_id);
    $o_view->setVar('t_subject', $t_subject);
    $o_view->setVar('t_representation', $t_rep);
    if ($vn_representation_id && (!sizeof($va_access_values) || in_array($t_rep->get('access'), $va_access_values))) {
        // check rep access
        $va_rep_display_info = caGetMediaDisplayInfo($vs_display_type, $t_rep->getMediaInfo('media', 'INPUT', 'MIMETYPE'));
        $va_rep_display_info['poster_frame_url'] = $t_rep->getMediaUrl('media', $va_rep_display_info['poster_frame_version']);
        $o_view->setVar('num_multifiles', $t_rep->numFiles());
        if (isset($pa_options['use_book_viewer'])) {
            $va_rep_display_info['use_book_viewer'] = (bool) $pa_options['use_book_viewer'];
        }
        $o_view->setVar('display_type', $vs_display_type);
        if (is_array($pa_additional_display_options)) {
            $va_rep_display_info = array_merge($va_rep_display_info, $pa_additional_display_options);
        }
        $o_view->setVar('display_options', $va_rep_display_info);
        $o_view->setVar('representation_id', $vn_representation_id);
        $o_view->setVar('versions', $va_versions = $t_rep->getMediaVersions('media'));
        $t_media = new Media();
        $o_view->setVar('version_type', $t_media->getMimetypeTypename($t_rep->getMediaInfo('media', 'original', 'MIMETYPE')));
        if ($vn_subject_id) {
            $o_view->setVar('reps', $va_reps = $t_subject->getRepresentations(array('icon'), null, array("return_with_access" => $va_access_values)));
            $vn_next_rep = $vn_prev_rep = null;
            $va_rep_list = array_values($va_reps);
            foreach ($va_rep_list as $vn_i => $va_rep) {
                if ($va_rep['representation_id'] == $vn_representation_id) {
                    if (isset($va_rep_list[$vn_i - 1])) {
                        $vn_prev_rep = $va_rep_list[$vn_i - 1]['representation_id'];
                    }
                    if (isset($va_rep_list[$vn_i + 1])) {
                        $vn_next_rep = $va_rep_list[$vn_i + 1]['representation_id'];
                    }
                    $o_view->setVar('representation_index', $vn_i + 1);
                }
            }
            $o_view->setVar('previous_representation_id', $vn_prev_rep);
            $o_view->setVar('next_representation_id', $vn_next_rep);
        }
        $ps_version = $po_request->getParameter('version', pString);
        if (!in_array($ps_version, $va_versions)) {
            if (!($ps_version = $va_rep_display_info['display_version'])) {
                $ps_version = null;
            }
        }
        $o_view->setVar('version', $ps_version);
        $o_view->setVar('version_info', $t_rep->getMediaInfo('media', $ps_version));
        $o_view->setVar('t_set_item', $t_set_item);
        $o_view->setVar('t_order_item', $t_order_item);
        $o_view->setVar('use_media_editor', $vb_media_editor);
        $o_view->setVar('noControls', $vb_no_controls);
    } else {
        //$t_attr = new ca_attributes($t_attr_val->get('attribute_id'));
        $t_attr_val->useBlobAsMediaField(true);
        $va_rep_display_info = caGetMediaDisplayInfo($vs_display_type, $t_attr_val->getMediaInfo('value_blob', 'INPUT', 'MIMETYPE'));
        $va_rep_display_info['poster_frame_url'] = $t_attr_val->getMediaUrl('value_blob', $va_rep_display_info['poster_frame_version']);
        $o_view->setVar('num_multifiles', $t_attr_val->numFiles());
        if (isset($pa_options['use_book_viewer'])) {
            $va_rep_display_info['use_book_viewer'] = (bool) $pa_options['use_book_viewer'];
        }
        $o_view->setVar('display_type', $vs_display_type);
        if (is_array($pa_additional_display_options)) {
            $va_rep_display_info = array_merge($va_rep_display_info, $pa_additional_display_options);
        }
        $o_view->setVar('display_options', $va_rep_display_info);
        $o_view->setVar('representation_id', $vn_representation_id);
        $o_view->setVar('t_attribute_value', $t_attr_val);
        $o_view->setVar('versions', $va_versions = $t_attr_val->getMediaVersions('value_blob'));
        $t_media = new Media();
        $o_view->setVar('version_type', $t_media->getMimetypeTypename($t_attr_val->getMediaInfo('value_blob', 'original', 'MIMETYPE')));
        $o_view->setVar('reps', array());
        $ps_version = $po_request->getParameter('version', pString);
        if (!in_array($ps_version, $va_versions)) {
            if (!($ps_version = $va_rep_display_info['display_version'])) {
                $ps_version = null;
            }
        }
        $o_view->setVar('version', $ps_version);
        $o_view->setVar('version_info', $t_attr_val->getMediaInfo('value_blob', $ps_version));
        $o_view->setVar('t_subject', $t_subject);
        $o_view->setVar('t_set_item', $t_set_item);
        $o_view->setVar('t_order_item', $t_order_item);
        $o_view->setVar('use_media_editor', $vb_media_editor);
        $o_view->setVar('noControls', $vb_no_controls);
    }
    return $o_view->render('representation_viewer_html.php');
}
コード例 #20
0
 /**
  * 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");
 }