Last active
August 29, 2015 14:02
-
-
Save markphi2013/e6c862ca594ba6430ae5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function checkFilterFields($filter) | |
{ | |
$filterErrors = array(); | |
$filter['filter_param'] = array_filter( | |
$filter['filter_param'], | |
function($filterParam) use (&$filterErrors) { | |
if (in_array("", $filterParam)) { | |
if ($filterParam[1] == "") { | |
$filterErrors[] = "first filter field is missing"; | |
} else if ($filterParam[2] == "") { | |
$filterErrors[] = $filterParam[1]; | |
} else { | |
//$filterErrors[] = $filterParam[1]." ".$filterParam[2]; | |
$filterErrors[] = localizedValue($filterParam[1])." ".localizedValue($filterParam[2]); | |
} | |
return false; //will filter out | |
} | |
return true; // will keep this filter | |
}); | |
$filterCheck['filter'] = $filter; | |
$filterCheck['filterErrors'] = $filterErrors; | |
return $filterCheck; | |
} | |
public function localizedValue(&$filterParam) | |
{ | |
$t = array( | |
'not-with' => __('not with'), | |
'start-with' => __('start with'), | |
'phone' => __('phone'), | |
'tagged' => __('tagged')); | |
$localizedLabel = $t[$filterParam]; | |
//print_r($localizedLabel); | |
//$checkedFilterErrorsValue = str_replace('-', ' ', $checkedFilterErrors); | |
return $localizedLabel; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment