本文整理汇总了PHP中ca_sets::get方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_sets::get方法的具体用法?PHP ca_sets::get怎么用?PHP ca_sets::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_sets
的用法示例。
在下文中一共展示了ca_sets::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Index
public function Index()
{
$va_participate_ids = array();
$t_participate = new ca_sets();
# --- participate set - set name assigned in eastend.conf - plugin conf file
$t_participate->load(array('set_code' => $this->opo_plugin_config->get('participate_set_name')));
# Enforce access control on set
if (sizeof($this->opa_access_values) == 0 || sizeof($this->opa_access_values) && in_array($t_participate->get("access"), $this->opa_access_values)) {
$this->view->setVar('participate_set_id', $t_participate->get("set_id"));
$va_participate_ids = array_keys(is_array($va_tmp = $t_participate->getItemRowIDs(array('checkAccess' => $this->opa_access_values, 'shuffle' => 1))) ? $va_tmp : array());
// These are the entity ids in the set
}
# --- loop through featured ids and grab the object's image
$t_object = new ca_objects();
$va_participate_images = array();
foreach ($va_participate_ids as $vn_participate_object_id) {
$va_tmp = array();
$t_object->load($vn_participate_object_id);
$va_tmp["object_id"] = $vn_participate_object_id;
$va_image = $t_object->getPrimaryRepresentation(array("mediumlarge"));
# --- don't show records with status ars/vaga don't show image
if ($t_object->get("ca_objects.object_status") != 348) {
if ($t_object->get("ca_objects.object_status") == 349) {
$va_tmp["vaga_class"] = "vagaDisclaimer";
}
$va_tmp["image"] = $va_image["tags"]["mediumlarge"];
$va_tmp["caption"] = $t_object->get("ca_objects.caption");
$va_tmp["title"] = $t_object->getLabelForDisplay();
}
$va_participate_images[$vn_participate_object_id] = $va_tmp;
}
$this->view->setVar("participate_images", $va_participate_images);
$this->render('participate_html.php');
}
示例2: testTest
public function testTest()
{
// establish everything went ok
$this->assertEquals('TEST', $this->opt_set->get('set_code'));
// should return primary label
$this->assertEquals('Homer J. Simpson', $this->opt_set->get('ca_sets.entity_reference'));
$this->assertEquals('Homer J. Simpson', $this->opt_set->getWithTemplate('^ca_sets.entity_reference'));
}
示例3: __call
/**
*
*/
public function __call($ps_function, $pa_args)
{
AssetLoadManager::register("carousel");
$va_access_values = caGetUserAccessValues($this->request);
$this->view->setVar('access_values', $va_access_values);
#
# --- if there is a set configured to show on the front page, load it now
#
$va_featured_ids = array();
if ($vs_set_code = $this->config->get("front_page_set_code")) {
$t_set = new ca_sets();
$t_set->load(array('set_code' => $vs_set_code));
# Enforce access control on set
if (sizeof($va_access_values) == 0 || sizeof($va_access_values) && in_array($t_set->get("access"), $va_access_values)) {
$this->view->setVar('featured_set_id', $t_set->get("set_id"));
$this->view->setVar('featured_set', $t_set);
$va_featured_ids = array_keys(is_array($va_tmp = $t_set->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 1))) ? $va_tmp : array());
$this->view->setVar('featured_set_item_ids', $va_featured_ids);
$this->view->setVar('featured_set_items_as_search_result', caMakeSearchResult('ca_objects', $va_featured_ids));
}
}
#
# --- no configured set/items in set so grab random objects with media
#
if (sizeof($va_featured_ids) == 0) {
$t_object = new ca_objects();
$va_featured_ids = array_keys($t_object->getRandomItems(10, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1)));
$this->view->setVar('featured_set_item_ids', $va_featured_ids);
$this->view->setVar('featured_set_items_as_search_result', caMakeSearchResult('ca_objects', $va_featured_ids));
}
$this->view->setVar('config', $this->config);
$o_result_context = new ResultContext($this->request, 'ca_objects', 'front');
$this->view->setVar('result_context', $o_result_context);
$o_result_context->setAsLastFind();
//
// Try to load selected page if it exists in Front/, otherwise load default Front/front_page_html.php
//
$ps_function = preg_replace("![^A-Za-z0-9_\\-]+!", "", $ps_function);
$vs_path = "Front/{$ps_function}_html.php";
if (file_exists(__CA_THEME_DIR__ . "/views/{$vs_path}")) {
$this->render($vs_path);
} else {
$this->render("Front/front_page_html.php");
}
}
示例4: Info
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);
}
示例5: 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);
}
示例6: 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");
}
示例7: caGetFrontConfig
* @package CollectiveAccess
* @subpackage Core
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License version 3
*
* ----------------------------------------------------------------------
*/
?>
<div class="row">
<?php
$va_access_values = $this->getVar("access_values");
$o_config = caGetFrontConfig();
# --- grab the set that has the featured
$t_set = new ca_sets();
$t_set->load(array('set_code' => $o_config->get("front_page_exhibit_set_code")));
$t_exhibition = new ca_occurrences();
if (sizeof($va_access_values) == 0 || sizeof($va_access_values) && in_array($t_set->get("access"), $va_access_values)) {
$va_exhibition_ids = array_keys(is_array($va_tmp = $t_set->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 1))) ? $va_tmp : array());
$t_exhibition->load($va_exhibition_ids[0]);
}
# --- check to see if there is an image set configured
$t_set->load(array('set_code' => $o_config->get("front_page_set_code")));
if (sizeof($va_access_values) == 0 || sizeof($va_access_values) && in_array($t_set->get("access"), $va_access_values)) {
$va_featured_ids = array_keys(is_array($va_tmp = $t_set->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 1))) ? $va_tmp : array());
$qr_res = caMakeSearchResult('ca_objects', $va_featured_ids);
}
if ($qr_res && $qr_res->numHits()) {
$qr_res = $this->getVar('featured_set_items_as_search_result');
while ($qr_res->nextHit()) {
if ($vs_media = $qr_res->getWithTemplate('^ca_object_representations.media.front', array("checkAccess" => $va_access_values))) {
print "<div class='col-sm-12'><div class='frontSlide'>" . $vs_media . "</div></div>";
break;
示例8: Index
public function Index()
{
if ($this->request->config->get("dont_enforce_access_settings")) {
$va_access_values = array();
} else {
$va_access_values = caGetUserAccessValues($this->request);
}
$t_object = new ca_objects();
$t_user_favs = new ca_sets();
// redirect user if not logged in
if ($this->request->config->get('pawtucket_requires_login') && !$this->request->isLoggedIn() || $this->request->config->get('show_bristol_only') && !$this->request->isLoggedIn()) {
$this->response->setRedirect(caNavUrl($this->request, "", "LoginReg", "form"));
} elseif ($this->request->config->get('show_bristol_only') && $this->request->isLoggedIn()) {
$this->response->setRedirect(caNavUrl($this->request, "bristol", "Show", "Index"));
}
# --- user favs - highest ranked
$va_user_favs = array();
$va_user_favs_ids = $t_object->getHighestRated(true, 12, $va_access_values);
if (is_array($va_user_favs_ids) && sizeof($va_user_favs_ids) > 0) {
foreach ($va_user_favs_ids as $vn_uf_object_id) {
$t_object = new ca_objects($vn_uf_object_id);
$va_reps = $t_object->getPrimaryRepresentation(array('thumbnail', 'preview'), null, array('return_with_access' => $va_access_values));
$va_user_favs[$vn_uf_object_id] = $va_reps["tags"]["preview"];
}
} else {
# --- get random objects
$this->view->setVar('user_favorites_is_random', 1);
$va_random_ids = $t_object->getRandomItems(15, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1));
if (is_array($va_random_ids) && sizeof($va_random_ids) > 0) {
$va_random = array();
foreach ($va_random_ids as $va_item_info) {
$vn_rand_object_id = $va_item_info['object_id'];
$t_object->load($vn_rand_object_id);
$va_reps = $t_object->getPrimaryRepresentation(array('thumbnail', 'preview'), null, array('return_with_access' => $va_access_values));
$va_random[$vn_rand_object_id] = $va_reps["tags"]["preview"];
}
$va_user_favs = $va_random;
}
}
$this->view->setVar('user_favs', $va_user_favs);
# --- featured items set set_code defined in app.conf
$t_featured = new ca_sets();
$t_featured->load(array('set_code' => $this->request->config->get('featured_set_name')));
# Enforce access control on set
if (sizeof($va_access_values) && !in_array($t_featured->get("access"), $va_access_values)) {
$t_featured = new ca_sets();
}
$va_featured = array();
if (is_array($va_row_ids = $t_featured->getItemRowIDs(array('checkAccess' => $va_access_values)))) {
$va_featured_ids = array_keys($va_row_ids);
// These are the object ids in the set
foreach ($va_featured_ids as $vn_f_object_id) {
$t_object = new ca_objects($vn_f_object_id);
$va_reps = $t_object->getPrimaryRepresentation(array('thumbnail', 'preview'), null, array('return_with_access' => $va_access_values));
$va_featured[$vn_f_object_id] = $va_reps["tags"]["preview"];
}
} else {
# --- get random objects
$va_random_ids = $t_object->getRandomItems(15, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1));
if (is_array($va_random_ids) && sizeof($va_random_ids) > 0) {
$va_random = array();
foreach ($va_random_ids as $va_item_info) {
$vn_rand_object_id = $va_item_info['object_id'];
$t_object->load($vn_rand_object_id);
$va_reps = $t_object->getPrimaryRepresentation(array('thumbnail', 'preview'), null, array('return_with_access' => $va_access_values));
$va_random[$vn_rand_object_id] = $va_reps["tags"]["preview"];
}
$va_featured = $va_random;
}
}
$this->view->setVar('featured', $va_featured);
# --- most viewed
$va_most_viewed_ids = $t_object->getMostViewedItems(15, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1));
if (is_array($va_most_viewed_ids) && sizeof($va_most_viewed_ids) > 0) {
$va_most_viewed = array();
foreach ($va_most_viewed_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_most_viewed[$vn_r_object_id] = $va_reps["tags"]["preview"];
}
}
$this->view->setVar('most_viewed', $va_most_viewed);
# --- recently added
$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('Favorites/favorites_landing_html.php');
}
示例9: addToSet
/**
* Add items to specified set
*/
public function addToSet()
{
$vn_added_items_count = $vn_dupe_item_count = 0;
$ps_rows = $this->request->getParameter('item_ids', pString);
$pa_row_ids = explode(';', $ps_rows);
if (!$ps_rows || !sizeof($pa_row_ids)) {
$this->view->setVar('error', _t('Nothing was selected'));
} else {
$t_model = $this->opo_datamodel->getInstanceByTableName($this->ops_tablename, true);
$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);
$this->view->setVar('set_name', $t_set->getLabelForDisplay());
$this->view->setVar('error', '');
if ($t_set->getPrimaryKey() && $t_set->get('table_num') == $t_model->tableNum()) {
$va_item_ids = $t_set->getItemRowIDs(array('user_id' => $this->request->getUserID()));
foreach ($pa_row_ids as $vn_row_id) {
if (!$vn_row_id) {
continue;
}
if (isset($va_item_ids[$vn_row_id])) {
$vn_dupe_item_count++;
continue;
}
if ($t_set->addItem($vn_row_id, array(), $this->request->getUserID())) {
$va_item_ids[$vn_row_id] = 1;
$vn_added_items_count++;
} else {
$this->view->setVar('error', join('; ', $t_set->getErrors()));
}
}
} else {
$this->view->setVar('error', _t('Invalid set'));
}
}
$this->view->setVar('num_items_added', $vn_added_items_count);
$this->view->setVar('num_items_already_in_set', $vn_dupe_item_count);
$this->render('Results/ajax_add_to_set_json.php');
}
示例10: array
<?php
require_once __CA_MODELS_DIR__ . "/ca_objects.php";
require_once __CA_MODELS_DIR__ . "/ca_sets.php";
require_once __CA_APP_DIR__ . '/helpers/accessHelpers.php';
$t_object = new ca_objects();
$t_featured_obj = new ca_sets();
# --- load the featured items set - set name assigned in app.conf
$t_featured_obj->load(array('set_code' => 'featured_object'));
# --- Enforce access control on set
if (sizeof($va_access_values) == 0 || sizeof($va_access_values) && in_array($t_featured_obj->get("access"), $va_access_values)) {
$vn_featured_set_id = $t_featured_obj->get("set_id");
$va_featured_ids = array_keys(is_array($va_tmp = $t_featured_obj->getItemRowIDs(array('checkAccess' => $va_access_values, 'limit' => 1))) ? $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('widepreview'), null, array('return_with_access' => $va_access_values));
$feat_obj_content_id = $va_featured_ids[0];
$feat_obj_content_widepreview = $va_rep["tags"]["widepreview"];
$vs_featured_content_label = $t_object->getLabelForDisplay();
}
# --- Recently Added
# --- get the 12 most recently added objects to display
$va_recently_added_items = $t_object->getRecentlyAddedItems(12, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1));
$va_labels = $t_object->getPreferredDisplayLabelsForIDs(array_keys($va_recently_added_items));
$va_media = $t_object->getPrimaryMediaForIDs(array_keys($va_recently_added_items), array('small', 'thumbnail', 'preview', 'widepreview'), array("checkAccess" => $va_access_values));
foreach ($va_recently_added_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_recently_added_objects[$vn_object_id] = $va_object_info;
示例11: Index
function Index($pa_options = null)
{
// Remove any browse criteria previously set
$this->opo_browse->removeAllCriteria();
parent::Index(array('dontRenderView' => true));
JavascriptLoadManager::register('imageScroller');
JavascriptLoadManager::register('browsable');
JavascriptLoadManager::register('tabUI');
JavascriptLoadManager::register('cycle');
$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);
}
$va_default_versions = array('thumbnail', 'icon', 'small', 'preview', 'medium', 'preview', 'widepreview');
# --- featured items set - set name assigned in app.conf
$t_featured->load(array('set_code' => $this->request->config->get('featured_set_name')));
# Enforce access control on set
if (sizeof($va_access_values) == 0 || sizeof($va_access_values) && in_array($t_featured->get("access"), $va_access_values)) {
$this->view->setVar('featured_set_id', $t_featured->get("set_id"));
$va_featured_ids = array_keys(is_array($va_tmp = $t_featured->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 1))) ? $va_tmp : array());
// These are the object ids in the set
}
if (!is_array($va_featured_ids) || sizeof($va_featured_ids) == 0) {
# put a random object in the features variable
$va_featured_ids = array_keys($t_object->getRandomItems(10, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1)));
}
$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));
$this->view->setVar('featured_content_id', $va_featured_ids[0]);
$this->view->setVar('featured_content_thumb', $va_rep["tags"]["thumbnail"]);
$this->view->setVar('featured_content_small', $va_rep["tags"]["small"]);
$this->view->setVar('featured_content_mediumlarge', $va_rep["tags"]["mediumlarge"]);
$this->view->setVar('featured_content_medium', $va_rep["tags"]["medium"]);
$this->view->setVar('featured_content_preview', $va_rep["tags"]["preview"]);
$this->view->setVar('featured_content_widepreview', $va_rep["tags"]["widepreview"]);
$this->view->setVar('featured_content_label', $t_object->getLabelForDisplay());
$this->view->setVar('featured_content_slideshow_id_list', $va_featured_ids);
if (!(bool) $this->request->config->get("splash_disable_highest_rated_objects")) {
if (!is_array($va_versions = $this->request->config->getList("splash_highest_rated_display_versions"))) {
$va_versions = $va_default_versions;
}
# --- 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($va_versions, null, array('return_with_access' => $va_access_values));
$this->view->setVar('user_favorites_id', $va_user_favorites_items[0]);
foreach ($va_versions as $vs_version) {
$this->view->setVar('user_favorites_' . $vs_version, $va_rep['tags'][$vs_version]);
}
}
} 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), $va_versions, 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 = reset($va_random_items);
$this->view->setVar('user_favorites_id', $va_object_info['object_id']);
foreach ($va_versions as $vs_version) {
$this->view->setVar('user_favorites_' . $vs_version, $va_media[$va_object_info['object_id']]['tags'][$vs_version]);
}
}
}
}
if (!(bool) $this->request->config->get("splash_disable_recently_added_objects")) {
if (!is_array($va_versions = $this->request->config->getList("splash_recently_added_display_versions"))) {
$va_versions = $va_default_versions;
}
# --- get the 12 most recently added objects to display
$va_recently_added_items = $t_object->getRecentlyAddedItems(12, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1));
$va_labels = $t_object->getPreferredDisplayLabelsForIDs(array_keys($va_recently_added_items));
$va_media = $t_object->getPrimaryMediaForIDs(array_keys($va_recently_added_items), $va_versions, array("checkAccess" => $va_access_values));
foreach ($va_recently_added_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_recently_added_objects[$vn_object_id] = $va_object_info;
}
$this->view->setVar('recently_added_objects', $va_recently_added_objects);
if (is_array($va_recently_added_objects) && sizeof($va_recently_added_objects) > 0) {
$va_object_info = reset($va_recently_added_objects);
$this->view->setVar('recently_added_id', $va_object_info['object_id']);
foreach ($va_versions as $vs_version) {
$this->view->setVar('recently_added_' . $vs_version, $va_media[$va_object_info['object_id']]['tags'][$vs_version]);
}
}
} else {
$this->view->setVar('recently_added_objects', array());
}
//.........这里部分代码省略.........
示例12: displaySet
public function displaySet()
{
# --- set info
$pn_set_id = $this->request->getParameter('set_id', pInteger);
$t_set = new ca_sets($pn_set_id);
$va_access_values = caGetUserAccessValues($this->request);
# Enforce access control
if (sizeof($va_access_values) && !in_array($t_set->get("access"), $va_access_values)) {
$this->notification->addNotification(_t("This set is not available for view"), "message");
$this->response->setRedirect(caNavUrl($this->request, "", "", "", ""));
return;
}
$this->view->setVar('t_set', $t_set);
$va_items = caExtractValuesByUserLocale($t_set->getItems(array('thumbnailVersions' => array('widepreview', 'medium', 'setimage'), "checkAccess" => $va_access_values)));
$this->view->setVar('items', $va_items);
$va_row_ids = array();
foreach ($va_items as $vn_item_id => $va_item_info) {
$va_row_ids[] = $va_item_info['row_id'];
}
# --- all featured sets - for display in right hand column
// get sets for public display
$t_list = new ca_lists();
$vn_public_set_type_id = $t_list->getItemIDFromList('set_types', $t_list->getAppConfig()->get('simpleGallery_set_type'));
$t_set = new ca_sets($pn_set_id);
$va_sets = caExtractValuesByUserLocale($t_set->getSets(array('table' => 'ca_objects', 'checkAccess' => $va_access_values, 'setType' => $vn_public_set_type_id)));
$va_set_first_items = array();
$va_set_first_items = $t_set->getFirstItemsFromSets(array_keys($va_sets), array("version" => "icon", "checkAccess" => $va_access_values));
$this->view->setVar('sets', $va_sets);
$this->view->setVar('first_items_from_sets', $va_set_first_items);
$this->view->setVar('set_title', $t_set->getLabelForDisplay());
$this->view->setVar('set_description', $t_set->get($this->opo_plugin_config->get('set_description_element_code'), array('convertLinkBreaks' => true)));
// Needed to figure out what result context to use on details
$this->opo_result_context->setParameter('set_id', $pn_set_id);
$this->opo_result_context->setResultList($va_row_ids);
$this->opo_result_context->setAsLastFind();
$this->opo_result_context->saveContext();
$this->render($this->ops_theme . '/set_info_html.php');
}
示例13: getFeaturedArtistSlideshow
public function getFeaturedArtistSlideshow()
{
$va_featured_ids = array();
$t_featured = new ca_sets();
# --- featured artists set - set name assigned in eastend.conf - plugin conf file
$t_featured->load(array('set_code' => $this->opo_plugin_config->get('featured_artists_set_name')));
# Enforce access control on set
if (sizeof($this->opa_access_values) == 0 || sizeof($this->opa_access_values) && in_array($t_featured->get("access"), $this->opa_access_values)) {
$this->view->setVar('featured_set_id', $t_featured->get("set_id"));
$va_featured_ids = array_keys(is_array($va_tmp = $t_featured->getItemRowIDs(array('checkAccess' => $this->opa_access_values, 'shuffle' => 1))) ? $va_tmp : array());
// These are the entity ids in the set
}
if (!is_array($va_featured_ids) || sizeof($va_featured_ids) == 0) {
# put random entities in the features variable
$o_db = new Db();
$q_entities = $o_db->query("SELECT e.entity_id from ca_entities e WHERE e.access IN (" . implode($this->opa_access_values, ", ") . ") ORDER BY RAND() LIMIT 10");
if ($q_entities->numRows() > 0) {
while ($q_entities->nextRow()) {
$va_featured_ids[] = $q_entities->get("entity_id");
}
}
}
# --- loop through featured ids and grab the entity's name, portrait, lifespan -lifespans_date, indexing_notes (brief description abouthow they relate to the east end)
$t_entity = new ca_entities();
$t_object = new ca_objects();
$va_featured_artists = array();
foreach ($va_featured_ids as $vn_featured_entity_id) {
$va_tmp = array();
$t_entity->load($vn_featured_entity_id);
$va_tmp["entity_id"] = $vn_featured_entity_id;
$va_tmp["lifespan"] = $t_entity->get("lifespans_date");
$va_tmp["indexing_notes"] = $t_entity->get("indexing_notes");
$va_tmp["name"] = $t_entity->getLabelForDisplay();
$va_objects = $t_entity->get("ca_objects", array("returnAsArray" => 1, 'checkAccess' => $this->opa_access_values, 'restrict_to_relationship_types' => array('portrait')));
$va_object = array_shift($va_objects);
$t_object->load($va_object["object_id"]);
$va_portrait = $t_object->getPrimaryRepresentation(array("abSlideShow"));
# --- don't show records with status ars/vaga don't show image
if ($t_object->get("ca_objects.object_status") != 348) {
if ($t_object->get("ca_objects.object_status") == 349) {
$va_tmp["vaga_class"] = "vagaDisclaimer";
}
$va_tmp["image"] = $va_portrait["tags"]["abSlideShow"];
$va_tmp["caption"] = $t_object->get("ca_objects.caption");
}
$va_featured_artists[$vn_featured_entity_id] = $va_tmp;
}
$this->view->setVar("featured_artists", $va_featured_artists);
$this->render('featured_artists_html.php');
}
示例14: AjaxAddItem
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");
}
}
}
示例15: array
* 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
*
* ----------------------------------------------------------------------
*/
# print $this->render("Front/featured_set_slideshow_html.php");
$va_featured_ids = array();
if ($vs_set_code = $this->request->config->get("front_page_set_code")) {
$t_set = new ca_sets();
$t_set->load(array('set_code' => $vs_set_code));
# Enforce access control on set
if (sizeof($va_access_values) == 0 || sizeof($va_access_values) && in_array($t_set->get("access"), $va_access_values)) {
$vs_set_id = $t_set->get("set_id");
$va_featured_ids = array_keys(is_array($va_tmp = $t_set->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 1))) ? $va_tmp : array());
$featured_set_items_as_search_result = caMakeSearchResult('ca_occurrences', $va_featured_ids);
}
}
?>
<div class="container">
<div class="row">
<div class="col-sm-8">
<h2>Selected exhibitions</h2>
<?php
if ($featured_set_items_as_search_result) {
while ($featured_set_items_as_search_result->nextHit()) {
$va_occurrence_id = $featured_set_items_as_search_result->get('ca_occurrences.occurrence_id');
$va_related_objects = $featured_set_items_as_search_result->get('ca_objects.object_id', array('returnAsArray' => true));