ILIAS  release_8 Revision v8.24
arWhere Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 asSQLStatement (ActiveRecord $activeRecord, ilDBInterface $db)
 
 setFieldname (string $fieldname)
 
 getFieldname ()
 
 setOperator (string $operator)
 
 getOperator ()
 
 setValue ($value)
 
 getValue ()
 
 setType (int $type)
 
 getType ()
 
 setStatement (string $statement)
 
 getStatement ()
 
 setLink (string $link)
 
 getLink ()
 
- Public Member Functions inherited from arStatement
 asSQLStatement (ActiveRecord $activeRecord, ilDBInterface $db)
 
 getTableNameAs ()
 
 setTableNameAs (string $table_name_as)
 

Data Fields

const TYPE_STRING = 1
 
const TYPE_REGULAR = 2
 

Protected Attributes

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

Additional Inherited Members

- Protected Member Functions inherited from arStatement
 wrapFields (array $fields, ilDBInterface $db)
 
 wrapField (string $field, ilDBInterface $db)
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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 24 of file class.arWhere.php.

Member Function Documentation

◆ asSQLStatement()

arWhere::asSQLStatement ( ActiveRecord  $activeRecord,
ilDBInterface  $db 
)
Parameters
ilDBInterface$db@description Build WHERE Statement
Exceptions
arException

Reimplemented from arStatement.

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

43 : string
44 {
45 $type = null;
46 if ($this->getType() === self::TYPE_REGULAR) {
47 $arField = $activeRecord->getArFieldList()->getFieldByName($this->getFieldname());
48 $type = 'text';
49 if ($arField instanceof arField) {
50 $type = $arField->getFieldType();
51 $statement = $activeRecord->getConnectorContainerName() . '.' . $this->getFieldname();
52 } else {
53 $statement = $this->getFieldname();
54 }
55
56 if (is_array($this->getValue())) {
57 if (in_array($this->getOperator(), ['IN', 'NOT IN', 'NOTIN'])) {
58 $statement .= ' ' . $this->getOperator() . ' (';
59 } else {
60 $statement .= ' IN (';
61 }
62 $values = [];
63 foreach ($this->getValue() as $value) {
64 $values[] = $activeRecord->getArConnector()->quote($value, $type);
65 }
66 $statement .= implode(', ', $values);
67 $statement .= ')';
68 } else {
69 if ($this->getValue() === null) {
70 $operator = 'IS';
71 if (in_array($this->getOperator(), ['IS', 'IS NOT'])) {
72 $operator = $this->getOperator();
73 }
74 $this->setOperator($operator);
75 }
76 $statement .= ' ' . $this->getOperator();
77 $statement .= ' ' . $activeRecord->getArConnector()->quote($this->getValue(), $type);
78 }
80 }
81
82 return $this->getStatement();
83 }
getConnectorContainerName()
@description Return the Name of your Connector Table
Class arField.
string $statement
setStatement(string $statement)
setOperator(string $operator)
string $operator

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

+ Here is the call graph for this function:

◆ getFieldname()

arWhere::getFieldname ( )

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

90 : string
91 {
92 return $this->fieldname;
93 }
string $fieldname

References $fieldname.

Referenced by asSQLStatement().

+ Here is the caller graph for this function:

◆ getLink()

arWhere::getLink ( )

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

146 : string
147 {
148 return $this->link;
149 }
string $link

References $link.

◆ getOperator()

arWhere::getOperator ( )

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

100 : string
101 {
102 return $this->operator;
103 }

References $operator.

Referenced by asSQLStatement().

+ Here is the caller graph for this function:

◆ getStatement()

arWhere::getStatement ( )

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

136 : string
137 {
138 return $this->statement;
139 }

References $statement.

Referenced by asSQLStatement().

+ Here is the caller graph for this function:

◆ getType()

arWhere::getType ( )

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

126 : int
127 {
128 return $this->type;
129 }

References $type.

Referenced by asSQLStatement().

+ Here is the caller graph for this function:

◆ getValue()

arWhere::getValue ( )
Returns
mixed|null

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

117 {
118 return $this->value;
119 }

References $value.

Referenced by asSQLStatement().

+ Here is the caller graph for this function:

◆ setFieldname()

arWhere::setFieldname ( string  $fieldname)

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

85 : void
86 {
87 $this->fieldname = $fieldname;
88 }

References $fieldname.

◆ setLink()

arWhere::setLink ( string  $link)

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

141 : void
142 {
143 $this->link = $link;
144 }

References $link.

◆ setOperator()

arWhere::setOperator ( string  $operator)

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

95 : void
96 {
97 $this->operator = $operator;
98 }

References $operator.

Referenced by asSQLStatement().

+ Here is the caller graph for this function:

◆ setStatement()

arWhere::setStatement ( string  $statement)

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

131 : void
132 {
133 $this->statement = $statement;
134 }

References $statement.

Referenced by asSQLStatement().

+ Here is the caller graph for this function:

◆ setType()

arWhere::setType ( int  $type)

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

121 : void
122 {
123 $this->type = $type;
124 }

References $type.

◆ setValue()

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

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

108 : void
109 {
110 $this->value = $value;
111 }

References $value.

Field Documentation

◆ $fieldname

string arWhere::$fieldname = ''
protected

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

Referenced by getFieldname(), and setFieldname().

◆ $link

string arWhere::$link = 'AND'
protected

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

Referenced by getLink(), and setLink().

◆ $operator

string arWhere::$operator = '='
protected

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

Referenced by getOperator(), and setOperator().

◆ $statement

string arWhere::$statement = ''
protected

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

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

◆ $type

int arWhere::$type = self::TYPE_REGULAR
protected

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

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

◆ $value

arWhere::$value
protected

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

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

◆ TYPE_REGULAR

const arWhere::TYPE_REGULAR = 2

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

◆ TYPE_STRING

const arWhere::TYPE_STRING = 1

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

Referenced by ActiveRecordList\where().


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