コード例 #1
0
 public function Index()
 {
     $va_participate_ids = array();
     $t_participate = new ca_sets();
     # --- participate set - set name assigned in eastend.conf - plugin conf file
     $t_participate->load(array('set_code' => $this->opo_plugin_config->get('participate_set_name')));
     # Enforce access control on set
     if (sizeof($this->opa_access_values) == 0 || sizeof($this->opa_access_values) && in_array($t_participate->get("access"), $this->opa_access_values)) {
         $this->view->setVar('participate_set_id', $t_participate->get("set_id"));
         $va_participate_ids = array_keys(is_array($va_tmp = $t_participate->getItemRowIDs(array('checkAccess' => $this->opa_access_values, 'shuffle' => 1))) ? $va_tmp : array());
         // These are the entity ids in the set
     }
     # --- loop through featured ids and grab the object's image
     $t_object = new ca_objects();
     $va_participate_images = array();
     foreach ($va_participate_ids as $vn_participate_object_id) {
         $va_tmp = array();
         $t_object->load($vn_participate_object_id);
         $va_tmp["object_id"] = $vn_participate_object_id;
         $va_image = $t_object->getPrimaryRepresentation(array("mediumlarge"));
         # --- don't show records with status ars/vaga don't show image
         if ($t_object->get("ca_objects.object_status") != 348) {
             if ($t_object->get("ca_objects.object_status") == 349) {
                 $va_tmp["vaga_class"] = "vagaDisclaimer";
             }
             $va_tmp["image"] = $va_image["tags"]["mediumlarge"];
             $va_tmp["caption"] = $t_object->get("ca_objects.caption");
             $va_tmp["title"] = $t_object->getLabelForDisplay();
         }
         $va_participate_images[$vn_participate_object_id] = $va_tmp;
     }
     $this->view->setVar("participate_images", $va_participate_images);
     $this->render('participate_html.php');
 }
コード例 #2
0
ファイル: splash_html.php プロジェクト: guaykuru/pawtucket
 *
 * 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
 *
 * ----------------------------------------------------------------------
 */
JavascriptLoadManager::register("cycle");
$t_object = new ca_objects();
$va_access_values = caGetUserAccessValues($this->request);
$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) == 0 || sizeof($va_access_values) && in_array($t_featured->get("access"), $va_access_values)) {
    $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
}
$va_item_ids = $va_featured_ids;
$va_item_media = $t_object->getPrimaryMediaForIDs($va_item_ids, array("mediumlarge", "widepreview", "splashpic"));
$va_item_labels = $t_object->getPreferredDisplayLabelsForIDs($va_item_ids);
$title_id = array_shift(array_keys($va_item_media));
$t_object = new ca_objects($title_id);
$va_artist_name = $t_object->get('ca_entities.preferred_labels.displayname', array('restrictToRelationshipTypes' => array('artist'), 'delimiter' => ' and '));
?>

	<h1 class='results'>Featured Art: <?php 
print $va_artist_name;
?>
</h1>
	<div style="height:25px;width:100%"></div>
コード例 #3
0
ファイル: splash_html.php プロジェクト: guaykuru/pawtucket
<?php

require_once __CA_MODELS_DIR__ . "/ca_objects.php";
require_once __CA_MODELS_DIR__ . "/ca_sets.php";
require_once __CA_APP_DIR__ . '/helpers/accessHelpers.php';
$t_object = new ca_objects();
$t_featured_obj = new ca_sets();
# --- load the featured items set - set name assigned in app.conf
$t_featured_obj->load(array('set_code' => 'featured_object'));
# --- 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;
コード例 #4
0
ファイル: CJF_html.php プロジェクト: ffarago/pawtucket2
$this->setVar('list_code', $vs_list_code = $this->getVar('config')->get('front_page_toc_list_code_CJF'));
print $this->render("Front/toc_functions_html.php");
if ($this->request->isAjax()) {
    return;
}
?>
<div id="frontPage" class="subhomeslide">
<?php 
$va_access_values = caGetUserAccessValues($this->request);
$this->config = caGetFrontConfig();
if ($vs_set_code = $this->config->get("front_page_set_code_CJF")) {
    $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)) {
        $va_item_ids = array_keys(is_array($va_tmp = $t_set->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 1))) ? $va_tmp : array());
    }
}
if (is_array($va_item_ids) && sizeof($va_item_ids)) {
    $t_object = new ca_objects();
    $va_item_media = $t_object->getPrimaryMediaForIDs($va_item_ids, array("mediumlarge"), array('checkAccess' => $va_access_values));
    $va_item_labels = $t_object->getPreferredDisplayLabelsForIDs($va_item_ids);
}
if (is_array($va_item_media) && sizeof($va_item_media)) {
    ?>
   
		<div class="jcarousel-wrapper slidecontainer">
			<!-- Carousel -->
			<div class="jcarousel">
				<ul>
<?php 
コード例 #5
0
 /**
  * Add items to specified set
  */
 public function addToSet()
 {
     $vn_added_items_count = $vn_dupe_item_count = 0;
     $ps_rows = $this->request->getParameter('item_ids', pString);
     $pa_row_ids = explode(';', $ps_rows);
     if (!$ps_rows || !sizeof($pa_row_ids)) {
         $this->view->setVar('error', _t('Nothing was selected'));
     } else {
         $t_model = $this->opo_datamodel->getInstanceByTableName($this->ops_tablename, true);
         $pn_set_id = $this->request->getParameter('set_id', pInteger);
         $t_set = new ca_sets($pn_set_id);
         $this->view->setVar('set_id', $pn_set_id);
         $this->view->setVar('set_name', $t_set->getLabelForDisplay());
         $this->view->setVar('error', '');
         if ($t_set->getPrimaryKey() && $t_set->get('table_num') == $t_model->tableNum()) {
             $va_item_ids = $t_set->getItemRowIDs(array('user_id' => $this->request->getUserID()));
             foreach ($pa_row_ids as $vn_row_id) {
                 if (!$vn_row_id) {
                     continue;
                 }
                 if (isset($va_item_ids[$vn_row_id])) {
                     $vn_dupe_item_count++;
                     continue;
                 }
                 if ($t_set->addItem($vn_row_id, array(), $this->request->getUserID())) {
                     $va_item_ids[$vn_row_id] = 1;
                     $vn_added_items_count++;
                 } else {
                     $this->view->setVar('error', join('; ', $t_set->getErrors()));
                 }
             }
         } else {
             $this->view->setVar('error', _t('Invalid set'));
         }
     }
     $this->view->setVar('num_items_added', $vn_added_items_count);
     $this->view->setVar('num_items_already_in_set', $vn_dupe_item_count);
     $this->render('Results/ajax_add_to_set_json.php');
 }
コード例 #6
0
<?php

$t_object = new ca_objects();
$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"];
        $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();
        }
コード例 #7
0
 /**
  * Download (accessible) media for all records in this set
  */
 public function getSetMedia()
 {
     set_time_limit(600);
     // allow a lot of time for this because the sets can be potentially large
     $o_dm = Datamodel::load();
     $t_set = new ca_sets($this->request->getParameter('set_id', pInteger));
     if (!$t_set->getPrimaryKey()) {
         $this->notification->addNotification(_t('No set defined'), __NOTIFICATION_TYPE_ERROR__);
         $this->opo_response->setRedirect(caEditorUrl($this->opo_request, 'ca_sets', $t_set->getPrimaryKey()));
         return false;
     }
     $va_record_ids = array_keys($t_set->getItemRowIDs(array('limit' => 100000)));
     if (!is_array($va_record_ids) || !sizeof($va_record_ids)) {
         $this->notification->addNotification(_t('No media is available for download'), __NOTIFICATION_TYPE_ERROR__);
         $this->opo_response->setRedirect(caEditorUrl($this->opo_request, 'ca_sets', $t_set->getPrimaryKey()));
         return false;
     }
     $vs_subject_table = $o_dm->getTableName($t_set->get('table_num'));
     $t_instance = $o_dm->getInstanceByTableName($vs_subject_table);
     $qr_res = $vs_subject_table::createResultSet($va_record_ids);
     $qr_res->filterNonPrimaryRepresentations(false);
     $va_paths = array();
     while ($qr_res->nextHit()) {
         $va_original_paths = $qr_res->getMediaPaths('ca_object_representations.media', 'original');
         if (sizeof($va_original_paths) > 0) {
             $va_paths[$qr_res->get($t_instance->primaryKey())] = array('idno' => $qr_res->get($t_instance->getProperty('ID_NUMBERING_ID_FIELD')), 'paths' => $va_original_paths);
         }
     }
     if (sizeof($va_paths) > 0) {
         $vs_tmp_name = caGetTempFileName('DownloadSetMedia', 'zip');
         $o_phar = new PharData($vs_tmp_name, null, null, Phar::ZIP);
         foreach ($va_paths as $vn_pk => $va_path_info) {
             $vn_c = 1;
             foreach ($va_path_info['paths'] as $vs_path) {
                 if (!file_exists($vs_path)) {
                     continue;
                 }
                 $vs_filename = $va_path_info['idno'] ? $va_path_info['idno'] : $vn_pk;
                 $vs_filename .= "_{$vn_c}";
                 if ($vs_ext = pathinfo($vs_path, PATHINFO_EXTENSION)) {
                     $vs_filename .= ".{$vs_ext}";
                 }
                 $o_phar->addFile($vs_path, $vs_filename);
                 $vn_c++;
             }
         }
         $o_view = new View($this->request, $this->request->getViewsDirectoryPath() . '/bundles/');
         // send download
         $vs_set_code = $t_set->get('set_code');
         $o_view->setVar('tmp_file', $vs_tmp_name);
         $o_view->setVar('download_name', 'media_for_' . mb_substr(preg_replace('![^A-Za-z0-9]+!u', '_', $vs_set_code ? $vs_set_code : $t_set->getPrimaryKey()), 0, 20) . '.zip');
         $this->response->addContent($o_view->render('ca_sets_download_media.php'));
         return;
     } else {
         $this->notification->addNotification(_t('No media is available for download'), __NOTIFICATION_TYPE_ERROR__);
         $this->opo_response->setRedirect(caEditorUrl($this->opo_request, 'ca_sets', $t_set->getPrimaryKey()));
         return;
     }
     return $this->Edit();
 }
コード例 #8
0
 /**
  *
  */
 public function insert($pa_options = null)
 {
     $t_trans = new ca_commerce_transactions($this->get('transaction_id'));
     if ($t_trans->getPrimaryKey()) {
         if ($vn_set_id = $t_trans->get('set_id')) {
             $t_set = new ca_sets($vn_set_id);
             if ($t_set->getPrimaryKey()) {
                 $va_row_ids = $t_set->getItemRowIDs();
                 $this->set('set_snapshot', array('table_num' => $t_set->get('table_num'), 'set_id' => $vn_set_id, 'datetime' => time(), 'items' => $va_row_ids));
             }
         }
         return parent::insert($pa_options);
     } else {
         $this->postError(1500, _t('Transaction does not exist'), 'ca_commerce_communications->insert()');
         return false;
     }
 }
コード例 #9
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');
 }
コード例 #10
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');
 }
コード例 #11
0
 public function getFeaturedArtistSlideshow()
 {
     $va_featured_ids = array();
     $t_featured = new ca_sets();
     # --- featured artists set - set name assigned in eastend.conf - plugin conf file
     $t_featured->load(array('set_code' => $this->opo_plugin_config->get('featured_artists_set_name')));
     # Enforce access control on set
     if (sizeof($this->opa_access_values) == 0 || sizeof($this->opa_access_values) && in_array($t_featured->get("access"), $this->opa_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' => $this->opa_access_values, 'shuffle' => 1))) ? $va_tmp : array());
         // These are the entity ids in the set
     }
     if (!is_array($va_featured_ids) || sizeof($va_featured_ids) == 0) {
         # put random entities in the features variable
         $o_db = new Db();
         $q_entities = $o_db->query("SELECT e.entity_id from ca_entities e WHERE e.access IN (" . implode($this->opa_access_values, ", ") . ") ORDER BY RAND() LIMIT 10");
         if ($q_entities->numRows() > 0) {
             while ($q_entities->nextRow()) {
                 $va_featured_ids[] = $q_entities->get("entity_id");
             }
         }
     }
     # --- loop through featured ids and grab the entity's name, portrait, lifespan -lifespans_date, indexing_notes (brief description abouthow they relate to the east end)
     $t_entity = new ca_entities();
     $t_object = new ca_objects();
     $va_featured_artists = array();
     foreach ($va_featured_ids as $vn_featured_entity_id) {
         $va_tmp = array();
         $t_entity->load($vn_featured_entity_id);
         $va_tmp["entity_id"] = $vn_featured_entity_id;
         $va_tmp["lifespan"] = $t_entity->get("lifespans_date");
         $va_tmp["indexing_notes"] = $t_entity->get("indexing_notes");
         $va_tmp["name"] = $t_entity->getLabelForDisplay();
         $va_objects = $t_entity->get("ca_objects", array("returnAsArray" => 1, 'checkAccess' => $this->opa_access_values, 'restrict_to_relationship_types' => array('portrait')));
         $va_object = array_shift($va_objects);
         $t_object->load($va_object["object_id"]);
         $va_portrait = $t_object->getPrimaryRepresentation(array("abSlideShow"));
         # --- don't show records with status ars/vaga don't show image
         if ($t_object->get("ca_objects.object_status") != 348) {
             if ($t_object->get("ca_objects.object_status") == 349) {
                 $va_tmp["vaga_class"] = "vagaDisclaimer";
             }
             $va_tmp["image"] = $va_portrait["tags"]["abSlideShow"];
             $va_tmp["caption"] = $t_object->get("ca_objects.caption");
         }
         $va_featured_artists[$vn_featured_entity_id] = $va_tmp;
     }
     $this->view->setVar("featured_artists", $va_featured_artists);
     $this->render('featured_artists_html.php');
 }
コード例 #12
0
ファイル: splash_html.php プロジェクト: guaykuru/pawtucket
 * CollectiveAccess is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTIES whatsoever, including any implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
 *
 * 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
 *
 * ----------------------------------------------------------------------
 */
JavascriptLoadManager::register("cycle");
$t_object = new ca_objects();
$t_featured = new ca_sets();
$featured_set = $t_featured->load(array('set_code' => 'splash'));
$carousel_ids = $t_featured->getItemRowIDs(array('shuffle' => true));
$qr_set = ca_objects::createResultSet(array_keys($carousel_ids));
$va_item_ids = $this->getVar('featured_content_slideshow_id_list');
$va_item_media = $t_object->getPrimaryMediaForIDs($va_item_ids, array("mediumlarge"));
$va_item_labels = $t_object->getPreferredDisplayLabelsForIDs($va_item_ids);
$va_access_values = caGetUserAccessValues($this->request);
?>
	<div id="splashBrowsePanel" class="browseSelectPanel" style="z-index:1000;">
		<a href="#" onclick="caUIBrowsePanel.hideBrowsePanel()" class="browseSelectPanelButton"></a>
		<div id="splashBrowsePanelContent">
		
		</div>
	</div>
	<script type="text/javascript">
		var caUIBrowsePanel = caUI.initBrowsePanel({ facetUrl: '<?php 
print caNavUrl($this->request, '', 'Browse', 'getFacet');
コード例 #13
0
 * @subpackage Core
 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License version 3
 *
 * ----------------------------------------------------------------------
 */
?>
<div class="row">
<?php 
$va_access_values = $this->getVar("access_values");
$o_config = caGetFrontConfig();
# --- grab the set that has the featured
$t_set = new ca_sets();
$t_set->load(array('set_code' => $o_config->get("front_page_exhibit_set_code")));
$t_exhibition = new ca_occurrences();
if (sizeof($va_access_values) == 0 || sizeof($va_access_values) && in_array($t_set->get("access"), $va_access_values)) {
    $va_exhibition_ids = array_keys(is_array($va_tmp = $t_set->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 1))) ? $va_tmp : array());
    $t_exhibition->load($va_exhibition_ids[0]);
}
# --- check to see if there is an image set configured
$t_set->load(array('set_code' => $o_config->get("front_page_set_code")));
if (sizeof($va_access_values) == 0 || sizeof($va_access_values) && in_array($t_set->get("access"), $va_access_values)) {
    $va_featured_ids = array_keys(is_array($va_tmp = $t_set->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 1))) ? $va_tmp : array());
    $qr_res = caMakeSearchResult('ca_objects', $va_featured_ids);
}
if ($qr_res && $qr_res->numHits()) {
    $qr_res = $this->getVar('featured_set_items_as_search_result');
    while ($qr_res->nextHit()) {
        if ($vs_media = $qr_res->getWithTemplate('^ca_object_representations.media.front', array("checkAccess" => $va_access_values))) {
            print "<div class='col-sm-12'><div class='frontSlide'>" . $vs_media . "</div></div>";
            break;
        }
コード例 #14
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');
 }