mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-23 21:29:58 +09:00
merge from 1.7.3.5(r13153:r13167)
git-svn-id: http://xe-core.googlecode.com/svn/trunk@13168 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
cc47d2b247
commit
2d3f149b5a
2042 changed files with 129266 additions and 126243 deletions
|
|
@ -1,87 +1,119 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /classes/db/queryparts/condition
|
||||
* @version 0.1
|
||||
*/
|
||||
class ConditionGroup
|
||||
{
|
||||
|
||||
/**
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /classes/db/queryparts/condition
|
||||
* @version 0.1
|
||||
* condition list
|
||||
* @var array
|
||||
*/
|
||||
class ConditionGroup {
|
||||
/**
|
||||
* condition list
|
||||
* @var array
|
||||
*/
|
||||
var $conditions;
|
||||
/**
|
||||
* pipe can use 'and', 'or'...
|
||||
* @var string
|
||||
*/
|
||||
var $pipe;
|
||||
var $conditions;
|
||||
|
||||
var $_group;
|
||||
var $_show;
|
||||
/**
|
||||
* pipe can use 'and', 'or'...
|
||||
* @var string
|
||||
*/
|
||||
var $pipe;
|
||||
var $_group;
|
||||
var $_show;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param array $conditions
|
||||
* @param string $pipe
|
||||
* @return void
|
||||
*/
|
||||
function ConditionGroup($conditions, $pipe = "") {
|
||||
$this->conditions = array();
|
||||
foreach($conditions as $condition){
|
||||
if($condition->show())
|
||||
$this->conditions[] = $condition;
|
||||
}
|
||||
if(count($this->conditions) === 0) $this->_show = false;
|
||||
else $this->_show = true;
|
||||
|
||||
$this->pipe = $pipe;
|
||||
/**
|
||||
* constructor
|
||||
* @param array $conditions
|
||||
* @param string $pipe
|
||||
* @return void
|
||||
*/
|
||||
function ConditionGroup($conditions, $pipe = "")
|
||||
{
|
||||
$this->conditions = array();
|
||||
foreach($conditions as $condition)
|
||||
{
|
||||
if($condition->show())
|
||||
{
|
||||
$this->conditions[] = $condition;
|
||||
}
|
||||
}
|
||||
if(count($this->conditions) === 0)
|
||||
{
|
||||
$this->_show = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_show = true;
|
||||
}
|
||||
|
||||
function show(){
|
||||
return $this->_show;
|
||||
}
|
||||
$this->pipe = $pipe;
|
||||
}
|
||||
|
||||
function setPipe($pipe){
|
||||
if($this->pipe !== $pipe) $this->_group = null;
|
||||
$this->pipe = $pipe;
|
||||
}
|
||||
function show()
|
||||
{
|
||||
return $this->_show;
|
||||
}
|
||||
|
||||
/**
|
||||
* value to string
|
||||
* @param boolean $with_value
|
||||
* @return string
|
||||
*/
|
||||
function toString($with_value = true){
|
||||
if(!isset($this->_group)){
|
||||
function setPipe($pipe)
|
||||
{
|
||||
if($this->pipe !== $pipe)
|
||||
{
|
||||
$this->_group = null;
|
||||
}
|
||||
$this->pipe = $pipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* value to string
|
||||
* @param boolean $with_value
|
||||
* @return string
|
||||
*/
|
||||
function toString($with_value = true)
|
||||
{
|
||||
if(!isset($this->_group))
|
||||
{
|
||||
$cond_indx = 0;
|
||||
$group = '';
|
||||
$group = '';
|
||||
|
||||
foreach($this->conditions as $condition){
|
||||
if($cond_indx === 0) $condition->setPipe("");
|
||||
$group .= $condition->toString($with_value) . ' ';
|
||||
$cond_indx++;
|
||||
foreach($this->conditions as $condition)
|
||||
{
|
||||
if($cond_indx === 0)
|
||||
{
|
||||
$condition->setPipe("");
|
||||
}
|
||||
$group .= $condition->toString($with_value) . ' ';
|
||||
$cond_indx++;
|
||||
}
|
||||
|
||||
if($this->pipe !== "" && trim($group) !== ''){
|
||||
$group = $this->pipe . ' (' . $group . ')';
|
||||
}
|
||||
if($this->pipe !== "" && trim($group) !== '')
|
||||
{
|
||||
$group = $this->pipe . ' (' . $group . ')';
|
||||
}
|
||||
|
||||
$this->_group = $group;
|
||||
}
|
||||
return $this->_group;
|
||||
}
|
||||
|
||||
/**
|
||||
* return argument list
|
||||
* @return array
|
||||
*/
|
||||
function getArguments(){
|
||||
$args = array();
|
||||
foreach($this->conditions as $condition){
|
||||
$arg = $condition->getArgument();
|
||||
if($arg) $args[] = $arg;
|
||||
}
|
||||
return $args;
|
||||
$this->_group = $group;
|
||||
}
|
||||
return $this->_group;
|
||||
}
|
||||
?>
|
||||
|
||||
/**
|
||||
* return argument list
|
||||
* @return array
|
||||
*/
|
||||
function getArguments()
|
||||
{
|
||||
$args = array();
|
||||
foreach($this->conditions as $condition)
|
||||
{
|
||||
$arg = $condition->getArgument();
|
||||
if($arg)
|
||||
{
|
||||
$args[] = $arg;
|
||||
}
|
||||
}
|
||||
return $args;
|
||||
}
|
||||
|
||||
}
|
||||
/* End of file ConditionGroup.class.php */
|
||||
/* Location: ./classes/db/queryparts/condition/ConditionGroup.class.php */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue