本文整理汇总了PHP中ca_objects::getRecentlyAddedItems方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_objects::getRecentlyAddedItems方法的具体用法?PHP ca_objects::getRecentlyAddedItems怎么用?PHP ca_objects::getRecentlyAddedItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_objects
的用法示例。
在下文中一共展示了ca_objects::getRecentlyAddedItems方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: recentlyAdded
function recentlyAdded()
{
// 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"));
}
$t_object = new ca_objects();
$va_recently_added_objects = $t_object->getRecentlyAddedItems(25, array('checkAccess' => caGetUserAccessValues($this->request)));
$va_entries = array();
$va_object_ids = array();
foreach ($va_recently_added_objects as $va_object) {
$va_object_ids[] = $va_object['object_id'];
}
$va_labels = $t_object->getPreferredDisplayLabelsForIDs($va_object_ids);
// TODO: Need to get object descriptions and last update times properly
foreach ($va_labels as $vn_object_id => $vs_label) {
$va_entries[] = array('title' => $vs_label, 'link' => $vs_link = $this->request->config->get('site_host') . caNavUrl($this->request, '', 'Detail/Object', 'Index', array('object_id' => $vn_object_id)), 'guid' => $vs_link, 'lastUpdate' => time(), 'description' => '', 'pubDate' => time());
}
$va_feed_data = array('title' => _t('Recently added'), 'link' => $this->request->getRequestUrl(true), 'charset' => 'UTF-8', 'entries' => $va_entries);
$o_feed = Zend_Feed::importArray($va_feed_data, 'rss');
$this->view->setVar('feed', $o_feed);
$this->render('Feed/feed_recently_added_xml.php');
}
示例2: recentlyAdded
function recentlyAdded()
{
// 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"));
}
$t_object = new ca_objects();
if (($vn_num_items = (int) $this->request->config->get('rss_number_of_items')) <= 0) {
$vn_num_items = 10;
}
$va_recently_added_objects = $t_object->getRecentlyAddedItems($vn_num_items, array('checkAccess' => caGetUserAccessValues($this->request)));
$va_entries = array();
$va_object_ids = array();
foreach ($va_recently_added_objects as $va_object) {
$va_object_ids[] = $va_object['object_id'];
}
$qr_res = $t_object->makeSearchResult('ca_objects', $va_object_ids);
$vs_description_bundle = $this->request->config->get('rss_description');
while ($qr_res->nextHit()) {
$vn_object_id = $qr_res->get('ca_objects.object_id');
if (!($vn_creation_time = $t_object->getCreationTimestamp($vn_object_id, array('timestampOnly' => true)))) {
$vn_creation_time = time();
}
if (!($vn_update_time = $t_object->getLastChangeTimestamp($vn_object_id, array('timestampOnly' => true)))) {
$vn_update_time = time();
}
$va_entries[] = array('title' => $qr_res->get('ca_objects.preferred_labels.name'), 'link' => $vs_link = $this->request->config->get('site_host') . caNavUrl($this->request, '', 'Detail/Object', 'Index', array('object_id' => $vn_object_id)), 'guid' => $vs_link, 'lastUpdate' => $vn_update_time, 'description' => $vs_description_bundle ? $qr_res->getMediaTag("ca_object_representations.media", "preview") . "\n" . $qr_res->get($vs_description_bundle) : '', 'pubDate' => $vn_creation_time);
}
$va_feed_data = array('title' => _t('Recently added'), 'link' => $this->request->getRequestUrl(true), 'charset' => 'UTF-8', 'entries' => $va_entries);
$o_feed = Zend_Feed::importArray($va_feed_data, 'rss');
$this->view->setVar('feed', $o_feed);
$this->render('Feed/feed_recently_added_xml.php');
}
示例3: array
# --- 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;
}
#$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 = array_shift($va_recently_added_objects);
$recently_added_id = $va_object_info['object_id'];
$recently_added_widepreview = $va_media[$va_object_info['object_id']]["tags"]["widepreview"];
}
?>
<div id="splashBrowsePanel" class="browseSelectPanel" style="z-index:1000;">
示例4: 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');
}
示例5: 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());
}
//.........这里部分代码省略.........
示例6: foreach
foreach ($va_most_viewed_ids as $va_item_info) {
$va_temp = array();
$vn_r_object_id = $va_item_info['object_id'];
$t_object->load($vn_r_object_id);
$va_reps = $t_object->getPrimaryRepresentation(array('thumbnail', 'widepreview'), null, array('return_with_access' => $va_access_values));
$va_temp["widepreview"] = $va_reps["tags"]["widepreview"];
$va_temp["label"] = $t_object->get("ca_objects.preferred_labels");
$va_most_viewed[$vn_r_object_id] = $va_temp;
}
}
# --- recently added
# -- get object type of fond and subfonds
$o_lists = new ca_lists();
$vn_fond_id = $o_lists->getItemIDFromList('object_types', 'fonds');
$vn_sub_fond_id = $o_lists->getItemIDFromList('object_types', 'sub_fonds');
$va_recently_added_ids = $t_object->getRecentlyAddedItems(15, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1, 'restrictToTypes' => array($vn_fond_id, $vn_sub_fond_id)));
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) {
$va_temp = array();
$vn_r_object_id = $va_item_info['object_id'];
$t_object->load($vn_r_object_id);
$va_reps = $t_object->getPrimaryRepresentation(array('thumbnail', 'widepreview'), null, array('return_with_access' => $va_access_values));
$va_temp["widepreview"] = $va_reps["tags"]["widepreview"];
$va_temp["label"] = $t_object->get("ca_objects.preferred_labels");
$va_recently_added[$vn_r_object_id] = $va_temp;
}
}
?>
<script type="text/javascript">
示例7: Index
/**
* Displays site stats
*/
public function Index()
{
$this->view->setVar("num_objects", $this->numObjects());
$this->view->setVar("num_members", $this->numEntities(array($this->opn_member_institution_id)));
$this->view->setVar("num_entities", $this->numEntities(array($this->opn_individual_id, $this->opn_family_id, $this->opn_organization_id)));
$this->view->setVar("num_reps", $this->numReps());
$this->view->setVar("oldest_date", $this->oldestDate());
$this->view->setVar("median_date", $this->medianDate());
$vs_version = "preview";
$t_object = new ca_objects();
// $va_user_favorites_items = array_reverse($t_object->getHighestRated(null, 3, $this->opa_access_values));
// $va_user_favorites = array();
// if(is_array($va_user_favorites_items) && (sizeof($va_user_favorites_items) > 0)){
// foreach($va_user_favorites_items as $vn_user_favorite_id){
// $t_object->load($vn_user_favorite_id);
// $va_rep = $t_object->getPrimaryRepresentation(array($vs_version), null, array('return_with_access' => $this->opa_access_values));
// $va_user_favorites[$vn_user_favorite_id] = array("image" => $va_rep['tags'][$vs_version], "label" => $t_object->getLabelForDisplay());
// }
// }
// $this->view->setVar("most_popular", $va_user_favorites);
$o_db = new Db();
$q_most_liked = $o_db->query("SELECT ic.row_id, count(*) c\n \t\t\t\t\t\t\t\t\t\t\t\tFROM ca_item_comments ic\n \t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN ca_objects o ON ic.row_id = o.object_id\n \t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN ca_objects_x_object_representations oxr ON oxr.object_id = o.object_id\n \t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN ca_object_representations r ON oxr.representation_id = r.representation_id\n \t\t\t\t\t\t\t\t\t\t\t\tWHERE o.access = 1 AND o.deleted = 0 AND r.access = 1 AND r.deleted = 0\n \t\t\t\t\t\t\t\t\t\t\t\tGROUP BY ic.row_id order by c DESC limit 3;");
$va_user_favorites = array();
if ($q_most_liked->numRows()) {
while ($q_most_liked->nextRow()) {
#print $q_most_liked->get("row_id")." - ";
$t_object->load($q_most_liked->get("row_id"));
$va_rep = $t_object->getPrimaryRepresentation(array($vs_version), null, array('return_with_access' => $this->opa_access_values));
$va_user_favorites[$q_most_liked->get("row_id")] = array("image" => $va_rep['tags'][$vs_version], "label" => $t_object->getLabelForDisplay());
}
}
$this->view->setVar("most_popular", $va_user_favorites);
$va_recently_added_items = $t_object->getRecentlyAddedItems(3, array('checkAccess' => $this->opa_access_values, 'hasRepresentations' => 1));
#print_r($va_recently_added_items);
$va_recently_added = array();
if (is_array($va_recently_added_items) && sizeof($va_recently_added_items) > 0) {
$i = 0;
foreach ($va_recently_added_items as $vn_recently_added_info) {
if ($i == 3) {
break;
}
$t_object->load($vn_recently_added_info["object_id"]);
$va_rep = $t_object->getPrimaryRepresentation(array($vs_version), null, array('return_with_access' => $this->opa_access_values));
if ($va_rep['tags'][$vs_version]) {
$va_recently_added[$vn_recently_added_info["object_id"]] = array("image" => $va_rep['tags'][$vs_version], "label" => $t_object->getLabelForDisplay());
$i++;
}
}
}
$this->view->setVar("recently_added", $va_recently_added);
# --- timestamp for 60 days ago
$vn_timestamp = time() - 24 * 60 * 60 * 60;
$this->view->setVar("createdLast60Days", $this->recentlyAdded($vn_timestamp));
$this->view->setVar("topThemes", $this->topThemes());
$this->render('dashboard_html.php');
}