コード例 #1
0
 public function Info($pa_parameters)
 {
     parent::info($pa_parameters);
     $vn_item_id = isset($pa_parameters['item_id']) ? $pa_parameters['item_id'] : null;
     $t_set_item = new ca_set_items($vn_item_id);
     $this->view->setVar('t_set', $t_set = new ca_sets($t_set_item->get('set_id')));
     if ($t_set_item->getPrimaryKey()) {
         $t_row_instance = $this->opo_datamodel->getInstanceByTableNum($t_set->get('table_num'), true);
         $t_row_instance->load($t_set_item->get('row_id'));
         $this->view->setVar('t_row_instance', $t_row_instance);
     }
     return $this->render('widget_set_item_info_html.php', true);
 }
コード例 #2
0
$q_set_items = $this->getVar("result");
$t_set = $this->getVar("set");
$vb_write_access = $this->getVar("write_access");
$va_lightbox_display_name = caGetSetDisplayName();
$vs_lightbox_display_name = $va_lightbox_display_name["singular"];
$vs_lightbox_display_name_plural = $va_lightbox_display_name["plural"];
$vn_object_table_num = $this->request->datamodel->getTableNum("ca_objects");
$vn_hits_per_block = (int) $this->getVar('hits_per_block');
// number of hits to display per block
?>
			<div class="row" id="sortable">
<?php 
if ($q_set_items->numHits()) {
    $vn_c = 0;
    while ($q_set_items->nextHit() && $vn_c < $vn_hits_per_block) {
        $t_set_item = new ca_set_items(array("row_id" => $q_set_items->get("object_id"), "set_id" => $t_set->get("set_id"), "table_num" => $vn_object_table_num));
        if ($t_set_item->get("item_id")) {
            print "<div class='col-xs-6 col-sm-4 col-md-3 col-lg-3 lbItem" . $t_set_item->get("item_id") . "' id='row-" . $q_set_items->get("object_id") . "'><div class='lbItemContainer'>";
            print caLightboxSetDetailItem($this->request, $q_set_items, $t_set_item, array("write_access" => $vb_write_access));
            print "</div></div><!-- end col 3 -->";
            $vn_c++;
        }
    }
} else {
    print "<div class='col-sm-12'>" . _t("There are no items in this %1", $vs_lightbox_display_name) . "</div>";
}
?>
			</div><!-- end row -->
<?php 
if ($vb_write_access) {
    ?>
コード例 #3
0
ファイル: ca_sets.php プロジェクト: kai-iak/providence
 /**
  * Returns information on items in current set
  *
  * @param array $pa_options Optional array of options. Supported options are:
  *			user_id = user_id of the current user; used to determine what may be shown
  *			thumbnailVersions = A list of of a media versions to return with each item. Only used if the set content type is ca_objects.
  *			thumbnailVersion = Same as 'thumbnailVersions' except it is a single value. (Maintained for compatibility with older code.)
  *			limit = Limits the total number of records to be returned
  *			checkAccess = An array of row-level access values to check set members for, often produced by the caGetUserAccessValues() helper. Set members with access values not in the list will be omitted. If this option is not set or left null no access checking is done.
  *			returnRowIdsOnly = If true a simple array of row_ids (keys of the set members) for members of the set is returned rather than full item-level info for each set member. IDs are keys in the returned array.
  *			returnItemIdsOnly = If true a simple array of item_ids (keys for the ca_set_items rows themselves) is returned rather than full item-level info for each set member.
  *			returnItemAttributes = A list of attribute element codes for the ca_set_item record to return values for.
  *			idsOnly = Return a simple numerically indexed array of row_ids
  * 			template =
  *
  * @return array An array of items. The format varies depending upon the options set. If returnRowIdsOnly or returnItemIdsOnly are set then the returned array is a 
  *			simple list of ids. The full return array is key'ed on ca_set_items.item_id and then on locale_id. The values are arrays with keys set to a number of fields including:
  *			set_id, item_id, row_id, rank, label_id, locale_id, caption (from the ca_set_items label), all instrinsic field content from the row_id, the display label of the row
  *			as 'set_item_label'. 
  *			If 'thumbnailVersion' is set then additional keys will be available for the selected media version:
  *				representation_tag, representation_url, representation_width and representation_height (the HTML tag, URL, pixel width and pixel height of the representation respectively)
  *			If 'thumbnailVersions' is set then additional keys will be available for the selected media versions:
  *				representation_tag_<version_name>, representation_url_<version_name>, representation_width_<version_name> and representation_height_<version_name> (the HTML tag, URL, pixel width and pixel height of the representation respectively)
  *			If 'returnItemAttributes' is set then there will be an additional key for each element_code prefixed with 'ca_attribute_' to ensure it doesn't conflict with any other key in the array.		
  *			
  */
 public function getItems($pa_options = null)
 {
     if (!($vn_set_id = $this->getPrimaryKey())) {
         return null;
     }
     if (!is_array($pa_options)) {
         $pa_options = array();
     }
     if ($pa_options['user_id'] && !$this->haveAccessToSet($pa_options['user_id'], __CA_SET_READ_ACCESS__)) {
         return false;
     }
     $o_db = $this->getDb();
     $o_dm = $this->getAppDatamodel();
     $t_rel_label_table = null;
     if (!($t_rel_table = $o_dm->getInstanceByTableNum($this->get('table_num'), true))) {
         return null;
     }
     if (method_exists($t_rel_table, 'getLabelTableName')) {
         if ($vs_label_table_name = $t_rel_table->getLabelTableName()) {
             $t_rel_label_table = $o_dm->getInstanceByTableName($vs_label_table_name, true);
         }
     }
     $vs_label_join_sql = '';
     if ($t_rel_label_table) {
         if ($t_rel_label_table->hasField("is_preferred")) {
             $vs_preferred_sql = " AND rel_label.is_preferred = 1 ";
         }
         $vs_label_join_sql = "LEFT JOIN " . $t_rel_label_table->tableName() . " AS rel_label ON rel." . $t_rel_table->primaryKey() . " = rel_label." . $t_rel_table->primaryKey() . " {$vs_preferred_sql}\n";
     }
     $vs_limit_sql = '';
     if (isset($pa_options['limit']) && $pa_options['limit'] > 0) {
         $vs_limit_sql = "LIMIT " . $pa_options['limit'];
     }
     // get set items
     $vs_access_sql = '';
     if (isset($pa_options['checkAccess']) && is_array($pa_options['checkAccess']) && sizeof($pa_options['checkAccess']) && $t_rel_table->hasField('access')) {
         $vs_access_sql = ' AND rel.access IN (' . join(',', $pa_options['checkAccess']) . ')';
     }
     $vs_deleted_sql = '';
     if ($t_rel_table->hasField('deleted')) {
         $vs_deleted_sql = ' AND rel.deleted = 0';
     }
     $va_representation_counts = array();
     $vs_rep_join_sql = $vs_rep_where_sql = $vs_rep_select = '';
     if ($t_rel_table->tableName() === 'ca_objects' && (isset($pa_options['thumbnailVersion']) || isset($pa_options['thumbnailVersions']))) {
         $vs_rep_join_sql = "LEFT JOIN ca_objects_x_object_representations AS coxor ON rel.object_id = coxor.object_id\nLEFT JOIN ca_object_representations AS cor ON coxor.representation_id = cor.representation_id\n";
         $vs_rep_where_sql = " AND (coxor.is_primary = 1 OR coxor.is_primary IS NULL)";
         $vs_rep_select = ', coxor.*, cor.media, cor.access rep_access';
         // get representation counts
         $qr_rep_counts = $o_db->query("\n\t\t\t\tSELECT \n\t\t\t\t\trel.object_id, count(*) c\n\t\t\t\tFROM ca_set_items casi\n\t\t\t\tINNER JOIN ca_objects AS rel ON rel.object_id = casi.row_id\n\t\t\t\tINNER JOIN ca_objects_x_object_representations AS coxor ON coxor.object_id = rel.object_id\n\t\t\t\tWHERE\n\t\t\t\t\tcasi.set_id = ? {$vs_access_sql} {$vs_deleted_sql}\n\t\t\t\tGROUP BY\n\t\t\t\t\trel.object_id\n\t\t\t", (int) $vn_set_id);
         while ($qr_rep_counts->nextRow()) {
             $va_representation_counts[(int) $qr_rep_counts->get('object_id')] = (int) $qr_rep_counts->get('c');
         }
     }
     // get row labels
     $qr_res = $o_db->query("\n\t\t\tSELECT \n\t\t\t\tcasi.set_id, casi.item_id, casi.row_id, casi.rank,\n\t\t\t\trel_label." . $t_rel_label_table->getDisplayField() . ", rel_label.locale_id\n\t\t\tFROM ca_set_items casi\n\t\t\tINNER JOIN " . $t_rel_table->tableName() . " AS rel ON rel." . $t_rel_table->primaryKey() . " = casi.row_id\n\t\t\t{$vs_label_join_sql}\n\t\t\tWHERE\n\t\t\t\tcasi.set_id = ? {$vs_access_sql} {$vs_deleted_sql}\n\t\t\tORDER BY \n\t\t\t\tcasi.rank ASC\n\t\t\t{$vs_limit_sql}\n\t\t", (int) $vn_set_id);
     $va_labels = array();
     while ($qr_res->nextRow()) {
         $va_labels[$qr_res->get('item_id')][$qr_res->get('locale_id')] = $qr_res->getRow();
     }
     $va_labels = caExtractValuesByUserLocale($va_labels);
     // get set items
     $vs_access_sql = '';
     if (isset($pa_options['checkAccess']) && is_array($pa_options['checkAccess']) && sizeof($pa_options['checkAccess']) && $t_rel_table->hasField('access')) {
         $vs_access_sql = ' AND rel.access IN (' . join(',', $pa_options['checkAccess']) . ')';
     }
     // list items happen to have the same primary key name as set items, which leads to weird side-effects
     // in the code below. so instead of getting rel.* we explicitly list the fields for ca_list_items and
     // rename cli.item_id to list_item_id so that any get('item_id') calls below refer to the set item id
     if ($t_rel_table->tableName() === 'ca_list_items') {
         $va_rel_field_list = array();
         foreach ($t_rel_table->getFields() as $vs_rel_field) {
             if ($vs_rel_field == $t_rel_table->primaryKey()) {
                 $va_rel_field_list[] = "rel.{$vs_rel_field} as list_{$vs_rel_field}";
             } else {
                 $va_rel_field_list[] = "rel.{$vs_rel_field}";
             }
         }
         $vs_rel_field_list_sql = join(', ', $va_rel_field_list);
     } else {
         $vs_rel_field_list_sql = 'rel.*';
     }
     $qr_res = $o_db->query("\n\t\t\tSELECT \n\t\t\t\tcasi.set_id, casi.item_id, casi.row_id, casi.rank, casi.vars,\n\t\t\t\tcasil.label_id, casil.caption, casil.locale_id set_item_label_locale_id,\n\t\t\t\t{$vs_rel_field_list_sql}, rel_label." . $t_rel_label_table->getDisplayField() . " set_item_label, rel_label.locale_id rel_locale_id\n\t\t\t\t{$vs_rep_select}\n\t\t\tFROM ca_set_items casi\n\t\t\tLEFT JOIN ca_set_item_labels AS casil ON casi.item_id = casil.item_id\n\t\t\tINNER JOIN " . $t_rel_table->tableName() . " AS rel ON rel." . $t_rel_table->primaryKey() . " = casi.row_id\n\t\t\t{$vs_label_join_sql}\n\t\t\t{$vs_rep_join_sql}\n\t\t\tWHERE\n\t\t\t\tcasi.set_id = ? {$vs_rep_where_sql} {$vs_access_sql} {$vs_deleted_sql}\n\t\t\tORDER BY \n\t\t\t\tcasi.rank ASC\n\t\t\t{$vs_limit_sql}\n\t\t", (int) $vn_set_id);
     if ($ps_template = caGetOption('template', $pa_options, null)) {
         $qr_ids = $o_db->query("SELECT row_id FROM ca_set_items WHERE set_id = ? ORDER BY rank ASC", $this->getPrimaryKey());
         $va_processed_templates = caProcessTemplateForIDs($ps_template, $t_rel_table->tableName(), $qr_ids->getAllFieldValues('row_id'), array('returnAsArray' => true));
     }
     $va_items = array();
     while ($qr_res->nextRow()) {
         $va_row = $qr_res->getRow();
         unset($va_row['media']);
         if (isset($pa_options['returnRowIdsOnly']) && $pa_options['returnRowIdsOnly'] || isset($pa_options['idsOnly']) && $pa_options['idsOnly']) {
             $va_items[$qr_res->get('row_id')] = true;
             continue;
         }
         if (isset($pa_options['returnItemIdsOnly']) && $pa_options['returnItemIdsOnly']) {
             $va_items[$qr_res->get('item_id')] = true;
             continue;
         }
         $va_vars = caUnserializeForDatabase($va_row['vars']);
         $vb_has_access_to_media = true;
         if ($vs_rep_join_sql && isset($pa_options['checkAccess']) && is_array($pa_options['checkAccess']) && sizeof($pa_options['checkAccess'])) {
             $vb_has_access_to_media = in_array($va_row['rep_access'], $pa_options['checkAccess']);
         }
         if ($vs_rep_join_sql && $vb_has_access_to_media) {
             if (isset($pa_options['thumbnailVersion'])) {
                 $va_row['representation_tag'] = $qr_res->getMediaTag('media', $pa_options['thumbnailVersion']);
                 $va_row['representation_url'] = $qr_res->getMediaUrl('media', $pa_options['thumbnailVersion']);
                 $va_row['representation_width'] = $qr_res->getMediaInfo('media', $pa_options['thumbnailVersion'], 'WIDTH');
                 $va_row['representation_height'] = $qr_res->getMediaInfo('media', $pa_options['thumbnailVersion'], 'HEIGHT');
             }
             if (isset($pa_options['thumbnailVersions']) && is_array($pa_options['thumbnailVersions'])) {
                 foreach ($pa_options['thumbnailVersions'] as $vs_version) {
                     $va_row['representation_tag_' . $vs_version] = $qr_res->getMediaTag('media', $vs_version);
                     $va_row['representation_url_' . $vs_version] = $qr_res->getMediaUrl('media', $vs_version);
                     $va_row['representation_width_' . $vs_version] = $qr_res->getMediaInfo('media', $vs_version, 'WIDTH');
                     $va_row['representation_height_' . $vs_version] = $qr_res->getMediaInfo('media', $vs_version, 'HEIGHT');
                 }
             }
         }
         if ($t_rel_table->tableName() === 'ca_objects') {
             if (isset($va_vars['selected_services'])) {
                 $va_row['selected_services'] = array_keys($va_vars['selected_services']);
             } else {
                 $va_row['selected_services'] = array();
             }
             if (isset($va_vars['selected_representations'])) {
                 $va_row['selected_representations'] = array_keys($va_vars['selected_representations']);
             } else {
                 $va_row['selected_representations'] = array();
             }
             $va_row['representation_count'] = (int) $va_representation_counts[$qr_res->get('row_id')];
         }
         if (is_array($va_labels[$vn_item_id = $qr_res->get('item_id')])) {
             $va_row = array_merge($va_row, $va_labels[$vn_item_id]);
         }
         if (isset($pa_options['returnItemAttributes']) && is_array($pa_options['returnItemAttributes']) && sizeof($pa_options['returnItemAttributes'])) {
             // TODO: doing a load for each item is inefficient... must replace with a query
             $t_item = new ca_set_items($va_row['item_id']);
             foreach ($pa_options['returnItemAttributes'] as $vs_element_code) {
                 $va_row['ca_attribute_' . $vs_element_code] = $t_item->getAttributesForDisplay($vs_element_code);
             }
             $va_row['set_item_label'] = $t_item->getLabelForDisplay(false);
         }
         if ($ps_template) {
             $va_row['displayTemplate'] = array_shift($va_processed_templates);
         }
         $va_items[$qr_res->get('item_id')][$qr_res->get('rel_locale_id') ? $qr_res->get('rel_locale_id') : 0] = $va_row;
     }
     if (caGetOption('idsOnly', $pa_options, false)) {
         return array_keys($va_items);
     }
     return $va_items;
 }
コード例 #4
0
ファイル: SetsController.php プロジェクト: guaykuru/pawtucket
 public function ReorderItems()
 {
     if ($this->request->isLoggedIn()) {
         $t_set = $this->_getSet();
         if (!$t_set->getPrimaryKey()) {
             $this->notification->addNotification(_t("The collection does not exist"), __NOTIFICATION_TYPE_ERROR__);
             return;
         }
         // does user have edit access to set?
         if (!$t_set->haveAccessToSet($this->request->getUserID(), __CA_SET_EDIT_ACCESS__)) {
             $this->notification->addNotification(_t("You cannot edit this collection"), __NOTIFICATION_TYPE_ERROR__);
             $this->Edit();
             return;
         }
         $va_item_ids = explode(';', $this->request->getParameter('sort', pString));
         for ($vn_i = 0; $vn_i < sizeof($va_item_ids); $vn_i++) {
             $va_item_ids[$vn_i] = str_replace('setItem', '', $va_item_ids[$vn_i]);
         }
         // get ranks
         $va_item_ranks = $t_set->getItemRanks(array('user_id' => $this->request->getUserID()));
         // rewrite ranks
         $vn_i = 0;
         $o_trans = new Transaction();
         $t_set_item = new ca_set_items();
         $t_set_item->setTransaction($o_trans);
         $t_set_item->setMode(ACCESS_WRITE);
         $va_errors = array();
         foreach ($va_item_ranks as $vn_item_id => $vn_rank) {
             if ($vn_item_id != $va_item_ids[$vn_i]) {
                 if ($t_set_item->load($va_item_ids[$vn_i])) {
                     $t_set_item->set('rank', $vn_rank);
                     $t_set_item->update();
                     if ($t_set_item->numErrors()) {
                         $va_errors[$va_item_ids[$vn_i]] = _t('Could not reorder item %1: %2', $va_item_ids[$vn_i], join('; ', $t_set_item->getErrors()));
                     }
                 }
             }
             $vn_i++;
         }
         if (sizeof($va_errors)) {
             $o_trans->rollback();
         } else {
             $o_trans->commit();
         }
     } else {
         $va_errors['general'] = 'Must be logged in';
     }
     $this->view->setVar('errors', $va_errors);
     $this->render('Sets/ajax_reorder_items_json.php');
 }
コード例 #5
0
ファイル: present_html.php プロジェクト: ffarago/pawtucket2
		<!--[if lt IE 9]>
		<script src="lib/js/html5shiv.js"></script>
		<![endif]-->
	</head>
	<body>
		<div class="reveal">
			<?php 
print caNavLink($this->request, _t("Back to Lightbox"), "", "", "Sets", "setDetail", array("set_id" => $t_set->get("set_id")), array("style" => "font-size:14px; padding:20px;"));
?>
			<!-- Any section element inside of this container is displayed as a slide -->
			<div class="slides">
<?php 
foreach ($va_items as $vn_i => $va_item) {
    $t_item = new ca_objects($va_item["row_id"]);
    $t_set_item = new ca_set_items($va_item["item_id"]);
    ?>
		<section>
			<h3><?php 
    print $va_item['name'];
    ?>
</h3>
			<p style="float:left; width:50%"><?php 
    print $va_item['representation_tag_medium'];
    ?>
</p>
			<p style="float:right; width:50%">
				<div><?php 
    print $t_item->get("ca_objects.dateSet.setDisplayValue");
    ?>
</div>
コード例 #6
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;
}
コード例 #7
0
 public function RecordRepresentationSelection()
 {
     $pn_item_id = $this->request->getParameter('item_id', pInteger);
     $pn_representation_id = $this->request->getParameter('representation_id', pInteger);
     $pn_selected = $this->request->getParameter('selected', pInteger);
     $va_errors = array();
     $t_set_item = new ca_set_items($pn_item_id);
     $t_set = new ca_sets($t_set_item->get('set_id'));
     if (!$t_set->getPrimaryKey() || !$t_set->haveAccessToSet($this->request->getUserID(), __CA_SET_EDIT_ACCESS__)) {
         // TODO: proper error reporting or redirect?
         return;
     }
     if (!$t_set_item->getPrimaryKey()) {
         $va_errors[] = _t("Invalid set item");
     }
     if (!sizeof($va_errors)) {
         $t_set = new ca_sets($t_set_item->get('set_id'));
         if (!$t_set->getPrimaryKey()) {
             $va_errors[] = _t("Invalid set");
         }
         if (!$t_set->haveAccessToSet($this->request->getUserID(), __CA_SET_EDIT_ACCESS__)) {
             $va_errors[] = _t("You do not have access to this set");
         }
         if (!sizeof($va_errors)) {
             if ((bool) $pn_selected) {
                 $t_set_item->addSelectedRepresentation($pn_representation_id);
             } else {
                 $t_set_item->removeSelectedRepresentation($pn_representation_id);
             }
             $t_set_item->update();
             $va_errors = $t_set_item->getErrors();
         }
     }
     $this->view->setVar("errors", $va_errors);
     $this->view->setVar('representation_id', $pn_representation_id);
     $this->view->setVar('item_id', $pn_item_id);
     $this->render("ajax_select_representation_json.php");
 }
コード例 #8
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');
 }
コード例 #9
0
        $t_object = new ca_objects();
        $va_library_media = $t_object->getPrimaryMediaForIDs($va_library_item_ids, array("small"), array('checkAccess' => caGetUserAccessValues($this->request)));
    }
}
if ($vs_archive_set_code = $this->request->config->get("featured_archive_set")) {
    $t_archive_set = new ca_sets();
    $t_archive_set->load(array('set_code' => $vs_archive_set_code));
    # Enforce access control on set
    if (sizeof($va_access_values) == 0 || sizeof($va_access_values) && in_array($t_archive_set->get("access"), $va_access_values)) {
        $va_archive_item_ids = array_keys(is_array($va_tmp = $t_archive_set->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 0))) ? $va_tmp : array());
        $va_archive_items = $t_archive_set->getItemIDs();
        foreach ($va_archive_items as $va_archive_item => $va_archive) {
            $va_archive_set_item = $va_archive_item;
            break;
        }
        $t_archive_item = new ca_set_items($va_archive_set_item);
        $va_archive_caption = $t_archive_item->get('ca_set_items.caption');
    }
    if (is_array($va_archive_item_ids) && sizeof($va_archive_item_ids)) {
        $t_object = new ca_objects();
        $va_archive_media = $t_object->getPrimaryMediaForIDs($va_archive_item_ids, array("small"), array('checkAccess' => caGetUserAccessValues($this->request)));
    }
}
if ($this->request->config->get('pawtucket_requires_login') && !$this->request->isLoggedIn()) {
    print "<div id='homepageLogin'>";
    print $this->render('LoginReg/form_login_html.php');
    print "</div>";
} else {
    ?>
<div class='row featuredItems'>
	<div class="col-sm-4">
コード例 #10
0
                $i = 0;
                print "<br/>";
            }
        }
        ?>
		</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>
			<div >
<?php 
    # --- caption text - Noguchi NCR specific!
    $t_set_item = new ca_set_items($pn_set_item_id);
    $va_object_title = $t_object->get('ca_objects.preferred_labels');
    print "<div class='captionLeft' >" . $t_set_item->getLabelForDisplay() . "</div>";
    print "<div class='captionRight' >" . $t_set_item->get("ca_set_items.set_item_description") . "</div>";
    print "<div class='recordLink'>" . _t('View this Object in the Collection') . ": " . caNavLink($this->request, $va_object_title, '', 'Detail', 'Object', 'Show', array('object_id' => $pn_object_id)) . "</div>";
    ?>
			
			</div>

			<div class='repNav'>
<?php 
    if ($this->getVar('previous_representation_id')) {
        print "<a href='#' onClick='jQuery(\"#{$vs_container_id}\").load(\"" . caNavUrl($this->request, '', 'educational/SetsOverlay', 'getSetsOverlay', array('representation_id' => (int) $this->getVar('previous_representation_id'), 'object_id' => (int) $this->getVar('previous_object_id'), 'set_id' => (int) $pn_set_id)) . "\");'>←</a>";
    }
    if (sizeof($va_reps) > 1) {
        print ' ' . _t("%1 of %2", $this->getVar('representation_index'), sizeof($va_reps)) . ' ';
コード例 #11
0
$q_set_items = $this->getVar("result");
$t_set = $this->getVar("set");
$vb_write_access = $this->getVar("write_access");
$va_lightbox_display_name = caGetSetDisplayName();
$vs_lightbox_display_name = $va_lightbox_display_name["singular"];
$vs_lightbox_display_name_plural = $va_lightbox_display_name["plural"];
$vn_object_table_num = $this->request->datamodel->getTableNum("ca_objects");
$vn_hits_per_block = (int) $this->getVar('hits_per_block');
// number of hits to display per block
?>
			<div class="row" id="sortable">
<?php 
if ($q_set_items->numHits()) {
    $vn_c = 0;
    while ($q_set_items->nextHit() && $vn_c < $vn_hits_per_block) {
        $t_set_item = new ca_set_items(array("row_id" => $q_set_items->get("object_id"), "set_id" => $t_set->get("set_id"), "table_num" => $vn_object_table_num));
        if ($t_set_item->get("item_id")) {
            print "<div class='col-xs-12 col-sm-4 lbItem" . $t_set_item->get("item_id") . "' id='row-" . $q_set_items->get("object_id") . "'><div class='lbItemContainerList'>";
            print caLightboxSetDetailItem($this->request, $q_set_items, $t_set_item, array("write_access" => $vb_write_access, "view" => "list"));
            print "</div></div><!-- end col 3 -->";
        }
        $vn_c++;
    }
} else {
    print "<div class='col-sm-12'>" . _t("There are no items in this %1", $vs_lightbox_display_name) . "</div>";
}
?>
			</div><!-- end row -->
<?php 
if ($vb_write_access) {
    ?>
コード例 #12
0
ファイル: themeHelpers.php プロジェクト: kai-iak/pawtucket2
/**
 * Returns the info for each set item
 * 
 * options: "write_access" = false
 * 
 */
function caLightboxSetDetailItemOld($po_request, $va_set_item = array(), $pa_options = array())
{
    $t_set_item = new ca_set_items($va_set_item["item_id"]);
    if (!$t_set_item->get("item_id")) {
        return false;
    }
    $vb_write_access = false;
    if ($pa_options["write_access"]) {
        $vb_write_access = true;
    }
    $t_list_items = new ca_list_items($va_set_item["type_id"]);
    $vs_placeholder = getPlaceholder($t_list_items->get("idno"), "placeholder_media_icon");
    $vs_caption = "";
    $o_config = caGetSetsConfig();
    $vs_caption_template = $o_config->get("caption_template");
    if ($vs_caption_template) {
        $t_object = new ca_objects($va_set_item["row_id"]);
        $vs_caption = $t_object->getWithTemplate($vs_caption_template);
    } else {
        $vs_caption = $va_set_item["set_item_label"];
    }
    $vs_set_item_display = "";
    $vs_set_item_display .= "<div class='lbItem'><div class='lbItemContent'>\n";
    #$vs_set_item_display .= "<div class='lbItem' onmouseover='jQuery(\"#lbExpandedInfo".$t_set_item->get("item_id")."\").show();'  onmouseout='jQuery(\"#lbExpandedInfo".$t_set_item->get("item_id")."\").hide();'><div class='lbItemContent'>\n";
    if ($va_set_item["representation_tag_medium"]) {
        $vs_set_item_display .= caDetailLink($po_request, "<div class='lbItemImg'>" . $va_set_item["representation_tag_medium"] . "</div>", '', 'ca_objects', $va_set_item["row_id"]);
    } else {
        $vs_set_item_display .= caDetailLink($po_request, "<div class='lbItemImg lbSetImgPlaceholder'>" . $vs_placeholder . "</div>", '', 'ca_objects', $va_set_item["row_id"]);
    }
    $vs_set_item_display .= "<div id='comment" . $t_set_item->get("item_id") . "' class='lbSetItemComment'><!-- load comments here --></div>\n";
    $vs_set_item_display .= "<div class='caption'>" . $vs_caption . "</div>\n";
    $vs_set_item_display .= "</div><!-- end lbItemContent -->\n";
    $vs_set_item_display .= "<div class='lbExpandedInfo' id='lbExpandedInfo" . $t_set_item->get("item_id") . "'>\n<hr>\n";
    if ($vb_write_access) {
        $vs_set_item_display .= "<div class='pull-right'><a href='#' class='lbItemDeleteButton' id='lbItemDelete" . $t_set_item->get("item_id") . "' title='" . _t("Remove") . "'><span class='glyphicon glyphicon-trash'></span></a></div>\n";
    }
    $vs_set_item_display .= "<div>" . caDetailLink($po_request, "<span class='glyphicon glyphicon-file'></span>", '', 'ca_objects', $va_set_item["row_id"], "", array("title" => _t("View Item Detail"))) . "\n";
    if ($va_set_item["representation_id"]) {
        $vs_set_item_display .= "&nbsp;<a href='#' title='" . _t("Enlarge Image") . "' onclick='caMediaPanel.showPanel(\"" . caNavUrl($po_request, '', 'Detail', 'GetRepresentationInfo', array('object_id' => $t_set_item->get("row_id"), 'representation_id' => $va_set_item["representation_id"], 'overlay' => 1)) . "\"); return false;' ><span class='glyphicon glyphicon-zoom-in'></span></a>\n";
    }
    $vs_set_item_display .= "&nbsp;&nbsp;<a href='#' title='" . _t("Comments") . "' onclick='jQuery(\"#comment" . $t_set_item->get("item_id") . "\").load(\"" . caNavUrl($po_request, '', 'Sets', 'AjaxListComments', array('item_id' => $t_set_item->get("item_id"), 'tablename' => 'ca_set_items', 'set_id' => $t_set_item->get("set_id"))) . "\", function(){jQuery(\"#comment" . $t_set_item->get("item_id") . "\").show();}); return false;'><span class='glyphicon glyphicon-comment'></span> <small>" . $t_set_item->getNumComments() . "</small></a></div>\n";
    $vs_set_item_display .= "</div><!-- end lbExpandedInfo --></div><!-- end lbItem -->\n";
    return $vs_set_item_display;
}
コード例 #13
0
                print "<br/>";
            }
        }
        ?>
		</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>
			<div >
<?php 
    # --- caption text
    $va_object_title = $t_object->get('ca_objects.preferred_labels');
    $t_set_item = new ca_set_items($pn_set_item_id);
    print "<div class='captionLeft' >";
    if ($va_set_caption = $t_set_item->getLabelForDisplay()) {
        print $va_set_caption;
    }
    print "</div>";
    print "<div class='captionRight' >" . $t_set_item->get("ca_set_items.{$va_set_description_code}") . "</div>";
    print "<div class='recordLink'>" . _t('View this Object in the Collection') . ": " . caNavLink($this->request, $va_object_title, '', 'Detail', 'Object', 'Show', array('object_id' => $pn_object_id)) . "</div>";
    ?>
			
			</div>

			<div class='repNav'>
<?php 
    if ($this->getVar('previous_representation_id')) {
        print "<a href='#' onClick='jQuery(\"#{$vs_container_id}\").load(\"" . caNavUrl($this->request, '', 'simpleGallery/SetsOverlay', 'getSetsOverlay', array('representation_id' => (int) $this->getVar('previous_representation_id'), 'object_id' => (int) $this->getVar('previous_object_id'), 'set_id' => (int) $pn_set_id)) . "\");'>←</a>";
コード例 #14
0
 public function setItemInfo()
 {
     $va_access_values = caGetUserAccessValues($this->request);
     $pn_set_id = $this->request->getParameter('set_id', pInteger);
     $t_set = new ca_sets($pn_set_id);
     $this->view->setVar('set_id', $pn_set_id);
     $pn_set_item_id = $this->request->getParameter('set_item_id', pInteger);
     $t_set_item = new ca_set_items($pn_set_item_id);
     $va_set_item_info = array();
     $va_items = $t_set->getItemIDs(array("checkAccess" => $va_access_values));
     $pn_previous_id = "";
     foreach ($va_items as $vn_item_id => $va_item_info) {
         if ($va_set_item_info["item_id"]) {
             $va_set_item_info["next_id"] = $vn_item_id;
             break;
         }
         if ($pn_set_item_id == $vn_item_id) {
             $va_set_item_info["previous_id"] = $pn_previous_id;
             $va_set_item_info["item_id"] = $vn_item_id;
         }
         $pn_previous_id = $vn_item_id;
     }
     $va_set_item_info["item_id"] = $t_set_item->get("item_id");
     $va_set_item_info["info"] = $va_rep[0]['info'];
     $va_set_item_info["label"] = $t_set_item->getLabelForDisplay();
     $va_set_item_info["description"] = $t_set_item->get($this->opo_plugin_config->get('set_description_element_code'), array('convertLineBreaks' => true));
     $va_set_item_info["row_id"] = $t_set_item->get("row_id");
     $t_occurrence = new ca_occurrences($t_set_item->get("row_id"));
     $va_set_item_info["label"] = $t_occurrence->getLabelForDisplay();
     $va_mediumlarge_stills = $t_occurrence->get('ca_occurrences.ic_stills.ic_stills_media', array('version' => "mediumlarge", "showMediaInfo" => false, "returnAsArray" => true));
     if (sizeof($va_mediumlarge_stills) > 0) {
         $va_set_item_info["media_still"] = array_shift($va_mediumlarge_stills);
         $va_image_caption = $t_occurrence->get('ca_occurrences.ic_stills.ic_stills_credit', array("returnAsArray" => true));
         $vs_image_caption = array_shift($va_image_caption);
         if ($vs_image_caption) {
             $va_set_item_info["media_still_caption"] = $vs_image_caption;
         }
     }
     if ($vs_video = $t_occurrence->get('ca_occurrences.ic_moving_images.ic_moving_images_media', array('version' => 'original', 'showMediaInfo' => false, 'viewer_width' => 580, 'viewer_height' => 450, 'poster_frame_version' => 'mediumlarge'))) {
         $va_set_item_info["media_video"] = $vs_video;
         if ($vs_video_caption = $t_occurrence->get('ca_occurrences.ic_moving_images.ic_moving_images_credit')) {
             $va_set_item_info["media_video_caption"] = $vs_video_caption;
         }
     }
     $this->view->setVar('item_info', $va_set_item_info);
     $this->render('Exhibits/ajax_item_info_html.php');
 }
コード例 #15
0
ファイル: SetsController.php プロジェクト: guaykuru/pawtucket
 /**
  *
  */
 public function GetSelectedRepresentationCount()
 {
     $pn_item_id = $this->request->getParameter('item_id', pInteger);
     $t_set_item = new ca_set_items($pn_item_id);
     $t_set = new ca_sets($t_set_item->get('set_id'));
     if (!$t_set->getPrimaryKey() || !$t_set->haveAccessToSet($this->request->getUserID(), __CA_SET_EDIT_ACCESS__)) {
         // TODO: proper error reporting or redirect?
         return;
     }
     $vn_num_reps_selected = $t_set_item->getSelectedRepresentationCount();
     $vn_num_reps = $t_set_item->getRepresentationCount();
     $vs_msg = $vn_num_reps == 1 ? _t("%1/%2 page selected", $vn_num_reps_selected, $vn_num_reps) : _t("%1/%2 pages selected", $vn_num_reps_selected, $vn_num_reps);
     $this->response->addContent($vs_msg);
 }
コード例 #16
0
 public function getSetItemInfo()
 {
     $pn_item_id = $this->request->getParameter('item_id', pInteger);
     $pn_set_id = $this->request->getParameter('set_id', pInteger);
     $t_set = new ca_sets($pn_set_id);
     $t_set_item = new ca_set_items($pn_item_id);
     $t_object = new ca_objects($t_set_item->get("row_id"));
     $va_set_item_ids = array_keys($t_set->getItemIDs(array("checkAccess" => $this->opa_access_values)));
     $this->view->setVar("set_num_items", sizeof($va_set_item_ids));
     $this->view->setVar("set_item_num", array_search($pn_item_id, $va_set_item_ids) + 1);
     $this->view->setVar("object", $t_object);
     $this->view->setVar("object_id", $t_set_item->get("row_id"));
     $this->view->setVar("label", $t_object->getLabelForDisplay());
     //
     // Tag substitution
     //
     // Views can contain tags in the form {{{tagname}}}. Some tags, such as "label" are defined by
     // this controller. More usefully, you can pull data from the item being detailed by using a valid "get" expression
     // as a tag (Eg. {{{ca_objects.idno}}}. Even more usefully for some, you can also use a valid bundle display template
     // (see http://docs.collectiveaccess.org/wiki/Bundle_Display_Templates) as a tag. The template will be evaluated in the
     // context of the item being detailed.
     //
     $va_defined_vars = array_keys($this->view->getAllVars());
     // get list defined vars (we don't want to copy over them)
     $va_tag_list = $this->getTagListForView("Gallery/set_item_info_html.php");
     // get list of tags in view
     foreach ($va_tag_list as $vs_tag) {
         if (in_array($vs_tag, $va_defined_vars)) {
             continue;
         }
         if (strpos($vs_tag, "^") !== false || strpos($vs_tag, "<") !== false) {
             $this->view->setVar($vs_tag, $t_object->getWithTemplate($vs_tag, array('checkAccess' => $this->opa_access_values)));
         } elseif (strpos($vs_tag, ".") !== false) {
             $this->view->setVar($vs_tag, $t_object->get($vs_tag, array('checkAccess' => $this->opa_access_values)));
         } else {
             $this->view->setVar($vs_tag, "?{$vs_tag}");
         }
     }
     $this->render("Gallery/set_item_info_html.php");
 }
コード例 #17
0
$q_set_items = $this->getVar("result");
$t_set = $this->getVar("set");
$vb_write_access = $this->getVar("write_access");
$va_lightbox_display_name = caGetSetDisplayName();
$vs_lightbox_display_name = $va_lightbox_display_name["singular"];
$vs_lightbox_display_name_plural = $va_lightbox_display_name["plural"];
$vn_object_table_num = $this->request->datamodel->getTableNum("ca_objects");
$vn_hits_per_block = (int) $this->getVar('hits_per_block');
// number of hits to display per block
?>
			<div class="row" id="sortable">
<?php 
if ($q_set_items->numHits()) {
    $vn_c = 0;
    while ($q_set_items->nextHit() && $vn_c < $vn_hits_per_block) {
        $t_set_item = new ca_set_items(array("row_id" => $q_set_items->get("object_id"), "set_id" => $t_set->get("set_id"), "table_num" => $vn_object_table_num));
        if ($t_set_item->get("item_id")) {
            # --- Glenstone specific caption
            $vn_id = $q_set_items->get('ca_objects.object_id');
            $vs_rep = $vs_caption = $vs_label_artist = $vs_label_detail_link = $vs_date_link = $vs_art_idno_link = $vs_library_info = $vs_collection_link = $vs_type_link = "";
            if ($q_set_items->get('ca_objects.type_id') == 30) {
                # --- library --- book
                $vs_label_author = "<p class='artist'>" . $q_set_items->get("ca_entities.preferred_labels.name", array('restrictToRelationshipTypes' => 'author', 'delimiter' => '; ', 'template' => '^ca_entities.preferred_labels.forename ^ca_entities.preferred_labels.middlename ^ca_entities.preferred_labels.surname')) . "</p>";
                $vs_label_detail = "<p style='text-decoration:underline;'>" . caDetailLink($this->request, $q_set_items->get("ca_objects.preferred_labels.name"), '', 'ca_objects', $vn_id) . "</p>";
                $vs_label_pub = "<p>" . $q_set_items->get("ca_objects.publication_description") . "</p>";
                $vs_label_call = "<p>" . $q_set_items->get("ca_objects.call_number") . "</p>";
                $vs_label_status = "<p>" . $q_set_items->get("ca_objects.purchase_status", array('convertCodesToDisplayText' => true)) . "</p>";
                $vs_idno_detail_link = "";
                $vs_label_detail_link = "";
                $vs_library_info = $vs_label_detail . $vs_label_author . $vs_label_pub . $vs_label_call . $vs_label_status;
            } elseif ($q_set_items->get('ca_objects.type_id') == 1903) {
コード例 #18
0
<?php 
if ($this->getVar('previous_representation_id')) {
    print "<a href='#' onClick='jQuery(\"#{$vs_container_id}\").load(\"" . caNavUrl($this->request, '', 'simpleGallery/SetsOverlay', 'getSetsOverlay', array('representation_id' => (int) $this->getVar('previous_representation_id'), 'object_id' => (int) $this->getVar('previous_object_id'), 'set_id' => (int) $pn_set_id)) . "\");'>←</a>";
}
if (sizeof($va_reps) > 1) {
    print ' ' . _t("%1 of %2", $this->getVar('representation_index'), sizeof($va_reps)) . ' ';
}
if ($this->getVar('next_representation_id')) {
    print "<a href='#' onClick='jQuery(\"#{$vs_container_id}\").load(\"" . caNavUrl($this->request, '', 'simpleGallery/SetsOverlay', 'getSetsOverlay', array('representation_id' => (int) $this->getVar('next_representation_id'), 'object_id' => (int) $this->getVar('next_object_id'), 'set_id' => (int) $pn_set_id)) . "\");'>→</a>";
}
?>
		</div>
<?php 
# --- caption text
$va_object_title = $t_object->get('ca_objects.preferred_labels');
$t_set_item = new ca_set_items($pn_set_item_id);
if ($vs_set_caption = $t_set_item->getLabelForDisplay()) {
    print "<div class='simpleGalleryCaption'>";
    print $vs_set_caption;
    print "</div>";
}
print "<div class='simpleGallerySetItemDescription'>";
if ($t_set_item->get("ca_set_items.{$ps_set_description_code}")) {
    print $t_set_item->get("ca_set_items.{$ps_set_description_code}") . "<br/><br/>";
}
print "<b>" . _t('View this Object in the Collection') . ":</b> " . caNavLink($this->request, $va_object_title, '', 'Detail', 'Object', 'Show', array('object_id' => $pn_object_id));
print "</div>";
?>
			
	</div><!-- end caMediaOverlayControls -->
コード例 #19
0
ファイル: SetsController.php プロジェクト: ffarago/pawtucket2
 public function AjaxAddItem()
 {
     if (!$this->request->isLoggedIn()) {
         $this->response->setRedirect(caNavUrl($this->request, '', 'LoginReg', 'loginForm'));
         return;
     }
     global $g_ui_locale_id;
     // current locale_id for user
     $va_errors = array();
     $o_purifier = new HTMLPurifier();
     # --- set_id is passed through form, otherwise we're saving a new set, and adding the item to it
     if ($this->request->getParameter('set_id', pInteger)) {
         $t_set = $this->_getSet(__CA_EDIT_READ_ACCESS__);
         if (!$t_set && ($t_set = $this->_getSet(__CA_SET_READ_ACCESS__))) {
             $va_errors["general"] = _t("You can not add items to this lightbox.  You have read only access.");
             $this->view->setVar('errors', $va_errors);
             $this->addItemForm();
             return;
         }
     } else {
         $t_set = new ca_sets();
         # --- set name - if not sent, make a decent default
         $ps_name = $o_purifier->purify($this->request->getParameter('name', pString));
         if (!$ps_name) {
             $ps_name = _t("Your lightbox");
         }
         # --- set description - optional
         $ps_description = $o_purifier->purify($this->request->getParameter('description', pString));
         $t_list = new ca_lists();
         $vn_set_type_user = $t_list->getItemIDFromList('set_types', $this->request->config->get('user_set_type'));
         $t_object = new ca_objects();
         $vn_object_table_num = $t_object->tableNum();
         $t_set->setMode(ACCESS_WRITE);
         $t_set->set('access', 1);
         #$t_set->set('access', $this->request->getParameter('access', pInteger));
         $t_set->set('table_num', $vn_object_table_num);
         $t_set->set('type_id', $vn_set_type_user);
         $t_set->set('user_id', $this->request->getUserID());
         $t_set->set('set_code', $this->request->getUserID() . '_' . time());
         # --- create new attribute
         if ($ps_description) {
             $t_set->addAttribute(array('description' => $ps_description, 'locale_id' => $g_ui_locale_id), 'description');
         }
         $t_set->insert();
         if ($t_set->numErrors()) {
             $va_errors["general"] = join("; ", $t_set->getErrors());
             $this->view->setVar('errors', $va_errors);
             $this->addItemForm();
             return;
         } else {
             # --- save name - add new label
             $t_set->addLabel(array('name' => $ps_name), $g_ui_locale_id, null, true);
             # --- select the current set
             $this->request->user->setVar('current_set_id', $t_set->get("set_id"));
         }
     }
     if ($t_set) {
         $pn_item_id = null;
         $pn_object_id = $this->request->getParameter('object_id', pInteger);
         if ($pn_object_id) {
             if (!$t_set->isInSet("ca_objects", $pn_object_id, $t_set->get("set_id"))) {
                 if ($pn_item_id = $t_set->addItem($pn_object_id, array(), $this->request->getUserID())) {
                     //
                     // Select primary representation
                     //
                     $t_object = new ca_objects($pn_object_id);
                     $vn_rep_id = $t_object->getPrimaryRepresentationID();
                     // get representation_id for primary
                     $t_item = new ca_set_items($pn_item_id);
                     $t_item->addSelectedRepresentation($vn_rep_id);
                     // flag as selected in item vars
                     $t_item->update();
                     $va_errors = array();
                     $this->view->setVar('message', _t("Successfully added item."));
                     $this->render("Form/reload_html.php");
                 } else {
                     $va_errors["message"] = _t('Could not add item to lightbox');
                     $this->render("Form/reload_html.php");
                 }
             } else {
                 $this->view->setVar('message', _t("Item already in lightbox."));
                 $this->render("Form/reload_html.php");
             }
         } else {
             $this->view->setVar('message', _t("Object ID is not defined"));
             $this->render("Form/reload_html.php");
         }
     }
 }
コード例 #20
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');
}
コード例 #21
0
 /**
  * Removes item from set
  *
  * @param int $set_id
  * @param int $set_item_id
  * @return boolean
  * @throws SoapFault
  */
 public function removeItemFromSet($set_id, $set_item_id)
 {
     $t_set_item = new ca_set_items();
     if (!$t_set_item->load($set_item_id)) {
         throw new SoapFault("Server", "Invalid set_item id");
     }
     $t_set_item->setMode(ACCESS_WRITE);
     $t_set_item->delete();
     if ($t_set_item->numErrors() == 0) {
         return true;
     } else {
         throw new SoapFault("Server", "There were errors while updating the item: " . join(";", $t_set_item->getErrors()));
     }
 }