diff options
author | Antonio Gallo <tonicucoz@gmail.com> | 2011-12-03 12:30:25 +0000 |
---|---|---|
committer | Antonio Gallo <tonicucoz@gmail.com> | 2011-12-03 12:30:25 +0000 |
commit | d30d70afd95653bb356603612db6519d6e6ebead (patch) | |
tree | 8ca2f2a7f24eeea1203b0042015d25f18f97496b /h-source/Library/Model | |
parent | f56fa1fc50484d99906a0a22e2931f9c1fe708b6 (diff) |
improved i18n
Diffstat (limited to 'h-source/Library/Model')
-rwxr-xr-x | h-source/Library/Model/Base.php | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/h-source/Library/Model/Base.php b/h-source/Library/Model/Base.php index c89abcd..57d769a 100755 --- a/h-source/Library/Model/Base.php +++ b/h-source/Library/Model/Base.php @@ -236,7 +236,7 @@ abstract class Model_Base //method to create the where clause of the select query from the $this->where array //$level: level of the ricorsion //$whereClauseLevel: array containing the field=>value statements of the where clause. If $whereClause = null than $this->where is considered - public function createWhereClause($level = 0, $whereClauseLevel = null) + public function createWhereClause($level = 0, $whereClauseLevel = null, $operator = null) { $whereClause = null; $whereClauseArray = array(); @@ -247,7 +247,19 @@ abstract class Model_Base { if (is_array($value)) { - $newValue = $this->createWhereClause($level+1, $value); + if (strstr($field,"OR")) + { + $op = " OR "; + } + else if (strstr($field,"AND")) + { + $op = " AND "; + } + else + { + $op = null; + } + $newValue = $this->createWhereClause($level+1, $value, $op); if (isset($newValue)) $whereClauseArray[] = $newValue; } else @@ -283,7 +295,14 @@ abstract class Model_Base } } //get the logic operator at the current level - $logicOper = isset($this->logicalOperators[$level]) ? ' '.$this->logicalOperators[$level].' ' : ' AND '; + if (isset($operator)) + { + $logicOper = $operator; + } + else + { + $logicOper = isset($this->logicalOperators[$level]) ? ' '.$this->logicalOperators[$level].' ' : ' AND '; + } $whereClause = !empty($whereClauseArray) ? implode($logicOper,$whereClauseArray) : null; $whereClause = (isset($whereClause) and $level>0) ? '('.$whereClause.')' : $whereClause; return $whereClause; |