当前位置: 首页>>代码示例>>PHP>>正文


PHP caExtractValuesByUserLocale函数代码示例

本文整理汇总了PHP中caExtractValuesByUserLocale函数的典型用法代码示例。如果您正苦于以下问题:PHP caExtractValuesByUserLocale函数的具体用法?PHP caExtractValuesByUserLocale怎么用?PHP caExtractValuesByUserLocale使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了caExtractValuesByUserLocale函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Info

 /**
  * 
  */
 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);
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:10,代码来源:BundleDisplaysController.php

示例2: __construct

 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]);
                 }
             }
         }
     }
 }
开发者ID:samrahman,项目名称:providence,代码行数:29,代码来源:recordsByStatusWidget.php

示例3: displaySet

 public function displaySet()
 {
     $pn_set_id = $this->request->getParameter('set_id', pInteger);
     $t_set = new ca_sets($pn_set_id);
     $t_list = new ca_lists();
     $va_access_values = caGetUserAccessValues($this->request);
     $this->view->setVar('t_set', $t_set);
     $this->view->setVar('set_presentation_types', caExtractValuesByUserLocale($t_list->getItemsForList('set_presentation_types')));
     $this->view->setVar('access_values', $va_access_values);
     $this->render('features_contents_html.php');
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:11,代码来源:ShowController.php

示例4: ListForms

 public function ListForms()
 {
     AssetLoadManager::register('tableList');
     $t_form = new ca_search_forms();
     $this->view->setVar('t_form', $t_form);
     $this->view->setVar('form_list', $va_forms = caExtractValuesByUserLocale($t_form->getForms(array('user_id' => $this->request->getUserID(), 'access' => __CA_SEARCH_FORM_EDIT_ACCESS__)), null, null, array()));
     $o_result_context = new ResultContext($this->request, 'ca_search_forms', 'basic_search');
     $o_result_context->setAsLastFind();
     $o_result_context->setResultList(is_array($va_forms) ? array_keys($va_forms) : array());
     $o_result_context->saveContext();
     $this->view->setVar('table_list', caFilterTableList($t_form->getFieldInfo('table_num', 'BOUNDS_CHOICE_LIST')));
     $this->render('search_form_list_html.php');
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:13,代码来源:SearchFormController.php

示例5: renderWidget

 public function renderWidget($ps_widget_id, &$pa_settings)
 {
     parent::renderWidget($ps_widget_id, $pa_settings);
     $this->opo_view->setVar('request', $this->getRequest());
     $t_set = new ca_sets();
     $va_tables = array("ca_objects", "ca_entities", "ca_places", "ca_object_lots", "ca_storage_locations", "ca_collections", "ca_occurrences");
     $va_sets = array();
     foreach ($va_tables as $vs_table) {
         $va_sets[$vs_table][] = caExtractValuesByUserLocale($t_set->getSets(array('table' => $vs_table, 'user_id' => $this->request->getUserID())));
     }
     $this->opo_view->setVar("sets_by_table", $va_sets);
     return $this->opo_view->render('main_html.php');
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:13,代码来源:searchBySetWidget.php

示例6: browseName

 /**
  * Returns string representing the name of the item the browse will return
  *
  * If $ps_mode is 'singular' [default] then the singular version of the name is returned, otherwise the plural is returned
  */
 public function browseName($ps_mode = 'singular')
 {
     $vb_type_restriction_has_changed = false;
     $vn_type_id = $this->opo_result_context->getTypeRestriction($vb_type_restriction_has_changed);
     $t_list = new ca_lists();
     $t_list->load(array('list_code' => 'occurrence_types'));
     $t_list_item = new ca_list_items();
     $t_list_item->load(array('list_id' => $t_list->getPrimaryKey(), 'parent_id' => null));
     $va_hier = caExtractValuesByUserLocale($t_list_item->getHierarchyWithLabels());
     if (!($vs_name = $ps_mode == 'singular' ? $va_hier[$vn_type_id]['name_singular'] : $va_hier[$vn_type_id]['name_plural'])) {
         $vs_name = '???';
     }
     return $vs_name;
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:19,代码来源:BrowseOccurrencesController.php

示例7: testInsertLoadAndDeleteCycleWithCaObjectsModel

 public function testInsertLoadAndDeleteCycleWithCaObjectsModel()
 {
     $t_list = new ca_lists();
     $va_object_types = $t_list->getItemsForList('object_types');
     $this->assertGreaterThan(0, sizeof($va_object_types), "No object types available");
     $va_object_types = caExtractValuesByUserLocale($va_object_types);
     $this->assertGreaterThan(0, sizeof($va_object_types), "No locale-filtered object types available");
     $vn_locale_id = 1;
     $t_object = new ca_objects();
     $t_object->setMode(ACCESS_WRITE);
     $vn_item_id = 0;
     foreach ($va_object_types as $va_object_type) {
         if (intval($va_object_type['is_enabled']) === 1) {
             $vn_item_id = $va_object_type['item_id'];
         }
     }
     $this->assertGreaterThan(0, $vn_item_id, 'No enabled object type found');
     $t_object->set('type_id', $vn_item_id);
     $t_object->set('locale_id', $vn_locale_id);
     $t_object->set('idno', time());
     $t_object->addAttribute(array('description' => 'Test description', 'locale_id' => $vn_locale_id), 'description');
     $vb_res = $t_object->insert();
     $this->assertTrue($vb_res !== false, 'Insert returned non-true value');
     // insert() returns false OR the primary key, therefore simply asserting $vb_res being true doesn't cut it
     $this->assertEquals($t_object->numErrors(), 0, "Errors on insert: " . join('; ', $t_object->getErrors()));
     $this->opa_test_record_ids['ca_objects'][] = $t_object->getPrimaryKey();
     $vb_res = $t_object->addLabel(array('name' => 'Unit test object'), $vn_locale_id, null, true);
     $this->assertGreaterThan(0, $vb_res, 'AddLabel returned zero value but should return non-zero label_id: ' . join('; ', $t_object->getErrors()));
     $t_object2 = new ca_objects();
     $vb_res = $t_object2->load($t_object->getPrimaryKey());
     $this->assertTrue($vb_res, 'Load of newly created record failed [record does not seem to exist or return row id was invalid?]');
     $this->assertEquals($t_object2->getLabelForDisplay(), 'Unit test object', 'Retrieved row label does not match');
     $this->assertEquals($t_object2->getAttributesForDisplay('description'), 'Test description', 'Retrieved value for attribute "description" does not match expected value');
     // try to search for it
     $o_search = new ObjectSearch();
     $qr_hits = $o_search->search("Unit test object");
     $this->assertGreaterThan(0, $qr_hits->numHits(), 'Search for ca_object by label found no results');
     $vb_found_object = false;
     while ($qr_hits->nextHit()) {
         if ($qr_hits->get('object_id') == $t_object->getPrimaryKey()) {
             $vb_found_object = true;
             break;
         }
     }
     $this->assertTrue($vb_found_object, 'ca_object was not in returned search results for ca_object by label');
     // try delete
     $t_object->delete(true, array('hard' => true));
     $this->assertEquals($t_object->numErrors(), 0, "Errors on delete: " . join('; ', $t_object->getErrors()));
 }
开发者ID:samrahman,项目名称:providence,代码行数:49,代码来源:BundlableLabelableBaseModelWithAttributesTest.php

示例8: Edit

 public function Edit($pa_values = null, $pa_options = null)
 {
     AssetLoadManager::register('bundleableEditor');
     $t_element = $this->getElementObject();
     $t_restriction = new ca_metadata_type_restrictions(null, true);
     $this->view->setVar('available_settings', $t_element->getAvailableSettings());
     $this->view->setVar('type_list', $t_restriction->getTypeListsForTables());
     $va_initial_values = array();
     if ($t_element->getPrimaryKey()) {
         $va_sub_elements = array();
         /* BaseModel::getHierarchyChildren orders by PK, but we need to order by rank */
         $vo_db = new Db();
         $qr_result = $vo_db->query("\n\t\t\t\tSELECT cmel.*, cme.* \n\t\t\t\tFROM ca_metadata_elements cme\n\t\t\t\tLEFT JOIN ca_metadata_element_labels AS cmel ON cme.element_id = cmel.element_id\n\t\t\t\tWHERE\n\t\t\t\t\tcme.parent_id = ?\n\t\t\t\tORDER BY\n\t\t\t\t\tcme.rank\n\t\t\t", (int) $t_element->get('element_id'));
         while ($qr_result->nextRow()) {
             $va_row = $qr_result->getRow();
             if (!$va_row['name']) {
                 $va_row['name'] = $va_row['element_code'];
             }
             $va_sub_elements[$qr_result->get('element_id')][$qr_result->get('locale_id')] = $va_row;
         }
         $va_sub_elements = caExtractValuesByUserLocale($va_sub_elements);
         $this->view->setVar('sub_elements', $va_sub_elements);
         // get restrictions
         $this->view->setVar('type_restrictions', $va_type_restrictions = $t_element->getTypeRestrictions());
         $va_restriction_settings = $t_restriction->getAvailableSettings();
         if (is_array($va_type_restrictions)) {
             foreach ($va_type_restrictions as $va_restriction) {
                 if ($t_restriction->load($va_restriction['restriction_id'])) {
                     foreach ($va_restriction_settings as $vs_setting => $va_setting_info) {
                         if (!is_array($va_settings = $t_restriction->getSettings())) {
                             $va_settings = array();
                         }
                         $va_initial_values[$t_restriction->getPrimaryKey()] = array_merge($t_restriction->getFieldValuesArray(), $va_settings);
                     }
                 }
             }
         }
     }
     $this->view->setVar('initial_restriction_values', $va_initial_values);
     if ($vn_parent_id = $this->request->getParameter('parent_id', pInteger)) {
         $this->view->setVar('parent_id', $vn_parent_id);
     }
     $this->view->setVar('t_restriction', $t_restriction);
     $this->render('elements_edit_html.php');
 }
开发者ID:samrahman,项目名称:providence,代码行数:45,代码来源:ElementsController.php

示例9: renderWidget

 public function renderWidget($ps_widget_id, &$pa_settings)
 {
     parent::renderWidget($ps_widget_id, $pa_settings);
     $this->opo_view->setVar('request', $this->getRequest());
     $t_form = new ca_search_forms();
     if (!($vn_form_id = (int) $pa_settings["form_code"])) {
         $va_forms = caExtractValuesByUserLocale($t_form->getForms(array('table' => 'ca_objects', '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->opo_view->setVar("t_form", $t_form);
     if ($t_form->haveAccessToForm($this->getRequest()->user->getUserID(), __CA_SEARCH_FORM_READ_ACCESS__)) {
         $vo_dm = Datamodel::load();
         $vo_result_context = new ResultContext($this->getRequest(), $vo_dm->getTableName($t_form->get("table_num")), "advanced_search");
         $va_form_data = $vo_result_context->getParameter('form_data');
         $this->opo_view->setVar("controller_name", $this->getAdvancedSearchControllerNameForTable($vo_dm->getTableName($t_form->get("table_num"))));
         $this->opo_view->setVar('form_data', $va_form_data);
         $this->opo_view->setVar('form_elements', $t_form->getHTMLFormElements($this->getRequest(), $va_form_data));
     } else {
         $t_form->clear();
     }
     return $this->opo_view->render('main_html.php');
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:24,代码来源:advancedSearchFormWidget.php

示例10: _getUIList

 /**
  *
  */
 public function _getUIList($pn_table_num)
 {
     if (!$this->getPrimaryKey()) {
         return false;
     }
     $vs_group_sql = '';
     if (is_array($va_groups = $this->getUserGroups()) && sizeof($va_groups)) {
         $vs_group_sql = " (\n\t\t\t\t(ceui.ui_id IN (\n\t\t\t\t\t\tSELECT ui_id \n\t\t\t\t\t\tFROM ca_editor_uis_x_user_groups \n\t\t\t\t\t\tWHERE \n\t\t\t\t\t\t\tgroup_id IN (" . join(',', array_keys($va_groups)) . ")\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t) OR ";
     }
     $o_db = $this->getDb();
     $qr_uis = $o_db->query("\n\t\t\tSELECT *\n\t\t\tFROM ca_editor_uis ceui\n\t\t\tINNER JOIN ca_editor_ui_labels AS ceuil ON ceui.ui_id = ceuil.ui_id\n\t\t\tWHERE\n\t\t\t\t(\n\t\t\t\t\tceui.user_id = ? OR \n\t\t\t\t\tceui.is_system_ui = 1 OR\n\t\t\t\t\t{$vs_group_sql}\n\t\t\t\t\t(ceui.ui_id IN (\n\t\t\t\t\t\t\tSELECT ui_id \n\t\t\t\t\t\t\tFROM ca_editor_uis_x_users \n\t\t\t\t\t\t\tWHERE \n\t\t\t\t\t\t\t\tuser_id = ?\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t) AND (ceui.editor_type = ?)\n\t\t", (int) $this->getPrimaryKey(), (int) $this->getPrimaryKey(), (int) $pn_table_num);
     $va_opts = array();
     while ($qr_uis->nextRow()) {
         $va_opts[$qr_uis->get('ui_id')][$qr_uis->get('locale_id')] = $qr_uis->get('name');
     }
     return caExtractValuesByUserLocale($va_opts);
 }
开发者ID:kai-iak,项目名称:providence,代码行数:20,代码来源:ca_users.php

示例11: Show


//.........这里部分代码省略.........
             $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"]);
开发者ID:guaykuru,项目名称:pawtucket,代码行数:67,代码来源:BaseDetailController.php

示例12: getHierarchyList

 /**
  * Return array containing information about all place hierarchies, including their root_id's
  */
 public function getHierarchyList($pb_dummy = false)
 {
     $t_list = new ca_lists();
     $va_place_hierarchies = caExtractValuesByUserLocale($t_list->getItemsForList('place_hierarchies'));
     $o_db = $this->getDb();
     $va_hierarchy_ids = array();
     foreach ($va_place_hierarchies as $vn_i => $va_item) {
         $va_hierarchy_ids[] = intval($va_item['item_id']);
     }
     if (!sizeof($va_hierarchy_ids)) {
         return array();
     }
     // get root for each hierarchy
     $qr_res = $o_db->query("\n\t\t\tSELECT p.place_id, p.hierarchy_id, count(*) children\n\t\t\tFROM ca_places p\n\t\t\tINNER JOIN ca_places AS p2 ON p.place_id = p2.place_id\n\t\t\tWHERE \n\t\t\t\tp.parent_id IS NULL and p.hierarchy_id IN (" . join(',', $va_hierarchy_ids) . ")\n\t\t\tGROUP BY\n\t\t\t\tp.place_id, p.hierarchy_id\n\t\t");
     while ($qr_res->nextRow()) {
         $vn_hierarchy_id = $qr_res->get('hierarchy_id');
         $va_place_hierarchies[$vn_hierarchy_id]['place_id'] = $va_place_hierarchies[$vn_hierarchy_id]['item_id'] = $qr_res->get('place_id');
         $va_place_hierarchies[$vn_hierarchy_id]['name'] = $va_place_hierarchies[$vn_hierarchy_id]['name_plural'];
         $va_place_hierarchies[$vn_hierarchy_id]['children'] = $qr_res->get('children');
     }
     return $va_place_hierarchies;
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:25,代码来源:ca_places.php

示例13: getNonPreferredDisplayLabelsForIDs

 /**
  * Returns associative array, keyed by primary key value with values being
  * the nonpreferred label of the row from a suitable locale, ready for display 
  * 
  * @param array $pa_ids indexed array of primary key values to fetch labels for
  * @param array $pa_options Optional array of options. Supported options include:
  *								returnAllLocales = if set to true, an array indexed by row_id and then locale_id will be returned
  * @return array An array of nonpreferred labels in the current locale indexed by row_id, unless returnAllLocales is set, in which case the array includes preferred labels in all available locales and is indexed by row_id and locale_id
  */
 public function getNonPreferredDisplayLabelsForIDs($pa_ids, $pa_options = null)
 {
     $va_ids = array();
     foreach ($pa_ids as $vn_id) {
         if (intval($vn_id) > 0) {
             $va_ids[] = intval($vn_id);
         }
     }
     if (!is_array($va_ids) || !sizeof($va_ids)) {
         return array();
     }
     $vb_return_all_locales = caGetOption('returnAllLocales', $pa_options, false);
     $vs_cache_key = md5($this->tableName() . "/" . print_r($pa_ids, true) . '/' . print_R($pa_options, true) . '_non_preferred');
     if (!isset($pa_options['noCache']) && !$pa_options['noCache'] && LabelableBaseModelWithAttributes::$s_labels_by_id_cache[$vs_cache_key]) {
         return LabelableBaseModelWithAttributes::$s_labels_by_id_cache[$vs_cache_key];
     }
     $o_db = $this->getDb();
     $vs_display_field = $this->getLabelDisplayField();
     $vs_pk = $this->primaryKey();
     $vs_preferred_sql = '';
     if (($t_label_instance = $this->getLabelTableInstance()) && $t_label_instance->hasField('is_preferred')) {
         $vs_preferred_sql = "AND (is_preferred = 0)";
     }
     $va_labels = array();
     $qr_res = $o_db->query("\n\t\t\t\tSELECT {$vs_pk}, {$vs_display_field}, locale_id\n\t\t\t\tFROM " . $this->getLabelTableName() . "\n\t\t\t\tWHERE\n\t\t\t\t\t({$vs_pk} IN (" . join(',', $va_ids) . ")) {$vs_preferred_sql}\n\t\t\t\tORDER BY\n\t\t\t\t\t{$vs_display_field}\n\t\t\t");
     while ($qr_res->nextRow()) {
         $va_labels[$qr_res->get($vs_pk)][$qr_res->get('locale_id')][] = $qr_res->get($vs_display_field);
     }
     // make sure it's in same order the ids were passed in
     $va_sorted_labels = array();
     foreach ($va_ids as $vn_id) {
         $va_sorted_labels[$vn_id] = $va_labels[$vn_id];
     }
     if ($vb_return_all_locales) {
         return LabelableBaseModelWithAttributes::$s_labels_by_id_cache[$vs_cache_key] = $va_sorted_labels;
     }
     return LabelableBaseModelWithAttributes::$s_labels_by_id_cache[$vs_cache_key] = caExtractValuesByUserLocale($va_sorted_labels);
 }
开发者ID:kai-iak,项目名称:pawtucket2,代码行数:47,代码来源:LabelableBaseModelWithAttributes.php

示例14: lookup

 public function lookup()
 {
     $vs_search = $this->request->getParameter('q', pString);
     $t_list = new ca_lists();
     $va_data = array();
     $va_access_values = caGetUserAccessValues($this->request);
     #
     # Do "quicksearches" on so-configured tables
     #
     if ($this->request->config->get('quicksearch_return_ca_objects')) {
         $va_results = caExtractValuesByUserLocale(SearchEngine::quickSearch($vs_search, 'ca_objects', 57, array('limit' => 3, 'checkAccess' => $va_access_values)));
         // break found objects out by type
         foreach ($va_results as $vn_id => $va_match_info) {
             $vs_type = unicode_ucfirst($t_list->getItemFromListForDisplayByItemID('object_types', $va_match_info['type_id'], true));
             $va_data['ca_objects'][$vs_type][$vn_id] = $va_match_info;
         }
     }
     if ($this->request->config->get('quicksearch_return_ca_entities')) {
         $va_data['ca_entities'][_t('Entities')] = caExtractValuesByUserLocale(SearchEngine::quickSearch($vs_search, 'ca_entities', 20, array('limit' => 10, 'checkAccess' => $va_access_values)));
     }
     if ($this->request->config->get('quicksearch_return_ca_places')) {
         $va_data['ca_places'][_t('Places')] = caExtractValuesByUserLocale(SearchEngine::quickSearch($vs_search, 'ca_places', 72, array('limit' => 10, 'checkAccess' => $va_access_values)));
     }
     if ($this->request->config->get('quicksearch_return_ca_occurrences')) {
         $va_results = caExtractValuesByUserLocale(SearchEngine::quickSearch($vs_search, 'ca_occurrences', 67, array('limit' => 10, 'checkAccess' => $va_access_values)));
         // break found occurrences out by type
         foreach ($va_results as $vn_id => $va_match_info) {
             $vs_type = unicode_ucfirst($t_list->getItemFromListForDisplayByItemID('occurrence_types', $va_match_info['type_id'], true));
             $va_data['ca_occurrences'][$vs_type][$vn_id] = $va_match_info;
         }
     }
     if ($this->request->config->get('quicksearch_return_ca_collections')) {
         $va_data['ca_collections'][_t('Collections')] = caExtractValuesByUserLocale(SearchEngine::quickSearch($vs_search, 'ca_collections', 13, array('limit' => 10, 'checkAccess' => $va_access_values)));
     }
     $this->view->setVar('matches', $va_data);
     $this->render('Search/ajax_search_lookup_json.php');
 }
开发者ID:samrahman,项目名称:providence,代码行数:37,代码来源:BaseSearchController.php

示例15: Tools

 /**
  * Set up variables for "tools" widget
  */
 public function Tools($pa_parameters)
 {
     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);
     }
     $this->view->setVar('views', $this->opa_views);
     // pass view list to view for rendering
     $this->view->setVar('current_view', $vs_view);
     $vn_type_id = $this->opo_result_context->getTypeRestriction($vb_dummy);
     $va_sortable_elements = ca_metadata_elements::getSortableElements($this->ops_tablename, $vn_type_id);
     if (!is_array($this->opa_sorts)) {
         $this->opa_sorts = array();
     }
     foreach ($va_sortable_elements as $vn_element_id => $va_sortable_element) {
         $this->opa_sorts[$this->ops_tablename . '.' . $va_sortable_element['element_code']] = $va_sortable_element['display_label'];
     }
     $this->view->setVar('sorts', $this->opa_sorts);
     // pass sort list to view for rendering
     $this->view->setVar('current_sort', $vs_sort);
     $this->view->setVar('items_per_page', $this->opa_items_per_page);
     $this->view->setVar('current_items_per_page', $vn_items_per_page);
     //
     // Available sets
     //
     $t_set = new ca_sets();
     $this->view->setVar('available_sets', caExtractValuesByUserLocale($t_set->getSets(array('table' => $this->ops_tablename, 'user_id' => $this->request->getUserID()))));
     $this->view->setVar('last_search', $this->opo_result_context->getSearchExpression());
     $this->view->setVar('result_context', $this->opo_result_context);
     $va_results_id_list = $this->opo_result_context->getResultList();
     $this->view->setVar('result', is_array($va_results_id_list) && sizeof($va_results_id_list) > 0 ? caMakeSearchResult($this->ops_tablename, $va_results_id_list) : null);
     $t_model = $this->opo_datamodel->getInstanceByTableName($this->ops_tablename, true);
     $this->view->setVar('t_subject', $t_model);
 }
开发者ID:ffarago,项目名称:pawtucket2,代码行数:44,代码来源:BaseFindController.php


注:本文中的caExtractValuesByUserLocale函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。