本文整理汇总了PHP中ca_lists::getItemsForList方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_lists::getItemsForList方法的具体用法?PHP ca_lists::getItemsForList怎么用?PHP ca_lists::getItemsForList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_lists
的用法示例。
在下文中一共展示了ca_lists::getItemsForList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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]);
}
}
}
}
}
示例2: refine
/**
*
*/
public function refine(&$pa_destination_data, $pa_group, $pa_item, $pa_source_data, $pa_options = null)
{
$o_log = isset($pa_options['log']) && is_object($pa_options['log']) ? $pa_options['log'] : null;
// Set place hierarchy
if ($vs_hierarchy = $pa_item['settings']['placeSplitter_placeHierarchy']) {
$vn_hierarchy_id = caGetListItemID('place_hierarchies', $vs_hierarchy);
} else {
// Default to first place hierarchy
$t_list = new ca_lists();
$va_hierarchy_ids = $t_list->getItemsForList('place_hierarchies', array('idsOnly' => true));
$vn_hierarchy_id = array_shift($va_hierarchy_ids);
}
if (!$vn_hierarchy_id) {
if ($o_log) {
$o_log->logError(_t('[placeSplitterRefinery] No place hierarchies are defined'));
}
return array();
}
$pa_options['hierarchyID'] = $vn_hierarchy_id;
$t_place = new ca_places();
if ($t_place->load(array('parent_id' => null, 'hierarchy_id' => $vn_hierarchy_id))) {
$pa_options['defaultParentID'] = $t_place->getPrimaryKey();
}
return caGenericImportSplitter('placeSplitter', 'place', 'ca_places', $this, $pa_destination_data, $pa_group, $pa_item, $pa_source_data, $pa_options);
}
示例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');
}
示例4: setUp
public function setUp()
{
$t_list = new ca_lists();
// add a minimal object for testing
$va_object_types = $t_list->getItemsForList('object_types', array('idsOnly' => true, 'enabledOnly' => true));
$t_object = new ca_objects();
$t_object->setMode(ACCESS_WRITE);
$t_object->set('type_id', array_shift($va_object_types));
$t_object->insert();
$this->opn_object_id = $t_object->getPrimaryKey();
$this->assertGreaterThan(0, $this->opn_object_id, 'Object should have a primary key after insert');
// add minimal set
$va_set_types = $t_list->getItemsForList('set_types', array('idsOnly' => true, 'enabledOnly' => true));
$t_set = new ca_sets();
$t_set->setMode(ACCESS_WRITE);
$t_set->set('type_id', array_shift($va_set_types));
$t_set->set('table_num', $t_object->tableNum());
$t_set->insert();
$this->opn_set_id = $t_set->getPrimaryKey();
$this->assertGreaterThan(0, $this->opn_set_id, 'Set should have a primary key after insert');
}
示例5: 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()));
}
示例6: getFacetContent
//.........这里部分代码省略.........
$va_orderbys = array();
$t_rel_item_label = new ca_list_item_labels();
foreach ($va_ordering_fields_to_fetch as $vs_sort_by_field) {
if (!$t_rel_item_label->hasField($vs_sort_by_field)) {
continue;
}
$va_orderbys[] = $va_label_selects[] = 'lil.' . $vs_sort_by_field;
}
$vs_order_by = sizeof($va_orderbys) ? "ORDER BY " . join(', ', $va_orderbys) : '';
$vs_sql = "\n\t\t\t\t\t\t\t\tSELECT DISTINCT lil.item_id, lil.name_singular, lil.name_plural, lil.locale_id\n\t\t\t\t\t\t\t\tFROM ca_list_items li\n\t\t\t\t\t\t\t\tINNER JOIN ca_list_item_labels AS lil ON lil.item_id = li.item_id\n\t\t\t\t\t\t\t\t{$vs_join_sql}\n\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\tca_lists.list_code = ? AND lil.is_preferred = 1 {$vs_where_sql} {$vs_order_by}";
//print $vs_sql." [$vs_list_name]";
$qr_res = $this->opo_db->query($vs_sql, $vs_list_name);
$va_values = array();
while ($qr_res->nextRow()) {
$vn_id = $qr_res->get('item_id');
if ($va_criteria[$vn_id]) {
continue;
}
// skip items that are used as browse critera - don't want to browse on something you're already browsing on
$va_values[$vn_id][$qr_res->get('locale_id')] = array('id' => $vn_id, 'label' => $qr_res->get('name_plural'));
if (!is_null($vs_single_value) && $vn_id == $vs_single_value) {
$vb_single_value_is_present = true;
}
}
if (!is_null($vs_single_value) && !$vb_single_value_is_present) {
return array();
}
return caExtractValuesByUserLocale($va_values);
}
} else {
if ($vs_list_name = $va_field_info['LIST']) {
$va_list_items_by_value = array();
// fields with values set according to ca_list_items (not a foreign key ref)
if ($va_list_items = caExtractValuesByUserLocale($t_list->getItemsForList($vs_list_name))) {
foreach ($va_list_items as $vn_id => $va_list_item) {
$va_list_items_by_value[$va_list_item['item_value']] = $va_list_item['name_plural'];
}
} else {
foreach ($va_field_info['BOUNDS_CHOICE_LIST'] as $vs_val => $vn_id) {
$va_list_items_by_value[$vn_id] = $vs_val;
}
}
if (sizeof($va_results) && $this->numCriteria() > 0) {
$va_wheres[] = "(" . $t_subject->tableName() . '.' . $t_subject->primaryKey() . " IN (" . join(',', $va_results) . "))";
}
if ($vs_browse_type_limit_sql) {
$va_wheres[] = $vs_browse_type_limit_sql;
}
if ($t_subject->hasField('deleted')) {
$va_wheres[] = "(" . $t_subject->tableName() . ".deleted = 0)";
}
if ($va_facet_info['relative_to']) {
if ($va_relative_sql_data = $this->_getRelativeFacetSQLData($va_facet_info['relative_to'], $pa_options)) {
$va_joins = array_merge($va_joins, $va_relative_sql_data['joins']);
$va_wheres = array_merge($va_wheres, $va_relative_sql_data['wheres']);
}
}
if ($this->opo_config->get('perform_item_level_access_checking')) {
if ($t_item = $this->opo_datamodel->getInstanceByTableName($vs_browse_table_name, true)) {
// Join to limit what browse table items are used to generate facet
$va_joins[] = 'LEFT JOIN ca_acl ON ' . $vs_browse_table_name . '.' . $t_item->primaryKey() . ' = ca_acl.row_id AND ca_acl.table_num = ' . $t_item->tableNum() . "\n";
$va_wheres[] = "(\n\t\t\t\t\t\t\t\t\t\t((\n\t\t\t\t\t\t\t\t\t\t\t(ca_acl.user_id = " . (int) $vn_user_id . ")\n\t\t\t\t\t\t\t\t\t\t\t" . (sizeof($va_group_ids) > 0 ? "OR\n\t\t\t\t\t\t\t\t\t\t\t(ca_acl.group_id IN (" . join(",", $va_group_ids) . "))" : "") . "\n\t\t\t\t\t\t\t\t\t\t\tOR\n\t\t\t\t\t\t\t\t\t\t\t(ca_acl.user_id IS NULL and ca_acl.group_id IS NULL)\n\t\t\t\t\t\t\t\t\t\t) AND ca_acl.access >= " . __CA_ACL_READONLY_ACCESS__ . ")\n\t\t\t\t\t\t\t\t\t\t" . ($vb_show_if_no_acl ? "OR ca_acl.acl_id IS NULL" : "") . "\n\t\t\t\t\t\t\t\t\t)";
}
}
if (is_array($va_wheres) && sizeof($va_wheres) && ($vs_where_sql = join(' AND ', $va_wheres))) {
$vs_where_sql = '(' . $vs_where_sql . ')';
示例7: array
<?php
//
// Handle AJAX request
//
if ($this->request->isAjax()) {
$vn_item_id = $this->request->getParameter('item_id', pInteger);
$t_list = new ca_lists();
$va_list_sub_items = $t_list->getItemsForList($this->getVar('list_code'), array('directChildrenOnly' => true, 'item_id' => $vn_item_id, 'extractValuesByUserLocale' => true, 'enabledOnly' => true, 'sort' => __CA_LISTS_SORT_BY_RANK__));
$va_resp = array();
if (is_array($va_list_sub_items)) {
foreach ($va_list_sub_items as $vn_i => $va_item) {
$va_list_sub_sub_items = caExtractValuesByUserLocale($t_list->getChildItemsForList($this->getVar('list_code'), $va_item['item_id'], array('directChildrenOnly' => true)));
if (is_array($va_list_sub_sub_items) && sizeof($va_list_sub_sub_items)) {
$va_resp['subList'] .= "<li><a href='#' onClick='\$(\"#tocSubList" . $vn_i . "\").toggle(); return false;'>+ " . $va_item['name_plural'] . "</a></li>\n";
$va_resp['subList'] .= "<ul class='tocSubSubMenu' id='tocSubList" . $vn_i . "'>";
foreach ($va_list_sub_sub_items as $vn_sub_i => $va_subitem) {
#$va_resp['subList'] .= "<li>".caNavLink($this->request, $va_subitem['name_plural'], '', '', 'Browse', 'Objects', array('facet' => 'term_facet', 'id' => $vn_sub_i))."</li>\n";
$va_resp['subList'] .= "<li>" . caNavLink($this->request, $va_subitem['name_plural'], '', '', 'MultiSearch', 'Index', array('search' => 'ca_list_items.item_id:' . $vn_sub_i)) . "</li>\n";
}
$va_resp['subList'] .= "</ul>";
} else {
#$va_resp['subList'] .= "<li>".caNavLink($this->request, $va_item['name_plural'], '', '', 'Browse', 'Objects', array('facet' => 'term_facet', 'id' => $vn_i))."</li>\n";
$va_resp['subList'] .= "<li>" . caNavLink($this->request, $va_item['name_plural'], '', '', 'MultiSearch', 'Index', array('search' => 'ca_list_items.item_id:' . $vn_i)) . "</li>\n";
}
}
}
require_once __CA_MODELS_DIR__ . "/ca_list_items.php";
$t_list_item = new ca_list_items($vn_item_id);
$va_resp['selectedTitle'] = $t_list_item->get('ca_list_items.preferred_labels.name_plural');
$va_resp['selectedDescription'] = $t_list_item->get('ca_list_items.preferred_labels.description') . "<br/><br>" . caNavLink($this->request, _t('View'), '', '', 'MultiSearch', 'Index', array('search' => 'ca_list_items.item_id:' . $vn_item_id));
示例8: getObjectTypeList
/**
*
*/
public function getObjectTypeList()
{
$va_data = array();
$t_list = new ca_lists();
$va_types = $t_list->getItemsForList('object_types', array('extractValuesByUserLocale' => true));
foreach ($va_types as $vn_type_id => $va_type) {
$va_data[$vn_type_id] = array('type_id' => $vn_type_id, 'typecode' => $va_type['idno'], 'typename' => $va_type['name_plural'], 'parent_id' => $va_type['parent_id']);
}
return $this->makeResponse($va_data);
}
示例9: Save
public function Save()
{
AssetLoadManager::register('tableList');
$o_dm = Datamodel::load();
$t_list = new ca_lists();
$t_role = $this->getRoleObject();
$t_role->setMode(ACCESS_WRITE);
foreach ($t_role->getFormFields() as $vs_f => $va_field_info) {
$t_role->set($vs_f, $_REQUEST[$vs_f]);
if ($t_role->numErrors()) {
$this->request->addActionErrors($t_role->errors(), 'field_' . $vs_f);
}
}
// get vars
$va_vars = $t_role->get('vars');
if (!is_array($va_vars)) {
$va_vars = array();
}
// save bundle access settings
$t_screen = new ca_editor_ui_screens();
$va_bundle_access_settings = array();
foreach (ca_users::$s_bundlable_tables as $vs_table) {
$va_available_bundles = $t_screen->getAvailableBundles($vs_table);
foreach ($va_available_bundles as $vs_bundle_name => $va_bundle_info) {
$vs_bundle_name_proc = $vs_table . '_' . str_replace(".", "_", $vs_bundle_name);
$vn_access = $this->request->getParameter($vs_bundle_name_proc, pInteger);
$va_bundle_access_settings[$vs_table . '.' . $vs_bundle_name] = $vn_access;
}
}
$va_vars['bundle_access_settings'] = $va_bundle_access_settings;
if ($t_role->getAppConfig()->get('perform_type_access_checking')) {
// save type access settings
$va_type_access_settings = array();
foreach (ca_users::$s_bundlable_tables as $vs_table) {
if (!caTableIsActive($vs_table) && $vs_table != 'ca_object_representations') {
continue;
}
$t_instance = $o_dm->getInstanceByTableName($vs_table, true);
if (!($vs_list_code = $t_instance->getTypeListCode())) {
continue;
}
$va_type_ids = $t_list->getItemsForList($vs_list_code, array('idsOnly' => true));
if (is_array($va_type_ids)) {
foreach ($va_type_ids as $vn_i => $vn_item_id) {
$vn_access = $this->request->getParameter($vs_table . '_type_' . $vn_item_id, pInteger);
$va_type_access_settings[$vs_table . '.' . $vn_item_id] = $vn_access;
}
}
}
$va_vars['type_access_settings'] = $va_type_access_settings;
}
if ($t_role->getAppConfig()->get('perform_source_access_checking')) {
// save source access settings
$va_source_access_settings = array();
foreach (ca_users::$s_bundlable_tables as $vs_table) {
if (!caTableIsActive($vs_table) && $vs_table != 'ca_object_representations') {
continue;
}
$t_instance = $o_dm->getInstanceByTableName($vs_table, true);
if (!($vs_list_code = $t_instance->getSourceListCode())) {
continue;
}
$va_source_ids = $t_list->getItemsForList($vs_list_code, array('idsOnly' => true));
if (is_array($va_source_ids)) {
foreach ($va_source_ids as $vn_i => $vn_item_id) {
$vn_access = $this->request->getParameter($vs_table . '_source_' . $vn_item_id, pInteger);
$va_source_access_settings[$vs_table . '.' . $vn_item_id] = $vn_access;
}
}
$va_source_access_settings[$vs_table . '_default_id'] = $this->request->getParameter($vs_table . '_default_source', pInteger);
}
$va_vars['source_access_settings'] = $va_source_access_settings;
}
$va_access_status_settings = array();
if (is_array($va_access_status_ids = $va_source_ids = $t_list->getItemsForList('access_statuses', array('idsOnly' => true)))) {
foreach ($va_access_status_ids as $vn_i => $vn_item_id) {
$vs_access = $this->request->getParameter('access_status_' . $vn_item_id, pString);
switch ($vs_access) {
case 0:
case 1:
$va_access_status_settings[$vn_item_id] = $vs_access;
break;
default:
$va_access_status_settings[$vn_item_id] = null;
break;
}
}
}
$va_vars['access_status_settings'] = $va_access_status_settings;
$t_role->set('vars', $va_vars);
// save actions
$va_role_action_list = $t_role->getRoleActionList();
$va_new_role_action_settings = array();
foreach ($va_role_action_list as $vs_group => $va_group_info) {
if (caTableIsActive($vs_group) === false && $vs_group != 'ca_object_representations') {
continue;
}
// will return null if group name is not a table name; true if it's an enabled table and false if it's a disabled table
foreach ($va_group_info['actions'] as $vs_action => $va_action_info) {
if ($this->request->getParameter($vs_action, pInteger) > 0) {
//.........这里部分代码省略.........
示例10: get
//.........这里部分代码省略.........
foreach ($va_label_list as $vn_i => $va_label) {
if ($vs_template) {
$va_values[] = caProcessTemplate($vs_template, $va_label, array('removePrefix' => 'preferred_labels.'));
} else {
$va_values[] = $va_label[$vs_disp_field];
}
}
}
return join($vs_delimiter, $va_values);
} else {
$va_labels = $t_instance->getPreferredLabels(null, false);
if ($vb_return_all_locales) {
return $va_labels;
} else {
// Simplify array by getting rid of third level array which is unnecessary since
// there is only ever one preferred label for a locale
$va_labels = caExtractValuesByUserLocale($va_labels, null, $va_preferred_locales);
$va_processed_labels = array();
foreach ($va_labels as $vn_label_id => $va_label_list) {
$va_processed_labels[$vn_label_id] = $va_label_list[0];
}
return $va_processed_labels;
}
}
break;
# ---------------------------------------------
# ---------------------------------------------
case 'nonpreferred_labels':
if (!$vb_return_as_array) {
$vs_disp_field = $this->getLabelDisplayField();
$va_labels = caExtractValuesByUserLocale($t_instance->getNonPreferredLabels(), null, $va_preferred_locales);
$t_list = new ca_lists();
if ($vb_convert_codes_to_display_text) {
$va_types = $t_list->getItemsForList($this->getLabelTableInstance()->getFieldInfo('type_id', 'LIST_CODE'), array('extractValuesByUserLocale' => true));
}
$va_values = array();
foreach ($va_labels as $vn_row_id => $va_label_list) {
foreach ($va_label_list as $vn_i => $va_label) {
if ($vs_template) {
$va_label_values = $va_label;
$va_label_values['typename_singular'] = $va_types[$va_label['type_id']]['name_singular'];
$va_label_values['typename_plural'] = $va_types[$va_label['type_id']]['name_plural'];
if ($vb_convert_codes_to_display_text) {
$va_label_values['type_id'] = $va_types[$va_label['type_id']]['name_singular'];
}
$va_values[] = caProcessTemplate($vs_template, $va_label_values, array('removePrefix' => 'nonpreferred_labels.'));
} else {
if ($vb_convert_codes_to_display_text && $vs_disp_field == 'type_id') {
$va_values[] = $va_types[$va_label[$vs_disp_field]]['name_singular'];
} else {
$va_values[] = $va_label[$vs_disp_field];
}
}
}
}
return join($vs_delimiter, $va_values);
$va_labels = caExtractValuesByUserLocale($t_instance->getNonPreferredLabels(null, false));
$vs_disp_field = $this->getLabelDisplayField();
$va_processed_labels = array();
foreach ($va_labels as $vn_label_id => $va_label_list) {
foreach ($va_label_list as $vn_i => $va_label) {
$va_processed_labels[] = $va_label[$vs_disp_field];
}
}
return join($vs_delimiter, $va_processed_labels);
} else {
示例11: Get
public function Get($pa_additional_query_params = null, $pa_options = null)
{
if (!$this->ops_search_class) {
return null;
}
$ps_query = $this->request->getParameter('q', pString);
$pb_exact = $this->request->getParameter('exact', pInteger);
$ps_exclude = $this->request->getParameter('exclude', pString);
$va_excludes = explode(";", $ps_exclude);
$ps_type = $this->request->getParameter('type', pString);
$ps_types = $this->request->getParameter('types', pString);
$pb_no_subtypes = (bool) $this->request->getParameter('noSubtypes', pInteger);
if (!($pn_limit = $this->request->getParameter('limit', pInteger))) {
$pn_limit = 100;
}
$va_items = array();
if (($vn_str_len = mb_strlen($ps_query)) > 0) {
if ($vn_str_len < 3) {
$pb_exact = true;
}
// force short strings to be an exact match (using a very short string as a stem would perform badly and return too many matches in most cases)
$o_search = new $this->ops_search_class();
$pa_types = array();
if ($ps_types) {
$pa_types = explode(';', $ps_types);
} else {
if ($ps_type) {
$pa_types = array($ps_type);
}
}
// Get type_ids
$vs_type_query = '';
$va_ids = array();
if (sizeof($pa_types)) {
$va_types = $this->opo_item_instance->getTypeList();
$va_types_proc = array();
foreach ($va_types as $vn_type_id => $va_type) {
$va_types_proc[$vn_type_id] = $va_types_proc[$va_type['idno']] = $vn_type_id;
}
foreach ($pa_types as $ps_type) {
if (isset($va_types_proc[$ps_type])) {
$va_ids[$va_types_proc[$ps_type]] = true;
}
}
$va_ids = array_keys($va_ids);
if (sizeof($va_ids) > 0) {
$t_list = new ca_lists();
if (!$pb_no_subtypes) {
foreach ($va_ids as $vn_id) {
$va_children = $t_list->getItemsForList($this->opo_item_instance->getTypeListCode(), array('item_id' => $vn_id, 'idsOnly' => true));
$va_ids = array_merge($va_ids, $va_children);
}
$va_ids = array_flip(array_flip($va_ids));
}
$o_search->addResultFilter($this->opo_item_instance->tableName() . '.' . $this->opo_item_instance->getTypeFieldName(), 'IN', join(",", $va_ids));
}
} else {
$va_ids = null;
}
// add any additional search elements
$vs_additional_query_params = '';
if (is_array($pa_additional_query_params) && sizeof($pa_additional_query_params)) {
$vs_additional_query_params = ' AND (' . join(' AND ', $pa_additional_query_params) . ')';
}
// get sort field
$vs_sort = '';
if ($vs_idno_fld = $this->opo_item_instance->getProperty('ID_NUMBERING_SORT_FIELD')) {
$vs_sort = $this->opo_item_instance->tableName() . ".{$vs_idno_fld}";
} else {
if (method_exists($this->opo_item_instance, "getLabelSortField")) {
$vs_sort = $this->opo_item_instance->getLabelTableName() . '.' . $this->opo_item_instance->getLabelSortField();
}
}
$vs_hier_parent_id_fld = $this->opo_item_instance->getProperty('HIERARCHY_PARENT_ID_FLD');
$vs_hier_fld = $this->opo_item_instance->getProperty('HIERARCHY_ID_FLD');
if ($vs_hier_fld && ($vn_restrict_to_hier_id = $this->request->getParameter('currentHierarchyOnly', pInteger))) {
$o_search->addResultFilter($this->opo_item_instance->tableName() . '.' . $vs_hier_fld, '=', (int) $vn_restrict_to_hier_id);
}
// add filters
if (isset($pa_options['filters']) && is_array($pa_options['filters']) && sizeof($pa_options['filters'])) {
foreach ($pa_options['filters'] as $va_filter) {
$o_search->addResultFilter($va_filter[0], $va_filter[1], $va_filter[2]);
}
}
// do search
$qr_res = $o_search->search('(' . $ps_query . (intval($pb_exact) ? '' : '*') . ')' . $vs_type_query . $vs_additional_query_params, array('search_source' => 'Lookup', 'no_cache' => false, 'sort' => $vs_sort));
$qr_res->setOption('prefetch', $pn_limit);
$qr_res->setOption('dontPrefetchAttributes', true);
$va_items = caProcessRelationshipLookupLabel($qr_res, $this->opo_item_instance, array('exclude' => $va_excludes, 'config' => $this->opo_plugin_config));
}
if (!is_array($va_items)) {
$va_items = array();
}
$this->view->setVar(str_replace(' ', '_', $this->ops_name_singular) . '_list', $va_items);
return $this->render('lookup/' . str_replace(' ', '_', 'ajax_' . $this->ops_name_singular . '_list_html.php'));
}
示例12: Index
/**
*
*/
public function Index($pa_options = null)
{
$ps_search = $this->request->getParameter('search', pString);
$ps_sort = $this->request->getParameter('sort', pString);
if (!$ps_search) {
$ps_search = $this->request->session->getVar('quick_search_last_search');
}
if (!in_array($ps_sort, array('name', 'idno'))) {
if (!($ps_sort = $this->request->session->getVar('quick_search_last_sort'))) {
$ps_sort = 'name';
}
}
MetaTagManager::setWindowTitle(_t('Quick search'));
$o_config = Configuration::load();
$vs_default_actions["ca_objects"] = $this->request->user->canDoAction("can_edit_ca_objects") ? "Edit" : "Summary";
$vs_default_actions["ca_object_lots"] = $this->request->user->canDoAction("can_edit_ca_object_lots") ? "Edit" : "Summary";
$vs_default_actions["ca_entities"] = $this->request->user->canDoAction("can_edit_ca_entities") ? "Edit" : "Summary";
$vs_default_actions["ca_places"] = $this->request->user->canDoAction("can_edit_ca_places") ? "Edit" : "Summary";
$vs_default_actions["ca_occurrences"] = $this->request->user->canDoAction("can_edit_ca_occurrences") ? "Edit" : "Summary";
$vs_default_actions["ca_collections"] = $this->request->user->canDoAction("can_edit_ca_collections") ? "Edit" : "Summary";
$vs_default_actions["ca_storage_locations"] = $this->request->user->canDoAction("can_edit_ca_storage_locations") ? "Edit" : "Summary";
$vs_default_actions["ca_loans"] = $this->request->user->canDoAction("can_edit_ca_loans") ? "Edit" : "Summary";
$vs_default_actions["ca_movements"] = $this->request->user->canDoAction("can_edit_ca_movements") ? "Edit" : "Summary";
$vs_default_actions["ca_tours"] = $this->request->user->canDoAction("can_edit_ca_tours") ? "Edit" : "Summary";
$vs_default_actions["ca_tour_stops"] = $this->request->user->canDoAction("can_edit_ca_tours") ? "Edit" : "Summary";
$va_searches = array('ca_collections' => array('name' => 'ca_collection_labels.name', 'displayidno' => 'ca_collections.idno', 'idno' => 'ca_collections.idno_sort', 'displayname' => _t('Collections'), 'primary_key' => 'collection_id', 'module' => 'editor/collections', 'controller' => 'CollectionEditor', 'action' => $vs_default_actions["ca_collections"], 'searchModule' => 'find', 'searchController' => 'SearchCollections', 'searchAction' => "Index"), 'ca_objects' => array('name' => 'ca_object_labels.name', 'displayidno' => 'ca_objects.idno', 'idno' => 'ca_objects.idno_sort', 'displayname' => _t('Objects'), 'primary_key' => 'object_id', 'module' => 'editor/objects', 'controller' => 'ObjectEditor', 'action' => $vs_default_actions["ca_objects"], 'searchModule' => 'find', 'searchController' => 'SearchObjects', 'searchAction' => "Index"), 'ca_object_lots' => array('name' => 'ca_object_lot_labels.name', 'displayidno' => 'ca_object_lots.idno_stub', 'idno' => 'ca_object_lots.idno_stub_sort', 'displayname' => _t('Object lots'), 'primary_key' => 'lot_id', 'module' => 'editor/object_lots', 'controller' => 'ObjectLotEditor', 'action' => $vs_default_actions["ca_object_lots"], 'searchModule' => 'find', 'searchController' => 'SearchObjectLots', 'searchAction' => "Index"), 'ca_entities' => array('name' => 'ca_entity_labels.surname;ca_entity_labels.forename', 'displayidno' => 'ca_entities.idno', 'idno' => 'ca_entities.idno_sort', 'displayname' => _t('Entities'), 'primary_key' => 'entity_id', 'module' => 'editor/entities', 'controller' => 'EntityEditor', 'action' => $vs_default_actions["ca_entities"], 'searchModule' => 'find', 'searchController' => 'SearchEntities', 'searchAction' => "Index"), 'ca_places' => array('name' => 'ca_place_labels.name', 'displayidno' => 'ca_places.idno', 'idno' => 'ca_places.idno_sort', 'displayname' => _t('Places'), 'primary_key' => 'place_id', 'module' => 'editor/places', 'controller' => 'PlaceEditor', 'action' => $vs_default_actions["ca_places"], 'searchModule' => 'find', 'searchController' => 'SearchPlaces', 'searchAction' => "Index"), 'ca_occurrences' => array('name' => 'ca_occurrence_labels.name', 'displayidno' => 'ca_occurrences.idno', 'idno' => 'ca_occurrences.idno_sort', 'displayname' => _t('Occurrences'), 'primary_key' => 'occurrence_id', 'module' => 'editor/occurrences', 'controller' => 'OccurrenceEditor', 'action' => $vs_default_actions["ca_occurrences"], 'searchModule' => 'find', 'searchController' => 'SearchOccurrences', 'searchAction' => "Index"), 'ca_storage_locations' => array('name' => 'ca_storage_location_labels.name', 'displayidno' => '', 'idno' => '', 'displayname' => _t('Storage locations'), 'primary_key' => 'location_id', 'module' => 'editor/storage_locations', 'controller' => 'StorageLocationEditor', 'action' => $vs_default_actions["ca_storage_locations"], 'searchModule' => 'find', 'searchController' => 'SearchStorageLocations', 'searchAction' => "Index"), 'ca_loans' => array('name' => 'ca_loan_labels.name', 'displayidno' => 'ca_loans.idno', 'idno' => 'ca_loans.idno_sort', 'displayname' => _t('Loans'), 'primary_key' => 'loan_id', 'module' => 'editor/loans', 'controller' => 'LoanEditor', 'action' => $vs_default_actions["ca_loans"], 'searchModule' => 'find', 'searchController' => 'SearchLoans', 'searchAction' => "Index"), 'ca_movements' => array('name' => 'ca_movement_labels.name', 'displayidno' => 'ca_movements.idno', 'idno' => 'ca_movements.idno_sort', 'displayname' => _t('Movements'), 'primary_key' => 'movement_id', 'module' => 'editor/movements', 'controller' => 'MovementEditor', 'action' => $vs_default_actions["ca_movements"], 'searchModule' => 'find', 'searchController' => 'SearchMovements', 'searchAction' => "Index"), 'ca_tours' => array('name' => 'ca_tour_labels.name', 'displayidno' => 'ca_tours.tour_code', 'idno' => 'ca_tours.tour_code', 'displayname' => _t('Tours'), 'primary_key' => 'tour_id', 'module' => 'editor/tours', 'controller' => 'TourEditor', 'action' => $vs_default_actions["ca_tours"], 'searchModule' => 'find', 'searchController' => 'SearchTours', 'searchAction' => "Index"), 'ca_tour_stops' => array('name' => 'ca_tour_stop_labels.name', 'displayidno' => 'ca_tour_stops.idno', 'idno' => 'ca_tour_stops.idno_sort', 'displayname' => _t('Tour stops'), 'primary_key' => 'stop_id', 'module' => 'editor/tour_stops', 'controller' => 'TourStopEditor', 'action' => $vs_default_actions["ca_tour_stops"], 'searchModule' => 'find', 'searchController' => 'SearchTourStops', 'searchAction' => "Index"));
$t_list = new ca_lists();
$this->view->setVar('occurrence_types', caExtractValuesByUserLocale($t_list->getItemsForList('occurrence_types')));
if (sizeof($va_aps_in_search = caSearchGetAccessPoints($ps_search))) {
$va_aps = caSearchGetTablesForAccessPoints($va_aps_in_search);
$vb_uses_aps = true;
} else {
$vb_uses_aps = false;
}
$va_single_results = array();
$pn_multiple_results = 0;
foreach ($va_searches as $vs_table => $va_sorts) {
if ($o_config->get($vs_table . '_disable') || $vs_table == 'ca_tour_stops' && $o_config->get('ca_tours_disable') || $vb_uses_aps && !in_array($vs_table, $va_aps)) {
unset($va_searches[$vs_table]);
continue;
}
if (!($vo_result = $this->_doSearch($vs_table, $ps_search, $va_sorts[$ps_sort]))) {
unset($va_searches[$vs_table]);
continue;
}
$vo_result->setOption('prefetch', $this->opn_num_results_per_item_type);
// get everything we need in one pass
$vo_result->setOption('dontPrefetchAttributes', true);
// don't bother trying to prefetch attributes as we don't need them
$this->view->setVar($vs_table . '_results', $vo_result);
$va_found_item_ids = array();
while ($vo_result->nextHit()) {
$va_found_item_ids[] = $vo_result->get($va_sorts['primary_key']);
}
$vo_result->seek(0);
$o_result_context = new ResultContext($this->request, $vs_table, 'quick_search');
$o_result_context->setAsLastFind();
$o_result_context->setResultList($va_found_item_ids);
$o_result_context->saveContext();
if ($vo_result->numHits() > 0) {
if ($vo_result->numHits() == 1) {
$va_single_results[$vs_table] = $va_found_item_ids[0];
} else {
$pn_multiple_results = 1;
}
}
}
$this->view->setVar('searches', $va_searches);
// note last quick search
if ($ps_search) {
$this->request->session->setVar('quick_search_last_search', $ps_search);
}
if ($ps_sort) {
$this->request->session->setVar('quick_search_last_sort', $ps_sort);
}
$this->view->setVar('search', $ps_search);
$this->view->setVar('sort', $this->request->session->getVar('quick_search_last_sort'));
$this->view->setVar('maxNumberResults', $this->opn_num_results_per_item_type);
// did we find only a single result in a single table? If so, then redirect to that record instead of showing results
if (!$pn_multiple_results && sizeof($va_single_results) == 1) {
foreach ($va_single_results as $vs_table => $vn_id) {
$this->response->setRedirect(caEditorUrl($this->request, $vs_table, $vn_id));
return;
}
}
$this->render('Results/quick_search_results_html.php');
}
示例13: getAvailableSettings
public function getAvailableSettings($pa_element_info = null)
{
global $_ca_attribute_settings, $g_request;
$va_element_settings = $_ca_attribute_settings['ListAttributeValue'];
/*
* For the dependent field visibility feature we need to add a select-able list of all applicable
* UI bundle placements here ... for each item in that list!
*/
if (Configuration::load()->get('enable_dependent_field_visibility') && is_array($pa_element_info) && isset($pa_element_info['list_id']) && (!$pa_element_info['settings']['render'] || in_array($pa_element_info['settings']['render'], array('select', 'radio_buttons', 'yes_no_checkboxes'))) && $g_request && $g_request instanceof RequestHTTP) {
$va_options_for_settings = array();
$t_mde = new ca_metadata_elements($pa_element_info['element_id']);
$va_restrictions = $t_mde->getTypeRestrictions();
$va_tables = array();
if (is_array($va_restrictions) && sizeof($va_restrictions)) {
foreach ($va_restrictions as $va_restriction) {
$va_tables[] = $va_restriction['table_num'];
}
}
$t_ui = new ca_editor_uis();
foreach (array_unique($va_tables) as $vn_table_num) {
// get UIs
$va_ui_list = ca_editor_uis::getAvailableUIs($vn_table_num, $g_request);
foreach ($va_ui_list as $vn_ui_id => $vs_ui_name) {
$t_ui->load($vn_ui_id);
// get screens
foreach ($t_ui->getScreens() as $va_screen) {
// get placements
foreach ($t_ui->getScreenBundlePlacements($va_screen['screen_id']) as $va_placement) {
$va_options_for_settings[$t_ui->get('editor_code') . '/' . $va_screen['idno'] . '/' . $va_placement['placement_code']] = $t_ui->get('editor_code') . '/' . $va_screen['idno'] . '/' . $va_placement['placement_code'];
}
}
}
}
$t_list = new ca_lists();
foreach ($t_list->getItemsForList($pa_element_info['list_id']) as $va_items_by_locale) {
foreach ($va_items_by_locale as $vn_locale_id => $va_item) {
$va_element_settings['hideIfSelected_' . $va_item['idno']] = array('formatType' => FT_TEXT, 'displayType' => DT_SELECT, 'options' => $va_options_for_settings, 'takesLocale' => false, 'default' => '', 'width' => "400px", 'height' => 10, 'label' => _t('Hide bundles if "%1" is selected', $va_item['name_singular']), 'description' => _t('Select bundles from the list below'));
}
}
} elseif (defined('__CollectiveAccess_Installer__') && Configuration::load()->get('enable_dependent_field_visibility')) {
// when installing, UIs, screens and placements are not yet available when we process elementSets, so
// we just add the hideIfSelected_* as available settings (without actual settings) so that the validation doesn't fail
$t_list = new ca_lists();
foreach ($t_list->getItemsForList($pa_element_info['list_id']) as $va_items_by_locale) {
foreach ($va_items_by_locale as $vn_locale_id => $va_item) {
$va_element_settings['hideIfSelected_' . $va_item['idno']] = true;
}
}
}
return $va_element_settings;
}
示例14: getFacetContent
//.........这里部分代码省略.........
}
}
$vs_join_sql = join("\n", $va_joins);
if (is_array($va_wheres) && sizeof($va_wheres) && ($vs_where_sql = join(' AND ', $va_wheres))) {
$vs_where_sql = ' AND (' . $vs_where_sql . ')';
}
if ($vb_check_availability_only) {
// exclude criteria values
$vs_criteria_exclude_sql = '';
if (is_array($va_criteria) && sizeof($va_criteria)) {
$vs_criteria_exclude_sql = ' AND (ca_attribute_values.value_longtext1 NOT IN (' . join(", ", caQuoteList(array_keys($va_criteria))) . ')) ';
}
$vs_sql = "\n\t\t\t\t\t\t\tSELECT count(DISTINCT value_longtext1) c\n\t\t\t\t\t\t\tFROM ca_attributes\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t{$vs_join_sql}\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t(ca_attribute_values.element_id = ?) {$vs_criteria_exclude_sql} {$vs_where_sql}\n\t\t\t\t\t\t\tLIMIT 1";
//print $vs_sql;
$qr_res = $this->opo_db->query($vs_sql, $vn_element_id);
if ($qr_res->nextRow()) {
return (int) $qr_res->get('c') > 0 ? true : false;
}
return false;
} else {
$vs_sql = "\n\t\t\t\t\t\t\tSELECT DISTINCT value_longtext1, value_decimal1, value_longtext2\n\t\t\t\t\t\t\tFROM ca_attributes\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t{$vs_join_sql}\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\tca_attribute_values.element_id = ? {$vs_where_sql}";
//print $vs_sql;
$qr_res = $this->opo_db->query($vs_sql, $vn_element_id);
$va_values = array();
$vn_element_type = $t_element->get('datatype');
$va_list_items = null;
$va_suppress_values = null;
if ($va_facet_info['suppress'] && !is_array($va_facet_info['suppress'])) {
$va_facet_info['suppress'] = array($va_facet_info['suppress']);
}
if ($vn_element_type == 3) {
// list
$t_list = new ca_lists();
$va_list_items = caExtractValuesByUserLocale($t_list->getItemsForList($t_element->get('list_id')));
if (isset($va_facet_info['suppress']) && is_array($va_facet_info['suppress'])) {
$va_suppress_values = ca_lists::getItemIDsFromList($t_element->get('list_id'), $va_facet_info['suppress']);
}
} else {
if (isset($va_facet_info['suppress']) && is_array($va_facet_info['suppress'])) {
$va_suppress_values = $va_facet_info['suppress'];
}
}
while ($qr_res->nextRow()) {
$o_attr = Attribute::getValueInstance($vn_element_type, $qr_res->getRow());
if (!($vs_val = trim($o_attr->getDisplayValue()))) {
continue;
}
if (is_array($va_suppress_values) && in_array($vs_val, $va_suppress_values)) {
continue;
}
switch ($vn_element_type) {
case 3:
// list
if ($va_criteria[$vs_val]) {
continue;
}
// skip items that are used as browse critera - don't want to browse on something you're already browsing on
$vn_child_count = 0;
foreach ($va_list_items as $vn_id => $va_item) {
if ($va_item['parent_id'] == $vs_val) {
$vn_child_count++;
}
}
$va_values[$vs_val] = array('id' => $vs_val, 'label' => $va_list_items[$vs_val]['name_plural'] ? $va_list_items[$vs_val]['name_plural'] : $va_list_items[$vs_val]['item_value'], 'parent_id' => $va_list_items[$vs_val]['parent_id'], 'child_count' => $vn_child_count);
break;
case 6:
示例15: Get
/**
* Given a item_id (request parameter 'id') returns a list of direct children for use in the hierarchy browser
* Returned data is JSON format
*/
public function Get($pa_additional_query_params = null, $pa_options = null)
{
$ps_query = $this->request->getParameter('term', pString);
$pb_exact = $this->request->getParameter('exact', pInteger);
$ps_exclude = $this->request->getParameter('exclude', pString);
$va_excludes = explode(";", $ps_exclude);
$ps_type = $this->request->getParameter('type', pString);
$ps_types = $this->request->getParameter('types', pString);
$pb_no_subtypes = (bool) $this->request->getParameter('noSubtypes', pInteger);
$pb_quickadd = (bool) $this->request->getParameter('quickadd', pInteger);
$pb_no_inline = (bool) $this->request->getParameter('noInline', pInteger);
$t_object = new ca_objects();
$t_collection = new ca_collections();
if (!($pn_limit = $this->request->getParameter('limit', pInteger))) {
$pn_limit = 100;
}
$va_items = array();
if (($vn_str_len = mb_strlen($ps_query)) > 0) {
if ($vn_str_len < 3) {
$pb_exact = true;
}
// force short strings to be an exact match (using a very short string as a stem would perform badly and return too many matches in most cases)
$o_object_search = new ObjectSearch();
$o_collection_search = new CollectionSearch();
$pa_types = array();
if ($ps_types) {
$pa_types = explode(';', $ps_types);
} else {
if ($ps_type) {
$pa_types = array($ps_type);
}
}
// Get type_ids
$vs_type_query = '';
$va_ids = array();
if (sizeof($pa_types)) {
$va_types = $this->opo_item_instance->getTypeList();
$va_types_proc = array();
foreach ($va_types as $vn_type_id => $va_type) {
$va_types_proc[$vn_type_id] = $va_types_proc[$va_type['idno']] = $vn_type_id;
}
foreach ($pa_types as $ps_type) {
if (isset($va_types_proc[$ps_type])) {
$va_ids[$va_types_proc[$ps_type]] = true;
}
}
$va_ids = array_keys($va_ids);
if (sizeof($va_ids) > 0) {
$t_list = new ca_lists();
if (!$pb_no_subtypes) {
foreach ($va_ids as $vn_id) {
$va_children = $t_list->getItemsForList($this->opo_item_instance->getTypeListCode(), array('item_id' => $vn_id, 'idsOnly' => true));
$va_ids = array_merge($va_ids, $va_children);
}
$va_ids = array_flip(array_flip($va_ids));
}
$o_object_search->addResultFilter($this->opo_item_instance->tableName() . '.' . $this->opo_item_instance->getTypeFieldName(), 'IN', join(",", $va_ids));
}
} else {
$va_ids = null;
}
// add any additional search elements
$vs_additional_query_params = '';
if (is_array($pa_additional_query_params) && sizeof($pa_additional_query_params)) {
$vs_additional_query_params = ' AND (' . join(' AND ', $pa_additional_query_params) . ')';
}
// add filters
if (isset($pa_options['filters']) && is_array($pa_options['filters']) && sizeof($pa_options['filters'])) {
foreach ($pa_options['filters'] as $va_filter) {
$o_object_search->addResultFilter($va_filter[0], $va_filter[1], $va_filter[2]);
}
}
// do search
$va_opts = array('exclude' => $va_excludes, 'limit' => $pn_limit);
if ($vn_restrict_to_hier_id = $this->request->getParameter('currentHierarchyOnly', pInteger)) {
$o_object_search->addResultFilter('ca_objects.hier_object_id', '=', (int) $vn_restrict_to_hier_id);
}
$qr_res = $o_object_search->search('(' . $ps_query . (intval($pb_exact) ? '' : '*') . ')' . $vs_type_query . $vs_additional_query_params, array('search_source' => 'Lookup', 'no_cache' => false, 'sort' => 'ca_objects.idno_sort'));
$qr_res->setOption('prefetch', $pn_limit);
$qr_res->setOption('dontPrefetchAttributes', true);
if (is_array($va_objects = caProcessRelationshipLookupLabel($qr_res, new ca_objects(), $va_opts))) {
foreach ($va_objects as $vn_object_id => $va_object) {
$va_objects[$vn_object_id]['id'] = 'ca_objects-' . $va_objects[$vn_object_id]['id'];
}
}
//if ($vs_hier_fld && ($vn_restrict_to_hier_id = $this->request->getParameter('currentHierarchyOnly', pInteger))) {
//$o_collection_search->addResultFilter('ca_collections.hier_collection_id', '=', (int)$vn_restrict_to_hier_id);
// How to restrict objects?
//}
$qr_res = $o_collection_search->search('(' . $ps_query . (intval($pb_exact) ? '' : '*') . ')' . $vs_type_query . $vs_additional_query_params, array('search_source' => 'Lookup', 'no_cache' => false, 'sort' => 'ca_collections.idno_sort'));
$qr_res->setOption('prefetch', $pn_limit);
$qr_res->setOption('dontPrefetchAttributes', true);
if (is_array($va_collections = caProcessRelationshipLookupLabel($qr_res, new ca_collections(), $va_opts))) {
foreach ($va_collections as $vn_collection_id => $va_collection) {
$va_collections[$vn_collection_id]['id'] = 'ca_collections-' . $va_collections[$vn_collection_id]['id'];
}
//.........这里部分代码省略.........