Changeset View
Changeset View
Standalone View
Standalone View
core/units/helpers/search_helper.php
Show First 20 Lines • Show All 422 Lines • ▼ Show 20 Line(s) | |||||
$custom_filter = Array (); | $custom_filter = Array (); | ||||
} | } | ||||
// submit format custom_filters[prefix_special][field] | // submit format custom_filters[prefix_special][field] | ||||
$submit_filters = $this->Application->GetVar('custom_filters'); | $submit_filters = $this->Application->GetVar('custom_filters'); | ||||
if ($submit_filters) { | if ($submit_filters) { | ||||
$submit_filters = getArrayValue($submit_filters, $event->getPrefixSpecial(), $grid_name); | $submit_filters = getArrayValue($submit_filters, $event->getPrefixSpecial(), $grid_name); | ||||
if ($submit_filters) { | if ($submit_filters) { | ||||
foreach ($submit_filters as $field_name => $field_options) { | foreach ($submit_filters as $field_name => $field_options) { | ||||
Lint: CodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBrace: Expected 1 spaces after "foreach" opening bracket; 0 found | |||||
Expected 1 spaces before "foreach" closing bracket; 0 found Lint: CodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBrace: Expected 1 spaces before "foreach" closing bracket; 0 found | |||||
list ($filter_type, $field_value) = each($field_options); | $filter_type = key($field_options); | ||||
$field_value = $field_options[$filter_type]; | |||||
$is_empty = strlen(is_array($field_value) ? implode('', $field_value) : $field_value) == 0; | $is_empty = strlen(is_array($field_value) ? implode('', $field_value) : $field_value) == 0; | ||||
if ($is_empty) { | if ($is_empty) { | ||||
if (isset($custom_filter[$field_name])) { | if (isset($custom_filter[$field_name])) { | ||||
// use isset, because non-existing key will cause "php notice"! | // use isset, because non-existing key will cause "php notice"! | ||||
unset($custom_filter[$field_name][$filter_type]); // remove filter | unset($custom_filter[$field_name][$filter_type]); // remove filter | ||||
if (!$custom_filter[$field_name]) { | if (!$custom_filter[$field_name]) { | ||||
// if no filters left for field, then delete record at all | // if no filters left for field, then delete record at all | ||||
Show All 19 Lines | |||||
if (!$custom_filter) { | if (!$custom_filter) { | ||||
// in case when no filters specified, there are nothing to process | // in case when no filters specified, there are nothing to process | ||||
$this->Application->StorePersistentVar($event->getPrefixSpecial().'_custom_filter.'.$view_name, serialize($custom_filters) ); | $this->Application->StorePersistentVar($event->getPrefixSpecial().'_custom_filter.'.$view_name, serialize($custom_filters) ); | ||||
return false; | return false; | ||||
} | } | ||||
$object = $event->getObject(); // don't recall it each time in getCustomFilterSearchClause | $object = $event->getObject(); // don't recall it each time in getCustomFilterSearchClause | ||||
$grid_info = $this->Application->getUnitOption($event->Prefix.'.'.$grid_name, 'Grids'); | $grid_info = $this->Application->getUnitOption($event->Prefix.'.'.$grid_name, 'Grids'); | ||||
foreach ($custom_filter as $field_name => $field_options) { | foreach ($custom_filter as $field_name => $field_options) { | ||||
Expected 1 spaces before "foreach" closing bracket; 0 found Lint: CodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBrace: Expected 1 spaces before "foreach" closing bracket; 0 found | |||||
Expected 1 spaces after "foreach" opening bracket; 0 found Lint: CodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBrace: Expected 1 spaces after "foreach" opening bracket; 0 found | |||||
No blank line found before "foreach" control structure Lint: CodingStandard.WhiteSpace.ControlStructureSpacing.NoLineBeforeOpen: No blank line found before "foreach" control structure | |||||
list ($filter_type, $field_options) = each($field_options); | $filter_type = key($field_options); | ||||
$field_options = $field_options[$filter_type]; | |||||
alexUnsubmitted Done ReplyRemove. alex: Remove. | |||||
$field_options['grid_options'] = $grid_info['Fields'][$field_name]; | $field_options['grid_options'] = $grid_info['Fields'][$field_name]; | ||||
$field_options = $this->getCustomFilterSearchClause($object, $field_name, $filter_type, $field_options); | $field_options = $this->getCustomFilterSearchClause($object, $field_name, $filter_type, $field_options); | ||||
if ($field_options['value']) { | if ($field_options['value']) { | ||||
unset($field_options['grid_options']); | unset($field_options['grid_options']); | ||||
$custom_filter[$field_name][$filter_type] = $field_options; | $custom_filter[$field_name][$filter_type] = $field_options; | ||||
} | } | ||||
} | } | ||||
Show All 31 Lines | |||||
// filters not defined for given grid | // filters not defined for given grid | ||||
$cache[$cache_key] = false; | $cache[$cache_key] = false; | ||||
return false; | return false; | ||||
} | } | ||||
$range_filter_defined = false; | $range_filter_defined = false; | ||||
$custom_filter = $custom_filters[$grid_name]; | $custom_filter = $custom_filters[$grid_name]; | ||||
foreach ($custom_filter as $field_name => $field_options) { | foreach ($custom_filter as $field_name => $field_options) { | ||||
No blank line found before "foreach" control structure Lint: CodingStandard.WhiteSpace.ControlStructureSpacing.NoLineBeforeOpen: No blank line found before "foreach" control structure | |||||
Expected 1 spaces after "foreach" opening bracket; 0 found Lint: CodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBrace: Expected 1 spaces after "foreach" opening bracket; 0 found | |||||
Expected 1 spaces before "foreach" closing bracket; 0 found Lint: CodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBrace: Expected 1 spaces before "foreach" closing bracket; 0 found | |||||
list ($filter_type, $field_options) = each($field_options); | $filter_type = key($field_options); | ||||
$field_options = $field_options[$filter_type]; | |||||
if (strpos($filter_type, 'range') === false) { | if (strpos($filter_type, 'range') === false) { | ||||
continue; | continue; | ||||
} | } | ||||
$to_value = (string)$field_options['submit_value']['to']; | $to_value = (string)$field_options['submit_value']['to']; | ||||
if ($to_value !== '') { | if ($to_value !== '') { | ||||
$range_filter_defined = true; | $range_filter_defined = true; | ||||
▲ Show 20 Lines • Show All 332 Lines • Show Last 20 Lines |
Expected 1 spaces after "foreach" opening bracket; 0 found