本文整理汇总了PHP中ca_sets::getItems方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_sets::getItems方法的具体用法?PHP ca_sets::getItems怎么用?PHP ca_sets::getItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_sets
的用法示例。
在下文中一共展示了ca_sets::getItems方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Edit
public function Edit($pa_values = null, $pa_options = null)
{
$vn_ret = parent::Edit($pa_values, $pa_options);
$t_subject = $this->view->getVar("t_subject");
$t_set = new ca_sets($vn_set_id = $t_subject->get('set_id'));
$va_items = $t_set->getItems(array('user_id' => $this->request->getUserID()));
$this->opo_result_context = new ResultContext($this->request, 'ca_set_items', 'set_item_edit');
$this->opo_result_context->setResultList(is_array($va_items) ? array_keys($va_items) : array());
$this->opo_result_context->setParameter('set_id', $vn_set_id);
$this->opo_result_context->setAsLastFind();
$this->opo_result_context->saveContext();
return $vn_ret;
}
示例2: getSetItems
/**
* Returns list of items in specified set
*
* @param int $set_id
* @param array $pa_options Optional array of options. Supported options are:
* 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.
* 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.
* @return array
* @throws SoapFault
*/
public function getSetItems($set_id, $options)
{
$t_set = new ca_sets();
if (!$t_set->load($set_id)) {
throw new SoapFault("Server", "Invalid set_id");
}
$options["user_id"] = $this->opo_request->getUserID();
return $t_set->getItems($options);
}
示例3: getSetItemRep
public function getSetItemRep()
{
$pn_set_id = $this->request->getParameter('set_id', pInteger);
$t_set = new ca_sets($pn_set_id);
$t_set->load($pn_set_id);
$va_set_items = caExtractValuesByUserLocale($t_set->getItems(array("thumbnailVersions" => array("icon"), "checkAccess" => $this->opa_access_values)));
$this->view->setVar("set_id", $pn_set_id);
$pn_item_id = $this->request->getParameter('item_id', pInteger);
$t_rep = new ca_object_representations($va_set_items[$pn_item_id]["representation_id"]);
$va_rep_info = $t_rep->getMediaInfo("media", "mediumlarge");
$this->view->setVar("rep", $t_rep->getMediaTag("media", "mediumlarge"));
$this->view->setVar("repToolBar", caRepToolbar($this->request, $t_rep, $va_set_items[$pn_item_id]["row_id"]));
$this->view->setVar("representation_id", $va_set_items[$pn_item_id]["representation_id"]);
$this->view->setVar("object_id", $va_set_items[$pn_item_id]["row_id"]);
$pn_previous_id = 0;
$pn_next_id = 0;
$va_set_item_ids = array_keys($va_set_items);
$vn_current_index = array_search($pn_item_id, $va_set_item_ids);
if ($va_set_item_ids[$vn_current_index - 1]) {
$pn_previous_id = $va_set_item_ids[$vn_current_index - 1];
}
if ($va_set_item_ids[$vn_current_index + 1]) {
$pn_next_id = $va_set_item_ids[$vn_current_index + 1];
}
$this->view->setVar("next_item_id", $pn_next_id);
$this->view->setVar("previous_item_id", $pn_previous_id);
$this->render("Gallery/set_item_rep_html.php");
}
示例4: foreach
*
* This source code is free and modifiable under the terms of
* GNU General Public License. (http://www.gnu.org/copyleft/gpl.html). See
* the "license.txt" file for details, or visit the CollectiveAccess web site at
* http://www.CollectiveAccess.org
*
* @package CollectiveAccess
* @subpackage Core
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License version 3
*
* ----------------------------------------------------------------------
*/
$qr_res = $this->getVar('featured_set_items_as_search_result');
$t_featured = new ca_sets();
$t_featured->load(array('set_code' => 'featuredSet'));
$va_set_items = $t_featured->getItems();
?>
<div id="featuredSlideshow">
<div class='blockTitle'>Featured Items</div>
<div class='blockFeatured scrollBlock' >
<div class='scrollingDiv'><div class='scrollingDivContent'>
<?php
foreach ($va_set_items as $va_set_id => $va_set_item_a) {
foreach ($va_set_item_a as $va_set_item_id => $va_set_item) {
$va_object_id = $va_set_item['row_id'];
$t_object = new ca_objects($va_object_id);
$va_image_width = $t_object->get('ca_object_representations.media.mediumlarge.width');
print "<div class='featuredObject' style='width:{$va_image_width}px;'>";
print "<div class='featuredObjectImg'>";
示例5: getSetsOverlay
/**
* Returns content for overlay containing details for object representation linked to occurrence
*/
public function getSetsOverlay()
{
$this->view->setVar('display_type', 'media_overlay');
$pn_set_id = $this->request->getParameter('set_id', pInteger);
$pn_object_id = $this->request->getParameter('object_id', pInteger);
$this->view->setVar('object_id', $pn_object_id);
$pn_representation_id = $this->request->getParameter('representation_id', pInteger);
$this->opo_plugin_config = Configuration::load($this->request->getAppConfig()->get('application_plugins') . '/simpleGallery/conf/simpleGallery.conf');
$this->view->setVar('set_id', $pn_set_id);
$t_set = new ca_sets($pn_set_id);
$pn_set_item_id = $this->request->getParameter('set_item_id', pInteger);
$this->view->setVar('set_item_id', $pn_set_item_id);
$ps_set_item_description_code = $this->opo_plugin_config->get('set_item_description_element_code');
$this->view->setVar('set_item_description', $ps_set_item_description_code);
$this->view->setVar('object_id', $pn_object_id);
$t_object = new ca_objects($pn_object_id);
$this->view->setVar('t_object', $t_object);
$t_rep = new ca_object_representations($pn_representation_id);
$this->view->setVar('representation_id', $pn_representation_id);
$this->view->setVar('t_object_representation', $t_rep);
if ($this->request->config->get("dont_enforce_access_settings")) {
$va_access_values = array();
} else {
$va_access_values = caGetUserAccessValues($this->request);
}
if (!$t_set->getPrimaryKey()) {
die("Invalid set_id");
}
if (!$t_object->getPrimaryKey()) {
die("Invalid object_id");
}
if (!$t_rep->getPrimaryKey()) {
die("Invalid representation_id");
}
if (sizeof($va_access_values) && !in_array($t_set->get('access'), $va_access_values)) {
die("Invalid set_id");
}
if (sizeof($va_access_values) && !in_array($t_object->get('access'), $va_access_values)) {
die("Invalid object_id");
}
if (sizeof($va_access_values) && !in_array($t_rep->get('access'), $va_access_values)) {
die("Invalid rep_id");
}
// Get media for display using configured rules
$va_rep_display_info = caGetMediaDisplayInfo("media_overlay", $t_rep->getMediaInfo('media', 'INPUT', 'MIMETYPE'));
// set version
$this->view->setVar('version', $va_rep_display_info['display_version']);
unset($va_display_info['display_version']);
// set other options
$this->view->setVar('display_options', $va_rep_display_info);
if (!($ps_containerID = trim($this->request->getParameter('containerID', pString)))) {
$ps_containerID = 'caMediaPanelContentArea';
}
$this->view->setVar("containerID", $ps_containerID);
// Get all objects asscoiated with this set and show primary reps as icons for navigation
$va_set_items = $t_set->getItems(array("checkAccess" => $va_access_values));
#print "<pre>";
#print_r($va_set_items);
#print "</pre>";
if (sizeof($va_set_items) > 0) {
$t_image_objects = new ca_objects();
$i = 1;
foreach ($va_set_items as $vn_rel_id => $va_inter) {
foreach ($va_inter as $id => $va_info) {
$t_image_objects->load($va_info["row_id"]);
if ($t_primary_rep = $t_image_objects->getPrimaryRepresentationInstance()) {
$va_temp = array();
if (!sizeof($va_access_values) || in_array($t_primary_rep->get('access'), $va_access_values)) {
$va_temp["representation_id"] = $t_primary_rep->get("representation_id");
$va_temp["rep_icon"] = $t_primary_rep->getMediaTag('media', 'icon');
$va_temp["rep_tinyicon"] = $t_primary_rep->getMediaTag('media', 'tinyicon');
$va_temp["object_id"] = $va_info["object_id"];
$va_temp["set_item_id"] = $va_info['item_id'];
$va_thumbnails[$va_info["object_id"]] = $va_temp;
if ($vn_getNext == 1) {
$this->view->setVar("next_object_id", $va_info["object_id"]);
$this->view->setVar("next_representation_id", $t_primary_rep->get("representation_id"));
$vn_getNext = 0;
}
if ($va_info["object_id"] == $pn_object_id) {
$this->view->setVar("representation_index", $i);
$this->view->setVar("previous_object_id", $vn_prev_obj_id);
$this->view->setVar("previous_representation_id", $vn_prev_rep_id);
$this->view->setVar("set_item_id", $va_info['item_id']);
$vn_getNext = 1;
}
$vn_prev_obj_id = $va_info["object_id"];
$vn_prev_rep_id = $t_primary_rep->get("representation_id");
$i++;
}
}
}
}
}
$this->view->setVar('reps', $va_thumbnails);
return $this->render($this->ops_theme . "/ajax_ca_sets_media_overlay_html.php");
}
示例6: CreateNewOrderFromCommunication
/**
*
*/
public function CreateNewOrderFromCommunication()
{
if ($pn_communication_id = $this->request->getParameter('communication_id', pInteger)) {
$t_comm = new ca_commerce_communications($pn_communication_id);
if (!$t_comm->getPrimaryKey()) {
$this->notification->addNotification(_t('Invalid message'), __NOTIFICATION_TYPE_ERROR__);
$this->CustomerInfo();
return;
}
$t_trans = new ca_commerce_transactions($t_comm->get('transaction_id'));
if (!$t_trans->getPrimaryKey()) {
$this->notification->addNotification(_t('Message is not associated with a transaction'), __NOTIFICATION_TYPE_ERROR__);
$this->CustomerInfo();
return;
}
$t_user = new ca_users($t_trans->get('user_id'));
$this->opt_order->setMode(ACCESS_WRITE);
$this->opt_order->set('transaction_id', $t_trans->getPrimaryKey());
if ($t_user->getPrimaryKey()) {
$this->opt_order->set('billing_fname', $t_user->get('fname'));
$this->opt_order->set('billing_lname', $t_user->get('lname'));
$this->opt_order->set('billing_email', $t_user->get('email'));
$this->opt_order->set('shipping_fname', $t_user->get('fname'));
$this->opt_order->set('shipping_lname', $t_user->get('lname'));
$this->opt_order->set('shipping_email', $t_user->get('email'));
// Pre-populate order with user's profile address
$va_mapping = array('billing_organization' => 'user_profile_organization', 'billing_address1' => 'user_profile_address1', 'billing_address2' => 'user_profile_address2', 'billing_city' => 'user_profile_city', 'billing_zone' => 'user_profile_state', 'billing_postal_code' => 'user_profile_postalcode', 'billing_country' => 'user_profile_country', 'billing_phone' => 'user_profile_phone', 'billing_fax' => 'user_profile_fax', 'shipping_organization' => 'user_profile_organization', 'shipping_address1' => 'user_profile_address1', 'shipping_address2' => 'user_profile_address2', 'shipping_city' => 'user_profile_city', 'shipping_zone' => 'user_profile_state', 'shipping_postal_code' => 'user_profile_postalcode', 'shipping_country' => 'user_profile_country', 'shipping_phone' => 'user_profile_phone', 'shipping_fax' => 'user_profile_fax');
foreach ($va_mapping as $vs_field => $vs_pref) {
$this->opt_order->set($vs_field, $t_user->getPreference($vs_pref));
}
}
$this->opt_order->set('order_type', 'L');
// L=loan
$this->opt_order->insert();
$this->request->setParameter('order_id', $this->opt_order->getPrimaryKey());
if (!$this->opt_order->numErrors()) {
$this->notification->addNotification(_t('Saved changes'), __NOTIFICATION_TYPE_INFO__);
// Add items
$t_set = new ca_sets($t_trans->get('set_id'));
if ($t_set->getPrimaryKey()) {
$va_items = $t_set->getItems();
foreach ($va_items as $va_item_list) {
foreach ($va_item_list as $vn_i => $va_item) {
if (!is_array($va_item['selected_services'])) {
//$va_item['selected_services'] = array('DIGITAL_COPY'); // TODO: make default configurable
}
foreach ($va_item['selected_services'] as $vs_service) {
if ($t_item = $this->opt_order->addItem($va_item['row_id'], array('service' => $vs_service), array('representations_ids' => is_array($va_item['selected_representations']) && sizeof($va_item['selected_representations']) ? $va_item['selected_representations'] : null))) {
$t_item->updateFee();
}
}
}
}
// Delete originating set if configured to do so
if ($this->opo_client_services_config->get('set_disposal_policy') == 'DELETE_WHEN_ORDER_CREATED') {
$t_set->setMode(ACCESS_WRITE);
$t_set->delete(true);
}
}
} else {
$va_errors['general'] = $this->opt_order->errors();
$this->notification->addNotification(_t('Errors occurred: %1', join('; ', $this->opt_order->getErrors())), __NOTIFICATION_TYPE_ERROR__);
}
$this->view->setVar('errors', $va_errors);
}
$this->OrderOverview();
}
示例7: exportRecordsFromSet
/**
* Export set items
*
* @param string $ps_exporter_code defines the exporter to use
* @param int $pn_set_id primary key of set to export
* @param string $ps_filename Destination filename (we can't keep everything in memory here)
* @param array $pa_options
* progressCallback = callback function for asynchronous UI status reporting
* showCLIProgressBar = Show command-line progress bar. Default is false.
* logDirectory = path to directory where logs should be written
* logLevel = KLogger constant for minimum log level to record. Default is KLogger::INFO.
* @return boolean success state
*/
public static function exportRecordsFromSet($ps_exporter_code, $pn_set_id, $ps_filename, $pa_options = null)
{
ca_data_exporters::$s_exporter_cache = array();
ca_data_exporters::$s_exporter_item_cache = array();
if (!($t_mapping = ca_data_exporters::loadExporterByCode($ps_exporter_code))) {
return false;
}
if (sizeof(ca_data_exporters::checkMapping($ps_exporter_code)) > 0) {
return false;
}
$t_set = new ca_sets();
if (!$t_set->load($pn_set_id)) {
return false;
}
$va_row_ids = array_keys($t_set->getItems(array('returnRowIdsOnly' => true)));
$o_result = $t_set->makeSearchResult($t_set->get('table_num'), $va_row_ids);
return self::exportRecordsFromSearchResult($ps_exporter_code, $o_result, $ps_filename, $pa_options);
}
示例8: getFirstItemsFromSets
/**
* Returns the first item from each set listed in $pa_set_ids.
*
* @param array $pa_set_ids The set_ids (*not* set codes) for which the first item should be fetched
* @param array $pa_options And optional array of options. Supported values include:
* version = the media version to include with returned set items, when media is available
*
* @return array A list of items; the keys of the array are set_ids while the values are associative arrays containing the latest information.
*/
public static function getFirstItemsFromSets($pa_set_ids, $pa_options = null)
{
if (!is_array($pa_options)) {
$pa_options = array();
}
if ($pa_options["version"]) {
$vs_version = $pa_options["version"];
} else {
$vs_version = "thumbnail";
}
$pa_options["thumbnailVersion"] = $vs_version;
$pa_options["limit"] = 1;
$t_set = new ca_sets();
$va_items = array();
foreach ($pa_set_ids as $vn_set_id) {
if ($t_set->load($vn_set_id)) {
$va_item_list = caExtractValuesByUserLocale($t_set->getItems($pa_options));
$va_items[$vn_set_id] = $va_item_list;
}
}
return $va_items;
}
示例9: array
* the "license.txt" file for details, or visit the CollectiveAccess web site at
* http://www.CollectiveAccess.org
*
* ----------------------------------------------------------------------
*/
require_once __CA_MODELS_DIR__ . '/ca_objects.php';
$va_facets = $this->getVar('available_facets');
$va_facets_with_content = $this->getVar('facets_with_content');
$va_facet_info = $this->getVar('facet_info');
$va_criteria = is_array($this->getVar('criteria')) ? $this->getVar('criteria') : array();
$va_results = $this->getVar('result');
$vs_browse_target = $this->getVar('target');
$t_object = new ca_objects();
$t_featured = new ca_sets();
$featured_set = $t_featured->load(array('set_code' => 'carousel'));
$set_item = $t_featured->getItems();
foreach ($set_item as $id => $item) {
foreach ($item as $i_d => $the_item) {
$carousel_ids[] = $the_item['object_id'];
}
}
shuffle($carousel_ids);
$qr_set = ca_objects::createResultSet($carousel_ids);
$va_random_items = $t_object->getRandomItems(10, array('checkAccess' => $this->getVar('access_values'), 'hasRepresentations' => 1));
$va_labels = $t_object->getPreferredDisplayLabelsForIDs(array_keys($va_random_items));
$va_media = $t_object->getPrimaryMediaForIDs(array_keys($va_random_items), array('small', 'thumbnail', 'preview', 'medium', 'widepreview'), array('checkAccess' => $this->getVar('access_values')));
JavascriptLoadManager::register('cycle');
if (!$this->request->isAjax()) {
?>
<h1><?php
print _t('Browse the Archive');
示例10: foreach
<div class="unit">
<div class="heading"><?php
print _t("STAFF PICKS");
?>
</div>
<div class="divide"><!-- empty --></div>
<?php
foreach ($va_staff_picks_sets as $vn_set_id => $va_set_info) {
?>
<div class="heading"><?php
print $va_set_info["name"];
?>
:</div>
<ul class="crossList">
<?php
$t_set->load($vn_set_id);
$va_set_items = caExtractValuesByUserLocale($t_set->getItems());
foreach ($va_set_items as $vn_item_id => $va_item_info) {
if ($va_item_info["access"] == 1) {
print "<li>" . caNavLink($this->request, $va_item_info["name"], '', 'Detail', 'Collection', 'Show', array('collection_id' => $va_item_info["row_id"])) . "</li>";
}
}
?>
</ul>
<div class="divide"><!-- empty --></div>
<?php
}
?>
</div>
<?php
}
示例11: getSetsOverlay
/**
* Returns content for overlay containing details for object representation linked to occurrence
*/
public function getSetsOverlay()
{
$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->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);
$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 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 set and show primary reps as icons for navigation
//****THIS WONT WORK
#$va_exhibition_images = $t_set->get("ca_objects", array('restrict_to_relationship_types' => array('describes'), "returnAsArray" => 1, 'checkAccess' => $va_access_values));
$va_exhibition_images = $t_set->getItems(array("checkAccess" => $va_access_values));
#print "<pre>";
#print_r($va_exhibition_images);
#print "</pre>";
if (sizeof($va_exhibition_images) > 0) {
$t_image_objects = new ca_objects();
$i = 1;
foreach ($va_exhibition_images 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++;
}
}
//.........这里部分代码省略.........
示例12: Index
function Index()
{
// Remove any browse criteria previously set
$this->opo_browse->removeAllCriteria();
parent::Index(true);
JavascriptLoadManager::register('imageScroller');
JavascriptLoadManager::register('browsable');
JavascriptLoadManager::register('tabUI');
$t_object = new ca_objects();
$t_featured = new ca_sets();
if ($this->request->config->get("dont_enforce_access_settings")) {
$va_access_values = array();
} else {
$va_access_values = caGetUserAccessValues($this->request);
}
# --- featured items set - set name assigned in app.conf
$featured_sets = $this->request->config->get('featured_sets');
$len = count($featured_sets);
if ($len > 3) {
$len = 3;
}
for ($i = 0; $i < $len; $i++) {
$t_featured->load(array('set_code' => $featured_sets[$i]));
$set_id = $t_featured->getPrimaryKey();
$set_title = $t_featured->getLabelForDisplay();
$set_desc = $t_featured->getAttributeFromSets('description', array(0 => $set_id));
$va_featured_ids = array_keys(is_array($va_tmp = $t_featured->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 0))) ? $va_tmp : array());
// These are the object ids in the set
if (is_array($va_featured_ids) && sizeof($va_featured_ids) > 0) {
$t_object = new ca_objects($va_featured_ids[0]);
$va_rep = $t_object->getPrimaryRepresentation(array('thumbnail', 'small', 'medium', 'mediumlarge', 'preview', 'widepreview'), null, array('return_with_access' => $va_access_values));
$featured_set_id_array[$i] = array('featured_set_code' => $featured_sets[$i], 'featured_content_id' => $va_featured_ids[0], 'featured_content_small' => $va_rep["tags"]["small"], 'featured_content_label' => $set_title, 'featured_content_description' => $set_desc[$set_id][0], 'featured_set_id' => $set_id);
}
}
$this->view->setVar('featured_set_id_array', $featured_set_id_array);
# --- user favorites get the highest ranked objects to display
$va_user_favorites_items = $t_object->getHighestRated(true, 12, $va_access_values);
if (sizeof($va_user_favorites_items) > 0) {
if (is_array($va_user_favorites_items) && sizeof($va_user_favorites_items) > 0) {
$t_object = new ca_objects($va_user_favorites_items[0]);
$va_rep = $t_object->getPrimaryRepresentation(array('thumbnail', 'small', 'preview', 'widepreview'), null, array('return_with_access' => $va_access_values));
$this->view->setVar('user_favorites_id', $va_user_favorites_items[0]);
$this->view->setVar('user_favorites_thumb', $va_rep["tags"]["thumbnail"]);
$this->view->setVar('user_favorites_small', $va_rep["tags"]["small"]);
$this->view->setVar('user_favorites_preview', $va_rep["tags"]["preview"]);
$this->view->setVar('user_favorites_widepreview', $va_rep["tags"]["widepreview"]);
}
} else {
$this->view->setVar('user_favorites_is_random', 1);
# if no ranks set, choose a random object
$va_random_items = $t_object->getRandomItems(1, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1));
$va_labels = $t_object->getPreferredDisplayLabelsForIDs(array_keys($va_random_items));
$va_media = $t_object->getPrimaryMediaForIDs(array_keys($va_random_items), array('small', 'thumbnail', 'preview', 'medium', 'widepreview'), array("checkAccess" => $va_access_values));
foreach ($va_random_items as $vn_object_id => $va_object_info) {
$va_object_info['title'] = $va_labels[$vn_object_id];
$va_object_info['media'] = $va_media[$vn_object_id];
$va_random_items[$vn_object_id] = $va_object_info;
}
$this->view->setVar('random_objects', $va_random_items);
if (is_array($va_random_items) && sizeof($va_random_items) > 0) {
$va_object_info = array_shift($va_random_items);
$this->view->setVar('user_favorites_id', $va_object_info['object_id']);
$this->view->setVar('user_favorites_thumb', $va_media[$va_object_info['object_id']]["tags"]["thumbnail"]);
$this->view->setVar('user_favorites_small', $va_media[$va_object_info['object_id']]["tags"]["small"]);
$this->view->setVar('user_favorites_preview', $va_media[$va_object_info['object_id']]["tags"]["preview"]);
$this->view->setVar('user_favorites_widepreview', $va_media[$va_object_info['object_id']]["tags"]["widepreview"]);
$this->view->setVar('user_favorites_medium', $va_media[$va_object_info['object_id']]["tags"]["medium"]);
}
}
#---- new 'recently added'
$t_set = new ca_sets();
$ra_set_code = $this->request->config->get('recently_added_set_id');
$t_set->load(array('set_code' => $ra_set_code));
$set_id = $t_set->getPrimaryKey();
$ra_items = caExtractValuesByUserLocale($t_set->getItems(array('thumbnailVersions' => array('thumbnail', 'preview'), "checkAccess" => 1)));
$va_recently_added = array();
foreach ($ra_items as $va_item_info) {
$vn_r_object_id = $va_item_info['object_id'];
$t_object->load($vn_r_object_id);
$va_reps = $t_object->getPrimaryRepresentation(array('thumbnail', 'preview'), null, array('return_with_access' => $va_access_values));
$va_recently_added[$vn_r_object_id] = $va_reps["tags"]["preview"];
}
# --- get the 12 most recently added objects to display
/*$va_recently_added_ids = $t_object->getRecentlyAddedItems(15, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1));
if(is_array($va_recently_added_ids) && sizeof($va_recently_added_ids) > 0){
$va_recently_added = array();
foreach($va_recently_added_ids as $va_item_info){
$vn_r_object_id = $va_item_info['object_id'];
$t_object->load($vn_r_object_id);
$va_reps = $t_object->getPrimaryRepresentation(array('thumbnail', 'preview'), null, array('return_with_access' => $va_access_values));
$va_recently_added[$vn_r_object_id] = $va_reps["tags"]["preview"];
}
}*/
$this->view->setVar('recently_added', $va_recently_added);
$this->render('Splash/splash_html.php');
}
示例13: caGetUserAccessValues
Funding from the Council on Library and Information Services, <a href="http://www.clir.org/hiddencollections/index.html" target="_blank">Cataloging Hidden Special Collections and Archives program</a>.
<br/><br/>Katrina Dixon was the project media cataloger.
<br/>Karan Sheldon was the project director. <a href="mailto:karan@oldfilm.org">karan@oldfilm.org</a>
<br/><br/><br/>
<div class="subTitle">Featured Collections</div>
<div id="featuredCollections">
<?php
$t_featured_set = new ca_sets();
$va_access_values = caGetUserAccessValues($this->request);
# --- featured collections - set_code hiddenCollections
$t_featured_set->load(array('set_code' => "hiddenCollections"));
#$va_featured_ids = array_keys(is_array($va_tmp = $t_featured_set->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 0))) ? $va_tmp : array()); // These are the collection ids in the set
$va_items = caExtractValuesByUserLocale($t_featured_set->getItems(array('returnItemAttributes' => array('caption'))));
if (is_array($va_items) && sizeof($va_items) > 0) {
$t_collection = new ca_collections();
foreach ($va_items as $vn_i => $va_set_item_info) {
print "<div class='featuredCollection'>";
$vn_collection_id = $va_set_item_info["row_id"];
$t_collection->load($vn_collection_id);
print caNavLink($this->request, $t_collection->getAttributesForDisplay("collection_still", null, array('version' => 'thumbnail', 'showMediaInfo' => false)), '', 'Detail', 'Collection', 'Show', array('collection_id' => $vn_collection_id));
print caNavLink($this->request, $t_collection->getLabelForDisplay(), '', 'Detail', 'Collection', 'Show', array('collection_id' => $vn_collection_id)) . "<br/>\n";
print "<div>" . $va_set_item_info["ca_attribute_caption"] . "</div>";
print "</div>";
}
}
?>
</div>
示例14: testAddAndGetSetItem
/**
* @link http://clangers.collectiveaccess.org/jira/browse/PROV-434
*/
public function testAddAndGetSetItem()
{
$t_set = new ca_sets($this->opn_set_id);
$t_set->setMode(ACCESS_WRITE);
// "quick" add object (this method uses direct INSERT queries)
$t_set->addItems(array($this->opn_object_id));
$va_set_items = $t_set->getItems();
// get rid of unneeded nesting in array. we should only have one label in one locale.
$this->assertEquals(1, sizeof($va_set_items), 'Set should only have one item in one locale');
$va_set_items = array_shift($va_set_items);
$this->assertEquals(1, sizeof($va_set_items), 'Set should only have one item in one locale');
$va_set_items = array_shift($va_set_items);
// basic checks
$this->assertArrayHasKey('caption', $va_set_items, 'Set item must have empty/blank label');
$this->assertEquals('[BLANK]', $va_set_items['caption'], 'Set item must have empty/blank label');
$this->assertArrayHasKey('row_id', $va_set_items, 'Set item must be related to object');
$this->assertEquals($this->opn_object_id, $va_set_items['row_id'], 'Set item must be related to object');
//
// this is (hopefully was?) the actual PROV-434 bug
// @see http://clangers.collectiveaccess.org/jira/browse/PROV-434
//
$va_items = $t_set->get('ca_set_items', array('returnWithStructure' => true));
$this->assertEquals(1, sizeof($va_items));
$va_item = array_shift($va_items);
$this->assertArrayHasKey('caption', $va_item, 'Set item must have empty/blank label');
$this->assertEquals('[BLANK]', $va_item['caption'], 'Set item must have empty/blank label');
$this->assertArrayHasKey('record_id', $va_item, 'Set item must be related to object');
$this->assertEquals($this->opn_object_id, $va_item['record_id'], 'Set item must be related to object');
// try text (no return as array)
$vs_ret = $t_set->get('ca_set_items.item_id');
// what comes out is a string with the primary key
$this->assertRegExp("/^[0-9]+\$/", $vs_ret);
$vs_ret = $t_set->get('ca_set_items.preferred_labels');
$this->assertEquals("[BLANK]", $vs_ret);
$vs_ret = $t_set->get('ca_set_items.row_id');
$this->assertEquals((string) $this->opn_object_id, $vs_ret);
// remove item
$t_set->removeItem($this->opn_object_id);
$this->assertEmpty($t_set->getItems());
// re-add object using model method (as opposed to direct insert addItems() above)
$t_set->addItem($this->opn_object_id);
// basic checks (again)
$va_set_items = $t_set->getItems();
// get rid of unneeded nesting in array. we should only have one label in one locale.
$this->assertEquals(1, sizeof($va_set_items), 'Set should only have one item in one locale');
$va_set_items = array_shift($va_set_items);
$this->assertEquals(1, sizeof($va_set_items), 'Set should only have one item in one locale');
$va_set_items = array_shift($va_set_items);
$this->assertArrayHasKey('caption', $va_set_items, 'Set item must have empty/blank label');
$this->assertEquals('[BLANK]', $va_set_items['caption'], 'Set item must have empty/blank label');
$this->assertArrayHasKey('row_id', $va_set_items, 'Set item must be related to object');
$this->assertEquals($this->opn_object_id, $va_set_items['row_id'], 'Set item must be related to object');
//
// this is (hopefully was?) the actual PROV-434 bug
// @see http://clangers.collectiveaccess.org/jira/browse/PROV-434
//
$va_items = $t_set->get('ca_set_items', array('returnWithStructure' => true));
$this->assertEquals(1, sizeof($va_items));
$va_item = array_shift($va_items);
$this->assertArrayHasKey('caption', $va_item, 'Set item must have empty/blank label');
$this->assertEquals('[BLANK]', $va_item['caption'], 'Set item must have empty/blank label');
$this->assertArrayHasKey('record_id', $va_item, 'Set item must be related to object');
$this->assertEquals($this->opn_object_id, $va_item['record_id'], 'Set item must be related to object');
}
示例15: Index
public function Index()
{
JavascriptLoadManager::register('browsable');
JavascriptLoadManager::register('hierBrowser');
// Remove any browse criteria previously set
$this->opo_browse->removeAllCriteria();
parent::Index(true);
# --- get the featured collections
$va_featured = array();
$va_access_values = caGetUserAccessValues($this->request);
$t_featured = new ca_sets();
$t_featured->load(array('set_code' => "featured_collections"));
# Enforce access control on set
if (sizeof($va_access_values) == 0 || sizeof($va_access_values) && in_array($t_featured->get("access"), $va_access_values)) {
$va_featured_collections = caExtractValuesByUserLocale($t_featured->getItems(array('checkAccess' => $va_access_values, 'shuffle' => 1)));
// These are the collection ids in the set
}
if (is_array($va_featured_collections) && sizeof($va_featured_collections) > 0) {
$va_featured_collections = array_slice($va_featured_collections, 0, 5);
foreach ($va_featured_collections as $vn_i => $va_collection_info) {
$va_temp = array();
$va_temp["idno"] = $va_collection_info["idno"];
$va_temp["collection_id"] = $va_collection_info["row_id"];
$va_temp["label"] = $va_collection_info["set_item_label"];
$va_featured[$va_collection_info["set_item_label"]] = $va_temp;
}
}
arsort($va_featured);
$this->view->setVar("featured_collections", $va_featured);
$this->render('collections_landing_index_html.php');
}