ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
arWhere Class Reference

Class arWhere. More...

+ Inheritance diagram for arWhere:
+ Collaboration diagram for arWhere:

Public Member Functions

 asSQLStatement (ActiveRecord $ar)
 Build WHERE Statement More...
 
 setFieldname ($fieldname)
 
 getFieldname ()
 
 setOperator ($operator)
 
 getOperator ()
 
 setValue ($value)
 
 getValue ()
 
 setType ($type)
 
 getType ()
 
 setStatement ($statement)
 
 getStatement ()
 
 setLink ($link)
 
 getLink ()
 
- Public Member Functions inherited from arStatement
 asSQLStatement (ActiveRecord $ar)
 
 getTableNameAs ()
 
 setTableNameAs ($table_name_as)
 

Data Fields

const TYPE_STRING = 1
 
const TYPE_REGULAR = 2
 

Protected Attributes

 $type = self::TYPE_REGULAR
 
 $fieldname = ''
 
 $value
 
 $operator='='
 
 $statement = ''
 
 $link = 'AND'
 
- Protected Attributes inherited from arStatement
 $table_name_as = ''
 

Detailed Description

Class arWhere.

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Version
2.0.7

Definition at line 10 of file class.arWhere.php.

Member Function Documentation

◆ asSQLStatement()

arWhere::asSQLStatement ( ActiveRecord  $ar)

Build WHERE Statement

Parameters
ActiveRecord$ar
Exceptions
arException
Returns
string

Definition at line 48 of file class.arWhere.php.

References $statement, $type, $value, ActiveRecord\getArConnector(), ActiveRecord\getArFieldList(), ActiveRecord\getConnectorContainerName(), getFieldname(), getOperator(), getStatement(), getType(), getValue(), setOperator(), and setStatement().

48  {
49  if ($this->getType() == self::TYPE_REGULAR) {
50  $arField = $ar->getArFieldList()->getFieldByName($this->getFieldname());
51  if ($arField instanceof arField) {
52  $type = $arField->getFieldType();
53  $statement = $ar->getConnectorContainerName() . '.' . $this->getFieldname();
54  } else {
55  $statement = $this->getFieldname();
56  }
57 
58  if (is_array($this->getValue())) {
59  if (in_array($this->getOperator(), array( 'IN', 'NOT IN', 'NOTIN' ))) {
60  $statement .= ' ' . $this->getOperator() . ' (';
61  } else {
62  $statement .= ' IN (';
63  }
64  $values = array();
65  foreach ($this->getValue() as $value) {
66  $values[] = $ar->getArConnector()->quote($value, $type);
67  }
68  $statement .= implode(', ', $values);
69  $statement .= ')';
70  } else {
71  if ($this->getValue() === NULL) {
72  $operator = 'IS';
73  if (in_array($this->getOperator(), array('IS', 'IS NOT'))) {
74  $operator = $this->getOperator();
75  }
76  $this->setOperator($operator);
77  }
78  $statement .= ' ' . $this->getOperator();
79  $statement .= ' ' . $ar->getArConnector()->quote($this->getValue(), $type);
80  }
81  $this->setStatement($statement);
82  }
83 
84  return $this->getStatement();
85  }
Class arField.
setStatement($statement)
setOperator($operator)
+ Here is the call graph for this function:

◆ getFieldname()

arWhere::getFieldname ( )
Returns
string

Definition at line 99 of file class.arWhere.php.

References $fieldname.

Referenced by asSQLStatement().

99  {
100  return $this->fieldname;
101  }
+ Here is the caller graph for this function:

◆ getLink()

arWhere::getLink ( )
Returns
string

Definition at line 179 of file class.arWhere.php.

References $link.

179  {
180  return $this->link;
181  }

◆ getOperator()

arWhere::getOperator ( )
Returns
string

Definition at line 115 of file class.arWhere.php.

Referenced by asSQLStatement().

115  {
116  return $this->operator;
117  }
+ Here is the caller graph for this function:

◆ getStatement()

arWhere::getStatement ( )
Returns
string

Definition at line 163 of file class.arWhere.php.

References $statement.

Referenced by asSQLStatement().

163  {
164  return $this->statement;
165  }
+ Here is the caller graph for this function:

◆ getType()

arWhere::getType ( )
Returns
int

Definition at line 147 of file class.arWhere.php.

References $type.

Referenced by asSQLStatement().

147  {
148  return $this->type;
149  }
+ Here is the caller graph for this function:

◆ getValue()

arWhere::getValue ( )
Returns
mixed

Definition at line 131 of file class.arWhere.php.

References $value.

Referenced by asSQLStatement().

131  {
132  return $this->value;
133  }
+ Here is the caller graph for this function:

◆ setFieldname()

arWhere::setFieldname (   $fieldname)
Parameters
string$fieldname

Definition at line 91 of file class.arWhere.php.

References $fieldname.

91  {
92  $this->fieldname = $fieldname;
93  }

◆ setLink()

arWhere::setLink (   $link)
Parameters
string$link

Definition at line 171 of file class.arWhere.php.

References $link.

171  {
172  $this->link = $link;
173  }

◆ setOperator()

arWhere::setOperator (   $operator)
Parameters
string$operator

Definition at line 107 of file class.arWhere.php.

Referenced by asSQLStatement().

107  {
108  $this->operator = $operator;
109  }
+ Here is the caller graph for this function:

◆ setStatement()

arWhere::setStatement (   $statement)
Parameters
string$statement

Definition at line 155 of file class.arWhere.php.

References $statement.

Referenced by asSQLStatement().

155  {
156  $this->statement = $statement;
157  }
+ Here is the caller graph for this function:

◆ setType()

arWhere::setType (   $type)
Parameters
int$type

Definition at line 139 of file class.arWhere.php.

References $type.

139  {
140  $this->type = $type;
141  }

◆ setValue()

arWhere::setValue (   $value)
Parameters
mixed$value

Definition at line 123 of file class.arWhere.php.

References $value.

123  {
124  $this->value = $value;
125  }

Field Documentation

◆ $fieldname

arWhere::$fieldname = ''
protected

Definition at line 21 of file class.arWhere.php.

Referenced by getFieldname(), and setFieldname().

◆ $link

arWhere::$link = 'AND'
protected

Definition at line 37 of file class.arWhere.php.

Referenced by getLink(), and setLink().

◆ $operator='='

arWhere::$operator='='
protected

Definition at line 29 of file class.arWhere.php.

◆ $statement

arWhere::$statement = ''
protected

Definition at line 33 of file class.arWhere.php.

Referenced by asSQLStatement(), getStatement(), and setStatement().

◆ $type

arWhere::$type = self::TYPE_REGULAR
protected

Definition at line 17 of file class.arWhere.php.

Referenced by asSQLStatement(), getType(), and setType().

◆ $value

arWhere::$value
protected

Definition at line 25 of file class.arWhere.php.

Referenced by asSQLStatement(), getValue(), and setValue().

◆ TYPE_REGULAR

const arWhere::TYPE_REGULAR = 2

Definition at line 13 of file class.arWhere.php.

◆ TYPE_STRING

const arWhere::TYPE_STRING = 1

Definition at line 12 of file class.arWhere.php.

Referenced by ActiveRecordList\where().


The documentation for this class was generated from the following file: