Пример #1
0
 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());
     }
     # --- 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');
 }
Пример #2
0
 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');
 }
Пример #3
0
<?php

require_once __CA_LIB_DIR__ . "/ca/Search/CollectionSearch.php";
require_once __CA_LIB_DIR__ . "/ca/Search/ObjectSearch.php";
JavascriptLoadManager::register('tabUI');
# --- get the access values for checking permissions
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();
# --- 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) {
        $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');