Created
March 13, 2012 14:46
-
-
Save tomasfejfar/2029216 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
<?php | |
class Crud_Filter_ValueProcessor_Text extends Crud_Filter_ValueProcessor_Abstract | |
{ | |
public function isValidFormat($value) | |
{ | |
return true; | |
} | |
public function process($column, $value) { | |
if ($column->isExactMatch()) { | |
strtr($value, '*', ''); | |
return new Crud_Filter_ValueProcessor_Result($column . ' = ?', $value); | |
} else { | |
$paramValue = str_replace('*', '%', $value); | |
if (strpos($value, '*') === false) { | |
$paramValue = '%' . $value . '%'; | |
} | |
return new Crud_Filter_ValueProcessor_Result($column . ' LIKE ?', $value); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment