rhymix/classes/db/queryparts/condition/ConditionGroup.class.php
mosmartin 0b78e26357 Fix condition/ConditionGroup.class.php when all conditions have no value.
Add page navigation mechanism.

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0-DB@8399 201d5d3c-b55e-5fd7-737f-ddc643e51545
2011-05-27 11:39:45 +00:00

35 lines
No EOL
717 B
PHP

<?php
class ConditionGroup {
var $conditions;
var $pipe;
function ConditionGroup($conditions, $pipe = ""){
$this->conditions = $conditions;
$this->pipe = $pipe;
}
function toString(){
if($this->pipe !== "")
$group = $this->pipe .' (';
else $group = '';
$cond_indx = 0;
foreach($this->conditions as $condition){
if($condition->show()){
if($cond_indx === 0) $condition->setPipe("");
$group .= $condition->toString() . ' ';
$cond_indx++;
}
}
// If the group has no conditions in it, return ''
if($cond_indx === 0) return '';
if($this->pipe !== "")
$group .= ')';
return $group;
}
}
?>