本文整理汇总了PHP中ca_lists::getItemIDsFromList方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_lists::getItemIDsFromList方法的具体用法?PHP ca_lists::getItemIDsFromList怎么用?PHP ca_lists::getItemIDsFromList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_lists
的用法示例。
在下文中一共展示了ca_lists::getItemIDsFromList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFacetContent
//.........这里部分代码省略.........
} 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'));
break;
case __CA_ATTRIBUTE_VALUE_OBJECTS__:
case __CA_ATTRIBUTE_VALUE_ENTITIES__:
示例2: 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:
// currency
$va_values[sprintf("%014.2f", preg_replace("![\\D]+!", "", $vs_val))] = array('id' => str_replace('/', '/', $vs_val), 'label' => $vs_val);