本文整理汇总了PHP中ca_objects::getRepresentations方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_objects::getRepresentations方法的具体用法?PHP ca_objects::getRepresentations怎么用?PHP ca_objects::getRepresentations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_objects
的用法示例。
在下文中一共展示了ca_objects::getRepresentations方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: caRepresentationViewerHTMLBundle
/**
*
*
* @param RequestHTTP $po_request
* @param array $pa_options
* @param array $pa_additional_display_options
* @return string HTML output
*/
function caRepresentationViewerHTMLBundle($po_data, $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;
$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)));
}
$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_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, $po_data->getMediaInfo('media', 'INPUT', 'MIMETYPE'));
$va_rep_display_info['poster_frame_url'] = $po_data->getMediaUrl('media', $va_rep_display_info['poster_frame_version']);
if (method_exists($po_data, 'numFiles')) {
$o_view->setVar('num_multifiles', $po_data->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_object_representation', $po_data);
$o_view->setVar('versions', $va_versions = $po_data->getMediaVersions('media'));
$t_media = new Media();
$o_view->setVar('version_type', $t_media->getMimetypeTypename($po_data->getMediaInfo('media', 'original', 'MIMETYPE')));
if ($t_object->getPrimaryKey()) {
$o_view->setVar('reps', $va_reps = $t_object->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', $po_data->getMediaInfo('media', $ps_version));
$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);
}
return $o_view->render('representation_viewer_html.php');
}
示例2: DownloadMedia
/**
* Download all media attached to specified object (not necessarily open for editing)
* Includes all representation media attached to the specified object + any media attached to oter
* objects in the same object hierarchy as the specified object. Used by the book viewer interfacce to
* initiate a download.
*/
public function DownloadMedia()
{
if (!caObjectsDisplayDownloadLink($this->request)) {
$this->postError(1100, _t('Cannot download media'), 'DetailController->DownloadMedia');
return;
}
$pn_object_id = $this->request->getParameter('object_id', pInteger);
$t_object = new ca_objects($pn_object_id);
if (!($vn_object_id = $t_object->getPrimaryKey())) {
return;
}
$ps_version = $this->request->getParameter('version', pString);
if (!$ps_version) {
$ps_version = 'original';
}
$this->view->setVar('version', $ps_version);
$va_ancestor_ids = $t_object->getHierarchyAncestors(null, array('idsOnly' => true, 'includeSelf' => true));
if ($vn_parent_id = array_pop($va_ancestor_ids)) {
$t_object->load($vn_parent_id);
array_unshift($va_ancestor_ids, $vn_parent_id);
}
$va_child_ids = $t_object->getHierarchyChildren(null, array('idsOnly' => true));
foreach ($va_ancestor_ids as $vn_id) {
array_unshift($va_child_ids, $vn_id);
}
$vn_c = 1;
$va_file_names = array();
$va_file_paths = array();
foreach ($va_child_ids as $vn_object_id) {
$t_object = new ca_objects($vn_object_id);
if (!$t_object->getPrimaryKey()) {
continue;
}
$va_reps = $t_object->getRepresentations(array($ps_version));
$vs_idno = $t_object->get('idno');
foreach ($va_reps as $vn_representation_id => $va_rep) {
$va_rep_info = $va_rep['info'][$ps_version];
$vs_idno_proc = preg_replace('![^A-Za-z0-9_\\-]+!', '_', $vs_idno);
switch ($this->request->user->getPreference('downloaded_file_naming')) {
case 'idno':
$vs_file_name = $vs_idno_proc . '_' . $vn_c . '.' . $va_rep_info['EXTENSION'];
break;
case 'idno_and_version':
$vs_file_name = $vs_idno_proc . '_' . $ps_version . '_' . $vn_c . '.' . $va_rep_info['EXTENSION'];
break;
case 'idno_and_rep_id_and_version':
$vs_file_name = $vs_idno_proc . '_representation_' . $vn_representation_id . '_' . $ps_version . '.' . $va_rep_info['EXTENSION'];
break;
case 'original_name':
default:
if ($va_rep['info']['original_filename']) {
$va_tmp = explode('.', $va_rep['info']['original_filename']);
if (sizeof($va_tmp) > 1) {
if (strlen($vs_ext = array_pop($va_tmp)) < 3) {
$va_tmp[] = $vs_ext;
}
}
$vs_file_name = join('_', $va_tmp);
} else {
$vs_file_name = $vs_idno_proc . '_representation_' . $vn_representation_id . '_' . $ps_version;
}
if (isset($va_file_names[$vs_file_name . '.' . $va_rep_info['EXTENSION']])) {
$vs_file_name .= "_{$vn_c}";
}
$vs_file_name .= '.' . $va_rep_info['EXTENSION'];
break;
}
$va_file_names[$vs_file_name] = true;
$this->view->setVar('version_download_name', $vs_file_name);
//
// Perform metadata embedding
$t_rep = new ca_object_representations($va_rep['representation_id']);
if (!($vs_path = caEmbedMetadataIntoRepresentation($t_object, $t_rep, $ps_version))) {
$vs_path = $t_rep->getMediaPath('media', $ps_version);
}
$va_file_paths[$vs_path] = $vs_file_name;
$vn_c++;
}
}
if (sizeof($va_file_paths) > 1) {
if (!($vn_limit = ini_get('max_execution_time'))) {
$vn_limit = 30;
}
set_time_limit($vn_limit * 2);
$o_zip = new ZipFile();
foreach ($va_file_paths as $vs_path => $vs_name) {
$o_zip->addFile($vs_path, $vs_name, null, array('compression' => 0));
// don't try to compress
}
$this->view->setVar('archive_path', $vs_path = $o_zip->output(ZIPFILE_FILEPATH));
$this->view->setVar('archive_name', preg_replace('![^A-Za-z0-9\\.\\-]+!', '_', $t_object->get('idno')) . '.zip');
$this->response->sendHeaders();
$vn_rc = $this->render('Details/object_download_media_binary.php');
$this->response->sendContent();
//.........这里部分代码省略.........
示例3: media
/**
*
*/
public function media()
{
if (!is_object($t_entity = $this->_checkEntity())) {
return $t_entity;
}
$vn_id = $t_entity->getPrimaryKey();
$t_list = new ca_lists();
$vn_exhibition_audio_type_id = $t_list->getItemIDFromList('object_types', 'MemEx_Audio');
$vs_filter = $this->opo_request->getParameter('filter', pString);
if (!in_array($vs_filter, array('video', 'audio', 'image', 'pdf'))) {
$vs_filter = null;
}
$t_object = new ca_objects();
$va_data = array('id' => $vn_id);
$from = $this->opo_request->getParameter('from', pString);
$until = $this->opo_request->getParameter('until', pString);
if (!$until) {
$until = date('c');
}
$vs_range = $from && $until ? self::utcToDb($from) . ' to ' . self::utcToDb($until) : null;
$o_tep = new TimeExpressionParser();
$vb_parsed_date = false;
if ($vs_range) {
if ($vb_parsed_date = $o_tep->parse($vs_range)) {
$va_range = $o_tep->getUnixTimestamps();
}
}
$t_rep = new ca_object_representations();
$t_list = new ca_lists();
$va_pub_target_values = $t_list->getItemsForList('object_publication_targets', array('extractValuesByUserLocale' => true));
$va_audio_target_values = $t_list->getItemsForList('audio_publication_targets', array('extractValuesByUserLocale' => true));
$vn_memorial_exhibition_audio_type_id = $t_list->getItemIDFromList('object_types', 'MemEx_Audio');
$vn_publish_annotation_id = $t_list->getItemIDFromList('annotation_publication_targets', 'interactive_tables');
$vn_publish_rep = $t_list->getItemIDFromList("memex_status", "publish");
$va_objects = $t_entity->getRelatedItems('ca_objects');
foreach ($va_objects as $vn_relation_id => $va_object_info) {
$va_timestamp = $t_object->getLastChangeTimestamp($va_object_info['object_id']);
if ($vb_parsed_date && ($va_timestamp['timestamp'] <= $va_range['start'] || $va_timestamp['timestamp'] >= $va_range['end'])) {
continue;
}
if ($t_object->load($va_object_info['object_id'])) {
$va_reps = $t_object->getRepresentations(array("preview", "preview170", "icon", "small", "medium", "large", "large_png", "original", "h264_hi", "mp3"));
if (!is_array($va_reps) || !sizeof($va_reps)) {
continue;
}
$va_filtered_reps = array();
foreach ($va_reps as $vn_i => $va_rep) {
$va_tmp = explode('/', $vs_mimetype = $va_rep['info']['original']['MIMETYPE']);
if ($vs_filter && ($va_tmp[0] != $vs_filter && $va_tmp[1] != $vs_filter)) {
continue;
}
$vb_is_audio = false;
if ($t_object->get('type_id') == $vn_memorial_exhibition_audio_type_id) {
$va_pub_targets = $t_object->get('ca_objects.audio_publication_targets', array('returnAsArray' => true, 'convertCodesToDisplayText' => false));
$vb_is_audio = true;
} else {
$va_pub_targets = $t_object->get('ca_objects.object_publication_targets', array('returnAsArray' => true, 'convertCodesToDisplayText' => false));
}
if (!sizeof($va_pub_targets)) {
continue;
}
if (!$t_rep->load($va_rep['representation_id'])) {
continue;
}
if ($t_rep->get("ca_object_representations.memex_status", array('convertCodesToDisplayText' => false)) != $vn_publish_rep) {
continue;
}
// reset filesize property to reflect size of version, not size of original
foreach ($va_reps[$vn_i]['paths'] as $vs_version => $vs_path) {
$va_reps[$vn_i]['info'][$vs_version]['PROPERTIES']['filesize'] = @filesize($va_reps[$vn_i]['paths'][$vs_version]);
}
unset($va_reps[$vn_i]['paths']);
unset($va_reps[$vn_i]['tags']);
unset($va_reps[$vn_i]['media']);
unset($va_reps[$vn_i]['media_metadata']);
unset($va_reps[$vn_i]['is_primary']);
unset($va_reps[$vn_i]['name']);
unset($va_reps[$vn_i]['status']);
unset($va_reps[$vn_i]['locale_id']);
unset($va_reps[$vn_i]['type_id']);
$va_reps[$vn_i]['lastupdate_timestamp'] = date('o-m-N', $va_timestamp['timestamp']) . "T" . date('H:i:s', $va_timestamp['timestamp']) . "Z";
//date('c', $va_timestamp['timestamp']);
$va_reps[$vn_i]['type_id'] = $vn_type_id = $t_object->get('ca_objects.type_id');
$va_reps[$vn_i]['typename'] = $t_object->getTypeName();
$va_reps[$vn_i]['typecode'] = $t_object->getTypeCode();
$va_targets = array();
foreach ($va_pub_targets as $vn_attr_id => $va_value) {
$va_targets[] = $va_pub_target_values[$va_value['object_publication_targets']]['idno'] ? $va_pub_target_values[$va_value['object_publication_targets']]['idno'] : $va_audio_target_values[$va_value['audio_publication_targets']]['idno'];
}
$va_reps[$vn_i]['publication_targets'] = $va_targets;
$va_reps[$vn_i]['title'] = $t_object->get('ca_objects.memex_title');
$va_reps[$vn_i]['credit'] = $t_object->get('ca_objects.memex_credit_line');
$va_reps[$vn_i]['caption'] = $t_object->get('ca_objects.memex_caption');
if ($t_object->get('type_id') == $vn_exhibition_audio_type_id) {
$va_reps[$vn_i]['transcript'] = $t_object->get('ca_objects.final_text_inner_chamber');
$va_reps[$vn_i]['attribution'] = $t_object->get('ca_objects.remembrance_attribution');
}
//.........这里部分代码省略.........
示例4: Download
/**
*
*/
public function Download()
{
$pn_item_id = $this->request->getParameter('item_id', pInteger);
$t_item = new ca_commerce_order_items($pn_item_id);
$t_order = new ca_commerce_orders($t_item->get('order_id'));
$t_transaction = new ca_commerce_transactions($t_order->get('transaction_id'));
$o_media = new Media();
if ($t_item->getPrimaryKey() && $t_order->getPrimaryKey()) {
// Is the order paid for...
if (!in_array($t_order->get('order_status'), array('PROCESSED', 'PROCESSED_AWAITING_DIGITIZATION', 'COMPLETED'))) {
$this->notification->addNotification(_t("This order must be processed before you can download items"), __NOTIFICATION_TYPE_ERROR__);
$this->Index();
return;
}
// ... and accessible by this user?
if ($t_transaction->get('user_id') != $this->request->getUserID()) {
$this->notification->addNotification(_t("You may not download this item"), __NOTIFICATION_TYPE_ERROR__);
$this->Index();
return;
}
// Is this item downloadable?
if ($t_item->get('fullfillment_method') != 'DOWNLOAD') {
$this->notification->addNotification(_t("This item cannot be downloaded"), __NOTIFICATION_TYPE_ERROR__);
$this->Index();
return;
}
// Which reps, and what versions?
$t_object = new ca_objects($t_item->get('object_id'));
$va_services_list = array();
if (is_array($va_service_groups = $this->opo_client_services_config->getAssoc("service_groups"))) {
foreach ($va_service_groups as $vs_group => $va_services_in_group) {
foreach ($va_services_in_group['services'] as $vs_service => $va_service_info) {
$va_services_list[$vs_service] = $va_service_info;
}
}
}
if (!($vs_version = $va_services_list[$t_item->get('service')]['download_version'])) {
$vs_version = 'small';
}
$va_reps = $t_object->getRepresentations(array($vs_version));
$va_reps_to_download = $t_item->getRepresentationIDs();
$o_zip = new ZipFile();
$va_files = array();
$vn_size = 0;
foreach ($va_reps as $va_rep) {
if (!isset($va_reps_to_download[$va_rep['representation_id']]) || !$va_reps_to_download[$va_rep['representation_id']]) {
continue;
}
$va_tmp = explode('.', $va_rep['paths'][$vs_version]);
$vs_ext = array_pop($va_tmp);
if ($va_rep['original_filename']) {
$va_tmp2 = explode(".", $va_rep['original_filename']);
if (sizeof($va_tmp2) > 1) {
array_pop($va_tmp2);
}
$vs_filename = join(".", $va_tmp2) . ".{$vs_ext}";
} else {
$vs_filename = $t_object->get('idno') . "_" . $va_rep['representation_id'] . ".{$vs_ext}";
}
$vn_size += $va_files[$va_rep['paths'][$vs_version]] = filesize($va_rep['paths'][$vs_version]);
$o_zip->addFile($va_rep['paths'][$vs_version], $vs_filename, 0, array('compression' => 0));
}
$this->view->setVar('zip', $o_zip);
$this->view->setVar('version_download_name', date('dmY', $t_order->get('created_on', array('GET_DIRECT_DATE' => true))) . '-' . $t_order->getPrimaryKey());
// Log fulfillment
$t_item->logFulfillmentEvent('DOWNLOAD', array('ip_addr' => $_SERVER['REMOTE_ADDR'], 'user_id' => $this->request->getUserID(), 'datetime' => time(), 'user_agent' => $_SERVER['HTTP_USER_AGENT'], 'files' => $va_files, 'size' => $vn_size, 'representation_ids' => $va_reps_to_download));
return $this->render('Account/download_binary.php');
}
$this->notification->addNotification(_t("You may not download this"), __NOTIFICATION_TYPE_ERROR__);
$this->Index();
return;
}
示例5: BlankWorksheet
public function BlankWorksheet()
{
# --- used for back button
$pn_occurrence_id = $this->request->getParameter('occurrence_id', pInteger);
$this->view->setVar("occurrence_id", $pn_occurrence_id);
$t_occurrence = new ca_occurrences($pn_occurrence_id);
$pn_relation_id = $this->request->getParameter('relation_id', pInteger);
$this->view->setVar("relation_id", $pn_relation_id);
$t_objects_x_occurrences = new ca_objects_x_occurrences($pn_relation_id);
$t_object = new ca_objects($t_objects_x_occurrences->get("object_id"));
# --- get the images
$va_reps = $t_object->getRepresentations(array("medium"));
$va_images = array();
if (is_array($va_reps)) {
foreach ($va_reps as $vn_i => $va_rep) {
$va_rep["representation_id"];
$va_images[$va_rep["representation_id"]] = $va_rep["tags"]["medium"];
}
}
$this->view->setVar("images", $va_images);
$t_lists = new ca_lists();
$vn_original_date = $t_lists->getItemIDFromList("date_types", "dateOriginal");
$vs_image_info = "<div style='font-size:11px; font-style:italic;'>" . $t_objects_x_occurrences->get("ca_objects.preferred_labels.name");
if ($va_dates = $t_objects_x_occurrences->get("ca_objects.date", array("returnAsArray" => true))) {
foreach ($va_dates as $va_date_info) {
if ($va_date_info["dc_dates_types"] == $vn_original_date) {
$vs_image_info .= ", " . $va_date_info["dates_value"];
}
}
}
if ($t_objects_x_occurrences->get("ca_objects.repository")) {
$vs_image_info .= ", " . $t_objects_x_occurrences->get("ca_objects.repository", array('delimiter' => ', ', 'convertCodesToDisplayText' => true));
}
$vs_image_info .= ", " . $t_objects_x_occurrences->get("ca_objects.idno") . "</div>";
$this->view->setVar("image_info", $vs_image_info);
# --- try to get the tranlation/transcription for the rep your making the blank worksheet for
# --- those fields can be on either the occurrence or ca_object_x_occurrences record
$vs_translation = "";
if ($t_occurrence->get("translation")) {
$vs_translation = $t_occurrence->get("translation");
} elseif ($t_objects_x_occurrences->get("translation")) {
$vs_translation = $t_objects_x_occurrences->get("translation");
}
$this->view->setVar("translation", $vs_translation);
$vs_transcription = "";
if ($t_occurrence->get("ca_occurrences.transcription")) {
$vs_transcription = $t_occurrence->get("ca_occurrences.transcription");
} elseif ($t_objects_x_occurrences->get("ca_objects_x_occurrences.transcription")) {
$vs_transcription = $t_objects_x_occurrences->get("ca_objects_x_occurrences.transcription");
}
$this->view->setVar("transcription", $vs_transcription);
# --- attributes used in worksheets
# --- these will be displayed as title and form elements so user can enter their own text
$this->view->setVar("worksheet_attributes", $this->opa_worksheet_attributes);
$this->render('nysa/customize_worksheet_html.php');
}