コード例 #1
0
 public function Index($pa_options = null)
 {
     AssetLoadManager::register('imageScroller');
     AssetLoadManager::register('tabUI');
     AssetLoadManager::register('panel');
     parent::Index($pa_options);
 }
コード例 #2
0
ファイル: MapController.php プロジェクト: guaykuru/pawtucket
 /**
  * Overrides base controller!
  */
 public function clearAndAddCriteria()
 {
     $o_cache = caGetCacheObject('ca_map_browser');
     $this->getDefaults();
     $this->opo_browse->setFacetGroup("map");
     $this->opo_browse->removeAllCriteria();
     $ps_facet_name = $this->request->getParameter('facet', pString);
     $vs_id = $this->request->getParameter('id', pString);
     $vs_md5_key = md5('EEMap/' . $ps_facet_name . '/' . $vs_id);
     $o_cache->load($vs_md5_key);
     if (false) {
         //($vs_content = $o_cache->load($vs_md5_key)) !== false) {
         $this->response->addContent($vs_content);
         $va_object_ids = $o_cache->load($vs_md5_key . '_id_list');
         $this->opo_result_context->setResultList($va_object_ids);
         $this->opo_result_context->saveContext();
     } else {
         $this->opo_browse->addCriteria('has_georefs', '1');
         if ($ps_facet_name) {
             $this->opo_browse->addCriteria($ps_facet_name, array($vs_id));
         }
         parent::Index(array('dontRenderView' => 1));
         $this->opo_result_context->setSearchExpression($this->opo_browse->getBrowseID());
         $this->view->setVar('current_view', 'map');
         $this->view->setVar('result_views', array('map' => 1));
         $vo_result = $this->view->getVar('result');
         $vo_result->seek(0);
         $vs_content = $this->render('Browse/map_controls_html.php');
         $vo_result->seek(0);
         $va_object_ids = array();
         while ($vo_result->nextHit()) {
             $va_object_ids[] = $vo_result->get('ca_objects.object_id');
         }
         $this->opo_result_context->setResultList($va_object_ids);
         $this->opo_result_context->saveContext();
         #$o_cache->load($vs_md5_key);
         $o_cache->save($vs_content);
         $o_cache->load($vs_md5_key . '_id_list');
         $o_cache->save($va_object_ids);
     }
 }
コード例 #3
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');
 }
コード例 #4
0
 function chronology()
 {
     $this->ops_tablename = 'ca_occurrences';
     $t_list = new ca_lists();
     $this->opn_type_restriction_id = $t_list->getItemIDFromList('occurrence_types', 'chronology');
     $va_access_values = caGetUserAccessValues($this->request);
     $this->getDefaults();
     // set type restrictions for searches
     $o_search_result_context = new ResultContext($this->request, $this->ops_tablename, 'basic_search');
     $o_search_result_context->setTypeRestriction($this->opn_type_restriction_id);
     $o_search_result_context->saveContext();
     // Set type restriction (ie. only show occurrences with type=bibliography)
     // the base browse controller Index() method will take care of actually setting the restriction
     $this->opo_result_context = new ResultContext($this->request, $this->ops_tablename, $this->ops_find_type);
     $this->opo_result_context->setTypeRestriction($this->opn_type_restriction_id);
     $this->opo_browse = new OccurrenceBrowse($this->opo_result_context->getSearchExpression(), 'pawtucket2');
     $this->opo_browse->setTypeRestrictions(array($this->opn_type_restriction_id));
     $this->opa_sorts = array('ca_occurrence_labels.name' => _t('title'), 'ca_occurrences.idno' => _t('idno'));
     // Remove any browse criteria previously set
     $this->opo_browse->removeAllCriteria();
     parent::Index(true);
     $this->render('Landing/chronology_html.php');
 }
コード例 #5
0
 /**
  * Overrides base controller!
  */
 public function clearAndAddCriteria()
 {
     $o_cache = caGetCacheObject('ca_artists_browser');
     $this->getDefaults();
     $this->opo_browse->removeAllCriteria();
     $ps_facet_name = $this->request->getParameter('facet', pString);
     $vs_id = $this->request->getParameter('id', pString);
     $vs_md5_key = md5('EEartistBrowser/' . $ps_facet_name . '/' . $vs_id);
     if (($vs_content = $o_cache->load($vs_md5_key)) !== false) {
         $this->response->addContent($vs_content);
         $va_entity_ids = $o_cache->load($vs_md5_key . '_id_list');
         $this->opo_result_context->setResultList($va_entity_ids);
         $this->opo_result_context->saveContext();
     } else {
         $this->opo_browse->addCriteria('_search', 'ca_entities.source_id:' . $this->aoee_featured_source . ' or ca_entities.source_id:' . $this->aoee_source . ' or ca_entities.source_id:' . $this->aoee_priority_source);
         if ($ps_facet_name) {
             $this->opo_browse->addCriteria($ps_facet_name, array($vs_id));
         }
         $this->view->setVar('result_views', array('full'));
         parent::Index(true);
         $vo_result = $this->view->getVar('result');
         $vo_result->seek(0);
         $vs_content = $this->render('Browse/browse_controls_html.php', true);
         $vo_result->seek(0);
         $va_entity_ids = array();
         while ($vo_result->nextHit()) {
             $va_entity_ids[] = $vo_result->get('ca_entities.entity_id');
         }
         $this->opo_result_context->setResultList($va_entity_ids);
         $this->opo_result_context->saveContext();
         #$o_cache->load($vs_md5_key);
         $o_cache->save($vs_content);
         $o_cache->load($vs_md5_key . '_id_list');
         $o_cache->save($va_entity_ids);
     }
 }
コード例 #6
0
 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');
 }
コード例 #7
0
 public function Index()
 {
     JavascriptLoadManager::register('browsable');
     JavascriptLoadManager::register('hierBrowser');
     // Remove any browse criteria previously set
     $this->opo_browse->removeAllCriteria();
     parent::Index(true);
     # --- get the featured collections
     $va_featured = array();
     $va_access_values = caGetUserAccessValues($this->request);
     $t_featured = new ca_sets();
     $t_featured->load(array('set_code' => "featured_collections"));
     # Enforce access control on set
     if (sizeof($va_access_values) == 0 || sizeof($va_access_values) && in_array($t_featured->get("access"), $va_access_values)) {
         $va_featured_collections = caExtractValuesByUserLocale($t_featured->getItems(array('checkAccess' => $va_access_values, 'shuffle' => 1)));
         // These are the collection ids in the set
     }
     if (is_array($va_featured_collections) && sizeof($va_featured_collections) > 0) {
         $va_featured_collections = array_slice($va_featured_collections, 0, 5);
         foreach ($va_featured_collections as $vn_i => $va_collection_info) {
             $va_temp = array();
             $va_temp["idno"] = $va_collection_info["idno"];
             $va_temp["collection_id"] = $va_collection_info["row_id"];
             $va_temp["label"] = $va_collection_info["set_item_label"];
             $va_featured[$va_collection_info["set_item_label"]] = $va_temp;
         }
     }
     arsort($va_featured);
     $this->view->setVar("featured_collections", $va_featured);
     $this->render('collections_landing_index_html.php');
 }
コード例 #8
0
 /**
  * Override browse index to check if we need to honor the "use_splash_page_for_start_of_browse" setting and  redirect user to the splash page
  */
 public function Index()
 {
     if ($this->request->config->get('use_splash_page_for_start_of_browse') && !$this->opo_browse->numCriteria()) {
         $this->response->setRedirect(caNavUrl($this->request, '', 'Splash', 'Index'));
         return;
     }
     parent::Index();
 }