protected function setUp()
 {
     $o_dm = new Datamodel(true);
     // PHPUnit seems to barf on the caching code if we don't instanciate a Datamodel instance
     $o_dm->getTableNum("ca_objects");
     // set up test role
     $this->opt_role = new ca_user_roles();
     $this->opt_role->setMode(ACCESS_WRITE);
     $this->opt_role->set("name", "UnitTestRole");
     $this->opt_role->set("code", "unit_test_role");
     if (!$this->opt_role->insert()) {
         print "ERROR inserting role: " . join(" ", $this->opt_role->getErrors()) . "\n";
     }
     $this->opt_role->setMode(ACCESS_READ);
     // set up test user
     $this->ops_username = "******";
     $this->ops_password = "******";
     $this->opt_user = new ca_users();
     $this->opt_user->setMode(ACCESS_WRITE);
     $this->opt_user->set(array('user_name' => $this->ops_username, 'password' => $this->ops_password, 'email' => '*****@*****.**', 'active' => 1, 'userclass' => 0, 'fname' => 'Test', 'lname' => "User"));
     if (!$this->opt_user->insert()) {
         print "ERROR inserting user: "******" ", $this->opt_user->getErrors()) . "\n";
     }
     $this->opt_user->addRoles("unit_test_role");
     $this->opt_user->setMode(ACCESS_READ);
     global $req, $resp;
     $resp = new ResponseHTTP();
     $req = new RequestHTTP($resp, array("dont_create_new_session" => true));
     $this->assertInstanceOf('ca_users', $this->opt_user);
     $this->assertInstanceOf('ca_user_roles', $this->opt_role);
 }
 /**
  * 
  */
 public function Info()
 {
     $o_dm = Datamodel::load();
     $t_display = new ca_bundle_displays($vn_display_id = $this->_getDisplayID());
     $this->view->setVar('bundle_displays', caExtractValuesByUserLocale($t_display->getBundleDisplays(array('user_id' => $this->request->getUserID(), 'access' => __CA_BUNDLE_DISPLAY_EDIT_ACCESS__)), null, array()));
     return $this->render('widget_bundle_display_info_html.php', true);
 }
 public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
 {
     parent::__construct($po_request, $po_response, $pa_view_paths);
     $this->opo_datamodel = Datamodel::load();
     $this->opo_app_plugin_manager = new ApplicationPluginManager();
     $this->opo_result_context = new ResultContext($po_request, $this->ops_table_name, ResultContext::getLastFind($po_request, $this->ops_table_name));
 }
 public function __construct($pa_hits, $pn_table_num)
 {
     $this->opo_datamodel = Datamodel::load();
     $this->opn_subject_tablenum = $pn_table_num;
     $this->ops_subject_pk = $this->opo_datamodel->getTablePrimaryKeyName($pn_table_num);
     $this->setHits($pa_hits);
 }
Example #5
0
 /**
  *
  *
  * @param string $ps_cache_key
  * @param array $pa_options Options include:
  *		removeDeletedItems = remove any items in the cache that are currently marked as deleted [Default=true]
  *
  * @return bool
  */
 public function load($ps_cache_key, $pa_options = null)
 {
     if (ExternalCache::contains($ps_cache_key, 'Browse')) {
         $this->opa_browse = ExternalCache::fetch($ps_cache_key, 'Browse');
         $this->ops_cache_key = $ps_cache_key;
         if (caGetOption('removeDeletedItems', $pa_options, true)) {
             $o_dm = Datamodel::load();
             if (($t_instance = $o_dm->getInstanceByTableNum($this->opa_browse['params']['table_num'], true)) && $t_instance->hasField('deleted')) {
                 // check if there are any deleted items in the cache
                 if (is_array($va_ids = $this->opa_browse['results']) && sizeof($va_ids)) {
                     $vs_pk = $t_instance->primaryKey();
                     $qr_deleted = $t_instance->getDb()->query($x = "\n\t\t\t\t\t\t\tSELECT {$vs_pk} FROM " . $t_instance->tableName() . " WHERE {$vs_pk} IN (?) AND deleted = 1\n\t\t\t\t\t\t", array($va_ids));
                     if ($qr_deleted->numRows() > 0) {
                         $va_deleted_ids = $qr_deleted->getAllFieldValues($vs_pk);
                         foreach ($va_deleted_ids as $vn_deleted_id) {
                             if (($vn_i = array_search($vn_deleted_id, $va_ids)) !== false) {
                                 unset($va_ids[$vn_i]);
                             }
                         }
                         $this->opa_browse['results'] = array_values($va_ids);
                     }
                 }
             }
         }
         return true;
     }
     return false;
 }
Example #6
0
 /**
  *
  */
 public function __construct($pm_subject_table_name_or_num, $pn_browse_id = null, $ps_browse_context = '')
 {
     $this->opo_datamodel = Datamodel::load();
     $this->opo_db = new Db();
     $this->opa_result_filters = array();
     if (is_numeric($pm_subject_table_name_or_num)) {
         $this->opn_browse_table_num = intval($pm_subject_table_name_or_num);
         $this->ops_browse_table_name = $this->opo_datamodel->getTableName($this->opn_browse_table_num);
     } else {
         $this->opn_browse_table_num = $this->opo_datamodel->getTableNum($pm_subject_table_name_or_num);
         $this->ops_browse_table_name = $pm_subject_table_name_or_num;
     }
     $this->opo_config = Configuration::load();
     $this->opo_ca_browse_config = Configuration::load($this->opo_config->get('browse_config'));
     $this->opa_browse_settings = $this->opo_ca_browse_config->getAssoc($this->ops_browse_table_name);
     // Add "virtual" search facet - allows one to seed a browse with a search
     $this->opa_browse_settings['facets']['_search'] = array('label_singular' => _t('Search'), 'label_plural' => _t('Searches'));
     $this->_processBrowseSettings();
     $this->opo_ca_browse_cache = new BrowseCache();
     if ($pn_browse_id) {
         $this->opo_ca_browse_cache->setParameter('table_num', $this->opn_browse_table_num);
         $this->opo_ca_browse_cache->load($pn_browse_id);
     } else {
         $this->opo_ca_browse_cache->setParameter('table_num', $this->opn_browse_table_num);
         $this->setContext($ps_browse_context);
     }
 }
 public function __construct($ps_widget_path, $pa_settings)
 {
     $this->title = _t('Records by status');
     $this->description = _t('Displays objects or authority items by cataloguing status');
     parent::__construct($ps_widget_path, $pa_settings);
     $this->opo_config = Configuration::load($ps_widget_path . '/conf/recordsByStatus.conf');
     $this->opo_datamodel = Datamodel::load();
     # -- get status values
     $t_lists = new ca_lists();
     $va_statuses = caExtractValuesByUserLocale($t_lists->getItemsForList("workflow_statuses"));
     $va_status_info = array();
     $va_status_values = array();
     foreach ($va_statuses as $i => $va_info) {
         $va_status_info[$va_info["item_value"]] = $va_info["name_singular"];
         $va_status_values[] = $va_info["item_value"];
     }
     $this->opa_status_display_names = $va_status_info;
     $this->opa_status_values = $va_status_values;
     $this->opa_table_display_names = array('ca_objects' => _t('Objects'), 'ca_entities' => _t('Entities'), 'ca_places' => _t('Places'), 'ca_occurrences' => _t('Occurrences'), 'ca_sets' => _t('Sets'), 'ca_collections' => _t('Collections'), 'ca_object_representations' => _t('Object representations'), 'ca_object_lots' => _t('Object lots'));
     foreach ($this->opa_table_display_names as $vs_table => $vs_display) {
         if (!$this->getRequest() || !$this->getRequest()->user->canDoAction("can_use_records_by_status_widget_{$vs_table}")) {
             foreach (BaseWidget::$s_widget_settings['recordsByStatusWidget']["display_type"]["options"] as $vs_setting_display => $vs_setting_table) {
                 if ($vs_setting_table == $vs_table) {
                     unset(BaseWidget::$s_widget_settings['recordsByStatusWidget']["display_type"]["options"][$vs_setting_display]);
                 }
             }
         }
     }
 }
 public function dispatchLoopShutdown()
 {
     //
     // Force output to be sent - we need the client to have the page before
     // we start flushing progress bar updates
     //
     $app = AppController::getInstance();
     $req = $app->getRequest();
     $resp = $app->getResponse();
     $resp->sendResponse();
     $resp->clearContent();
     //
     // Do reindexing
     //
     if ($req->isLoggedIn() && $req->user->canDoAction('can_do_search_reindex')) {
         set_time_limit(3600 * 8);
         $o_db = new Db();
         $t_timer = new Timer();
         $o_dm = Datamodel::load();
         $va_table_names = $o_dm->getTableNames();
         $vn_tc = 0;
         foreach ($va_table_names as $vs_table) {
             if ($o_instance = $o_dm->getInstanceByTableName($vs_table)) {
                 if ($o_instance->isHierarchical()) {
                     if (!$o_instance->rebuildAllHierarchicalIndexes()) {
                         $o_instance->rebuildHierarchicalIndex();
                     }
                 }
                 caIncrementHierachicalReindexProgress(_t('Rebuilding hierarchical index for %1', $o_instance->getProperty('NAME_PLURAL')), $t_timer->getTime(2), memory_get_usage(true), $va_table_names, $o_instance->tableNum(), $o_instance->getProperty('NAME_PLURAL'), $vn_tc + 1);
             }
             $vn_tc++;
         }
         caIncrementHierachicalReindexProgress(_t('Index rebuild complete!'), $t_timer->getTime(2), memory_get_usage(true), $va_table_names, null, null, sizeof($va_table_names));
     }
 }
 public function __construct($po_request)
 {
     parent::__construct($po_request);
     $this->opo_dm = Datamodel::load();
     $t_list = new ca_lists();
     $this->opn_victim_type_id = $t_list->getItemIDFromList('entity_types', 'victim');
 }
 public function Get($pa_additional_query_params = null, $pa_options = null)
 {
     $ps_query = $this->request->getParameter('q', pString);
     $ps_bundle = $this->request->getParameter('bundle', pString);
     $va_tmp = explode('.', $ps_bundle);
     $vs_table = $va_tmp[0];
     $vs_field = $va_tmp[1];
     $o_dm = Datamodel::load();
     if (!($t_table = $o_dm->getInstanceByTableName($vs_table, true))) {
         // bad table name
         print _t("Invalid table name");
         return null;
     }
     if (!$t_table->hasField($vs_field) || !in_array($t_table->getFieldInfo($vs_field, 'FIELD_TYPE'), array(FT_TEXT, FT_NUMBER))) {
         // bad field name
         print _t("Invalid bundle name");
         return null;
     }
     if ($this->request->user->getBundleAccessLevel($vs_table, $vs_field) == __CA_BUNDLE_ACCESS_NONE__) {
         print _t("You do not have access to this bundle");
         return null;
     }
     $vn_max_returned_values = 50;
     $o_db = new Db();
     $qr_res = $o_db->query("\n\t\t\t\tSELECT DISTINCT {$vs_field}\n\t\t\t\tFROM {$vs_table}\n\t\t\t\tWHERE\n\t\t\t\t\t({$vs_field} LIKE ?) " . ($t_table->hasField('deleted') ? ' AND deleted = 0' : '') . "\n\t\t\t\tORDER BY\n\t\t\t\t\t{$vs_field}\n\t\t\t\tLIMIT {$vn_max_returned_values}\n\t\t\t", (string) $ps_query . '%');
     $this->view->setVar('intrinsic_value_list', $qr_res->getAllFieldValues($vs_field));
     return $this->render('ajax_intrinsic_value_list_html.php');
 }
Example #11
0
 public function __construct($po_request, $ps_table = "")
 {
     $this->opo_request = $po_request;
     $this->ops_table = $ps_table;
     $this->opo_dm = Datamodel::load();
     $this->opa_errors = array();
     $this->ops_method = $this->opo_request->getRequestMethod();
     if (!in_array($this->ops_method, array("PUT", "DELETE", "GET", "OPTIONS"))) {
         $this->addError("Invalid HTTP request method");
     }
     $this->opn_id = $this->opo_request->getParameter("id", pString);
     // we allow for a string to support fetching by idno; typically it's a numeric id
     $vs_post_data = $this->opo_request->getRawPostData();
     if (strlen(trim($vs_post_data)) > 0) {
         $this->opa_post = json_decode($vs_post_data, true);
         if (!is_array($this->opa_post)) {
             $this->addError(_t("Data sent via POST doesn't seem to be in JSON format"));
         }
     } else {
         if ($vs_post_data = $this->opo_request->getParameter('source', pString)) {
             $this->opa_post = json_decode($vs_post_data, true);
             if (!is_array($this->opa_post)) {
                 $this->addError(_t("Data sent via 'source' parameter doesn't seem to be in JSON format"));
             }
         } else {
             $this->opa_post = array();
         }
     }
     $this->opa_valid_tables = array("ca_objects", "ca_object_lots", "ca_entities", "ca_places", "ca_occurrences", "ca_collections", "ca_list_items", "ca_lists", "ca_object_representations", "ca_storage_locations", "ca_movements", "ca_loans", "ca_tours", "ca_tour_stops", "ca_sets");
     if (strlen($ps_table) > 0) {
         if (!in_array($ps_table, $this->opa_valid_tables)) {
             $this->addError(_t("Table does not exist"));
         }
     }
 }
 /**
  * 
  */
 public function Info()
 {
     $o_dm = Datamodel::load();
     $t_form = new ca_search_forms();
     $this->view->setVar('form_count', $t_form->getFormCount(array('user_id' => $this->request->getUserID(), 'access' => __CA_SEARCH_FORM_EDIT_ACCESS__)));
     return $this->render('widget_search_form_info_html.php', true);
 }
 public function __construct($ps_widget_path, $pa_settings)
 {
     $this->title = _t('Recent changes');
     $this->description = _t('Lists recent changes to objects or authority items');
     parent::__construct($ps_widget_path, $pa_settings);
     $this->opo_config = Configuration::load($ps_widget_path . '/conf/recentChangesWidget.conf');
     $this->opo_datamodel = Datamodel::load();
 }
 public function __construct($m_table = '', $ps_field_name)
 {
     $this->opo_config = Configuration::load();
     $this->opo_datamodel = Datamodel::load();
     if ($m_table && $ps_field_name) {
         $this->loadSettings($m_table, $ps_field_name);
     }
 }
 public function __construct($ps_table)
 {
     $o_dm = Datamodel::load();
     $this->ops_tablename = $ps_table;
     $this->opn_tablenum = $o_dm->getTableNum($ps_table);
     $this->ops_primary_key = $o_dm->getTablePrimaryKeyName($ps_table);
     parent::__construct();
 }
 protected function setPrimaryTable($ps_table)
 {
     $o_dm = Datamodel::load();
     if (!$o_dm->tableExists($ps_table)) {
         $this->assertTrue(false, 'Invalid table ' . $ps_table);
     }
     $this->ops_primary_table = $ps_table;
 }
 public function __construct($ps_widget_path, $pa_settings)
 {
     $this->title = _t('Comments');
     $this->description = _t('Lists recently created comments');
     parent::__construct($ps_widget_path, $pa_settings);
     $this->opo_config = Configuration::load($ps_widget_path . '/conf/recentComments.conf');
     $this->opo_datamodel = Datamodel::load();
 }
 public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
 {
     AssetLoadManager::register('bundleableEditor');
     AssetLoadManager::register('panel');
     parent::__construct($po_request, $po_response, $pa_view_paths);
     $this->opo_datamodel = Datamodel::load();
     $this->opo_app_plugin_manager = new ApplicationPluginManager();
     $this->cleanOldExportFilesFromTmpDir();
 }
Example #19
0
 /**
  *
  */
 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;
     }
 }
Example #20
0
 public function __construct($po_engine_result = null, $pa_tables = null)
 {
     parent::__construct($po_engine_result, $pa_tables);
     $this->opo_list = new ca_lists();
     $this->opo_datamodel = Datamodel::load();
     $this->opa_locales = ca_locales::getLocaleList();
     $this->ops_label_table_name = method_exists($this->opo_subject_instance, "getLabelTableName") ? $this->opo_subject_instance->getLabelTableName() : null;
     $this->ops_label_display_field = method_exists($this->opo_subject_instance, "getLabelDisplayField") ? $this->opo_subject_instance->getLabelDisplayField() : null;
 }
Example #21
0
 public function __construct()
 {
     $this->opo_config = Configuration::load();
     $this->opo_search_config = Configuration::load($this->opo_config->get('search_config'));
     $this->opo_datamodel = Datamodel::load();
     $this->ops_encoding = $this->opo_config->get('character_set');
     $this->opo_db = new Db();
     $this->init();
     parent::__construct();
 }
 /**
  * Set up tools manager, check user privs and call parent constructor
  */
 public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
 {
     if (!$po_request->isLoggedIn() || !$po_request->user->canDoAction('can_use_plugin_tools')) {
         $this->response->setRedirect($po_request->config->get('error_display_url') . '/n/3000?r=' . urlencode($po_request->getFullUrlPath()));
         return;
     }
     parent::__construct($po_request, $po_response, $pa_view_paths);
     $this->opo_datamodel = Datamodel::load();
     $this->opo_tools_manager = new ToolsManager();
 }
 /**
  *
  */
 public function __construct($ps_source = null, $pa_options = null)
 {
     parent::__construct($ps_source, $pa_options);
     $this->ops_title = _t('CollectiveAccess data reader');
     $this->ops_display_name = _t('CollectiveAccess database');
     $this->ops_description = _t('Reads data from CollectiveAccess databases via web services');
     $this->opa_formats = array('collectiveaccess');
     // must be all lowercase to allow for case-insensitive matching
     $this->opo_datamodel = Datamodel::load();
 }
 public function Save($pa_options = null)
 {
     $vn_rc = parent::Save($pa_options);
     $va_response = $this->getView()->getVar('response');
     if (is_array($va_response) && isset($va_response['id']) && $va_response['id'] > 0) {
         $t_set = Datamodel::load()->getInstance('ca_sets', true);
         $t_set->getDb()->query('UPDATE ca_sets SET user_id=? WHERE set_id=?', $this->getRequest()->getUserID(), $va_response['id']);
     }
     return $vn_rc;
 }
Example #25
0
 public function setHits($pa_hits)
 {
     $this->opa_hits = $pa_hits;
     $this->opn_current_row = -1;
     if (sizeof($this->opa_hits)) {
         $o_dm = Datamodel::load();
         $this->opo_subject_instance = $o_dm->getInstanceByTableNum($this->opn_subject_tablenum, true);
         $this->ops_subject_primary_key = $this->opo_subject_instance->primaryKey();
         $this->ops_subject_table_name = $this->opo_subject_instance->tableName();
     }
 }
Example #26
0
 /**
  * Mapping constructor.
  */
 public function __construct()
 {
     // set up basic properties
     $this->opo_datamodel = \Datamodel::load();
     $this->opo_search_conf = \Configuration::load(\Configuration::load()->get('search_config'));
     $this->opo_indexing_conf = \Configuration::load($this->opo_search_conf->get('search_indexing_config'));
     $this->opo_db = new \Db();
     $this->opo_search_base = new \SearchBase($this->opo_db, null, false);
     $this->opa_element_info = array();
     $this->opo_app_vars = new \ApplicationVars($this->opo_db);
     $this->prefetchElementInfo();
 }
Example #27
0
 /**
  * @param Db $po_db A database client object to use rather than creating a new connection. [Default is to create a new database connection]
  * @param string $ps_engine Name of the search engine to use. [Default is the engine configured using "search_engine_plugin" in app.conf]
  */
 public function __construct($po_db = null, $ps_engine = null)
 {
     $this->opo_datamodel = Datamodel::load();
     $this->opo_app_config = Configuration::load();
     $this->opo_search_config = Configuration::load($this->opo_app_config->get("search_config"));
     $this->opo_search_indexing_config = Configuration::load($this->opo_search_config->get("search_indexing_config"));
     // load search engine plugin as configured by the 'search_engine_plugin' directive in the main app config file
     if (!($this->opo_engine = SearchBase::newSearchEngine($ps_engine, $po_db))) {
         die("Couldn't load configured search engine plugin. Check your application configuration and make sure 'search_engine_plugin' directive is set properly.");
     }
     $this->opo_db = $po_db ? $po_db : new Db();
 }
 public function Index()
 {
     AssetLoadManager::register('tableList');
     $vo_dm = Datamodel::load();
     $va_elements = ca_metadata_elements::getRootElementsAsList(null, null, true, true);
     $this->view->setVar('element_list', $va_elements);
     $this->view->setVar('attribute_types', Attribute::getAttributeTypes());
     $o_result_context = new ResultContext($this->request, $this->ops_table_name, 'basic_search');
     $o_result_context->setResultList(array_keys($va_elements));
     $o_result_context->setAsLastFind();
     $o_result_context->saveContext();
     return $this->render('elements_list_html.php');
 }
 public function info($pa_parameters)
 {
     parent::info($pa_parameters);
     $o_dm = Datamodel::load();
     $t_item = $this->view->getVar('t_item');
     $vn_item_id = $t_item->getPrimaryKey();
     // get parent items
     $va_ancestors = array_reverse(caExtractValuesByUserLocaleFromHierarchyAncestorList($t_item->getHierarchyAncestors(null, array('additionalTableToJoin' => 'ca_relationship_type_labels', 'additionalTableJoinType' => 'LEFT', 'additionalTableSelectFields' => array('typename', 'typename_reverse', 'description', 'description_reverse', 'locale_id'), 'includeSelf' => false)), 'type_id', 'typename', 'type_code'));
     $vn_rel_table_num = $t_item->get('table_num');
     array_shift($va_ancestors);
     // get rid of hierarchy root record, which should not be displayed
     $this->view->setVar('ancestors', $va_ancestors);
     return $this->render('widget_relationship_type_info_html.php', true);
 }
Example #30
0
 public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
 {
     parent::__construct($po_request, $po_response, $pa_view_paths);
     if ($this->request->config->get('pawtucket_requires_login') && !$this->request->isLoggedIn()) {
         $this->response->setRedirect(caNavUrl($this->request, "", "LoginReg", "LoginForm"));
     }
     $this->config = caGetDetailConfig();
     $this->opa_detail_types = $this->config->getAssoc('detailTypes');
     $this->opo_datamodel = Datamodel::load();
     $va_access_values = caGetUserAccessValues($this->request);
     $this->opa_access_values = $va_access_values;
     $this->view->setVar("access_values", $va_access_values);
     caSetPageCSSClasses(array("detail"));
 }