static function createFilter(&$filter, $value = '', $formName = 'adminForm', $indexed_elements = false, $search_prop = '') { static $apply_cache = null; static $faceted_overlimit_msg = null; $user = JFactory::getUser(); $mainframe = JFactory::getApplication(); //$cparams = $mainframe->getParams('com_flexicontent'); $cparams = JComponentHelper::getParams('com_flexicontent'); // createFilter maybe called in backend too ... $print_logging_info = $cparams->get('print_logging_info'); $option = JRequest::getVar('option'); $view = JRequest::getVar('view'); $is_fc_component = $option == 'com_flexicontent'; $isCategoryView = $is_fc_component && $view == 'category'; $isSearchView = $is_fc_component && $view == 'search'; if ($print_logging_info) { global $fc_run_times; $start_microtime = microtime(true); } // Apply caching to filters regardless of cache setting ... $apply_cache = FLEXI_CACHE; if ($apply_cache) { $itemcache = JFactory::getCache('com_flexicontent_filters'); // Get Joomla Cache of '...items' Caching Group $itemcache->setCaching(1); // Force cache ON $itemcache->setLifeTime(FLEXI_CACHE_TIME); // Set expire time (default is 1 hour) } $isdate = in_array($filter->field_type, array('date', 'created', 'modified')) || $filter->parameters->get('isdate', 0); $default_size = $isdate ? 15 : 30; $_s = $isSearchView ? '_s' : ''; // Some parameter shortcuts $label_filter = $filter->parameters->get('display_label_filter' . $_s, 0); // How to show filter label $size = $filter->parameters->get('text_filter_size', $default_size); // Size of filter $faceted_filter = $filter->parameters->get('faceted_filter' . $_s, 2); $display_filter_as = $filter->parameters->get('display_filter_as' . $_s, 0); // Filter Type of Display $filter_as_range = in_array($display_filter_as, array(2, 3)); $require_all = !in_array($display_filter_as, array(1, 2, 3)) ? $filter->parameters->get('filter_values_require_all', 0) : 0; $combine_tip = $filter->parameters->get('filter_values_require_all_tip', 0); $show_matching_items = $filter->parameters->get('show_matching_items' . $_s, 1); $show_matches = $filter_as_range || !$faceted_filter ? 0 : $show_matching_items; $hide_disabled_values = $filter->parameters->get('hide_disabled_values' . $_s, 0); $get_filter_vals = in_array($display_filter_as, array(0, 2, 4, 5, 6)); $filter_ffname = 'filter_' . $filter->id; $filter_ffid = $formName . '_' . $filter->id . '_val'; // Make sure the current filtering values match the field filter configuration to single or multi-value if (in_array($display_filter_as, array(2, 3, 5, 6))) { if (!is_array($value)) { $value = strlen($value) ? array($value) : array(); } } else { if (is_array($value)) { $value = @$value[0]; } } //print_r($value); // Alter search property name (indexed fields only), remove underscore _ at start & end of it if ($indexed_elements && $search_prop) { preg_match("/^_([a-zA-Z_0-9]+)_\$/", $search_prop, $prop_matches); $search_prop = @$prop_matches[1]; } // Get filtering values, this can be cached if not filtering according to current category filters if ($get_filter_vals) { $view_join = ''; $view_where = ''; $filters_where = array(); // *** Limiting of displayed filter values according to current category filtering, but show all field values if filter is active if ($isCategoryView) { // category view, use parameter to decide if limitting filter values global $fc_catview; if ($faceted_filter) { $view_join = @$fc_catview['join_clauses']; $view_where = $fc_catview['where_conf_only']; $filters_where = $fc_catview['filters_where']; $view_total = isset($fc_catview['view_total']) ? $fc_catview['view_total'] : 0; if ($fc_catview['alpha_where']) { $filters_where['alpha'] = $fc_catview['alpha_where']; } // we use count bellow ... so add it only if it is non-empty } } else { if ($isSearchView) { // search view, use parameter to decide if limitting filter values global $fc_searchview; if (empty($fc_searchview)) { return array(); } // search view plugin disabled ? if ($faceted_filter) { $view_join = $fc_searchview['join_clauses']; $view_where = $fc_searchview['where_conf_only']; $filters_where = $fc_searchview['filters_where']; $view_total = isset($fc_searchview['view_total']) ? $fc_searchview['view_total'] : 0; } } } $createFilterValues = !$isSearchView ? 'createFilterValues' : 'createFilterValuesSearch'; // This is hack for filter core properties to be filterable in search view without being added to the adv search index if ($filter->field_type == 'coreprops' && $view == 'search') { $createFilterValues = 'createFilterValues'; } // Get filter values considering PAGE configuration (regardless of ACTIVE filters) if ($apply_cache) { $results_page = $itemcache->call(array('FlexicontentFields', $createFilterValues), $filter, $view_join, $view_where, array(), $indexed_elements, $search_prop); } else { if (!$isSearchView) { $results_page = FlexicontentFields::createFilterValues($filter, $view_join, $view_where, array(), $indexed_elements, $search_prop); } else { $results_page = FlexicontentFields::createFilterValuesSearch($filter, $view_join, $view_where, array(), $indexed_elements, $search_prop); } } // Get filter values considering ACTIVE filters, but only if there is at least ONE filter active $faceted_max_item_limit = 10000; if ($faceted_filter == 2 && count($filters_where)) { if ($view_total <= $faceted_max_item_limit) { // DO NOT cache at this point the filter combinations are endless, so they will produce big amounts of cached data, that will be rarely used ... if (!$isSearchView) { $results_active = FlexicontentFields::createFilterValues($filter, $view_join, $view_where, $filters_where, $indexed_elements, $search_prop); } else { $results_active = FlexicontentFields::createFilterValuesSearch($filter, $view_join, $view_where, $filters_where, $indexed_elements, $search_prop); } } else { if ($faceted_overlimit_msg === null) { // Set a notice message about not counting item per filter values and instead showing item TOTAL of current category / view $faceted_overlimit_msg = 1; $filter_messages = JRequest::getVar('filter_message', array()); $filter_messages[] = JText::sprintf('FLEXI_FACETED_ITEM_LIST_OVER_LIMIT', $faceted_max_item_limit, $view_total); JRequest::setVar('filter_messages', $filter_messages); } } } // Decide which results to show those based: (a) on active filters or (b) on page configuration // This depends if hiding disabled values (for FACETED: 2) AND if active filters exist $use_active_vals = $hide_disabled_values && isset($results_active); $results_shown = $use_active_vals ? $results_active : $results_page; $update_found = !$use_active_vals && isset($results_active); // Set usage counters $results = array(); foreach ($results_shown as $i => $result) { $results[$i] = $result; // FACETED: 0,1 or NOT showing usage // Set usage to non-zero value e.g. -1 ... which maybe used (e.g. disabling values) but not be displayed if (!$show_matches || $faceted_filter < 2) { $results[$i]->found = -1; } else { if ($update_found) { $results[$i]->found = (int) @$results_active[$i]->found; } else { } } // Append value usage to value's label if ($faceted_filter == 2 && $show_matches && $results[$i]->found) { $results[$i]->text .= ' (' . $results[$i]->found . ')'; } } } else { $faceted_filter = 0; // clear faceted filter flag } // Prepend Field's Label to filter HTML // Commented out because it was moved in to form template file //$filter->html = $label_filter==1 ? $filter->label.': ' : ''; $filter->html = ''; // *** Create the form field(s) used for filtering switch ($display_filter_as) { case 0: case 2: case 6: // 0: Select (single value selectable), 2: Dual select (value range), 6: Multi Select (multiple values selectable) $options = array(); // MULTI-select does not has an internal label a drop-down list option if ($display_filter_as != 6) { $first_option_txt = $label_filter == 2 ? $filter->label : JText::_('FLEXI_ANY'); $options[] = JHTML::_('select.option', '', '- ' . $first_option_txt . ' -'); } // Make use of select2 lib flexicontent_html::loadFramework('select2'); $classes = " use_select2_lib"; $extra_param = ''; // MULTI-select: special label and prompts if ($display_filter_as == 6) { $classes .= ' fc_label_internal fc_prompt_internal'; // Add field's LABEL internally or click to select PROMPT (via js) $_inner_lb = $label_filter == 2 ? $filter->label : JText::_('FLEXI_CLICK_TO_LIST'); // Add type to filter PROMPT (via js) $extra_param = ' data-fc_label_text="' . flexicontent_html::escapeJsText($_inner_lb, 's') . '"'; $extra_param .= ' fc_prompt_text="' . flexicontent_html::escapeJsText(JText::_('FLEXI_TYPE_TO_FILTER'), 's') . '"'; } // Create HTML tag attributes $attribs_str = ' class="fc_field_filter' . $classes . '" ' . $extra_param; $attribs_str .= $display_filter_as == 6 ? ' multiple="multiple" size="20" ' : ''; //$attribs_str .= ($display_filter_as==0 || $display_filter_as==6) ? ' onchange="document.getElementById(\''.$formName.'\').submit();"' : ''; foreach ($results as $result) { if (!strlen($result->value)) { continue; } $options[] = JHTML::_('select.option', $result->value, $result->text, 'value', 'text', $disabled = $faceted_filter == 2 && !$result->found); } if ($display_filter_as == 6 && $combine_tip) { $filter->html .= ' <span class="fc_filter_tip_inline">' . JText::_(!$require_all ? 'FLEXI_ANY_OF' : 'FLEXI_ALL_OF') . '</span> '; } if ($display_filter_as == 0 || $display_filter_as == 6) { $filter->html .= JHTML::_('select.genericlist', $options, $filter_ffname . '[]', $attribs_str, 'value', 'text', $value, $filter_ffid); } else { $filter->html .= JHTML::_('select.genericlist', $options, $filter_ffname . '[1]', $attribs_str, 'value', 'text', @$value[1], $filter_ffid . '1'); $filter->html .= '<span class="fc_range"></span>'; $filter->html .= JHTML::_('select.genericlist', $options, $filter_ffname . '[2]', $attribs_str, 'value', 'text', @$value[2], $filter_ffid . '2'); } break; case 1: case 3: // (TODO: autocomplete) ... 1: Text input, 3: Dual text input (value range), both of these can be JS date calendars $_inner_lb = $label_filter == 2 ? $filter->label : JText::_($isdate ? 'FLEXI_CLICK_CALENDAR' : 'FLEXI_TYPE_TO_LIST'); $_inner_lb = flexicontent_html::escapeJsText($_inner_lb, 's'); $attribs_str = ' class="fc_field_filter fc_label_internal fc_iscalendar" data-fc_label_text="' . $_inner_lb . '"'; $attribs_arr = array('class' => 'fc_field_filter fc_label_internal fc_iscalendar', 'data-fc_label_text' => $_inner_lb); if ($display_filter_as == 1) { if ($isdate) { $filter->html .= FlexicontentFields::createCalendarField($value, $allowtime = 0, $filter_ffname, $filter_ffid, $attribs_arr); } else { $filter->html .= '<input id="' . $filter_ffid . '" name="' . $filter_ffname . '" ' . $attribs_str . ' type="text" size="' . $size . '" value="' . @$value . '" />'; } } else { if ($isdate) { $filter->html .= '<span class="fc_filter_element">'; $filter->html .= FlexicontentFields::createCalendarField(@$value[1], $allowtime = 0, $filter_ffname . '[1]', $filter_ffid . '1', $attribs_arr); $filter->html .= '</span>'; $filter->html .= '<span class="fc_range"></span>'; $filter->html .= '<span class="fc_filter_element">'; $filter->html .= FlexicontentFields::createCalendarField(@$value[2], $allowtime = 0, $filter_ffname . '[2]', $filter_ffid . '2', $attribs_arr); $filter->html .= '</span>'; } else { $size = (int) ($size / 2); $filter->html .= '<span class="fc_filter_element">'; $filter->html .= '<input name="' . $filter_ffname . '[1]" ' . $attribs_str . ' type="text" size="' . $size . '" value="' . @$value[1] . '" />'; $filter->html .= '</span>'; $filter->html .= '<span class="fc_range"></span>'; $filter->html .= '<span class="fc_filter_element">'; $filter->html .= '<input name="' . $filter_ffname . '[2]" ' . $attribs_str . ' type="text" size="' . $size . '" value="' . @$value[2] . '" />' . "\n"; $filter->html .= '</span>'; } } break; case 4: case 5: // 4: radio (single value selectable), 5: checkbox (multiple values selectable) $lf_min = 10; // add parameter for this ? $add_lf = count($results) >= $lf_min; if ($add_lf) { flexicontent_html::loadFramework('mCSB'); } $clear_values = 0; $value_style = $clear_values ? 'float:left; clear:both;' : ''; $i = 0; $checked = $display_filter_as == 5 ? !count($value) || !strlen(reset($value)) : !strlen($value); $checked_attr = $checked ? 'checked="checked"' : ''; $checked_class = $checked ? 'fc_highlight' : ''; $checked_class_li = $checked ? ' fc_checkradio_checked' : ''; $filter->html .= '<span class="fc_checkradio_group_wrapper fc_add_scroller' . ($add_lf ? ' fc_list_filter_wrapper' : '') . '">'; $filter->html .= '<ul class="fc_field_filter fc_checkradio_group' . ($add_lf ? ' fc_list_filter' : '') . '">'; $filter->html .= '<li class="fc_checkradio_option fc_checkradio_special' . $checked_class_li . '" style="' . $value_style . '">'; $filter->html .= $label_filter == 2 ? ' <span class="fc_filter_label_inline">' . $filter->label . '</span> ' : ''; if ($display_filter_as == 4) { $filter->html .= ' <input href="javascript:;" onchange="fc_toggleClassGrp(this, \'fc_highlight\', 1);" '; $filter->html .= ' id="' . $filter_ffid . $i . '" type="radio" name="' . $filter_ffname . '" '; $filter->html .= ' value="" ' . $checked_attr . ' class="fc_checkradio" />'; } else { $filter->html .= ' <input href="javascript:;" onchange="fc_toggleClass(this, \'fc_highlight\', 1);" '; $filter->html .= ' id="' . $filter_ffid . $i . '" type="checkbox" name="' . $filter_ffname . '[' . $i . ']" '; $filter->html .= ' value="" ' . $checked_attr . ' class="fc_checkradio" />'; } $filter->html .= '<label class="hasTip ' . $checked_class . '" for="' . $filter_ffid . $i . '" ' . ' title="::' . JText::_('FLEXI_REMOVE_ALL') . '"' . ($checked ? ' style="display:none!important;" ' : 'style="background:none!important; padding-left:0px!important;"') . '>' . '<span class="fc_delall_filters"></span>'; $filter->html .= '</label> ' . ($combine_tip ? ' <span class="fc_filter_tip_inline">' . JText::_(!$require_all ? 'FLEXI_ANY_OF' : 'FLEXI_ALL_OF') . '</span> ' : '') . ' </li>'; $i++; foreach ($results as $result) { if (!strlen($result->value)) { continue; } $checked = $display_filter_as == 5 ? in_array($result->value, $value) : $result->value == $value; $checked_attr = $checked ? ' checked=checked ' : ''; $disable_attr = $faceted_filter == 2 && !$result->found ? ' disabled=disabled ' : ''; $checked_class = $checked ? 'fc_highlight' : ''; $checked_class .= $faceted_filter == 2 && !$result->found ? ' fcdisabled ' : ''; $checked_class_li = $checked ? ' fc_checkradio_checked' : ''; $filter->html .= '<li class="fc_checkradio_option' . $checked_class_li . '" style="' . $value_style . '">'; if ($display_filter_as == 4) { $filter->html .= ' <input href="javascript:;" onchange="fc_toggleClassGrp(this, \'fc_highlight\');" '; $filter->html .= ' id="' . $filter_ffid . $i . '" type="radio" name="' . $filter_ffname . '" '; $filter->html .= ' value="' . $result->value . '" ' . $checked_attr . $disable_attr . ' class="fc_checkradio" />'; } else { $filter->html .= ' <input href="javascript:;" onchange="fc_toggleClass(this, \'fc_highlight\');" '; $filter->html .= ' id="' . $filter_ffid . $i . '" type="checkbox" name="' . $filter_ffname . '[' . $i . ']" '; $filter->html .= ' value="' . $result->value . '" ' . $checked_attr . $disable_attr . ' class="fc_checkradio" />'; } $filter->html .= '<label class="' . $checked_class . '" for="' . $filter_ffid . $i . '">'; $filter->html .= $result->text; $filter->html .= '</label>'; $filter->html .= '</li>'; $i++; } $filter->html .= '</ul>'; $filter->html .= '</span>'; break; } if ($print_logging_info) { $current_filter_creation = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10; $flt_active_count = isset($filters_where) ? count($filters_where) : 0; $faceted_str = array(0 => 'non-FACETED ', 1 => 'FACETED: current view (cacheable) ', 2 => 'FACETED: current filters:' . " (" . $flt_active_count . ' active) '); $fc_run_times['create_filter'][$filter->name] = $current_filter_creation; if (isset($fc_run_times['_create_filter_init'])) { $fc_run_times['create_filter'][$filter->name] -= $fc_run_times['_create_filter_init']; $fc_run_times['create_filter_init'] = $fc_run_times['_create_filter_init']; unset($fc_run_times['_create_filter_init']); } $fc_run_times['create_filter_type'][$filter->name] = $faceted_str[$faceted_filter]; } //$filter_display_typestr = array(0=>'Single Select', 1=>'Single Text', 2=>'Range Dual Select', 3=>'Range Dual Text', 4=>'Radio Buttons', 5=>'Checkbox Buttons'); //echo "FIELD name: <b>". $filter->name ."</b> Field Type: <b>". $filter->field_type."</b> Filter Type: <b>". $filter_display_typestr[$display_filter_as] ."</b> (".$display_filter_as.") ".sprintf(" %.2f s",$current_filter_creation/1000000)." <br/>"; }
static function createFilter(&$filter, $value = '', $formName = 'adminForm', $indexed_elements = false, $search_prop = '') { static $apply_cache = null; static $faceted_overlimit_msg = null; $user = JFactory::getUser(); $cparams = JComponentHelper::getParams('com_flexicontent'); // createFilter maybe called in backend too ... $print_logging_info = $cparams->get('print_logging_info'); $option = JRequest::getVar('option'); $view = JRequest::getVar('view'); $is_fc_component = $option == 'com_flexicontent'; $isCategoryView = $is_fc_component && $view == 'category'; $isSearchView = $is_fc_component && $view == 'search'; if ($print_logging_info) { global $fc_run_times; $start_microtime = microtime(true); } // Apply caching to filters regardless of cache setting ... $apply_cache = FLEXI_CACHE; if ($apply_cache) { $itemcache = JFactory::getCache('com_flexicontent_filters'); // Get Joomla Cache of '...items' Caching Group $itemcache->setCaching(1); // Force cache ON $itemcache->setLifeTime(FLEXI_CACHE_TIME); // Set expire time (default is 1 hour) } $isDate = in_array($filter->field_type, array('date', 'created', 'modified')) || $filter->parameters->get('isdate', 0); $default_size = $isDate ? 15 : 30; $_s = $isSearchView ? '_s' : ''; // Some parameter shortcuts $label_filter = $filter->parameters->get('display_label_filter' . $_s, 0); // How to show filter label $size = $filter->parameters->get('text_filter_size', $default_size); // Size of filter $faceted_filter = $filter->parameters->get('faceted_filter' . $_s, 2); $display_filter_as = $filter->parameters->get('display_filter_as' . $_s, 0); // Filter Type of Display $isSlider = $display_filter_as == 7 || $display_filter_as == 8; $slider_display_config = $filter->parameters->get('slider_display_config' . $_s, 1); // Slider found values: 1 or custom values/labels: 2 $filter_vals_display = $filter->parameters->get('filter_vals_display' . $_s, 0); $isRange = in_array($display_filter_as, array(2, 3, 8)); $require_all_param = $filter->parameters->get('filter_values_require_all', 0); $require_all = count($value) > 1 && !$isRange ? $require_all_param : 0; $combine_tip = $filter->parameters->get('filter_values_require_all_tip', 0); $show_matching_items = $filter->parameters->get('show_matching_items' . $_s, 1); $show_matches = $isRange || !$faceted_filter ? 0 : $show_matching_items; $hide_disabled_values = $filter->parameters->get('hide_disabled_values' . $_s, 0); $get_filter_vals = in_array($display_filter_as, array(0, 2, 4, 5, 6)) || $isSlider && $slider_display_config == 1; $filter_ffname = 'filter_' . $filter->id; $filter_ffid = $formName . '_' . $filter->id . '_val'; // Make sure the current filtering values match the field filter configuration to single or multi-value if (in_array($display_filter_as, array(2, 3, 5, 6, 8))) { if (!is_array($value)) { $value = strlen($value) ? array($value) : array(); } } else { if (is_array($value)) { $value = @$value[0]; } } // Escape values for output if (!is_array($value)) { $value = htmlspecialchars($value, ENT_COMPAT, 'UTF-8'); } else { foreach ($value as $i => $v) { $value[$i] = htmlspecialchars($value[$i], ENT_COMPAT, 'UTF-8'); } } // Alter search property name (indexed fields only), remove underscore _ at start & end of it if ($indexed_elements && $search_prop) { preg_match("/^_([a-zA-Z_0-9]+)_\$/", $search_prop, $prop_matches); $search_prop = @$prop_matches[1]; } // Get filtering values, this can be cached if not filtering according to current category filters if ($get_filter_vals) { $view_join = ''; $view_join_n_text = ''; $view_where = ''; $filters_where = array(); $text_search = ''; $view_total = 0; // *** Limiting of displayed filter values according to current category filtering, but show all field values if filter is active if ($isCategoryView) { // category view, use parameter to decide if limitting filter values global $fc_catview; if ($faceted_filter) { $view_join = @$fc_catview['join_clauses']; $view_join_n_text = @$fc_catview['join_clauses_with_text']; $view_where = @$fc_catview['where_conf_only']; $filters_where = @$fc_catview['filters_where']; $text_search = $fc_catview['search']; $view_total = isset($fc_catview['view_total']) ? $fc_catview['view_total'] : 0; } } else { if ($isSearchView) { // search view, use parameter to decide if limitting filter values global $fc_searchview; if (empty($fc_searchview)) { return array(); } // search view plugin disabled ? if ($faceted_filter) { $view_join = $fc_searchview['join_clauses']; $view_join_n_text = $fc_searchview['join_clauses_with_text']; $view_where = $fc_searchview['where_conf_only']; $filters_where = $fc_searchview['filters_where']; $text_search = $fc_searchview['search']; $view_total = isset($fc_searchview['view_total']) ? $fc_searchview['view_total'] : 0; } } } $createFilterValues = !$isSearchView ? 'createFilterValues' : 'createFilterValuesSearch'; // This is hack for filter core properties to be filterable in search view without being added to the adv search index if ($filter->field_type == 'coreprops' && $view == 'search') { $createFilterValues = 'createFilterValues'; } // Get filter values considering PAGE configuration (regardless of ACTIVE filters) if ($apply_cache) { $results_page = $itemcache->call(array('FlexicontentFields', $createFilterValues), $filter, $view_join, $view_where, array(), $indexed_elements, $search_prop); } else { if (!$isSearchView) { $results_page = FlexicontentFields::createFilterValues($filter, $view_join, $view_where, array(), $indexed_elements, $search_prop); } else { $results_page = FlexicontentFields::createFilterValuesSearch($filter, $view_join, $view_where, array(), $indexed_elements, $search_prop); } } // Get filter values considering ACTIVE filters, but only if there is at least ONE filter active $faceted_max_item_limit = 10000; if ($faceted_filter == 2) { if ($view_total <= $faceted_max_item_limit) { // DO NOT cache at this point the filter combinations are endless, so they will produce big amounts of cached data, that will be rarely used ... // but if only a single filter is active we can get the cached result of it ... because its own filter_where is not used for the filter itself if (!$text_search && (count($filters_where) == 0 || count($filters_where) == 1 && isset($filters_where[$filter->id]))) { $results_active = $results_page; } else { if (!$isSearchView) { $results_active = FlexicontentFields::createFilterValues($filter, $view_join_n_text, $view_where, $filters_where, $indexed_elements, $search_prop); } else { $results_active = FlexicontentFields::createFilterValuesSearch($filter, $view_join_n_text, $view_where, $filters_where, $indexed_elements, $search_prop); } } } else { if ($faceted_overlimit_msg === null) { // Set a notice message about not counting item per filter values and instead showing item TOTAL of current category / view $faceted_overlimit_msg = 1; $filter_messages = JRequest::getVar('filter_message', array()); $filter_messages[] = JText::sprintf('FLEXI_FACETED_ITEM_LIST_OVER_LIMIT', $faceted_max_item_limit, $view_total); JRequest::setVar('filter_messages', $filter_messages); } } } // Decide which results to show those based: (a) on active filters or (b) on page configuration // This depends if hiding disabled values (for FACETED: 2) AND if active filters exist $use_active_vals = $hide_disabled_values && isset($results_active); $results_shown = $use_active_vals ? $results_active : $results_page; $update_found = !$use_active_vals && isset($results_active); // Set usage counters $add_usage_counters = $faceted_filter == 2 && $show_matches; $results = array(); foreach ($results_shown as $i => $result) { $results[$i] = $result; // FACETED: 0,1 or NOT showing usage // Set usage to non-zero value e.g. -1 ... which maybe used (e.g. disabling values) but not be displayed if (!$show_matches || $faceted_filter < 2) { $results[$i]->found = -1; } else { if ($update_found) { $results[$i]->found = (int) @$results_active[$i]->found; } else { } } // Append value usage to value's label if ($add_usage_counters && $results[$i]->found) { $results[$i]->text .= ' (' . $results[$i]->found . ')'; } // THESE for indexed fields should have been cloned, so it is ok to modify } } else { $add_usage_counters = false; $faceted_filter = 0; // clear faceted filter flag } // Prepend Field's Label to filter HTML // Commented out because it was moved in to form template file //$filter->html = $label_filter==1 ? $filter->label.': ' : ''; $filter->html = ''; // *** Create the form field(s) used for filtering switch ($display_filter_as) { case 0: case 2: case 6: // 0: Select (single value selectable), 2: Dual select (value range), 6: Multi Select (multiple values selectable) $options = array(); // MULTI-select does not has an internal label a drop-down list option if ($display_filter_as != 6) { if ($label_filter == -1) { // *** e.g. BACKEND ITEMS MANAGER custom filter $filter->html = '<span class="' . $filter->parameters->get('label_filter_css' . $_s, 'label') . '">' . $filter->label . '</span>'; $first_option_txt = ''; } else { if ($label_filter == 2) { $first_option_txt = $filter->label; } else { $first_option_txt = $filter->parameters->get('filter_usefirstoption' . $_s, 0) ? $filter->parameters->get('filter_firstoptiontext' . $_s, 'FLEXI_ALL') : 'FLEXI_ANY'; $first_option_txt = JText::_($first_option_txt); } } $options[] = JHTML::_('select.option', '', !$first_option_txt ? '-' : '- ' . $first_option_txt . ' -'); } foreach ($results as $result) { if (!strlen($result->value)) { continue; } $options[] = JHTML::_('select.option', $result->value, $result->text, 'value', 'text', $disabled = $faceted_filter == 2 && !$result->found); } // Make use of select2 lib flexicontent_html::loadFramework('select2'); $classes = " use_select2_lib"; $extra_param = ''; // MULTI-select: special label and prompts if ($display_filter_as == 6) { //$classes .= ' fc_label_internal fc_prompt_internal'; $classes .= ' fc_prompt_internal'; // Add field's LABEL internally or click to select PROMPT (via js) $_inner_lb = $label_filter == 2 ? $filter->label : JText::_('FLEXI_CLICK_TO_LIST'); // Add type to filter PROMPT (via js) //$extra_param = ' data-fc_label_text="'.flexicontent_html::escapeJsText($_inner_lb,'s').'"'; $extra_param = ' placeholder="' . flexicontent_html::escapeJsText($_inner_lb, 's') . '"'; $extra_param .= ' data-fc_prompt_text="' . flexicontent_html::escapeJsText(JText::_('FLEXI_TYPE_TO_FILTER'), 's') . '"'; } // Create HTML tag attributes $attribs_str = ' class="fc_field_filter' . $classes . '" ' . $extra_param; $attribs_str .= $display_filter_as == 6 ? ' multiple="multiple" size="20" ' : ''; if ($extra_attribs = $filter->parameters->get('filter_extra_attribs' . $_s, '')) { $attribs_str .= $extra_attribs; } //$attribs_str .= ($display_filter_as==0 || $display_filter_as==6) ? ' onchange="document.getElementById(\''.$formName.'\').submit();"' : ''; if ($display_filter_as == 6 && $combine_tip) { $filter->html .= ' <span class="fc_filter_tip_inline badge badge-info">' . JText::_(!$require_all_param ? 'FLEXI_ANY_OF' : 'FLEXI_ALL_OF') . '</span> '; } if ($display_filter_as == 0) { $filter->html .= JHTML::_('select.genericlist', $options, $filter_ffname, $attribs_str, 'value', 'text', $value, $filter_ffid); } else { if ($display_filter_as == 6) { $filter->html .= JHTML::_('select.genericlist', $options, $filter_ffname . '[]', $attribs_str, 'value', 'text', $value, $filter_ffid); } else { $filter->html .= JHTML::_('select.genericlist', $options, $filter_ffname . '[1]', $attribs_str, 'value', 'text', @$value[1], $filter_ffid . '1'); $filter->html .= '<span class="fc_range"></span>'; $filter->html .= JHTML::_('select.genericlist', $options, $filter_ffname . '[2]', $attribs_str, 'value', 'text', @$value[2], $filter_ffid . '2'); } } break; case 1: case 3: case 7: case 8: // (TODO: autocomplete) ... 1: Text input, 3: Dual text input (value range), both of these can be JS date calendars, 7: Slider, 8: Slider range if (!$isSlider) { $_inner_lb = $label_filter == 2 ? $filter->label : JText::_($isDate ? 'FLEXI_CLICK_CALENDAR' : ''); $_inner_lb = flexicontent_html::escapeJsText($_inner_lb, 's'); //$attribs_str = ' class="fc_field_filter fc_label_internal '.($isDate ? 'fc_iscalendar' : '').'" data-fc_label_text="'.$_inner_lb.'"'; //$attribs_arr = array('class'=>'fc_field_filter fc_label_internal '.($isDate ? 'fc_iscalendar' : '').'', 'data-fc_label_text' => $_inner_lb ); $attribs_str = ' class="fc_field_filter ' . ($isDate ? 'fc_iscalendar' : '') . '" placeholder="' . $_inner_lb . '"'; $attribs_arr = array('class' => 'fc_field_filter ' . ($isDate ? 'fc_iscalendar' : '') . '', 'placeholder' => $_inner_lb); } else { $attribs_str = ""; $value1 = $display_filter_as == 8 ? @$value[1] : $value; $value2 = @$value[2]; if ($isSlider && $slider_display_config == 1) { $start = $min = 0; $end = $max = -1; $step = 1; $step_values = array(0 => "''"); $step_labels = array(0 => JText::_('FLEXI_ANY')); $i = 1; foreach ($results as $result) { if (!strlen($result->value)) { continue; } $step_values[] = "'" . $result->value . "'"; $step_labels[] = $result->text; if ($result->value == $value1) { $start = $i; } if ($result->value == $value2) { $end = $i; } $i++; } // Set max according considering the skipped empty values $max = $i - 1 + ($display_filter_as == 7 ? 0 : 1); //count($results)-1; if ($end == -1) { $end = $max; } // Set end to last element if it was not set if ($display_filter_as == 8) { $step_values[] = "''"; $step_labels[] = JText::_('FLEXI_ANY'); } $step_range = "step: 1,\n\t\t\t\t\t\t\trange: {'min': " . $min . ", 'max': " . $max . "},"; } else { if ($isSlider) { $custom_range = $filter->parameters->get('slider_custom_range' . $_s, "'min': '', '25%': 500, '50%': 2000, '75%': 10000, 'max': ''"); $custom_labels = preg_split("/\\s*##\\s*/u", $filter->parameters->get('slider_custom_labels' . $_s, 'label_any ## label_500 ## label_2000 ## label_10000 ## label_any')); if ($filter->parameters->get('slider_custom_labels_jtext' . $_s, 0)) { foreach ($custom_labels as $i => $custom_label) { $custom_labels[$i] = JText::_($custom_label); } // Language filter the custom labels } $custom_vals = json_decode('{' . str_replace("'", '"', $custom_range) . '}', true); if (!$custom_vals) { $filter->html = ' <div class="alert"> Bad syntax for custom range for slider filter: ' . $filter->label . "\n\t\t\t\t\t\t\t\tEXAMPLE: <br/> 'min': 0, '25%': 500, '50%': 2000, '75%': 10000, 'max': 50000" . ' </div>'; break; } if (!strlen($custom_vals['min'])) { $custom_vals['min'] = "''"; } if (!strlen($custom_vals['max'])) { $custom_vals['max'] = "''"; } $start = 0; $end = count($custom_vals) - 1; $step_values = $custom_vals; $step_labels =& $custom_labels; $i = 0; $set_start = strlen($value1) > 0; $set_end = strlen($value1) > 0; foreach ($custom_vals as $n => $custom_val) { if ($set_start && $custom_val == $value1) { $start = $i; } if ($set_end && $custom_val == $value2) { $end = $i; } $custom_vals[$n] = $i++; } $step_range = ' snap: true, range: ' . json_encode($custom_vals) . ', '; } } flexicontent_html::loadFramework('nouislider'); $left_no = $display_filter_as == 7 ? '' : '1'; $rght_no = '2'; // sometimes unused $js = "\n\t\t\t\t\tjQuery(document).ready(function(){\n\t\t\t\t\t\tvar slider = document.getElementById('" . $filter_ffid . "_nouislider');\n\t\t\t\t\t\t\n\t\t\t\t\t\tvar input1 = document.getElementById('" . $filter_ffid . $left_no . "');\n\t\t\t\t\t\tvar input2 = document.getElementById('" . $filter_ffid . $rght_no . "');\n\t\t\t\t\t\tvar isSingle = " . ($display_filter_as == 7 ? '1' : '0') . ";\n\t\t\t\t\t\t\n\t\t\t\t\t\tvar step_values = [" . implode(', ', $step_values) . "];\n\t\t\t\t\t\tvar step_labels = [\"" . implode('", "', array_map('addslashes', $step_labels)) . "\"];\n\t\t\t\t\t\t\n\t\t\t\t\t\tnoUiSlider.create(slider, {" . ($display_filter_as == 7 ? "\n\t\t\t\t\t\t\t\tstart: " . $start . ",\n\t\t\t\t\t\t\t\tconnect: false,\n\t\t\t\t\t\t\t" : "\n\t\t\t\t\t\t\t\tstart: [" . $start . ", " . $end . "],\n\t\t\t\t\t\t\t\tconnect: true,\n\t\t\t\t\t\t\t") . "\n\t\t\t\t\t\t\t\t" . $step_range . "\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\n\t\t\t\t\t\tvar tipHandles = slider.getElementsByClassName('noUi-handle'),\n\t\t\t\t\t\ttooltips = [];\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Add divs to the slider handles.\n\t\t\t\t\t\tfor ( var i = 0; i < tipHandles.length; i++ ){\n\t\t\t\t\t\t\ttooltips[i] = document.createElement('span');\n\t\t\t\t\t\t\ttipHandles[i].appendChild(tooltips[i]);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\ttooltips[i].className += 'fc-sliderTooltip'; // Add a class for styling\n\t\t\t\t\t\t\ttooltips[i].innerHTML = '<span></span>'; // Add additional markup\n\t\t\t\t\t\t\ttooltips[i] = tooltips[i].getElementsByTagName('span')[0]; // Replace the tooltip reference with the span we just added\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t// When the slider changes, display the value in the tooltips and set it into the input form elements\n\t\t\t\t\t\tslider.noUiSlider.on('update', function( values, handle ) {\n\t\t\t\t\t\t\tvar value = parseInt(values[handle]);\n\t\t\t\t\t\t\tvar i = value;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif ( handle ) {\n\t\t\t\t\t\t\t\tinput2.value = typeof step_values[value] !== 'undefined' ? step_values[value] : value;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tinput1.value = typeof step_values[value] !== 'undefined' ? step_values[value] : value;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar tooltip_text = typeof step_labels[value] !== 'undefined' ? step_labels[value] : value;\n\t\t\t\t\t\t\tvar max_len = 36;\n\t\t\t\t\t\t\ttooltips[handle].innerHTML = tooltip_text.length > max_len+4 ? tooltip_text.substring(0, max_len)+' ...' : tooltip_text;\n\t\t\t\t\t\t\tvar left = jQuery(tooltips[handle]).closest('.noUi-origin').position().left;\n\t\t\t\t\t\t\tvar width = jQuery(tooltips[handle]).closest('.noUi-base').width();\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//window.console.log ('handle: ' + handle + ', left : ' + left + ', width : ' + width);\n\t\t\t\t\t\t\tif (isSingle) {\n\t\t\t\t\t\t\t\tleft<(50/100)*width ?\n\t\t\t\t\t\t\t\t\tjQuery(tooltips[handle]).parent().removeClass('fc-left').addClass('fc-right') :\n\t\t\t\t\t\t\t\t\tjQuery(tooltips[handle]).parent().removeClass('fc-right').addClass('fc-left');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (handle) {\n\t\t\t\t\t\t\t\tleft<=(76/100)*width ?\n\t\t\t\t\t\t\t\t\tjQuery(tooltips[handle]).parent().removeClass('fc-left').addClass('fc-right') :\n\t\t\t\t\t\t\t\t\tjQuery(tooltips[handle]).parent().removeClass('fc-right').addClass('fc-left');\n\t\t\t\t\t\t\t\tleft<=(49/100)*width ?\n\t\t\t\t\t\t\t\t\tjQuery(tooltips[handle]).parent().addClass('fc-bottom') :\n\t\t\t\t\t\t\t\t\tjQuery(tooltips[handle]).parent().removeClass('fc-bottom');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tleft>=(24/100)*width ?\n\t\t\t\t\t\t\t\t\tjQuery(tooltips[handle]).parent().removeClass('fc-right').addClass('fc-left') :\n\t\t\t\t\t\t\t\t\tjQuery(tooltips[handle]).parent().removeClass('fc-left').addClass('fc-right');\n\t\t\t\t\t\t\t\tleft>=(51/100)*width ?\n\t\t\t\t\t\t\t\t\tjQuery(tooltips[handle]).parent().addClass('fc-bottom') :\n\t\t\t\t\t\t\t\t\tjQuery(tooltips[handle]).parent().removeClass('fc-bottom');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Handle form autosubmit\n\t\t\t\t\t\tslider.noUiSlider.on('change', function() {\n\t\t\t\t\t\t\tvar slider = jQuery('#" . $filter_ffid . "_nouislider');\n\t\t\t\t\t\t\tvar jform = slider.closest('form');\n\t\t\t\t\t\t\tvar form = jform.get(0);\n\t\t\t\t\t\t\tadminFormPrepare(form, parseInt(jform.attr('data-fc-autosubmit')));\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\n\t\t\t\t\t\tinput1.addEventListener('change', function(){\n\t\t\t\t\t\t\tvar value = 0; // default is first value = empty\n\t\t\t\t\t\t\tfor(var i=1; i<step_values.length-1; i++) {\n\t\t\t\t\t\t\t\tif (step_values[i] == this.value) { value=i; break; }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tslider.noUiSlider.set([value, null]);\n\t\t\t\t\t\t});\n\t\t\t\t\t\t" . ($display_filter_as == 8 ? "\n\t\t\t\t\t\tinput2.addEventListener('change', function(){\n\t\t\t\t\t\t\tvar value = step_values.length-1; // default is last value = empty\n\t\t\t\t\t\t\tfor(var i=1; i<step_values.length-1; i++) {\n\t\t\t\t\t\t\t\tif (step_values[i] == this.value) { value=i; break; }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tslider.noUiSlider.set([null, value]);\n\t\t\t\t\t\t});\n\t\t\t\t\t\t" : "") . "\n\t\t\t\t\t});\n\t\t\t\t"; JFactory::getDocument()->addScriptDeclaration($js); //JFactory::getDocument()->addStyleDeclaration(""); } if ($display_filter_as == 1 || $display_filter_as == 7) { if ($isDate && !$isSlider) { $filter->html .= ' <span class="fc_filter_element"> ' . FlexicontentFields::createCalendarField($value, $allowtime = 0, $filter_ffname, $filter_ffid, $attribs_arr) . ' </span>'; } else { $filter->html .= ($isSlider ? '<div id="' . $filter_ffid . '_nouislider" class="fcfilter_with_nouislider"></div><div class="fc_slider_input_box">' : '') . ' <span class="fc_filter_element"> <input id="' . $filter_ffid . '" name="' . $filter_ffname . '" ' . $attribs_str . ' type="text" size="' . $size . '" value="' . @$value . '" /> </span> ' . ($isSlider ? '</div>' : ''); } } else { if ($isDate && !$isSlider) { $filter->html .= ' <span class="fc_filter_element"> ' . FlexicontentFields::createCalendarField(@$value[1], $allowtime = 0, $filter_ffname . '[1]', $filter_ffid . '1', $attribs_arr) . ' </span> <span class="fc_range"></span> <span class="fc_filter_element"> ' . FlexicontentFields::createCalendarField(@$value[2], $allowtime = 0, $filter_ffname . '[2]', $filter_ffid . '2', $attribs_arr) . ' </span>'; } else { $size = (int) ($size / 2); $filter->html .= ($isSlider ? '<div id="' . $filter_ffid . '_nouislider" class="fcfilter_with_nouislider"></div><div class="fc_slider_input_box">' : '') . ' <span class="fc_filter_element"> <input name="' . $filter_ffname . '[1]" ' . $attribs_str . ' id="' . $filter_ffid . '1" type="text" size="' . $size . '" value="' . @$value[1] . '" /> </span> <span class="fc_range"></span> <span class="fc_filter_element"> <input name="' . $filter_ffname . '[2]" ' . $attribs_str . ' id="' . $filter_ffid . '2" type="text" size="' . $size . '" value="' . @$value[2] . '" /> </span> ' . ($isSlider ? '</div>' : ''); } } break; case 4: case 5: // 4: radio (single value selectable), 5: checkbox (multiple values selectable) $lf_min = 10; // add parameter for this ? $add_lf = count($results) >= $lf_min; if ($add_lf) { flexicontent_html::loadFramework('mCSB'); } $clear_values = 0; $value_style = $clear_values ? 'float:left; clear:both;' : ''; $i = 0; $checked = $display_filter_as == 5 ? !count($value) || !strlen(reset($value)) : !strlen($value); $checked_attr = $checked ? 'checked="checked"' : ''; $checked_class = $checked ? 'fc_highlight' : ''; $checked_class_li = $checked ? ' fc_checkradio_checked' : ''; $filter->html .= '<div class="fc_checkradio_group_wrapper fc_add_scroller' . ($add_lf ? ' fc_list_filter_wrapper' : '') . '">'; $filter->html .= '<ul class="fc_field_filter fc_checkradio_group' . ($add_lf ? ' fc_list_filter' : '') . '">'; $filter->html .= '<li class="fc_checkradio_option fc_checkradio_special' . $checked_class_li . '" style="' . $value_style . '">'; $filter->html .= $label_filter == 2 ? ' <span class="fc_filter_label_inline">' . $filter->label . '</span> ' : ''; if ($display_filter_as == 4) { $filter->html .= ' <input href="javascript:;" onchange="fc_toggleClassGrp(this, \'fc_highlight\', 1);" '; $filter->html .= ' id="' . $filter_ffid . $i . '" type="radio" name="' . $filter_ffname . '" '; $filter->html .= ' value="" ' . $checked_attr . ' class="fc_checkradio" />'; } else { $filter->html .= ' <input href="javascript:;" onchange="fc_toggleClass(this, \'fc_highlight\', 1);" '; $filter->html .= ' id="' . $filter_ffid . $i . '" type="checkbox" name="' . $filter_ffname . '[' . $i . ']" '; $filter->html .= ' value="" ' . $checked_attr . ' class="fc_checkradio" />'; } $tooltip_class = FLEXI_J30GE ? ' hasTooltip' : ' hasTip'; $tooltip_title = flexicontent_html::getToolTip('FLEXI_REMOVE_ALL', '', $translate = 1, $escape = 1); $filter->html .= '<label class="' . $checked_class . $tooltip_class . '" for="' . $filter_ffid . $i . '" ' . ' title="' . $tooltip_title . '" ' . ($checked ? ' style="display:none!important;" ' : ' style="background:none!important; padding-left:0px!important;" ') . '>' . '<span class="fc_delall_filters"></span>'; $filter->html .= '</label> ' . ($combine_tip ? ' <span class="fc_filter_tip_inline badge badge-info">' . JText::_(!$require_all_param ? 'FLEXI_ANY_OF' : 'FLEXI_ALL_OF') . '</span> ' : '') . ' </li>'; $i++; foreach ($results as $result) { if (!strlen($result->value)) { continue; } $checked = $display_filter_as == 5 ? in_array($result->value, $value) : $result->value == $value; $checked_attr = $checked ? ' checked=checked ' : ''; $disable_attr = $faceted_filter == 2 && !$result->found ? ' disabled=disabled ' : ''; $checked_class = $checked ? 'fc_highlight' : ''; $checked_class .= $faceted_filter == 2 && !$result->found ? ' fcdisabled ' : ''; $checked_class_li = $checked ? ' fc_checkradio_checked' : ''; $filter->html .= '<li class="fc_checkradio_option' . $checked_class_li . '" style="' . $value_style . '">'; // *** PLACE image before label (and e.g. (default) above the label) if ($filter_vals_display == 2) { $filter->html .= "<span class='fc_filter_val_img'><img onclick=\"jQuery(this).closest('li').find('input').click();\" src='" . $result->image_url . "' /></span>"; } if ($display_filter_as == 4) { $filter->html .= ' <input href="javascript:;" onchange="fc_toggleClassGrp(this, \'fc_highlight\');" '; $filter->html .= ' id="' . $filter_ffid . $i . '" type="radio" name="' . $filter_ffname . '" '; $filter->html .= ' value="' . $result->value . '" ' . $checked_attr . $disable_attr . ' class="fc_checkradio" />'; } else { $filter->html .= ' <input href="javascript:;" onchange="fc_toggleClass(this, \'fc_highlight\');" '; $filter->html .= ' id="' . $filter_ffid . $i . '" type="checkbox" name="' . $filter_ffname . '[' . $i . ']" '; $filter->html .= ' value="' . $result->value . '" ' . $checked_attr . $disable_attr . ' class="fc_checkradio" />'; } $filter->html .= '<label class="fc_filter_val fc_cleared ' . $checked_class . '" for="' . $filter_ffid . $i . '">'; if ($filter_vals_display == 0 || $filter_vals_display == 2) { $filter->html .= "<span class='fc_filter_val_lbl'>" . $result->text . "</span>"; } else { if ($add_usage_counters && $result->found) { $filter->html .= "<span class='fc_filter_val_lbl'>(" . $result->found . ")</span>"; } } $filter->html .= '</label>'; // *** PLACE image after label (and e.g. (default) next to the label) if ($filter_vals_display == 1) { $filter->html .= "<span class='fc_filter_val_img'>" . "<img onclick=\"jQuery(this).closest('li').find('input').click();\" src='" . $result->image_url . "' />" . "</span>"; } $filter->html .= '</li>'; $i++; } $filter->html .= '</ul>'; $filter->html .= '</div>'; break; } if ($print_logging_info) { $current_filter_creation = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10; $flt_active_count = isset($filters_where) ? count($filters_where) : 0; $faceted_str = array(0 => 'non-FACETED ', 1 => 'FACETED: current view (cacheable) ', 2 => 'FACETED: current filters:' . " (" . $flt_active_count . ' active) '); $fc_run_times['create_filter'][$filter->name] = $current_filter_creation + (!empty($fc_run_times['create_filter'][$filter->name]) ? $fc_run_times['create_filter'][$filter->name] : 0); if (isset($fc_run_times['_create_filter_init'])) { $fc_run_times['create_filter'][$filter->name] -= $fc_run_times['_create_filter_init']; $fc_run_times['create_filter_init'] = $fc_run_times['_create_filter_init'] + (!empty($fc_run_times['create_filter_init']) ? $fc_run_times['create_filter_init'] : 0); unset($fc_run_times['_create_filter_init']); } $fc_run_times['create_filter_type'][$filter->name] = $faceted_str[$faceted_filter]; } //$filter_display_typestr = array(0=>'Single Select', 1=>'Single Text', 2=>'Range Dual Select', 3=>'Range Dual Text', 4=>'Radio Buttons', 5=>'Checkbox Buttons'); //echo "FIELD name: <b>". $filter->name ."</b> Field Type: <b>". $filter->field_type."</b> Filter Type: <b>". $filter_display_typestr[$display_filter_as] ."</b> (".$display_filter_as.") ".sprintf(" %.2f s",$current_filter_creation/1000000)." <br/>"; }