本文整理汇总了PHP中FlexicontentFields::getFilterValues方法的典型用法代码示例。如果您正苦于以下问题:PHP FlexicontentFields::getFilterValues方法的具体用法?PHP FlexicontentFields::getFilterValues怎么用?PHP FlexicontentFields::getFilterValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FlexicontentFields
的用法示例。
在下文中一共展示了FlexicontentFields::getFilterValues方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createFilterValues
static function createFilterValues($filter, $view_join, $view_where, $filters_where, $indexed_elements, $search_prop)
{
$faceted_filter = $filter->parameters->get('faceted_filter', 2);
$display_filter_as = $filter->parameters->get('display_filter_as', 0);
// Filter Type of Display
$filter_as_range = in_array($display_filter_as, array(2, 3));
$lang_filter_values = $filter->parameters->get('lang_filter_values', 1);
$show_matching_items = $filter->parameters->get('show_matching_items', 1);
$show_matches = $filter_as_range || !$faceted_filter ? 0 : $show_matching_items;
//echo "<b>FILTER NAME</b>: ". $filter->label ."<br/>\n";
//echo "<b> view_join</b>: <br/>". $view_join ."<br/>\n";
//echo "<b> view_where</b>: <br/>". $view_where ."<br/>\n";
//echo "<b> filters_where</b>: <br/>". print_r($filters_where, true) ."<br/><br/>\n";
//exit;
if ($faceted_filter || !$indexed_elements) {
$_results = FlexicontentFields::getFilterValues($filter, $view_join, $view_where, $filters_where);
}
// Support of value-indexed fields
if (!$faceted_filter && $indexed_elements) {
$results =& $indexed_elements;
} else {
if ($indexed_elements) {
// Limit indexed element according to DB results found
$results = array_intersect_key($indexed_elements, $_results);
if ($faceted_filter == 2 && $show_matches) {
foreach ($results as $i => $result) {
$result->found = $_results[$i]->found;
}
}
// Support for multi-property fields
} else {
if ($search_prop) {
// Check and unserialize values
foreach ($_results as $i => $result) {
$v = @unserialize($result->value);
if ($v || $result->value === 'b:0;') {
$_results[$i] =& $v;
}
}
// Index values via the search property
$results = array();
foreach ($_results as $i => $result) {
if (is_array($_results[$i])) {
$_results[$i] = (object) $_results[$i];
} else {
$_results[$i] = (object) array($search_prop => $_results[$i]);
}
if (isset($_results[$i]->{$search_prop})) {
$results[$_results[$i]->{$search_prop}] = $_results[$i];
}
}
// non-indexable or single property field
} else {
$results =& $_results;
}
}
}
// Language filter labels
if ($lang_filter_values) {
foreach ($results as $i => $result) {
$results[$i]->text = JText::_($result->text);
}
}
// Skip sorting for indexed elements, DB query or element entry is responsible
// for ordering indexable fields, also skip if ordering is done by the filter
if (!$indexed_elements && empty($filter->filter_orderby)) {
uksort($results, 'strnatcasecmp');
}
return $results;
}