function index()
 {
     if (!$this->request->isLoggedIn()) {
         $this->response->setRedirect(caNavUrl($this->request, '', 'LoginReg', 'form'));
         return;
     }
     if (!($t_set = $this->_getSet())) {
         $t_set = new ca_sets();
     }
     JavascriptLoadManager::register('sortableUI');
     # --- get all sets for user
     $va_sets = caExtractValuesByUserLocale($t_set->getSets(array('table' => 'ca_objects', 'user_id' => $this->request->getUserID())));
     $t_new_set = new ca_sets();
     # --- new set object used for access drop down in new set form
     $this->view->setVar('t_set', $t_set);
     $this->view->setVar('t_new_set', $t_new_set);
     $this->view->setVar('set_list', $va_sets);
     $this->view->setVar('set_name', $t_set->getLabelForDisplay());
     $this->view->setVar('set_description', $t_set->get("ca_sets.set_intro"));
     $this->view->setVar('set_access', $t_set->get("ca_sets.access"));
     if ($this->request->config->get("dont_enforce_access_settings")) {
         $va_access_values = array();
     } else {
         $va_access_values = caGetUserAccessValues($this->request);
     }
     $this->view->setVar('items', caExtractValuesByUserLocale($t_set->getItems(array('thumbnailVersions' => array('thumbnail', 'icon'), 'checkAccess' => $va_access_values, 'user_id' => $this->request->getUserID()))));
     $this->render('Sets/sets_html.php');
 }
 public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
 {
     $this->ops_theme = __CA_THEME__;
     // get current theme
     if (!is_dir(__CA_APP_DIR__ . '/plugins/MetabolicChronology/themes/' . $this->ops_theme . '/views')) {
         // if theme is not defined for this plugin, try to use "default" theme
         $this->ops_theme = 'default';
     }
     parent::__construct($po_request, $po_response, array(__CA_APP_DIR__ . '/plugins/MetabolicChronology/themes/' . $this->ops_theme . '/views'));
     $this->opo_plugin_config = Configuration::load($this->request->getAppConfig()->get('application_plugins') . '/MetabolicChronology/conf/Chronology.conf');
     if (!(bool) $this->opo_plugin_config->get('enabled')) {
         die(_t('Metabolic Chronology plugin is not enabled'));
     }
     $this->_initView($pa_options);
     $this->opo_result_context = new ResultContext($po_request, 'ca_objects', 'MetabolicChronology');
     MetaTagManager::addLink('stylesheet', $po_request->getBaseUrlPath() . "/app/plugins/MetabolicChronology/themes/" . $this->ops_theme . "/css/chronology.css", 'text/css');
     JavascriptLoadManager::register('jcarousel');
     JavascriptLoadManager::register('maps');
     $t_list = new ca_lists();
     $this->opn_silo_type_id = $t_list->getItemIDFromList('collection_types', 'silo');
     $this->opn_action_type_id = $t_list->getItemIDFromList('occurrence_types', 'action');
     $this->opn_context_type_id = $t_list->getItemIDFromList('occurrence_types', 'context');
     $this->opn_yes_list_id = $t_list->getItemIDFromList('yes_no', 'yes');
     $t_relationship_types = new ca_relationship_types();
     $this->opn_rel_type_action_display_image = $t_relationship_types->getRelationshipTypeID("ca_objects_x_occurrences", "display");
     $this->opn_rel_type_action_secondary_images = $t_relationship_types->getRelationshipTypeID("ca_objects_x_occurrences", "secondary");
     $va_access_values = caGetUserAccessValues($this->request);
     $this->opa_access_values = $va_access_values;
     $this->view->setVar('access_values', $va_access_values);
 }
 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');
 }
 public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
 {
     $this->ops_theme = __CA_THEME__;
     // get current theme
     if (!is_dir(__CA_APP_DIR__ . '/plugins/eastend/themes/' . $this->ops_theme . '/views')) {
         // if theme is not defined for this plugin, try to use "default" theme
         $this->ops_theme = 'default';
     }
     parent::__construct($po_request, $po_response, array(__CA_APP_DIR__ . '/plugins/eastend/themes/' . $this->ops_theme . '/views'));
     MetaTagManager::addLink('stylesheet', $po_request->getBaseUrlPath() . "/app/plugins/eastend/themes/" . $this->ops_theme . "/css/eastend.css", 'text/css');
     $this->opo_plugin_config = Configuration::load($this->request->getAppConfig()->get('application_plugins') . '/eastend/conf/eastend.conf');
     if (!(bool) $this->opo_plugin_config->get('enabled')) {
         die(_t('eastend plugin is not enabled'));
     }
     // redirect user if not logged in
     if ($this->request->config->get('pawtucket_requires_login') && !$this->request->isLoggedIn()) {
         $this->response->setRedirect(caNavUrl($this->request, "", "LoginReg", "form"));
     }
     if ($this->request->config->get("dont_enforce_access_settings")) {
         $this->opa_access_values = array();
     } else {
         $this->opa_access_values = caGetUserAccessValues($this->request);
     }
     $this->view->setVar('access_values', $va_access_values);
     $this->opo_result_context = new ResultContext($po_request, 'ca_objects', ResultContext::getLastFind($po_request, 'ca_objects'));
     JavascriptLoadManager::register('cycle');
 }
 /**
  *
  */
 public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
 {
     $this->ops_theme = __CA_THEME__;
     // get current theme
     if (!is_dir(__CA_APP_DIR__ . '/plugins/Contribute/themes/' . $this->ops_theme . '/views')) {
         // if theme is not defined for this plugin, try to use "default" theme
         $this->ops_theme = 'default';
     }
     parent::__construct($po_request, $po_response, array(__CA_APP_DIR__ . '/plugins/Contribute/themes/' . $this->ops_theme . '/views'));
     #$this->opo_plugin_config = Configuration::load($po_request->getAppConfig()->get('application_plugins').'/Contribute/conf/contribute.conf');
     if (file_exists($po_request->getAppConfig()->get('application_plugins') . '/Contribute/themes/' . $this->ops_theme . '/conf/contribute.conf')) {
         // check if there is a config file in the theme first
         $this->opo_plugin_config = Configuration::load($po_request->getAppConfig()->get('application_plugins') . '/Contribute/themes/' . $this->ops_theme . '/conf/contribute.conf');
     } else {
         $this->opo_plugin_config = Configuration::load($po_request->getAppConfig()->get('application_plugins') . '/Contribute/conf/contribute.conf');
     }
     if (!(bool) $this->opo_plugin_config->get('enabled')) {
         die(_t('Contribute plugin is not enabled'));
     }
     $vs_default_ui = $this->opo_plugin_config->get('default_ui');
     $vs_requested_ui = $this->request->getParameter('ui', pString);
     $va_ui_list = $this->opo_plugin_config->getAssoc('uis');
     $o_dm = Datamodel::load();
     if (isset($va_ui_list[$vs_requested_ui]) && is_array($va_ui_list[$vs_requested_ui])) {
         $this->opa_ui_info = $va_ui_list[$vs_requested_ui];
         $this->ops_ui_code = $vs_requested_ui;
     } else {
         if (isset($va_ui_list[$vs_default_ui]) && is_array($va_ui_list[$vs_default_ui])) {
             $this->opa_ui_info = $va_ui_list[$vs_default_ui];
         } else {
             $vs_default_ui = array_shift(array_keys($va_ui_list));
             $this->opa_ui_info = $va_ui_list[$vs_default_ui];
         }
         $this->ops_ui_code = $vs_default_ui;
     }
     $this->ops_table_name = $this->opa_ui_info['table'];
     if (!($this->opo_instance = $o_dm->getInstanceByTableName($this->ops_table_name, true))) {
         die(_t('Invalid table "%1" specified in Contribute plugin for form "%2"', $this->ops_table_name, $vs_default_ui));
     }
     $t_list = new ca_lists();
     if (isset($this->opa_ui_info['type']) && $this->opa_ui_info['type']) {
         $this->opa_ui_info['type_id'] = $t_list->getItemIDFromList($this->opo_instance->getTypeListCode(), $this->opa_ui_info['type']);
     }
     if (isset($this->opa_ui_info['representation_type']) && $this->opa_ui_info['representation_type']) {
         $this->opa_ui_info['representation_type_id'] = $t_list->getItemIDFromList('object_representation_types', $this->opa_ui_info['representation_type']);
     }
     ContributePlugin::setUIInfo($this->ops_ui_code, $this->opa_ui_info);
     JavascriptLoadManager::register('panel');
     MetaTagManager::addLink('stylesheet', $po_request->getBaseUrlPath() . "/app/plugins/Contribute/themes/" . $this->ops_theme . "/css/contribute.css", 'text/css');
     $this->request->setParameter('dont_set_pawtucket2_last_page', '1');
     // Setting this parameter ensures that the "last page" we (may) redirect to after submission isn't the Contribute form itself
     if ($this->opa_ui_info['require_login'] && !$po_request->isLoggedIn()) {
         $this->notification->addNotification(_t("You must be logged in to use user contribution features."), __NOTIFICATION_TYPE_ERROR__);
         $this->response->setRedirect(caNavUrl($this->request, '', 'LoginReg', 'form'));
         return;
     }
 }
 /**
  * Displays the basic info for an object
  */
 public function Show($pa_options = null)
 {
     JavascriptLoadManager::register('panel');
     parent::Show($pa_options);
     // 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"));
     }
 }
 public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
 {
     parent::__construct($po_request, $po_response, $pa_view_paths);
     if (!$this->request->isLoggedIn()) {
         $this->notification->addNotification(_t("You must be logged in to view your orders"), __NOTIFICATION_TYPE_ERROR__);
         $this->response->setRedirect(caNavUrl($this->request, '', 'Splash', 'Index'), 302);
         return;
     }
     $this->opo_client_services_config = Configuration::load($this->request->config->get('client_services_config'));
     $this->view->setVar('client_services_config', $this->opo_client_services_config);
     $this->view->setVar('currency', $this->opo_client_services_config->get('currency'));
     $this->view->setVar('currency_symbol', $this->opo_client_services_config->get('currency_symbol'));
     JavascriptLoadManager::register("panel");
 }
 public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
 {
     JavascriptLoadManager::register('panel');
     JavascriptLoadManager::register('jquery', 'expander');
     parent::__construct($po_request, $po_response, $pa_view_paths);
     $this->opo_plugin_config = Configuration::load($this->request->getAppConfig()->get('application_plugins') . '/clir2/conf/clir2.conf');
     if (!(bool) $this->opo_plugin_config->get('enabled')) {
         die(_t('clir2 plugin is not enabled'));
     }
     $this->ops_theme = __CA_THEME__;
     // get current theme
     if (!is_dir(__CA_APP_DIR__ . '/plugins/clir2/views/' . $this->ops_theme)) {
         // if theme is not defined for this plugin, try to use "default" theme
         $this->ops_theme = 'default';
     }
     $this->opo_result_context = new ResultContext($po_request, 'ca_occurrences', 'exhibits');
 }
 public function Index()
 {
     JavascriptLoadManager::register('imageScroller');
     $va_access_values = caGetUserAccessValues($this->request);
     // get sets for public display
     $t_list = new ca_lists();
     $vn_public_set_type_id = $t_list->getItemIDFromList('set_types', $t_list->getAppConfig()->get('features_set_type'));
     // get value for public access status value
     $va_tmp = $t_list->getItemFromList('access_statuses', 'public_access');
     $vn_public_access = $va_tmp['item_value'];
     $t_set = new ca_sets();
     $va_sets = caExtractValuesByUserLocale($t_set->getSets(array('table' => 'ca_objects', 'checkAccess' => $va_access_values, 'setType' => $vn_public_set_type_id)));
     $va_set_ids = array();
     foreach ($va_sets as $va_set) {
         $va_set_ids[] = $va_set['set_id'];
     }
     $this->view->setVar('sets', $va_sets);
     $this->view->setVar('set_ids', $va_set_ids);
     $this->view->setVar('set_display_items', ca_sets::getFirstItemsFromSets($va_set_ids, array("version" => "preview160")));
     $this->render('features_landing_html.php');
 }
Exemple #10
0
 public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
 {
     JavascriptLoadManager::register('panel');
     JavascriptLoadManager::register('jquery', 'expander');
     JavascriptLoadManager::register('jquery', 'swipe');
     parent::__construct($po_request, $po_response, $pa_view_paths);
     // 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"));
     }
     $this->opo_plugin_config = Configuration::load($this->request->getAppConfig()->get('application_plugins') . '/bristol/conf/bristol.conf');
     if (!(bool) $this->opo_plugin_config->get('enabled')) {
         die(_t('bristol plugin is not enabled'));
     }
     $this->ops_theme = __CA_THEME__;
     // get current theme
     if (!is_dir(__CA_APP_DIR__ . '/plugins/bristol/views/' . $this->ops_theme)) {
         // if theme is not defined for this plugin, try to use "default" theme
         $this->ops_theme = 'default';
     }
     $this->opo_result_context = new ResultContext($po_request, 'ca_objects', 'simple_gallery');
 }
 public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
 {
     $this->ops_theme = __CA_THEME__;
     // get current theme
     if (!is_dir(__CA_APP_DIR__ . '/plugins/NovaMuse/themes/' . $this->ops_theme . '/views')) {
         // if theme is not defined for this plugin, try to use "default" theme
         $this->ops_theme = 'default';
     }
     parent::__construct($po_request, $po_response, array(__CA_APP_DIR__ . '/plugins/NovaMuse/themes/' . $this->ops_theme . '/views'));
     $this->opo_plugin_config = Configuration::load($this->request->getAppConfig()->get('application_plugins') . '/NovaMuse/conf/NovaMuse.conf');
     if (!(bool) $this->opo_plugin_config->get('enabled')) {
         die(_t('NovaMuse plugin is not enabled'));
     }
     MetaTagManager::addLink('stylesheet', $po_request->getBaseUrlPath() . "/app/plugins/NovaMuse/themes/" . $this->ops_theme . "/css/memberMap.css", 'text/css');
     JavascriptLoadManager::register('maps');
     $this->opo_result_context = new ResultContext($po_request, 'ca_entities', 'member_map');
     $t_list = new ca_lists();
     $this->opn_member_institution_id = $t_list->getItemIDFromList('entity_types', 'member_institution');
     $va_access_values = caGetUserAccessValues($this->request);
     $this->opa_access_values = $va_access_values;
     $this->view->setVar('access_values', $va_access_values);
 }
 public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
 {
     $this->ops_theme = __CA_THEME__;
     // get current theme
     if (!is_dir(__CA_APP_DIR__ . '/plugins/eastend/themes/' . $this->ops_theme . '/views')) {
         // if theme is not defined for this plugin, try to use "default" theme
         $this->ops_theme = 'default';
     }
     parent::__construct($po_request, $po_response, array(__CA_APP_DIR__ . '/plugins/eastend/themes/' . $this->ops_theme . '/views'));
     MetaTagManager::addLink('stylesheet', $po_request->getBaseUrlPath() . "/app/plugins/eastend/themes/" . $this->ops_theme . "/css/eastend.css", 'text/css');
     $this->opo_plugin_config = Configuration::load($this->request->getAppConfig()->get('application_plugins') . '/eastend/conf/eastend.conf');
     if (!(bool) $this->opo_plugin_config->get('enabled')) {
         die(_t('eastend plugin is not enabled'));
     }
     // redirect user if not logged in
     if ($this->request->config->get('pawtucket_requires_login') && !$this->request->isLoggedIn()) {
         $this->response->setRedirect(caNavUrl($this->request, "", "LoginReg", "form"));
     }
     JavascriptLoadManager::register('cycle');
     $t_list = new ca_lists();
     $this->view->setVar("user_contributed_source_id", $t_list->getItemIDFromList('object_sources', 'user_contributed'));
     $this->view->setVar("user_contributed_other_source_id", $t_list->getItemIDFromList('object_sources', 'user_contributed_other'));
 }
 function index()
 {
     if (!$this->request->isLoggedIn()) {
         $this->response->setRedirect(caNavUrl($this->request, '', 'LoginReg', 'form'));
         return;
     }
     if (!($t_folder = $this->_getFolder())) {
         $t_folder = new ca_bookmark_folders();
     }
     JavascriptLoadManager::register('sortableUI');
     # --- get all folders for user
     $va_folders = $t_folder->getFolders($this->request->getUserID());
     $this->view->setVar('t_folder', $t_folder);
     $this->view->setVar('folder_list', $va_folders);
     $this->view->setVar('folder_name', $t_folder->get("name"));
     if ($this->request->config->get("dont_enforce_access_settings")) {
         $va_access_values = array();
     } else {
         $va_access_values = caGetUserAccessValues($this->request);
     }
     $this->view->setVar('items', $t_folder->getBookmarks(null, $this->request->getUserID()));
     $this->render('Bookmarks/bookmarks_html.php');
 }
 /**
  * Initializes editor view with core set of values, loads model with record to be edited and selects user interface to use.
  *
  * @param $pa_options Array of options. Supported options are:
  *		ui = The ui_id or editor_code value for the user interface to use. If omitted the default user interface is used.
  */
 protected function _initView($pa_options = null)
 {
     // load required javascript
     JavascriptLoadManager::register('bundleableEditor');
     JavascriptLoadManager::register('imageScroller');
     JavascriptLoadManager::register('ckeditor');
     if (!($t_subject = $this->opo_datamodel->getInstanceByTableName($this->ops_table_name))) {
         return null;
     }
     if (is_array($pa_options) && isset($pa_options['loadSubject']) && (bool) $pa_options['loadSubject'] && ($vn_subject_id = (int) $this->request->getParameter($t_subject->primaryKey(), pInteger))) {
         $t_subject->load($vn_subject_id);
     }
     if (is_array($pa_options) && isset($pa_options['forceSubjectValues']) && is_array($pa_options['forceSubjectValues'])) {
         foreach ($pa_options['forceSubjectValues'] as $vs_f => $vs_v) {
             $t_subject->set($vs_f, $vs_v);
         }
     }
     // then reload the definitions (which includes bundle specs)
     $t_subject->reloadLabelDefinitions();
     $t_ui = new ca_editor_uis();
     if (isset($pa_options['ui']) && $pa_options['ui']) {
         if (is_numeric($pa_options['ui'])) {
             $t_ui->load((int) $pa_options['ui']);
         }
         if (!$t_ui->getPrimaryKey()) {
             $t_ui->load(array('editor_code' => $pa_options['ui']));
         }
     }
     if (!$t_ui->getPrimaryKey()) {
         $t_ui = ca_editor_uis::loadDefaultUI($this->ops_table_name, $this->request, $t_subject->getTypeID(), array('editorPref' => 'quickadd'));
     }
     $this->view->setVar($t_subject->primaryKey(), $t_subject->getPrimaryKey());
     $this->view->setVar('subject_id', $t_subject->getPrimaryKey());
     $this->view->setVar('t_subject', $t_subject);
     if ($vs_parent_id_fld = $t_subject->getProperty('HIERARCHY_PARENT_ID_FLD')) {
         $this->view->setVar('parent_id', $vn_parent_id = $this->request->getParameter($vs_parent_id_fld, pInteger));
         return array($t_subject, $t_ui, $vn_parent_id, $vn_above_id);
     }
     return array($t_subject, $t_ui);
 }
 /**
  * Generates detail detail. Will use a view named according to the following convention:
  *		<table_name>_<type_code>_detail_html.php
  *
  * So for example, the detail for objects of type 'artwork' (where 'artwork' is the type code for the artwork object type)
  * the view would be named "ca_objects_artwork_detail_html.php
  *
  * If the type specific view does not exist, then Show() will attemp to use a generic table-wide view name like this:
  *		<table_name>_detail_html.php
  *
  * For example: "ca_objects_detail_html.php"
  *
  * In general you should always have the table wide views defined. Then you can define type-specific views for your
  * application on an as-needed basis.
  */
 public function Show($pa_options = null)
 {
     JavascriptLoadManager::register('viz');
     JavascriptLoadManager::register("ca", "panel");
     JavascriptLoadManager::register("jit");
     JavascriptLoadManager::register('browsable');
     JavascriptLoadManager::register('imageScroller');
     JavascriptLoadManager::register('jquery', 'expander');
     $va_access_values = caGetUserAccessValues($this->request);
     $this->view->setVar('access_values', $va_access_values);
     if (!($t_item = $this->opo_datamodel->getInstanceByTableName($this->ops_tablename, true))) {
         die("Invalid table name " . $this->ops_tablename . " for detail");
         // shouldn't happen
     }
     if (!($vn_item_id = $this->request->getParameter($t_item->primaryKey(), pInteger))) {
         $this->notification->addNotification(_t("Invalid ID"), "message");
         $this->response->setRedirect(caNavUrl($this->request, "", "", "", ""));
         return;
     }
     if (!$t_item->load($vn_item_id)) {
         $this->notification->addNotification(_t("ID does not exist"), "message");
         $this->response->setRedirect(caNavUrl($this->request, "", "", "", ""));
         return;
     }
     if ($t_item->hasField('deleted') && $t_item->get('deleted')) {
         $this->notification->addNotification(_t("ID has been deleted"), "message");
         $this->response->setRedirect(caNavUrl($this->request, "", "", "", ""));
         return;
     }
     // Check if item conforms to any configured display type restrictions
     if (method_exists($t_item, "getTypeID")) {
         $va_types = caMergeTypeRestrictionLists($t_item, array());
         if (is_array($va_types) && sizeof($va_types) && !in_array($t_item->getTypeID(), $va_types)) {
             $this->notification->addNotification(_t("This item is not viewable"), "message");
             $this->response->setRedirect(caNavUrl($this->request, "", "", "", ""));
             return;
         }
     }
     #
     # Enforce access control
     #
     if (sizeof($va_access_values) && !in_array($t_item->get("access"), $va_access_values)) {
         $this->notification->addNotification(_t("This item is not available for view"), "message");
         $this->response->setRedirect(caNavUrl($this->request, "", "", "", ""));
         return;
     }
     //
     // In-detail browsing of objects - limited to object linked to the item being displayed
     //
     if (($vs_browse_for_table = $this->request->config->get('allow_browse_within_detail_for_' . $this->ops_tablename)) && is_object($this->opo_browse)) {
         // set browse context for controller
         $this->setContext($this->opo_browse->getContext());
         //
         // Restrict facets to specific group for refine browse (if set in app.conf config)
         //
         if ($vs_facet_group = $this->request->config->get('ca_objects_refine_facet_group')) {
             $this->opo_browse->setFacetGroup($vs_facet_group);
         }
         $t_table = $this->opo_datamodel->getInstanceByTableName($this->ops_tablename, true);
         if ($this->request->session->getVar($this->ops_tablename . '_' . $this->ops_appname . '_detail_current_item_id') != $vn_item_id) {
             $this->opo_browse->removeAllCriteria();
         }
         // look for 'authority' facet for current detail table type so we can limit the object browse to the currently displayed item
         //$vs_limit_facet_name = null;
         //foreach($this->opo_browse->getInfoForFacets() as $vs_facet_name => $va_facet_info) {
         //	if (($va_facet_info['type'] === 'authority') && ($va_facet_info['table'] === $this->ops_tablename)) {
         //		$vs_limit_facet_name = $vs_facet_name;
         //		break;
         //	}
         //}
         $this->opo_browse->addFacetConfiguration($vs_limit_facet_name = '_detail_browse_' . $this->ops_tablename, array('type' => 'authority', 'table' => $this->ops_tablename, 'relationship_table' => 'ca_objects_x_entities', 'restrict_to_types' => array(), 'restrict_to_relationship_types' => array(), 'label_singular' => 'Detail browse by ' . $this->ops_tablename, 'label_plural' => 'Detail browse by ' . $this->ops_tablename, 'group_mode' => 'none', 'indefinite_article' => 'a'));
         if ($vs_limit_facet_name) {
             if (($va_configured_type_restrictions = $this->request->config->getList($this->ops_tablename . '_detail_browse_type_restrictions')) && is_array($va_configured_type_restrictions)) {
                 $this->opo_browse->setTypeRestrictions($va_configured_type_restrictions, array('includeChildren' => false));
             }
             $this->opo_browse->addCriteria($vs_limit_facet_name, array($vn_item_id));
             $this->opo_browse->execute(array('checkAccess' => $va_access_values));
             $this->request->session->setVar($this->ops_tablename . '_' . $this->ops_appname . '_detail_current_browse_id', $this->opo_browse->getBrowseID());
             $this->view->setVar('show_browse', true);
             //
             // Browse paging
             //
             $vn_items_per_page = $this->request->config->get("objects_per_page_for_detail_pages");
             if (!$vn_items_per_page) {
                 $vn_items_per_page = 12;
             }
             $this->view->setVar('page', ($vn_p = $this->request->getParameter('page', pInteger)) ? $vn_p : 1);
             $qr_hits = null;
             if ($this->opo_browse) {
                 $va_sort = array();
                 if ($vs_sort = $this->request->config->get('sort_browse_within_detail_for_' . $this->ops_tablename)) {
                     $va_sort = array('sort' => $vs_sort);
                 }
                 $qr_hits = $this->opo_browse->getResults($va_sort);
                 $vn_num_pages = ceil($qr_hits->numHits() / $vn_items_per_page);
                 $qr_hits->seek(($vn_p - 1) * $vn_items_per_page);
             } else {
                 $vn_num_pages = 0;
             }
             $this->view->setVar('browse_results', $qr_hits);
             $this->view->setVar('num_pages', (int) $vn_num_pages);
             $this->view->setVar('items_per_page', (int) $vn_items_per_page);
             $this->view->setVar('opo_browse', $this->opo_browse);
             $this->view->setVar('sorts', $this->opa_sorts);
             // supported sorts for the object browse
             // browse criteria in an easy-to-display format
             $va_browse_criteria = array();
             foreach ($this->opo_browse->getCriteriaWithLabels() as $vs_facet_code => $va_criteria) {
                 $va_facet_info = $this->opo_browse->getInfoForFacet($vs_facet_code);
                 $va_criteria_list = array();
                 foreach ($va_criteria as $vn_criteria_id => $vs_criteria_label) {
                     $va_criteria_list[] = $vs_criteria_label;
                 }
                 $va_browse_criteria[$va_facet_info['label_singular']] = join('; ', $va_criteria_list);
             }
             $this->view->setVar('browse_criteria', $va_browse_criteria);
         } else {
             // not configured for browse
             $this->request->session->setVar($this->ops_tablename . '_' . $this->ops_appname . '_detail_current_browse_id', null);
             $this->view->setVar('show_browse', false);
         }
     }
     $this->request->session->setVar($this->ops_tablename . '_' . $this->ops_appname . '_detail_current_item_id', $vn_item_id);
     # Next and previous navigation
     $opo_result_context = new ResultContext($this->request, $this->ops_tablename, ResultContext::getLastFind($this->request, $this->ops_tablename));
     $this->view->setVar('next_id', $opo_result_context->getNextID($vn_item_id));
     $this->view->setVar('previous_id', $opo_result_context->getPreviousID($vn_item_id));
     # Is the item we're show details for in the result set?
     $this->view->setVar('is_in_result_list', $opo_result_context->getIndexInResultList($vn_item_id) != '?');
     # Item instance and id
     $this->view->setVar('t_item', $t_item);
     $this->view->setVar($t_item->getPrimaryKey(), $vn_item_id);
     # Item  - preferred
     $this->view->setVar('label', $t_item->getLabelForDisplay());
     # Item  - nonpreferred
     $this->view->setVar('nonpreferred_labels', caExtractValuesByUserLocale($t_item->getNonPreferredLabels()));
     # Item timestamps (creation and last change)
     if ($va_entry_info = $t_item->getCreationTimestamp()) {
         $this->view->setVar('date_of_entry', date('m/d/Y', $va_entry_info['timestamp']));
     }
     if ($va_last_change_info = $t_item->getLastChangeTimestamp()) {
         $this->view->setVar('date_of_last_change', date('m/d/Y', $va_last_change_info['timestamp']));
     }
     # Media representations to display (objects only)
     if (method_exists($t_item, 'getPrimaryRepresentationInstance')) {
         if ($t_primary_rep = $t_item->getPrimaryRepresentationInstance()) {
             if (!sizeof($va_access_values) || in_array($t_primary_rep->get('access'), $va_access_values)) {
                 // check rep access
                 $this->view->setVar('t_primary_rep', $t_primary_rep);
                 $va_rep_display_info = caGetMediaDisplayInfo('detail', $t_primary_rep->getMediaInfo('media', 'INPUT', 'MIMETYPE'));
                 $this->view->setVar('primary_rep_display_version', $va_rep_display_info['display_version']);
                 unset($va_display_info['display_version']);
                 $va_rep_display_info['poster_frame_url'] = $t_primary_rep->getMediaUrl('media', $va_rep_display_info['poster_frame_version']);
                 unset($va_display_info['poster_frame_version']);
                 $this->view->setVar('primary_rep_display_options', $va_rep_display_info);
             }
         }
     }
     #
     # User-generated comments, tags and ratings
     #
     $va_user_comments = $t_item->getComments(null, true);
     $va_comments = array();
     if (is_array($va_user_comments)) {
         foreach ($va_user_comments as $va_user_comment) {
             if ($va_user_comment["comment"] || $va_user_comment["media1"] || $va_user_comment["media2"] || $va_user_comment["media3"] || $va_user_comment["media4"]) {
                 # TODO: format date based on locale
                 $va_user_comment["date"] = date("n/j/Y", $va_user_comment["created_on"]);
                 # -- get name of commenter
                 $t_user = new ca_users($va_user_comment["user_id"]);
                 $va_user_comment["author"] = $t_user->getName();
                 $va_comments[] = $va_user_comment;
             }
         }
     }
     $this->view->setVar('comments', $va_comments);
     $va_user_tags = $t_item->getTags(null, true);
     $va_tags = array();
     if (is_array($va_user_tags)) {
         foreach ($va_user_tags as $va_user_tag) {
             if (!in_array($va_user_tag["tag"], $va_tags)) {
                 $va_tags[] = $va_user_tag["tag"];
             }
         }
     }
     $this->view->setVar('tags_array', $va_tags);
     $this->view->setVar('tags', implode(", ", $va_tags));
     $this->view->setVar('result_context', $opo_result_context);
     # -- get average user ranking
     $this->view->setVar('ranking', $t_item->getAverageRating(null));
     // null makes it ignore moderation status
     # -- get number of user rankings
     $this->view->setVar('numRankings', $t_item->getNumRatings(null));
     // null makes it ignore moderation status
     #
     # Miscellaneous useful information
     #
     $this->view->setVar('t_relationship_types', new ca_relationship_types());
     // relationship types object - used for displaying relationship type of related authority information
     if (method_exists($t_item, 'getTypeName')) {
         $this->view->setVar('typename', $t_item->getTypeName());
     }
     // Record view
     $t_item->registerItemView($this->request->getUserID());
     //
     // Render view
     //
     if (isset($pa_options['view']) && $pa_options['view']) {
         $this->render($pa_options['view']);
     } else {
         if ($this->getView()->viewExists($this->ops_tablename . '_' . $t_item->getTypeCode() . '_detail_html.php')) {
             $this->render($this->ops_tablename . '_' . $t_item->getTypeCode() . '_detail_html.php');
         } else {
             $this->render($this->ops_tablename . '_detail_html.php');
         }
     }
 }
Exemple #16
0
 *
 * This program is free software; you may redistribute it and/or modify it under
 * the terms of the provided license as published by Whirl-i-Gig
 *
 * 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('hierBrowser');
$vs_id_prefix = $this->getVar('placement_code') . $this->getVar('id_prefix');
$t_item = $this->getVar('t_item');
// list item
$t_item_rel = $this->getVar('t_item_rel');
$va_settings = $this->getVar('settings');
$vs_add_label = $this->getVar('add_label');
$va_rel_types = $this->getVar('relationship_types');
$va_initial_values = $this->getVar('initialValues');
?>
<div id="<?php 
print $vs_id_prefix . $t_item->tableNum() . '_rel';
?>
">
<?php 
//
Exemple #17
0
    print $va_facet_info['label_plural'];
    ?>
</a><br/>
<?php 
}
?>
				</div>
				<div style="margin-top:10px;" class="caption">
					<?php 
print _t("Or click \"Browse\" in the navigation bar to do a refined browse");
?>
				</div>
			</div> -->
		</div><!-- end quickLinkItems -->
<?php 
JavascriptLoadManager::register('cycle');
$t_slider = new ca_sets();
$t_slider->load(array('set_code' => 'siteFeatured'));
//$va_items = $t_slider->getItems(array('thumbnailVersions' => array('medium', 'mediumlarge'), 'checkAccess' => $va_access_values));
$va_images = $t_slider->getRepresentationTags('widesplash', array('checkAccess' => $va_access_values, 'quote' => true));
$t_slider = new ca_sets();
$t_slider->load(array('set_code' => 'cultureFeatured'));
//$va_items = $t_slider->getItems(array('thumbnailVersions' => array('medium', 'mediumlarge'), 'checkAccess' => $va_access_values));
$va_images2 = $t_slider->getRepresentationTags('widesplash', array('checkAccess' => $va_access_values, 'quote' => true));
?>
		
<script type="text/javascript">
	caUI.initCycle('#hpSlider', { 
				fx: 'fade', 
				imageList: [
<?php 
 /**
  * Generates display summary of record data based upon a bundle display for screen
  *
  * @param array $pa_options Array of options passed through to _initView 
  */
 protected function _initView($pa_options = null)
 {
     // load required javascript
     JavascriptLoadManager::register('bundleableEditor');
     JavascriptLoadManager::register('imageScroller');
     $t_subject = $this->opo_datamodel->getInstanceByTableName($this->ops_table_name);
     $t_subject->purify(true);
     // filter HTML for bad things like <script> tags and malformed markup
     // empty (ie. new) rows don't have a type_id set, which means we'll have no idea which attributes to display
     // so we get the type_id off of the request
     if (!($vn_type_id = $this->request->getParameter($t_subject->getTypeFieldName(), pInteger))) {
         $vn_type_id = null;
     }
     // then set the empty row's type_id
     $t_subject->set($t_subject->getTypeFieldName(), $vn_type_id);
     // then reload the definitions (which includes bundle specs)
     $t_subject->reloadLabelDefinitions();
     $t_ui = new ca_editor_uis();
     if (isset($pa_options['ui']) && $pa_options['ui']) {
         if (is_numeric($pa_options['ui'])) {
             $t_ui->load((int) $pa_options['ui']);
         }
         if (!$t_ui->getPrimaryKey()) {
             $t_ui->load(array('editor_code' => $pa_options['ui']));
         }
     }
     if (!$t_ui->getPrimaryKey()) {
         $t_ui->loadDefaultUI($this->ops_table_name, $this->request);
     }
     $this->view->setVar('t_subject', $t_subject);
     return array(null, $t_subject, $t_ui);
 }
 *
 * This program is free software; you may redistribute it and/or modify it under
 * the terms of the provided license as published by Whirl-i-Gig
 *
 * 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('sortableUI');
$vs_id_prefix = $this->getVar('placement_code') . $this->getVar('id_prefix');
$t_mapping = $this->getVar('t_mapping');
$t_group = $this->getVar('t_group');
$t_screen = $this->getVar('t_screen');
$vs_target = $t_mapping->get('target');
$va_initial_values = $this->getVar('groups');
// list of existing groups
// process rules for display
foreach ($va_initial_values as $vn_group_id => $va_group) {
    if (!is_array($va_group['rules'])) {
        $va_group['rules'] = array();
    }
    $vs_rule_display = '<table>';
    $vs_rule_display .= "<tr><td class='formLabel'>CollectiveAccess</td><td> </td><td class='formLabel'>{$vs_target}</td></tr>";
    foreach ($va_group['rules'] as $vn_rule_id => $va_rule) {
 public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
 {
     parent::__construct($po_request, $po_response, $pa_view_paths);
     //
     // Get browse target
     //
     if (!($vs_browse_target = $po_request->getParameter('target', pString))) {
         if (!($vs_browse_target = $po_request->session->getVar('pawtucket2_browse_target'))) {
             if (is_array($va_browse_targets = $this->request->config->getList('browse_targets'))) {
                 $vs_browse_target = array_shift($va_browse_targets);
             }
         }
     }
     // 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"));
     }
     //
     // Minimal view list (all targets have a "full" results view)
     //
     $this->opa_views = array('full' => _t('List'));
     $this->opa_views_options = array('full' => array("description" => _t("View results in a list"), "icon" => "icon_list.gif"));
     //
     // Set up for browse target
     //
     switch ($vs_browse_target) {
         case 'ca_entities':
             $this->ops_tablename = 'ca_entities';
             $this->opo_result_context = new ResultContext($po_request, $this->ops_tablename, $this->ops_find_type);
             $this->opo_browse = new EntityBrowse($this->opo_result_context->getSearchExpression(), 'pawtucket2');
             // get configured result views, if specified
             if ($va_result_views_for_ca_entities = $po_request->config->getAssoc('result_views_for_ca_entities')) {
                 $this->opa_views = $va_result_views_for_ca_entities;
             }
             // get configured result views options, if specified
             if ($va_result_views_options_for_ca_entities = $po_request->config->getAssoc('result_views_options_for_ca_entities')) {
                 $this->opa_views_options = $va_result_views_options_for_ca_entities;
             }
             // get configured result sort options, if specified
             if ($va_sort_options_for_ca_entities = $po_request->config->getAssoc('result_sort_options_for_ca_entities')) {
                 $this->opa_sorts = $va_sort_options_for_ca_entities;
             } else {
                 $this->opa_sorts = array('ca_entity_labels.displayname' => _t('Name'), 'ca_entities.type_id' => _t('Type'), 'ca_entities.idno_sort' => _t('Idno'));
             }
             break;
         case 'ca_places':
             $this->ops_tablename = 'ca_places';
             $this->opo_result_context = new ResultContext($po_request, $this->ops_tablename, $this->ops_find_type);
             $this->opo_browse = new PlaceBrowse($this->opo_result_context->getSearchExpression(), 'pawtucket2');
             // get configured result views, if specified
             if ($va_result_views_for_ca_places = $po_request->config->getAssoc('result_views_for_ca_places')) {
                 $this->opa_views = $va_result_views_for_ca_places;
             }
             // get configured result views options, if specified
             if ($va_result_views_options_for_ca_places = $po_request->config->getAssoc('result_views_options_for_ca_places')) {
                 $this->opa_views_options = $va_result_views_options_for_ca_places;
             }
             // get configured result sort options, if specified
             if ($va_sort_options_for_ca_places = $po_request->config->getAssoc('result_sort_options_for_ca_places')) {
                 $this->opa_sorts = $va_sort_options_for_ca_places;
             } else {
                 $this->opa_sorts = array('ca_place_labels.name' => _t('Name'), 'ca_places.type_id' => _t('Type'), 'ca_places.idno_sort' => _t('Idno'));
             }
             break;
         case 'ca_occurrences':
             $this->ops_tablename = 'ca_occurrences';
             $this->opo_result_context = new ResultContext($po_request, $this->ops_tablename, $this->ops_find_type);
             $this->opo_browse = new OccurrenceBrowse($this->opo_result_context->getSearchExpression(), 'pawtucket2');
             // get configured result views, if specified
             if ($va_result_views_for_ca_occurrences = $po_request->config->getAssoc('result_views_for_ca_occurrences')) {
                 $this->opa_views = $va_result_views_for_ca_occurrences;
             }
             // get configured result views options, if specified
             if ($va_result_views_options_for_ca_occurrences = $po_request->config->getAssoc('result_views_options_for_ca_occurrences')) {
                 $this->opa_views_options = $va_result_views_options_for_ca_occurrences;
             }
             // get configured result sort options, if specified
             if ($va_sort_options_for_ca_occurrences = $po_request->config->getAssoc('result_sort_options_for_ca_occurrences')) {
                 $this->opa_sorts = $va_sort_options_for_ca_occurrences;
             } else {
                 $this->opa_sorts = array('ca_occurrence_labels.name' => _t('Title'), 'ca_occurrences.idno_sort' => _t('Idno'));
             }
             break;
         case 'ca_collections':
             $this->ops_tablename = 'ca_collections';
             $this->opo_result_context = new ResultContext($po_request, $this->ops_tablename, $this->ops_find_type);
             $this->opo_browse = new CollectionBrowse($this->opo_result_context->getSearchExpression(), 'pawtucket2');
             // get configured result views, if specified
             if ($va_result_views_for_ca_collections = $po_request->config->getAssoc('result_views_for_ca_collections')) {
                 $this->opa_views = $va_result_views_for_ca_collections;
             }
             // get configured result views options, if specified
             if ($va_result_views_options_for_ca_collections = $po_request->config->getAssoc('result_views_options_for_ca_collections')) {
                 $this->opa_views_options = $va_result_views_options_for_ca_collections;
             }
             // get configured result sort options, if specified
             if ($va_sort_options_for_ca_collections = $po_request->config->getAssoc('result_sort_options_for_ca_collections')) {
                 $this->opa_sorts = $va_sort_options_for_ca_collections;
             } else {
                 $this->opa_sorts = array('ca_collection_labels.name' => _t('Name'), 'ca_collections.type_id' => _t('Type'), 'ca_collections.idno_sort' => _t('Idno'));
             }
             break;
         default:
             $this->ops_tablename = 'ca_objects';
             $this->opo_result_context = new ResultContext($po_request, $this->ops_tablename, $this->ops_find_type);
             $this->opo_browse = new ObjectBrowse($this->opo_result_context->getSearchExpression(), 'pawtucket2');
             // get configured result views, if specified
             if ($va_result_views_for_ca_objects = $po_request->config->getAssoc('result_views_for_ca_objects')) {
                 $this->opa_views = $va_result_views_for_ca_objects;
             } else {
                 $this->opa_views = array('full' => _t('List'), 'thumbnail' => _t('Thumbnails'));
             }
             // get configured result views options, if specified
             if ($va_result_views_options_for_ca_objects = $po_request->config->getAssoc('result_views_options_for_ca_objects')) {
                 $this->opa_views_options = $va_result_views_options_for_ca_objects;
             } else {
                 $this->opa_views_options = array('thumbnail' => array("description" => _t("View thumbnails with brief captions"), "icon" => "icon_thumbnail.gif"), 'full' => array("description" => _t("View images with full captions"), "icon" => "icon_full.gif"));
             }
             // get configured result sort options, if specified
             if ($va_sort_options_for_ca_objects = $po_request->config->getAssoc('result_sort_options_for_ca_objects')) {
                 $this->opa_sorts = $va_sort_options_for_ca_objects;
             } else {
                 $this->opa_sorts = array('ca_object_labels.name' => _t('Title'), 'ca_objects.type_id' => _t('Type'), 'ca_objects.idno_sort' => _t('Idno'));
             }
             if ($po_request->config->get("show_map_object_search_results")) {
                 JavascriptLoadManager::register('maps');
                 $this->opa_views['map'] = _t('Map');
                 if (!$this->opa_views_options['map']) {
                     $this->opa_views_options['map'] = array("description" => _t("View results plotted on a map"), "icon" => "icon_map.gif");
                 }
             }
             break;
     }
     // if target changes we need clear out all browse criteria as they are no longer valid
     if ($vs_browse_target != $po_request->session->getVar('pawtucket2_browse_target')) {
         $this->opo_browse->removeAllCriteria();
     }
     // Set up target vars and controls
     $po_request->session->setVar('pawtucket2_browse_target', $vs_browse_target);
     if (sizeof($va_browse_targets = $this->request->config->getList('browse_targets')) > 1) {
         $va_browse_options = array();
         foreach ($va_browse_targets as $vs_possible_browse_target) {
             if ($vs_browse_target_name = $this->opo_browse->getBrowseSubjectName($vs_possible_browse_target)) {
                 $va_browse_options[$vs_browse_target_name] = $vs_possible_browse_target;
             }
         }
         $this->view->setVar('browse_selector', "<form action='#'>" . caHTMLSelect('target', $va_browse_options, array('id' => 'caBrowseTargetSelectorSelect', 'onchange' => 'window.location = \'' . caNavUrl($this->request, $this->request->getModulePath(), $this->request->getController(), 'Index', array('target' => '')) . '\' + jQuery(\'#caBrowseTargetSelectorSelect\').val();'), array('value' => $vs_browse_target, 'dontConvertAttributeQuotesToEntities' => true)) . "</form>\n");
     }
     // get configured items per page options, if specified
     if ($va_items_per_page = $po_request->config->getList('items_per_page_options_for_' . $vs_browse_target . '_browse')) {
         $this->opa_items_per_page = $va_items_per_page;
     }
     if (($vn_items_per_page_default = (int) $po_request->config->get('items_per_page_default_for_' . $this->ops_tablename . '_browse')) > 0) {
         $this->opn_items_per_page_default = $vn_items_per_page_default;
     } else {
         $this->opn_items_per_page_default = $this->opa_items_per_page[0];
     }
     // set current result view options so can check we are including a configured result view
     $this->view->setVar('result_views', $this->opa_views);
     $this->view->setVar('result_views_options', $this->opa_views_options);
     //Roundabout added config options
     $ra_categories = array('artists' => $po_request->config->get('ra_browse_artists'), 'costumes' => $po_request->config->get('ra_browse_costumes'), 'orchestrations' => $po_request->config->get('ra_browse_orchestrations'), 'photographs' => $po_request->config->get('ra_browse_photographs'), 'playbills' => $po_request->config->get('ra_browse_playbills'), 'posters' => $po_request->config->get('ra_browse_posters'), 'productions' => $po_request->config->get('ra_browse_productions'), 'scripts' => $po_request->config->get('ra_browse_scripts'), 'sketch' => $po_request->config->get('ra_browse_sketch'), 'video' => $po_request->config->get('ra_browse_video'));
     $this->view->setVar('ra_categories', $ra_categories);
     if ($this->opn_type_restriction_id = $this->opo_result_context->getTypeRestriction($pb_type_restriction_has_changed)) {
         $_GET['type_id'] = $this->opn_type_restriction_id;
         // push type_id into globals so breadcrumb trail can pick it up
         $this->opb_type_restriction_has_changed = $pb_type_restriction_has_changed;
         // get change status
     }
 }
Exemple #21
0
	jQuery(document).ready(function() {
		if (caUI.initPanel) {
			caSetsSlideshowPanel = caUI.initPanel({ 
				panelID: 'caSetsSlideshowPanel',										/* DOM ID of the <div> enclosing the panel */
				panelContentID: 'caSetsSlideshowPanelContentArea',		/* DOM ID of the content area <div> in the panel */
				exposeBackgroundColor: '#000000',						/* color (in hex notation) of background masking out page content; include the leading '#' in the color spec */
				exposeBackgroundOpacity: 0.8,							/* opacity of background color masking out page content; 1.0 is opaque */
				panelTransitionSpeed: 400, 									/* time it takes the panel to fade in/out in milliseconds */
				allowMobileSafariZooming: true,
				mobileSafariViewportTagID: '_msafari_viewport',
				closeButtonSelector: '.close'					/* anything with the CSS classname "close" will trigger the panel to close */
			});
		}
<?php 
if ($this->request->isLoggedIn()) {
    JavascriptLoadManager::register('tokeninput');
    ?>
			jQuery('#to_email').tokenInput('<?php 
    print caNavUrl($this->request, 'Share/lookup', 'User', 'Get');
    ?>
', {
				onResult: function (results) {
					if (results.length == 0) {
						var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
						var emailinput = jQuery('#token-input-to_email').val();
						if (emailinput.search(emailRegEx) >= 0) {
							jQuery('#to_email').tokenInput("add", {id: emailinput, name: emailinput});
						}
					}
                    return results;
            	}, preventDuplicates: true
Exemple #22
0
 /**
  * Returns HTML form element for editing of setting
  *
  * Options:
  *
  * 	'name' => sets the name of the HTML form element explicitly, otherwise 'setting_<name_of_setting>' is used
  * 	'id' => sets the id of the HTML form element explicitly, otherwise 'setting_<name_of_setting>' is used
  *  'value' => sets the value of the HTML form element explicitly, otherwise the current value for the setting in the loaded row is used
  *  'label_id' => sets the id of the label for the setting form element (used to link tools tips to the label); if not set then the default is to set it to  'setting_<name_of_setting>_label'
  */
 public function settingHTMLFormElement($ps_setting, $pa_options = null)
 {
     if (!$this->isValidSetting($ps_setting)) {
         return false;
     }
     $va_available_settings = $this->getAvailableSettings();
     $va_properties = $va_available_settings[$ps_setting];
     if (isset($pa_options['name'])) {
         $vs_input_name = $pa_options['name'];
     } else {
         $vs_input_name = "setting_{$ps_setting}";
     }
     if (isset($pa_options['id'])) {
         $vs_input_id = $pa_options['id'];
     } else {
         $vs_input_id = "setting_{$ps_setting}";
     }
     if (isset($pa_options['value'])) {
         $vs_value = $pa_options['value'];
     } else {
         $vs_value = $this->getSetting(trim($ps_setting));
     }
     if (isset($pa_options['label_id'])) {
         $vs_label_id = $pa_options['label_id'];
     } else {
         $vs_label_id = "setting_{$ps_setting}_label";
     }
     $vs_return = "\n" . '<div class="formLabel" id="' . $vs_input_id . '_container">' . "\n";
     $vs_return .= '<span id="' . $vs_label_id . '"  class="' . $vs_label_id . '">' . $va_properties['label'] . '</span>';
     if ($vs_help_text = $pa_options['helpText']) {
         $vs_return .= "<a href='#' onclick='jQuery(\"#" . str_replace(".", "_", $vs_label_id) . "_help_text\").slideToggle(250); return false;' class='settingsKeyButton'>" . _t('Key') . "</a>";
     }
     $vs_return .= '<br />' . "\n";
     if ($vs_help_text) {
         $vs_return .= "\n<div id='" . str_replace(".", "_", $vs_label_id) . "_help_text' class='settingsKey'>{$vs_help_text}</div>\n";
     }
     switch ($va_properties['displayType']) {
         # --------------------------------------------
         case DT_FIELD:
             $vb_takes_locale = false;
             if (isset($va_properties['takesLocale']) && $va_properties['takesLocale']) {
                 $vb_takes_locale = true;
                 $va_locales = ca_locales::getLocaleList(array('sort_field' => '', 'sort_order' => 'asc', 'index_by_code' => true, 'available_for_cataloguing_only' => true));
             } else {
                 $va_locales = array('_generic' => array());
             }
             foreach ($va_locales as $vs_locale => $va_locale_info) {
                 if ($vb_takes_locale && sizeof($va_locales) > 1) {
                     $vs_locale_label = " (" . $va_locale_info['name'] . ")";
                     $vs_input_name_suffix = '_' . $vs_locale;
                 } else {
                     if ($vb_takes_locale) {
                         $vs_input_name_suffix = '_' . $vs_locale;
                     } else {
                         $vs_input_name_suffix = $vs_locale_label = '';
                     }
                 }
                 if ($vs_locale != '_generic' && is_array($vs_value)) {
                     // _generic means this setting doesn't take a locale
                     if (!($vs_text_value = $vs_value[$va_locale_info['locale_id']])) {
                         $vs_text_value = is_array($vs_value) && isset($vs_value[$va_locale_info['code']]) ? $vs_value[$va_locale_info['code']] : '';
                     }
                 } else {
                     $vs_text_value = $vs_value;
                 }
                 $vs_return .= caHTMLTextInput($vs_input_name . $vs_input_name_suffix, array('size' => $va_properties["width"], 'height' => $va_properties["height"], 'value' => $vs_text_value, 'id' => $vs_input_id)) . "{$vs_locale_label}<br/>\n";
             }
             break;
             # --------------------------------------------
         # --------------------------------------------
         case DT_CHECKBOXES:
             $va_attributes = array('value' => '1', 'id' => $vs_input_id);
             if ((int) $vs_value === 1) {
                 $va_attributes['checked'] = '1';
             }
             if (isset($va_properties['hideOnSelect'])) {
                 if (!is_array($va_properties['hideOnSelect'])) {
                     $va_properties['hideOnSelect'] = array($va_properties['hideOnSelect']);
                 }
                 $va_ids = array();
                 foreach ($va_properties['hideOnSelect'] as $vs_n) {
                     $va_ids[] = "#" . $pa_options['id_prefix'] . "_{$vs_n}_container";
                 }
                 $va_attributes['onchange'] = 'jQuery(this).prop("checked") ? jQuery("' . join(",", $va_ids) . '").slideUp(250).find("input, textarea").val("") : jQuery("' . join(",", $va_ids) . '").slideDown(250);';
             }
             $vs_return .= caHTMLCheckboxInput($vs_input_name, $va_attributes, array());
             break;
             # --------------------------------------------
         # --------------------------------------------
         case DT_COLORPICKER:
             $va_attributes = array('value' => $vs_value, 'id' => $vs_input_id);
             $vs_return .= caHTMLHiddenInput($vs_input_name, $va_attributes, array());
             $vs_return .= "<div id='{$vs_input_id}_colorchip' class='colorpicker_chip' style='background-color: #{$vs_value}'><!-- empty --></div>";
             $vs_return .= "<script type='text/javascript'>jQuery(document).ready(function() { jQuery('#{$vs_input_name}_colorchip').ColorPicker({\n\t\t\t\t\t\t\t\tonShow: function (colpkr) {\n\t\t\t\t\t\t\t\t\tjQuery(colpkr).fadeIn(500);\n\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tonHide: function (colpkr) {\n\t\t\t\t\t\t\t\t\tjQuery(colpkr).fadeOut(500);\n\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tonChange: function (hsb, hex, rgb) {\n\t\t\t\t\t\t\t\t\tjQuery('#{$vs_input_name}').val(hex);\n\t\t\t\t\t\t\t\t\tjQuery('#{$vs_input_name}_colorchip').css('backgroundColor', '#' + hex);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tcolor: jQuery('#" . $pa_options["name"] . "').val()\n\t\t\t\t\t\t\t})}); </script>\n";
             JavascriptLoadManager::register('jquery', 'colorpicker');
             break;
             # --------------------------------------------
         # --------------------------------------------
         case DT_SELECT:
             include_once __CA_MODELS_DIR__ . '/ca_relationship_types.php';
             $vn_width = isset($va_properties['width']) && strlen($va_properties['width']) > 0 ? $va_properties['width'] : "100px";
             $vn_height = isset($va_properties['height']) && strlen($va_properties['height']) > 0 ? $va_properties['height'] : "50px";
             $vs_select_element = '';
             if (($vs_rel_table = $va_properties['useRelationshipTypeList']) || ($vb_locale_list = (bool) $va_properties['useLocaleList']) || ($vs_list_code = $va_properties['useList']) || ($vb_show_lists = (bool) $va_properties['showLists'] || (bool) $va_properties['showVocabularies'])) {
                 if ($vs_rel_table) {
                     $t_rel = new ca_relationship_types();
                     $va_rels = $t_rel->getRelationshipInfo($vs_rel_table);
                     $va_rel_opts = array();
                     if (isset($va_properties['allowNull']) && $va_properties['allowNull']) {
                         $va_rel_opts['-'] = null;
                     }
                     foreach ($va_rels as $vn_type_id => $va_rel_type_info) {
                         if (!$va_rel_type_info['parent_id']) {
                             continue;
                         }
                         $va_rel_opts[$va_rel_type_info['typename'] . '/' . $va_rel_type_info['typename_reverse']] = $va_rel_type_info['type_id'];
                     }
                 } else {
                     if ($vb_locale_list) {
                         include_once __CA_MODELS_DIR__ . '/ca_locales.php';
                         $va_rel_opts = array_flip(ca_locales::getLocaleList(array('return_display_values' => true)));
                     } else {
                         if ($vb_show_lists) {
                             include_once __CA_MODELS_DIR__ . '/ca_lists.php';
                             $t_list = new ca_lists();
                             $va_lists = caExtractValuesByUserLocale($t_list->getListOfLists());
                             $va_rel_opts = array();
                             foreach ($va_lists as $vn_list_id => $va_list_info) {
                                 if ($va_properties['showVocabularies'] && !$va_list_info['use_as_vocabulary']) {
                                     continue;
                                 }
                                 $va_rel_opts[$va_list_info['name'] . ' (' . $va_list_info['list_code'] . ')'] = $vn_list_id;
                             }
                         }
                     }
                 }
                 $va_attr = array();
                 if ($vn_height > 1) {
                     $va_attr['multiple'] = 1;
                     $vs_input_name .= '[]';
                 }
                 $va_opts = array('id' => $vs_input_id, 'width' => $vn_width, 'height' => $vn_height);
                 if ($vn_height > 1) {
                     if ($vs_value && !is_array($vs_value)) {
                         $vs_value = array($vs_value);
                     }
                     $va_opts['values'] = $vs_value;
                 } else {
                     if (is_array($vs_value)) {
                         $va_opts['value'] = array_pop($vs_value);
                     } else {
                         if ($vs_value) {
                             $va_opts['value'] = $vs_value;
                         } else {
                             $va_opts['value'] = null;
                         }
                     }
                 }
                 if ($vs_list_code) {
                     $t_list = new ca_lists();
                     if (!isset($va_opts['value'])) {
                         $va_opts['value'] = -1;
                     }
                     // make sure default list item is never selected
                     $vs_select_element = $t_list->getListAsHTMLFormElement($vs_list_code, $vs_input_name, $va_attr, $va_opts);
                 } else {
                     if (!isset($va_opts['value'])) {
                         $va_opts['value'] = -1;
                     }
                     // make sure default list item is never selected
                     $vs_select_element = caHTMLSelect($vs_input_name, $va_rel_opts, $va_attr, $va_opts);
                 }
             } else {
                 if (strlen($va_properties['showSortableBundlesFor']) > 0) {
                     require_once __CA_MODELS_DIR__ . '/ca_metadata_elements.php';
                     $o_dm = Datamodel::load();
                     if (!($t_rel = $o_dm->getInstanceByTableName($va_properties['showSortableBundlesFor'], true))) {
                         break;
                     }
                     $va_elements = ca_metadata_elements::getSortableElements($va_properties['showSortableBundlesFor']);
                     $va_select_opts = array(_t('User defined sort order') => '', _t('Order created') => 'relation_id', _t('Preferred label') => $va_properties['showSortableBundlesFor'] . ".preferred_labels." . $t_rel->getLabelDisplayField());
                     foreach ($va_elements as $vn_element_id => $va_element) {
                         if (!$va_element['display_label']) {
                             continue;
                         }
                         $va_select_opts[_t('Element: %1', $va_element['display_label'])] = $va_properties['showSortableBundlesFor'] . "." . $va_element['element_code'];
                     }
                     $va_opts = array('id' => $vs_input_id, 'width' => $vn_width, 'height' => $vn_height, 'value' => is_array($vs_value) ? $vs_value[0] : $vs_value, 'values' => is_array($vs_value) ? $vs_value : array($vs_value));
                     $vs_select_element = caHTMLSelect($vs_input_name, $va_select_opts, array(), $va_opts);
                 } elseif ((int) $va_properties['showSortableElementsFor'] > 0) {
                     require_once __CA_MODELS_DIR__ . '/ca_metadata_elements.php';
                     $t_element = new ca_metadata_elements($va_properties['showSortableElementsFor']);
                     if (!$t_element->getPrimaryKey()) {
                         return '';
                     }
                     $va_elements = $t_element->getElementsInSet();
                     $va_select_opts = array(_t('Order created') => '');
                     foreach ($va_elements as $vn_i => $va_element) {
                         if ((int) $va_element['element_id'] == (int) $va_properties['showSortableElementsFor']) {
                             continue;
                         }
                         if (!$va_element['display_label']) {
                             continue;
                         }
                         $va_select_opts[_t('Element: %1', $va_element['display_label'])] = $va_element['element_code'];
                     }
                     $va_opts = array('id' => $vs_input_id, 'width' => $vn_width, 'height' => $vn_height, 'value' => is_array($vs_value) ? $vs_value[0] : $vs_value, 'values' => is_array($vs_value) ? $vs_value : array($vs_value));
                     $vs_select_element = caHTMLSelect($vs_input_name, $va_select_opts, array(), $va_opts);
                 } elseif ((int) $va_properties['showMetadataElementsWithDataType'] > 0) {
                     require_once __CA_MODELS_DIR__ . '/ca_metadata_elements.php';
                     $va_rep_elements = ca_metadata_elements::getElementsAsList(true, $va_properties['table'], null, true, false, true, array($va_properties['showMetadataElementsWithDataType']));
                     if (is_array($va_rep_elements)) {
                         $va_select_opts = array();
                         foreach ($va_rep_elements as $vs_element_code => $va_element_info) {
                             $va_select_opts[$va_element_info['display_label']] = $vs_element_code;
                         }
                         $va_opts = array('id' => $vs_input_id, 'width' => $vn_width, 'height' => $vn_height, 'value' => is_array($vs_value) ? $vs_value[0] : $vs_value, 'values' => is_array($vs_value) ? $vs_value : array($vs_value));
                         $vs_select_element = caHTMLSelect($vs_input_name, $va_select_opts, array(), $va_opts);
                     }
                 } else {
                     // Regular drop-down with configured options
                     if ($vn_height > 1) {
                         $va_attr['multiple'] = 1;
                         $vs_input_name .= '[]';
                     }
                     $va_opts = array('id' => $vs_input_id, 'width' => $vn_width, 'height' => $vn_height, 'value' => is_array($vs_value) ? $vs_value[0] : $vs_value, 'values' => is_array($vs_value) ? $vs_value : array($vs_value));
                     if (!isset($va_opts['value'])) {
                         $va_opts['value'] = -1;
                     }
                     // make sure default list item is never selected
                     $vs_select_element = caHTMLSelect($vs_input_name, $va_properties['options'], array(), $va_opts);
                 }
             }
             if ($vs_select_element) {
                 $vs_return .= $vs_select_element;
             } else {
                 return '';
             }
             break;
             # --------------------------------------------
         # --------------------------------------------
         default:
             break;
             # --------------------------------------------
     }
     $vs_return .= '</div>' . "\n";
     TooltipManager::add('.' . $vs_label_id, "<h3>" . $va_properties["label"] . "</h3>" . $va_properties["description"]);
     return $vs_return;
 }
Exemple #23
0
 *
 * This program is free software; you may redistribute it and/or modify it under
 * the terms of the provided license as published by Whirl-i-Gig
 *
 * 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();
$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 '));
 *
 * This program is free software; you may redistribute it and/or modify it under
 * the terms of the provided license as published by Whirl-i-Gig
 *
 * 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('tableview');
$t_display = $this->getVar('t_display');
$va_display_list = $this->getVar('display_list');
$vo_result = $this->getVar('result');
$vn_num_hits = $vo_result->numHits();
$vs_subject_table = $vo_result->tableName();
$va_columns = $this->getVar('columns');
$va_column_headers = $this->getVar('columnHeaders');
$va_row_headers = $this->getVar('rowHeaders');
$va_initial_data = $this->getVar('initialData');
?>
<div id="caResultsEditorWrapper">
	<div id="scrollingResults" class="caResultsEditorContainer">
		<div id="caResultsEditorGrid" class="caResultsEditorContent"></div>
		<a href="#" onclick="caResultsEditor.caResultsEditorOpenFullScreen();" class="caResultsEditorToggleFullScreenButton"><?php 
print caHTMLImage($this->request->getThemeUrlPath() . "/graphics/buttons/fullscreen.png", array('width' => 14, 'height' => 14, 'alt' => _t('Full screen')));
 /**
  * Return HTML form element for editing.
  *
  * @param array $pa_element_info An array of information about the metadata element being edited
  * @param array $pa_options array Options include:
  *			forSearch = simple text entry is returned for use with search forms [Default=false]
  *			class = the CSS class to apply to all visible form elements [Default=lookupBg]
  *			width = the width of the form element [Default=field width defined in metadata element definition]
  *			height = the height of the form element [Default=field height defined in metadata element definition]
  *			request = the RequestHTTP object for the current request; required for lookups to work [Default is null]
  *			disableMap = don't show map with Geonames data [Default=false]
  *
  * @return string
  */
 public function htmlFormElement($pa_element_info, $pa_options = null)
 {
     $vs_class = trim(isset($pa_options['class']) && $pa_options['class'] ? $pa_options['class'] : '');
     if (isset($pa_options['forSearch']) && $pa_options['forSearch']) {
         return caHTMLTextInput("{fieldNamePrefix}" . $pa_element_info['element_id'] . "_{n}", array('id' => "{fieldNamePrefix}" . $pa_element_info['element_id'] . "_{n}", 'value' => $pa_options['value']), $pa_options);
     }
     $o_config = Configuration::load();
     $va_settings = $this->getSettingValuesFromElementArray($pa_element_info, array('fieldWidth', 'fieldHeight', 'disableMap', 'maxResults', 'gnElements', 'gnDelimiter'));
     $vn_max_results = isset($va_settings['maxResults']) ? intval($va_settings['maxResults']) : 20;
     $vs_gn_elements = $va_settings['gnElements'];
     $vs_gn_delimiter = $va_settings['gnDelimiter'];
     if ($pa_options['request']) {
         $vs_url = caNavUrl($pa_options['request'], 'lookup', 'GeoNames', 'Get', array('maxRows' => $vn_max_results, 'gnElements' => urlencode($vs_gn_elements), 'gnDelimiter' => urlencode($vs_gn_delimiter)));
     }
     $vs_element = '<div id="geonames_' . $pa_element_info['element_id'] . '_input{n}">' . caHTMLTextInput('{fieldNamePrefix}' . $pa_element_info['element_id'] . '_autocomplete{n}', array('size' => isset($pa_options['width']) && $pa_options['width'] > 0 ? $pa_options['width'] : $va_settings['fieldWidth'], 'height' => isset($pa_options['height']) && $pa_options['height'] > 0 ? $pa_options['height'] : $va_settings['fieldHeight'], 'value' => '{{' . $pa_element_info['element_id'] . '}}', 'maxlength' => 512, 'id' => "geonames_" . $pa_element_info['element_id'] . "_autocomplete{n}", 'class' => $vs_class ? $vs_class : 'lookupBg')) . caHTMLHiddenInput('{fieldNamePrefix}' . $pa_element_info['element_id'] . '_{n}', array('value' => '{{' . $pa_element_info['element_id'] . '}}', 'id' => '{fieldNamePrefix}' . $pa_element_info['element_id'] . '_{n}'));
     $vs_element .= '</div>';
     $vs_element .= "\n\t\t\t<script type='text/javascript'>\n\t\t\t\tjQuery(document).ready(function() {\n\t\t\t\t\tjQuery('#geonames_" . $pa_element_info['element_id'] . "_autocomplete{n}').autocomplete(\n\t\t\t\t\t\t{ \n\t\t\t\t\t\t\tsource: '{$vs_url}',\n\t\t\t\t\t\t\tminLength: 3, delay: 800,\n\t\t\t\t\t\t\tselect: function(event, ui) {\n\t\t\t\t\t\t\t\tjQuery('#{fieldNamePrefix}" . $pa_element_info['element_id'] . "_{n}').val(ui.item.label + ' [id:' + ui.item.id + ']');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t).click(function() { this.select(); });\n\t\t\t\t});\n\t\t\t</script>\n\t\t";
     if (!caGetOption("disableMap", $va_settings, false) && !caGetOption("disableMap", $pa_options, false)) {
         JavascriptLoadManager::register('maps');
         $vs_element .= "\n\t\t\t\t<div id='map_" . $pa_element_info['element_id'] . "{n}' style='width:700px; height:160px;'>\n\n\t\t\t\t</div>\n\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\tif ('{n}'.substring(0,3) == 'new') {\n\t\t\t\t\t\tjQuery('#map_" . $pa_element_info['element_id'] . "{n}').hide();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery(document).ready(function() {\n\t\t\t";
         $vs_element .= "\n\t\t\t\t\tvar re = /\\[([\\d\\.\\-,; ]+)\\]/;\n\t\t\t\t\tvar r = re.exec('{{" . $pa_element_info['element_id'] . "}}');\n\t\t\t\t\tvar latlong = (r) ? r[1] : null;\n\n\t\t\t\t\tif (latlong) {\n\t\t\t\t\t\t// map vars are global\n\t\t\t\t\t\tmap_" . $pa_element_info['element_id'] . "{n} = new google.maps.Map(document.getElementById('map_" . $pa_element_info['element_id'] . "{n}'), {\n\t\t\t\t\t\t\tdisableDefaultUI: false,\n\t\t\t\t\t\t\tmapTypeId: google.maps.MapTypeId.SATELLITE\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tvar tmp = latlong.split(',');\n\t\t\t\t\t\tvar pt = new google.maps.LatLng(tmp[0], tmp[1]);\n\t\t\t\t\t\tmap_" . $pa_element_info['element_id'] . "{n}.setCenter(pt);\n\t\t\t\t\t\tmap_" . $pa_element_info['element_id'] . "{n}.setZoom(15);\t\t// todo: make this a user preference of some sort\n\t\t\t\t\t\tvar marker = new google.maps.Marker({\n\t\t\t\t\t\t\tposition: pt,\n\t\t\t\t\t\t\tmap: map_" . $pa_element_info['element_id'] . "{n}\n\t\t\t\t\t\t});\n\t\t\t\t\t}";
         $vs_element .= "\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t</script>";
     }
     return $vs_element;
 }
 function Detail()
 {
     JavascriptLoadManager::register('panel');
     if ($this->request->config->get("dont_enforce_access_settings")) {
         $va_access_values = array();
     } else {
         $va_access_values = caGetUserAccessValues($this->request);
     }
     $va_jumpToList = $this->ops_jumpToList;
     $this->view->setVar('jumpToList', $va_jumpToList);
     $va_periods = $this->ops_periods;
     $this->view->setVar('periods', $va_periods);
     $vn_year = $this->request->getParameter('year', pInteger);
     $vn_period = $this->request->getParameter('period', pInteger);
     if (!$vn_period) {
         if ($vn_year) {
             # --- determine the period from the year
             foreach ($va_periods as $i => $va_per_info) {
                 if ($vn_year >= $va_per_info["start"] && $vn_year <= $va_per_info["end"]) {
                     $vn_period = $i;
                     break;
                 }
             }
         }
     }
     $this->view->setVar('period', $vn_period);
     if (!$vn_year) {
         $vn_year = $va_periods[$vn_period]["start"];
     }
     $this->view->setVar('year', $vn_year);
     $vn_y = "";
     if ($va_periods[$vn_period]["displayAllYears"] == 1) {
         $vn_y = $va_periods[$vn_period]["start"] . " to " . $va_periods[$vn_period]["end"];
     } else {
         $vn_y = $vn_year;
     }
     $o_search = new OccurrenceSearch();
     $t_list = new ca_lists();
     $vn_chronology_type_id = $t_list->getItemIDFromList('occurrence_types', 'chronology');
     $vn_exhibition_type_id = $t_list->getItemIDFromList('occurrence_types', 'exhibition');
     $vn_bibliography_type_id = $t_list->getItemIDFromList('occurrence_types', 'bibliography');
     $vn_artwork_type_id = $t_list->getItemIDFromList('object_types', 'artwork');
     $vn_chron_images_type_id = $t_list->getItemIDFromList('object_types', 'chronology_image');
     $va_years_info = array();
     $qr_events = $o_search->search("ca_occurrences.access:1 AND ca_occurrences.type_id:{$vn_chronology_type_id} AND ca_occurrences.date.parsed_date:\"" . $vn_y . "\"", array("sort" => "ca_occurrences.date.parsed_date", "no_cache" => !$this->opb_cache_searches));
     $va_event_ids = array();
     if ($qr_events->numHits() > 0) {
         while ($qr_events->nextHit()) {
             $va_event_ids[] = $qr_events->get("occurrence_id");
         }
     }
     $opo_result_context = new ResultContext($this->request, "ca_occurrences", "basic_search");
     foreach ($va_event_ids as $vn_event_id) {
         if ($opo_result_context->getIndexInResultList($vn_event_id) != '?') {
             $this->view->setVar("show_back_button", 1);
             break;
         }
     }
     $qr_events->seek(0);
     $va_years_info["events"] = $qr_events;
     $qr_exhibitions = $o_search->search("ca_occurrences.access:1 AND ca_occurrences.type_id:{$vn_exhibition_type_id} AND ca_occurrences.date.parsed_date:\"" . $vn_y . "\"", array("sort" => "ca_occurrences.date.parsed_date", "no_cache" => !$this->opb_cache_searches));
     $va_years_info["exhibitions"] = $qr_exhibitions;
     $qr_bibliographies = $o_search->search("ca_occurrences.access:1 AND ca_occurrences.type_id:{$vn_bibliography_type_id} AND ca_occurrences.bib_year_published:\"" . $vn_y . "\"", array("sort" => "ca_occurrences.bib_year_published", "no_cache" => !$this->opb_cache_searches));
     $va_years_info["bibliographies"] = $qr_bibliographies;
     $o_obj_search = new ObjectSearch();
     $qr_artworks = $o_obj_search->search("ca_objects.access:1 AND ca_objects.date.parsed_date:\"" . $vn_y . "\" AND ca_objects.type_id:{$vn_artwork_type_id}", array("sort" => "ca_objects.idno_sort", "no_cache" => !$this->opb_cache_searches));
     $va_years_info["artworks"] = $qr_artworks;
     $qr_chron_images = $o_obj_search->search("ca_objects.access:1 AND ca_objects.date.parsed_date:\"" . $vn_y . "\" AND ca_objects.type_id:{$vn_chron_images_type_id}", array("sort" => "ca_objects.date.parsed_date", "no_cache" => !$this->opb_cache_searches));
     $va_years_info["chron_images"] = $qr_chron_images;
     $this->view->setVar('years_info', $va_years_info);
     $this->view->setVar('num_images', $qr_chron_images->numHits());
     $va_reps = array();
     if ($qr_chron_images->numHits() > 0) {
         while ($qr_chron_images->nextHit()) {
             $t_image_object = new ca_objects($qr_chron_images->get("object_id"));
             # Media representations to display (objects only)
             if ($t_primary_rep = $t_image_object->getPrimaryRepresentationInstance()) {
                 if (!sizeof($va_access_values) || in_array($t_primary_rep->get('access'), $va_access_values)) {
                     // check rep access
                     # --- build array of thumbnails on related images for display under main image
                     $va_temp = array();
                     $va_temp["representation_id"] = $t_primary_rep->get("representation_id");
                     $va_temp["rep_tinyicon"] = $t_primary_rep->getMediaTag('media', 'tinyicon');
                     $va_temp["object_id"] = $qr_chron_images->get("object_id");
                     $va_reps[$qr_chron_images->get("object_id")] = $va_temp;
                     if (!$vn_display_image_set) {
                         $vn_display_image_set = 1;
                         $this->view->setVar("image_object_id", $qr_chron_images->get("object_id"));
                         $this->view->setVar("image_description", $t_image_object->get("ca_objects.description"));
                         $this->view->setVar("image_photographer", $t_image_object->get("ca_objects.provenance"));
                         $this->view->setVar('t_primary_rep', $t_primary_rep);
                         $va_rep_display_info = caGetMediaDisplayInfo('detail', $t_primary_rep->getMediaInfo('media', 'INPUT', 'MIMETYPE'));
                         $this->view->setVar('primary_rep_display_version', $va_rep_display_info['display_version']);
                         unset($va_display_info['display_version']);
                         $va_rep_display_info['poster_frame_url'] = $t_primary_rep->getMediaUrl('media', $va_rep_display_info['poster_frame_version']);
                         unset($va_display_info['poster_frame_version']);
                         $this->view->setVar('primary_rep_display_options', $va_rep_display_info);
                     }
                 }
             }
         }
     }
     $this->view->setVar("reps", $va_reps);
     $this->render('Chronology/year_detail_html.php');
 }
Exemple #27
0
 public function index()
 {
     #print $this->ops_tablename;
     JavascriptLoadManager::register('cycle');
     $this->getDefaults();
     // Remove any browse criteria previously set
     //$this->opo_browse->removeAllCriteria();
     if (!$this->opo_browse->numCriteria()) {
         $this->opo_browse->addCriteria('has_georefs', '1');
     }
     $this->opo_browse->setFacetGroup("map");
     parent::Index(true);
     $this->render('map_html.php');
 }
Exemple #28
0
 /**
  *
  */
 public function getAttributeBundleHTML($pa_element_info, $pa_options = null)
 {
     JavascriptLoadManager::register('maps');
     $o_config = Configuration::load();
     if (!in_array($vs_map_type = $o_config->get('google_maps_default_type'), array('ROADMAP', 'SATELLITE', 'HYBRID', 'TERRAIN'))) {
         $vs_map_type = 'ROADMAP';
     }
     $vs_element = '<div id="mapholder_' . $pa_element_info['element_id'] . '_{n}" class="mapholder">';
     $vs_element .= '<div class="mapCoordInput">';
     $vs_element .= '<div class="mapSearchBox">';
     $vs_element .= '<input type="text" class="mapSearchText" name="searchtext"  id="{fieldNamePrefix}' . $pa_element_info['element_id'] . '_{n}" size="60" value="' . _t('Search for geographic location') . '..." autocomplete="off"/>';
     $vs_element .= '<div class="mapSearchSuggest"></div>';
     $vs_element .= '<a href="#" class="button">' . _t('Upload KML file') . ' &rsaquo;</a>';
     $vs_element .= '</div>';
     $vs_element .= '</div>';
     $vs_element .= '<div class="mapKMLInput" style="display: none;">';
     $vs_element .= _t("Select KML or KMZ file") . ': <input type="file" name="{fieldNamePrefix}' . $pa_element_info['element_id'] . '_{n}"/><a href="#" class="button">' . _t('Use map') . ' &rsaquo;</a>';
     $vs_element .= '</div>';
     $vs_element .= '<div class="map" style="width:695px; height:300px;"></div>';
     $vs_element .= '<script type="text/javascript">';
     $vs_element .= "jQuery(document).ready(function() {\n\t\t\t\tvar mID_{n} = " . $pa_element_info['element_id'] . ";\n\t\t\t\t\t\t\t\t\t\tvar mapdata = {\n\t\t\t\t\t\t\t\t\t\t\tmapID : mID_{n},\n\t\t\t\t\t\t\t\t\t\t\tmapholder : jQuery('#mapholder_' + mID_{n} + '_{n}'),\n\t\t\t\t\t\t\t\t\t\t\tsearchDefaultText : '" . _t('Search for geographic location') . "...',\n\t\t\t\t\t\t\t\t\t\t\tsearchTextID:  '{fieldNamePrefix}" . $pa_element_info['element_id'] . "_search_text{n}', \n\t\t\t\t\t\t\t\t\t\t\tzoomlevel : 12,\n\t\t\t\t\t\t\t\t\t\t\tinitialLocation : null,\n\t\t\t\t\t\t\t\t\t\t\tmap : null,\n\t\t\t\t\t\t\t\t\t\t\tgeocoder : null,\n\t\t\t\t\t\t\t\t\t\t\tmarker : null,\n\t\t\t\t\t\t\t\t\t\t\tmarkers : null,\n\t\t\t\t\t\t\t\t\t\t\tselectionIndex : -1,\n\t\t\t\t\t\t\t\t\t\t\tcoordinates : \"{{{" . $pa_element_info['element_id'] . "}}}\"\n\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tvar mapOptions = {\n\t\t\t\t\t\t\t\t\t\t\tzoom: 12,\n\t\t\t\t\t\t\t\t\t\t\tmapTypeControl: " . ((bool) $o_config->get('google_maps_show_map_type_controls') ? 'true' : 'false') . ",\n\t\t\t\t\t\t\t\t\t\t\tmapTypeControlOptions: {\n\t\t\t\t\t\t\t\t\t\t\t\tstyle: google.maps.MapTypeControlStyle.DEFAULT\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\tnavigationControl: " . ((bool) $o_config->get('google_maps_show_navigation_controls') ? 'true' : 'false') . ",\n\t\t\t\t\t\t\t\t\t\t\tnavigationControlOptions: {\n\t\t\t\t\t\t\t\t\t\t\t\tstyle: google.maps.NavigationControlStyle.DEFAULT\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\tscaleControl: " . ((bool) $o_config->get('google_maps_show_scale_controls') ? 'true' : 'false') . ",\n\t\t\t\t\t\t\t\t\t\t\tscaleControlOptions: {\n\t\t\t\t\t\t\t\t\t\t\t\tstyle: google.maps.ScaleControlStyle.DEFAULT\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\tdisableDefaultUI: false,\n\t\t\t\t\t\t\t\t\t\t\tmapTypeId: google.maps.MapTypeId.{$vs_map_type}\n\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\t/* Initialization of the map */\n\t\t\t\t\t\t\t\t\t\tif ('{n}'.substring(0,3) == 'new') {\n\t\t\t\t\t\t\t\t\t\t\tinitNewMap(mapdata,mapOptions);\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tinitExistingMap(mapdata,mapOptions);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tinitMapsApp(mapdata);\n\t\t\t\t\t\t\t\t\t});";
     $vs_element .= '</script>';
     $vs_element .= '<input class="coordinates mapCoordinateDisplay" type="text" name="{fieldNamePrefix}' . $pa_element_info['element_id'] . '_{n}" size="80"/>';
     $vs_element .= '</div>';
     return $vs_element;
 }
Exemple #29
0
 /**
  * Register any required javascript and CSS for loading
  *
  * @return void 
  */
 public function registerDependencies()
 {
     $va_packages = array("timelineJS");
     foreach ($va_packages as $vs_package) {
         JavascriptLoadManager::register($vs_package);
     }
     return $va_packages;
 }
 public function Index($pa_options = null)
 {
     $po_search = isset($pa_options['search']) && $pa_options['search'] ? $pa_options['search'] : null;
     parent::Index($pa_options);
     JavascriptLoadManager::register('browsable');
     // need this to support browse panel when filtering/refining search results
     $t_model = $this->opo_datamodel->getTableInstance($this->ops_tablename, true);
     // Get elements of result context
     $vn_page_num = $this->opo_result_context->getCurrentResultsPageNumber();
     $vs_search = $this->opo_result_context->getSearchExpression();
     if (!($vn_items_per_page = $this->opo_result_context->getItemsPerPage())) {
         $vn_items_per_page = $this->opa_items_per_page[0];
     }
     if (!($vs_view = $this->opo_result_context->getCurrentView())) {
         $va_tmp = array_keys($this->opa_views);
         $vs_view = array_shift($va_tmp);
     }
     if (!($vs_sort = $this->opo_result_context->getCurrentSort())) {
         $va_tmp = array_keys($this->opa_sorts);
         $vs_sort = array_shift($va_tmp);
     }
     $vs_sort_direction = $this->opo_result_context->getCurrentSortDirection();
     $vn_display_id = $this->opo_result_context->getCurrentBundleDisplay();
     if (!$this->opn_type_restriction_id) {
         $this->opn_type_restriction_id = '';
     }
     $this->view->setVar('type_id', $this->opn_type_restriction_id);
     MetaTagManager::setWindowTitle(_t('%1 advanced search', $this->searchName('plural')));
     $t_form = new ca_search_forms();
     if (!($vn_form_id = isset($pa_options['form_id']) ? $pa_options['form_id'] : null)) {
         if (!($vn_form_id = $this->opo_result_context->getParameter('form_id'))) {
             if (sizeof($va_forms = $t_form->getForms(array('table' => $this->ops_tablename, 'user_id' => $this->request->getUserID(), 'access' => __CA_SEARCH_FORM_READ_ACCESS__)))) {
                 $va_tmp = array_keys($va_forms);
                 $vn_form_id = array_shift($va_tmp);
             }
         }
     }
     $t_form->load($vn_form_id);
     $this->view->setVar('t_form', $t_form);
     $this->view->setVar('form_id', $vn_form_id);
     if ($pa_options['appendToSearch']) {
         $vs_append_to_search .= " AND (" . $pa_options['appendToSearch'] . ")";
     }
     //
     // Execute the search
     //
     if (isset($pa_options['saved_search']) && $pa_options['saved_search']) {
         // Is this a saved search? If so, reused the canned params
         $va_form_data = $pa_options['saved_search'];
         foreach ($pa_options['saved_search'] as $vs_fld => $vs_val) {
             $vs_proc_fld = str_replace(".", "_", $vs_fld);
             $va_proc_form_data[$vs_proc_fld] = $vs_val;
         }
         $vs_search = $t_form->getLuceneQueryStringForHTMLFormInput($va_proc_form_data);
         $vb_is_new_search = true;
     } else {
         if (!($vs_search = $t_form->getLuceneQueryStringForHTMLFormInput($_REQUEST))) {
             // try to get search off of request
             $vs_search = $this->opo_result_context->getSearchExpression();
             // get the search out of the result context
             $va_form_data = $this->opo_result_context->getParameter('form_data');
             $vb_is_new_search = !$this->opo_result_context->cacheIsValid();
         } else {
             $va_form_data = $t_form->extractFormValuesFromArray($_REQUEST);
             // ah ok, its an incoming request, so get the form values out for interpretation/processing/whatever
             $vb_is_new_search = true;
         }
     }
     if ($this->request->getParameter('reset', pString) == 'clear') {
         $vs_search = '';
         $vb_is_new_search = true;
     }
     if ($vs_search && $vs_search != "") {
         /* any request? */
         $va_search_opts = array('sort' => $vs_sort, 'sort_direction' => $vs_sort_direction, 'appendToSearch' => $vs_append_to_search, 'getCountsByField' => 'type_id', 'checkAccess' => $va_access_values, 'no_cache' => $vb_is_new_search);
         if ($vb_is_new_search || isset($pa_options['saved_search']) || is_subclass_of($po_search, "BrowseEngine") && !$po_search->numCriteria()) {
             $vs_browse_classname = get_class($po_search);
             $this->opo_browse = $po_search = new $vs_browse_classname();
             $po_search->addCriteria('_search', $vs_search);
         }
         if ($this->opn_type_restriction_id) {
             $po_search->setTypeRestrictions(array($this->opn_type_restriction_id));
         }
         $vb_criteria_have_changed = false;
         if (is_subclass_of($po_search, "BrowseEngine")) {
             $vb_criteria_have_changed = $po_search->criteriaHaveChanged();
             $po_search->execute($va_search_opts);
             $this->opo_result_context->setParameter('browse_id', $po_search->getBrowseID());
             $vo_result = $po_search->getResults($va_search_opts);
         } else {
             $vo_result = $po_search->search($vs_search, $va_search_opts);
         }
         $this->opo_result_context->validateCache();
         // Only prefetch what we need
         $vo_result->setOption('prefetch', $vn_items_per_page);
         $this->opo_result_context->setParameter('form_data', $va_form_data);
         $this->opo_result_context->setSearchExpression($vs_search);
         if ($vb_is_new_search || $vb_criteria_have_changed) {
             $this->opo_result_context->setResultList($vo_result->getPrimaryKeyValues());
             $vn_page_num = 1;
         }
         $vo_result->seek(($vn_page_num - 1) * $vn_items_per_page);
         $this->view->setVar('num_hits', $vo_result->numHits());
         $this->view->setVar('num_pages', $vn_num_pages = ceil($vo_result->numHits() / $vn_items_per_page));
         if ($vn_page_num > $vn_num_pages) {
             $vn_page_num = 1;
         }
         $this->view->setVar('page', $vn_page_num);
         $this->view->setVar('search', $vs_search);
         $this->view->setVar('result', $vo_result);
     }
     //
     // Set up view for display of results
     //
     $t_model = $this->opo_datamodel->getTableInstance($this->ops_tablename);
     $this->view->setVar('views', $this->opa_views);
     // pass view list to view for rendering
     $this->view->setVar('current_view', $vs_view);
     $this->view->setVar('sorts', $this->opa_sorts);
     // pass sort list to view for rendering
     $this->view->setVar('current_sort', $vs_sort);
     $this->view->setVar('current_sort_direction', $vs_sort_direction);
     $this->view->setVar('current_items_per_page', $vn_items_per_page);
     $this->view->setVar('items_per_page', $this->opa_items_per_page);
     $this->view->setVar('t_subject', $t_model);
     $this->view->setVar('mode_name', _t('search'));
     $this->view->setVar('mode', 'search');
     $this->view->setVar('mode_type_singular', $this->searchName('singular'));
     $this->view->setVar('mode_type_plural', $this->searchName('plural'));
     $this->view->setVar('search_history', $this->opo_result_context->getSearchHistory());
     $this->view->setVar('result_context', $this->opo_result_context);
     $this->view->setVar('browse', $po_search);
     switch ($pa_options['output_format']) {
         # ------------------------------------
         case 'PDF':
             $this->_genPDF($vo_result, $this->request->getParameter("label_form", pString), $vs_search);
             break;
             # ------------------------------------
         # ------------------------------------
         case 'EXPORT':
             $this->_genExport($vo_result, $this->request->getParameter("export_format", pString), $vs_search, $vs_search);
             break;
             # ------------------------------------
         # ------------------------------------
         case 'HTML':
         default:
             // generate type menu and type value list
             if (method_exists($t_model, "getTypeList")) {
                 $this->view->setVar('type_list', $t_model->getTypeList());
             }
             // Call advanced search form generator directly to set view vars in the current view
             // This lets our view in this action render Search/search_advanced_form_html.php directly
             // to avoid the annoying flicker that occurs if we load the initial search form via AJAX
             $this->getAdvancedSearchForm(false);
             $this->opo_result_context->setAsLastFind();
             $this->opo_result_context->saveContext();
             $this->render('Search/' . $this->ops_tablename . '_search_advanced_html.php');
             break;
             # ------------------------------------
     }
 }