本文整理汇总了PHP中ca_objects::getRandomItems方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_objects::getRandomItems方法的具体用法?PHP ca_objects::getRandomItems怎么用?PHP ca_objects::getRandomItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_objects
的用法示例。
在下文中一共展示了ca_objects::getRandomItems方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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");
}
}
示例2: renderWidget
/**
*
*/
public function renderWidget($ps_widget_id, &$pa_settings)
{
parent::renderWidget($ps_widget_id, $pa_settings);
$t_object = new ca_objects();
# get a random object for display
$va_random_item = $t_object->getRandomItems(1, array('hasRepresentations' => 1));
if (sizeof($va_random_item) > 0) {
foreach ($va_random_item as $vn_object_id => $va_object_info) {
$t_object->load($vn_object_id);
$va_rep = $t_object->getPrimaryRepresentation(array('medium'));
$this->opo_view->setVar('object_id', $vn_object_id);
$this->opo_view->setVar('image', $va_rep["tags"]["medium"]);
$this->opo_view->setVar('label', $t_object->getLabelForDisplay());
}
}
$this->opo_view->setVar('request', $this->getRequest());
return $this->opo_view->render('main_html.php');
}
示例3: array
$va_access_values = array();
} else {
$va_access_values = caGetUserAccessValues($this->request);
}
# --- set for share your knowledge box - set name assigned in app.conf - featured_share_set_name
$t_featured_share = new ca_sets();
$t_featured_share->load(array('set_code' => $this->request->config->get('featured_share_set_name')));
# Enforce access control on set
if (sizeof($va_access_values) == 0 || sizeof($va_access_values) && in_array($t_featured_share->get("access"), $va_access_values)) {
$vn_featured_share_set_id = $t_featured_share->get("set_id");
$va_featured_share_ids = array_keys(is_array($va_tmp = $t_featured_share->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 1))) ? $va_tmp : array());
// These are the object ids in the set
}
if (!is_array($va_featured_share_ids) || sizeof($va_featured_share_ids) == 0) {
# put a random object in the features variable
$va_featured_share_ids = array_keys($t_object->getRandomItems(10, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1)));
}
$t_object_share = new ca_objects($va_featured_share_ids[0]);
$va_rep = $t_object_share->getPrimaryRepresentation(array('frontpage'), null, array('return_with_access' => $va_access_values));
$vn_featured_share_id = $va_featured_share_ids[0];
$vs_featured_share_image = $va_rep["tags"]["frontpage"];
$vs_featured_share_label = $t_object->getLabelForDisplay();
# --- set for featured member - set name assigned in app.conf - featured_member_set_name - this is an ENTITY set
$t_featured_member = new ca_sets();
$t_featured_member->load(array('set_code' => $this->request->config->get('featured_member_set_name')));
# Enforce access control on set
if (sizeof($va_access_values) == 0 || sizeof($va_access_values) && in_array($t_featured_member->get("access"), $va_access_values)) {
$vn_featured_member_set_id = $t_featured_member->get("set_id");
$va_featured_member_ids = array_keys(is_array($va_tmp = $t_featured_member->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 1))) ? $va_tmp : array());
// These are the entity ids in the set
}
示例4: array
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"];
$vs_featured_content_label = $t_object->getLabelForDisplay();
}
} 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"];
$vs_featured_content_label = $t_object->getLabelForDisplay();
}
$va_featured = $va_random;
}
}
?>
<div id="featuredHeader">Featured Objects</div>
<div class="textContent">
示例5: array
* 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
*
* ----------------------------------------------------------------------
*/
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();
$va_random_items = $t_object->getRandomItems(10, array('checkAccess' => $this->getVar('access_values'), 'hasRepresentations' => 1));
$va_labels = array();
$va_media = array();
if (is_array($va_random_items) && sizeof($va_random_items)) {
$va_labels = $t_object->getPreferredDisplayLabelsForIDs(array_keys($va_random_items));
$va_media = $t_object->getPrimaryMediaForIDs(array_keys($va_random_items), array('medium'), array('checkAccess' => $this->getVar('access_values')));
}
JavascriptLoadManager::register('cycle');
?>
<div id="pageBody">
<?php
if (!$this->request->isAjax()) {
if ($this->getVar('browse_selector')) {
?>
<div class="browseTargetSelect"><?php
print _t('Browse for') . ' ' . $this->getVar('browse_selector');
示例6: 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');
}
示例7: 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());
}
//.........这里部分代码省略.........
示例8: 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');
}
示例9: array
<?php
$t_object = new ca_objects();
$va_featured_ids = array_keys($t_object->getRandomItems(10, array('checkAccess' => caGetUserAccessValues($this->request), 'hasRepresentations' => 1, 'restrictToTypes' => array("tracks", "track_item", "tracing", "cast"))));
if (sizeof($va_featured_ids)) {
$q_featured_items = caMakeSearchResult('ca_objects', $va_featured_ids);
if ($q_featured_items->numHits()) {
?>
<div class="jcarousel-wrapper hpCarousel">
<!-- Carousel -->
<div class="jcarousel">
<ul>
<?php
while ($q_featured_items->nextHit()) {
if ($vs_media = $q_featured_items->getWithTemplate('<l>^ca_object_representations.media.mediumlarge</l>', array("checkAccess" => caGetUserAccessValues($this->request)))) {
print "<li>" . $vs_media . "</li>";
}
}
?>
</ul>
</div><!-- end jcarousel -->
</div><!-- end jcarousel-wrapper -->
<script type='text/javascript'>
jQuery(document).ready(function() {
/*
Carousel initialization
*/
$('.jcarousel')
.jcarousel({
animation: {
duration: 0 // make changing image immediately
示例10: array
<?php
$t_object = new ca_objects();
$va_featured_ids = array_keys($t_object->getRandomItems(10, array('checkAccess' => caGetUserAccessValues($this->request), 'hasRepresentations' => 1, 'restrictToTypes' => array("eggshell", "fossil", "recent", "pseudo", "associated"))));
if (sizeof($va_featured_ids)) {
$q_featured_items = caMakeSearchResult('ca_objects', $va_featured_ids);
if ($q_featured_items->numHits()) {
?>
<div class="jcarousel-wrapper hpCarousel">
<!-- Carousel -->
<div class="jcarousel">
<ul>
<?php
while ($q_featured_items->nextHit()) {
if ($vs_media = $q_featured_items->getWithTemplate('<l>^ca_object_representations.media.mediumlarge</l>', array("checkAccess" => caGetUserAccessValues($this->request)))) {
print "<li>" . $vs_media . "</li>";
}
}
?>
</ul>
</div><!-- end jcarousel -->
</div><!-- end jcarousel-wrapper -->
<script type='text/javascript'>
jQuery(document).ready(function() {
/*
Carousel initialization
*/
$('.jcarousel')
.jcarousel({
animation: {
duration: 0 // make changing image immediately