本文整理汇总了PHP中ca_objects::getRecentlyViewedItems方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_objects::getRecentlyViewedItems方法的具体用法?PHP ca_objects::getRecentlyViewedItems怎么用?PHP ca_objects::getRecentlyViewedItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_objects
的用法示例。
在下文中一共展示了ca_objects::getRecentlyViewedItems方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Index
//.........这里部分代码省略.........
}
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());
}
# --- get the 12 most viewed objects
if (!(bool) $this->request->config->get("splash_disable_most_viewed_objects")) {
if (!is_array($va_versions = $this->request->config->getList("splash_most_viewed_display_versions"))) {
$va_versions = $va_default_versions;
}
$va_most_viewed_objects = $t_object->getMostViewedItems(12, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1));
$va_labels = $t_object->getPreferredDisplayLabelsForIDs(array_keys($va_most_viewed_objects));
$va_media = $t_object->getPrimaryMediaForIDs(array_keys($va_most_viewed_objects), $va_versions, array("checkAccess" => $va_access_values));
foreach ($va_most_viewed_objects 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_most_viewed_objects[$vn_object_id] = $va_object_info;
}
$this->view->setVar('most_viewed_objects', $va_most_viewed_objects);
if (is_array($va_most_viewed_objects) && sizeof($va_most_viewed_objects) > 0) {
$va_object_info = reset($va_most_viewed_objects);
$this->view->setVar('most_viewed_id', $va_object_info['object_id']);
foreach ($va_versions as $vs_version) {
$this->view->setVar('most_viewed_' . $vs_version, $va_media[$va_object_info['object_id']]['tags'][$vs_version]);
}
}
}
if (!(bool) $this->request->config->get("splash_disable_recently_viewed_objects")) {
if (!is_array($va_versions = $this->request->config->getList("splash_recently_viewed_display_versions"))) {
$va_versions = $va_default_versions;
}
# --- get the 12 recently viewed objects
$va_recently_viewed_objects = $t_object->getRecentlyViewedItems(12, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1));
$va_labels = $t_object->getPreferredDisplayLabelsForIDs($va_recently_viewed_objects);
$va_media = $t_object->getPrimaryMediaForIDs($va_recently_viewed_objects, $va_versions, array("checkAccess" => $va_access_values));
$va_recently_viewed_objects_for_display = array();
foreach ($va_recently_viewed_objects as $vn_object_id) {
$va_recently_viewed_objects_for_display[$vn_object_id] = array('object_id' => $vn_object_id, 'title' => $va_labels[$vn_object_id], 'media' => $va_media[$vn_object_id]);
}
$this->view->setVar('recently_viewed_objects', $va_recently_viewed_objects_for_display);
if (is_array($va_recently_viewed_objects) && sizeof($va_recently_viewed_objects) > 0) {
foreach ($va_recently_viewed_objects_for_display as $va_object_info) {
if ($va_media[$va_object_info['object_id']]['tags'][$vs_version]) {
$this->view->setVar('recently_viewed_id', $va_object_info['object_id']);
foreach ($va_versions as $vs_version) {
$this->view->setVar('recently_viewed_' . $vs_version, $va_media[$va_object_info['object_id']]['tags'][$vs_version]);
}
break;
}
}
}
} else {
$this->view->setVar('recently_viewed_objects', array());
}
if (!(bool) $this->request->config->get("splash_disable_random_objects")) {
if (!is_array($va_versions = $this->request->config->getList("splash_random_display_versions"))) {
$va_versions = $va_default_versions;
}
# --- get random objects
$va_random_items = $t_object->getRandomItems(12, 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 = array_shift($va_random_items);
$this->view->setVar('random_object_id', $va_object_info['object_id']);
foreach ($va_versions as $vs_version) {
$this->view->setVar('random_object_' . $vs_version, $va_media[$va_object_info['object_id']]['tags'][$vs_version]);
}
}
} else {
$this->view->setVar('random_objects', array());
}
$this->render('Splash/splash_html.php');
}