ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 (mixed $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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 143 of file class.arWhere.php.

143 : string
144 {
145 return $this->link;
146 }
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 133 of file class.arWhere.php.

133 : string
134 {
135 return $this->statement;
136 }

References $statement.

Referenced by asSQLStatement().

+ Here is the caller graph for this function:

◆ getType()

arWhere::getType ( )

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

123 : int
124 {
125 return $this->type;
126 }

References $type.

Referenced by asSQLStatement().

+ Here is the caller graph for this function:

◆ getValue()

arWhere::getValue ( )
Returns
mixed|null

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

114 {
115 return $this->value;
116 }

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 138 of file class.arWhere.php.

138 : void
139 {
140 $this->link = $link;
141 }
link(string $caption, string $href, bool $new_viewport=false)

References $link, and ILIAS\Repository\link().

+ Here is the call graph for this function:

◆ 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 128 of file class.arWhere.php.

128 : void
129 {
130 $this->statement = $statement;
131 }

References $statement.

Referenced by asSQLStatement().

+ Here is the caller graph for this function:

◆ setType()

arWhere::setType ( int  $type)

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

118 : void
119 {
120 $this->type = $type;
121 }

References $type.

◆ setValue()

arWhere::setValue ( mixed  $value)

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

105 : void
106 {
107 $this->value = $value;
108 }

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: