From d30d70afd95653bb356603612db6519d6e6ebead Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Sat, 3 Dec 2011 12:30:25 +0000 Subject: improved i18n --- h-source/Library/Model/Base.php | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'h-source/Library/Model/Base.php') 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; -- cgit v1.2.3