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


PHP ca_list_items::getPreferredDisplayLabelsForIDs方法代码示例

本文整理汇总了PHP中ca_list_items::getPreferredDisplayLabelsForIDs方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_list_items::getPreferredDisplayLabelsForIDs方法的具体用法?PHP ca_list_items::getPreferredDisplayLabelsForIDs怎么用?PHP ca_list_items::getPreferredDisplayLabelsForIDs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ca_list_items的用法示例。


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

示例1: indexRow


//.........这里部分代码省略.........
                            $va_attributes = $t_subject->getAttributesByElement($va_matches[1], array('row_id' => $pn_subject_row_id));
                            if (sizeof($va_attributes)) {
                                foreach ($va_attributes as $vo_attribute) {
                                    /* index each element of the container */
                                    foreach ($vo_attribute->getValues() as $vo_value) {
                                        $vn_list_id = $this->_getElementListID($vo_value->getElementID());
                                        $this->opo_engine->indexField($pn_subject_tablenum, 'A' . $vo_value->getElementID(), $vo_attribute->getAttributeID(), $vo_value->getDisplayValue($vn_list_id), $va_data);
                                    }
                                }
                            } else {
                                // we are deleting a container so cleanup existing sub-values
                                $va_sub_elements = $this->opo_metadata_element->getElementsInSet($va_matches[1]);
                                foreach ($va_sub_elements as $vn_i => $va_element_info) {
                                    $this->opo_engine->indexField($pn_subject_tablenum, 'A' . $va_element_info['element_id'], $va_element_info['element_id'], '', $va_data);
                                }
                            }
                            break;
                        case 3:
                            // list
                            // We pull the preferred labels of list items for indexing here. We do so for all languages. Note that
                            // this only done for list attributes that are standalone and not a sub-element in a container. Perhaps
                            // we should also index the text of sub-element lists, but it's not clear that it is a good idea yet. The list_id's of
                            // sub-elements *are* indexed however, so advanced search forms passing ids instead of text will work.
                            $va_tmp = array();
                            if (is_array($va_attributes = $t_subject->getAttributesByElement($va_matches[1], array('row_id' => $pn_subject_row_id)))) {
                                foreach ($va_attributes as $vo_attribute) {
                                    foreach ($vo_attribute->getValues() as $vo_value) {
                                        $va_tmp[$vo_attribute->getAttributeID()] = $vo_value->getDisplayValue();
                                    }
                                }
                            }
                            $va_new_values = array();
                            $t_item = new ca_list_items();
                            $va_labels = $t_item->getPreferredDisplayLabelsForIDs($va_tmp, array('returnAllLocales' => true));
                            foreach ($va_labels as $vn_row_id => $va_labels_per_row) {
                                foreach ($va_labels_per_row as $vn_locale_id => $va_label_list) {
                                    foreach ($va_label_list as $vs_label) {
                                        $va_new_values[$vn_row_id][$vs_label] = true;
                                    }
                                }
                            }
                            foreach ($va_tmp as $vn_attribute_id => $vn_item_id) {
                                if (!$vn_item_id) {
                                    continue;
                                }
                                if (!isset($va_new_values[$vn_item_id]) || !is_array($va_new_values[$vn_item_id])) {
                                    continue;
                                }
                                $vs_v = join(' ;  ', array_merge(array($vn_item_id), array_keys($va_new_values[$vn_item_id])));
                                $this->opo_engine->indexField($pn_subject_tablenum, 'A' . $va_matches[1], $vn_attribute_id, $vs_v, $va_data);
                            }
                            break;
                        default:
                            $va_attributes = $t_subject->getAttributesByElement($va_matches[1], array('row_id' => $pn_subject_row_id));
                            if (!is_array($va_attributes)) {
                                break;
                            }
                            foreach ($va_attributes as $vo_attribute) {
                                foreach ($vo_attribute->getValues() as $vo_value) {
                                    //if the field is a daterange type get content from start and end fields
                                    $va_field_list = $t_subject->getFieldsArray();
                                    if (in_array($va_field_list[$vs_field]['FIELD_TYPE'], array(FT_DATERANGE, FT_HISTORIC_DATERANGE))) {
                                        $start_field = $va_field_list[$vs_field]['START'];
                                        $end_field = $va_field_list[$vs_field]['END'];
                                        $pn_content = $pa_field_data[$start_field] . " - " . $pa_field_data[$end_field];
                                    } else {
开发者ID:guaykuru,项目名称:pawtucket,代码行数:67,代码来源:SearchIndexer.php

示例2: getTypesForItems

 /**
  * Returns list of types present for items in set
  *
  * @param array $pa_options
  *		user_id = Restricts access to sets accessible by the current user. If omitted then all sets, regardless of access are returned.
  *		checkAccess = Restricts returned sets to those with an public access level with the specified values. If omitted sets are returned regardless of public access (ca_sets.access) value. Can be a single value or array if you wish to filter on multiple public access values.
  *		includeParents =  Include parent types in the returned type list. [Default is false]
  * @return array List of types. Keys are integer type_ids, values are plural type names for the current locale
  */
 public function getTypesForItems($pa_options = null)
 {
     if (!($vn_set_id = $this->getPrimaryKey())) {
         return null;
     }
     if (!is_array($pa_options)) {
         $pa_options = array();
     }
     if ($pa_options['user_id'] && !$this->haveAccessToSet($pa_options['user_id'], __CA_SET_READ_ACCESS__)) {
         return false;
     }
     $o_db = $this->getDb();
     $o_dm = $this->getAppDatamodel();
     if (!($t_rel_table = $o_dm->getInstanceByTableNum($this->get('table_num'), true))) {
         return null;
     }
     if (!($vs_type_id_fld = $t_rel_table->getTypeFieldName())) {
         return array();
     }
     // get set items
     $vs_access_sql = '';
     if (isset($pa_options['checkAccess']) && is_array($pa_options['checkAccess']) && sizeof($pa_options['checkAccess']) && $t_rel_table->hasField('access')) {
         $vs_access_sql = ' AND rel.access IN (' . join(',', $pa_options['checkAccess']) . ')';
     }
     $vs_deleted_sql = '';
     if ($t_rel_table->hasField('deleted')) {
         $vs_deleted_sql = ' AND rel.deleted = 0';
     }
     $va_type_list = method_exists($t_rel_table, "getTypeList") ? $t_rel_table->getTypeList() : array();
     $qr_res = $o_db->query("\n\t\t\tSELECT distinct rel.{$vs_type_id_fld}\n\t\t\tFROM ca_set_items casi\n\t\t\tINNER JOIN " . $t_rel_table->tableName() . " AS rel ON rel." . $t_rel_table->primaryKey() . " = casi.row_id\n\t\t\tWHERE\n\t\t\t\tcasi.set_id = ? {$vs_access_sql} {$vs_deleted_sql}\n\t\t", array($vn_set_id));
     $va_type_ids = array();
     while ($qr_res->nextRow()) {
         $va_type_ids[$vn_type_id = $qr_res->get($vs_type_id_fld)] = $va_type_list[$vn_type_id]['name_plural'];
     }
     if (caGetOption('includeParents', $pa_options, false)) {
         $t_item = new ca_list_items();
         $va_expanded_types = $va_type_ids;
         $va_labels = $t_item->getPreferredDisplayLabelsForIDs($va_type_ids);
         foreach ($va_type_ids as $vn_type_id => $vs_type) {
             if (is_array($va_parents = $t_item->getHierarchyAncestors($vn_type_id, array('idsOnly' => true)))) {
                 foreach ($va_parents as $vn_parent_id) {
                     $va_expanded_types[$vn_parent_id] = $va_labels[$vn_parent_id];
                 }
             }
         }
         $va_type_ids = $va_expanded_types;
     }
     return $va_type_ids;
 }
开发者ID:kai-iak,项目名称:providence,代码行数:58,代码来源:ca_sets.php

示例3: getFacetContent


//.........这里部分代码省略.........
                 //print $vs_sql;
                 $qr_res = $this->opo_db->query($vs_sql, $vn_element_id);
                 return (int) $qr_res->numRows() > 1 ? true : false;
             } else {
                 $vs_sql = "\n\t\t\t\t\t\t\tSELECT DISTINCT value_longtext1, value_decimal1, value_longtext2, value_integer1\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}";
                 $qr_res = $this->opo_db->query($vs_sql, $vn_element_id);
                 $va_values = array();
                 $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 (!is_array($va_suppress_values = caGetOption('suppress', $va_facet_info, null))) {
                     $va_suppress_values = caGetOption('exclude_values', $va_facet_info, null);
                 }
                 switch ($vn_element_type) {
                     case __CA_ATTRIBUTE_VALUE_LIST__:
                         $va_values = $qr_res->getAllFieldValues('value_longtext1');
                         $qr_res->seek(0);
                         $t_list_item = new ca_list_items();
                         $va_list_item_cache = $t_list_item->getFieldValuesForIDs($va_values, array('idno', 'item_value', 'parent_id', 'access'));
                         $va_list_child_count_cache = array();
                         if (is_array($va_list_item_cache)) {
                             foreach ($va_list_item_cache as $vn_id => $va_item) {
                                 if (!($vn_parent_id = $va_item['parent_id'])) {
                                     continue;
                                 }
                                 if (is_array($pa_options['checkAccess']) && sizeof($pa_options['checkAccess']) && !in_array($va_item['access'], $pa_options['checkAccess'])) {
                                     continue;
                                 }
                                 $va_list_child_count_cache[$vn_parent_id]++;
                             }
                         }
                         $va_list_label_cache = $t_list_item->getPreferredDisplayLabelsForIDs($va_values);
                         // Translate value idnos to ids
                         if (is_array($va_suppress_values)) {
                             $va_suppress_values = ca_lists::getItemIDsFromList($t_element->get('list_id'), $va_suppress_values);
                         }
                         $va_facet_list = array();
                         foreach ($va_values as $vn_val) {
                             if (!$vn_val) {
                                 continue;
                             }
                             if (is_array($va_suppress_values) && in_array($vn_val, $va_suppress_values)) {
                                 continue;
                             }
                             if (is_array($pa_options['checkAccess']) && sizeof($pa_options['checkAccess']) && !in_array($va_item['access'], $pa_options['checkAccess'])) {
                                 continue;
                             }
                             if ($va_criteria[$vn_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 = isset($va_list_child_count_cache[$vn_val]) ? $va_list_child_count_cache[$vn_val] : 0;
                             $va_facet_list[$vn_val] = array('id' => $vn_val, 'label' => html_entity_decode($va_list_label_cache[$vn_val]), 'parent_id' => isset($va_list_item_cache[$vn_val]['parent_id']) ? $va_list_item_cache[$vn_val]['parent_id'] : null, 'child_count' => $vn_child_count);
                         }
                         // preserve order of list
                         $va_values_sorted_by_list_order = array();
                         if (is_array($va_list_item_cache)) {
                             foreach ($va_list_item_cache as $vn_item_id => $va_item) {
                                 if (isset($va_facet_list[$vn_item_id])) {
                                     $va_values_sorted_by_list_order[$vn_item_id] = $va_facet_list[$vn_item_id];
                                 }
                             }
                         }
                         return caSortArrayByKeyInValue($va_values_sorted_by_list_order, array('label'));
开发者ID:kai-iak,项目名称:pawtucket2,代码行数:67,代码来源:BrowseEngine.php

示例4: foreach

                $va_template_tags[] = "{$vn_element_id}_label";
                $va_initial_values[$vn_attr_id]["{$vn_element_id}_label"] = '';
                $va_item_ids[] = (int) $vs_display_val;
            }
        }
        $va_initial_values[$o_attr->getAttributeID()]['locale_id'] = $o_attr->getLocaleID();
        // set errors for attribute
        if (is_array($va_action_errors = $this->request->getActionErrors($vs_error_source_code, $o_attr->getAttributeID()))) {
            foreach ($va_action_errors as $o_error) {
                $va_errors[$o_attr->getAttributeID()][] = array('errorDescription' => $o_error->getErrorDescription(), 'errorCode' => $o_error->getErrorNumber());
            }
        }
    }
    if (sizeof($va_item_ids)) {
        $t_list_item = new ca_list_items();
        $va_labels = $t_list_item->getPreferredDisplayLabelsForIDs($va_item_ids);
        foreach ($va_initial_values as $vn_attr_id => $va_values) {
            foreach ($va_values as $vn_element_id => $vs_value) {
                $va_initial_values[$vn_attr_id][$vn_element_id . '_label'] = $va_labels[$va_initial_values[$vn_attr_id][$vn_element_id]];
            }
        }
    }
} else {
    // set labels for replacement in blank lookups
    if (is_array($va_element_ids)) {
        foreach ($va_element_ids as $vn_element_id) {
            $va_template_tags[] = "{$vn_element_id}_label";
        }
    }
}
// bundle settings
开发者ID:guaykuru,项目名称:pawtucket,代码行数:31,代码来源:ca_attributes.php


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