ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
arField Class Reference

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

+ Collaboration diagram for arField:

Public Member Functions

 loadFromArray (string $name, array $array)
 
 loadFromStdClass (string $name, stdClass $stdClass)
 
 getAttributesForConnector ()
 
 getAttributesForDescription ()
 
 isDateField ()
 
 setFieldType (string $field_type)
 
 getFieldType ()
 
 setHasField (bool $has_field)
 
 getHasField ()
 
 setLength (int $length)
 
 getLength ()
 
 setName (string $name)
 
 getName ()
 
 setNotNull (bool $not_null)
 
 getNotNull ()
 
 setPrimary (bool $primary)
 
 getPrimary ()
 
 setSequence (bool $sequence)
 
 getSequence ()
 
 setIndex (bool $index)
 
 getIndex ()
 

Static Public Member Functions

static isAllowedAttribute (string $type, string $field_name)
 
static isDateFieldType ($field_type)
 

Data Fields

 $not_null
 
const FIELD_TYPE_TEXT = 'text'
 
const FIELD_TYPE_INTEGER = 'integer'
 
const FIELD_TYPE_FLOAT = 'float'
 
const FIELD_TYPE_DATE = 'date'
 
const FIELD_TYPE_TIME = 'time'
 
const FIELD_TYPE_TIMESTAMP = 'timestamp'
 
const FIELD_TYPE_CLOB = 'clob'
 

Protected Attributes

bool $is_unique = false
 
string $fieldtype
 
int $length = null
 
bool $is_primary = false
 
string $name = ''
 
bool $is_notnull = false
 
bool $has_field = false
 
bool $sequence = false
 
bool $index = false
 

Static Protected Attributes

static array $allowed_attributes
 
static array $date_fields = [self::FIELD_TYPE_DATE, self::FIELD_TYPE_TIME, self::FIELD_TYPE_TIMESTAMP]
 

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 arField

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.arField.php.

Member Function Documentation

◆ getAttributesForConnector()

arField::getAttributesForConnector ( )
Returns
array<int|string, mixed>

Definition at line 76 of file class.arField.php.

76 : array
77 {
78 $return = [];
79 foreach (arFieldList::getAllowedConnectorFields() as $field_name) {
80 if (isset($this->{$field_name}) && $this->{$field_name} && self::isAllowedAttribute(
81 $this->getFieldType(),
82 $field_name
83 )) {
84 $return[arFieldList::mapKey($field_name)] = $this->{$field_name};
85 }
86 }
87
88 return $return;
89 }
static mapKey(string $key)
static getAllowedConnectorFields()
static isAllowedAttribute(string $type, string $field_name)

References arFieldList\getAllowedConnectorFields(), getFieldType(), isAllowedAttribute(), and arFieldList\mapKey().

+ Here is the call graph for this function:

◆ getAttributesForDescription()

arField::getAttributesForDescription ( )
Returns
array<int|string, mixed>

Definition at line 94 of file class.arField.php.

94 : array
95 {
96 $return = [];
97 foreach (arFieldList::getAllowedDescriptionFields() as $field_name) {
98 if ($this->{$field_name} && self::isAllowedAttribute($this->getFieldType(), $field_name)) {
99 $return[arFieldList::mapKey($field_name)] = $this->{$field_name};
100 }
101 }
102
103 return $return;
104 }
static getAllowedDescriptionFields()

References arFieldList\getAllowedDescriptionFields(), getFieldType(), isAllowedAttribute(), and arFieldList\mapKey().

+ Here is the call graph for this function:

◆ getFieldType()

arField::getFieldType ( )

Definition at line 125 of file class.arField.php.

125 : string
126 {
127 return $this->fieldtype;
128 }
string $fieldtype

References $fieldtype.

Referenced by getAttributesForConnector(), getAttributesForDescription(), and isDateField().

+ Here is the caller graph for this function:

◆ getHasField()

arField::getHasField ( )

Definition at line 135 of file class.arField.php.

135 : bool
136 {
137 return $this->has_field;
138 }
bool $has_field

References $has_field.

◆ getIndex()

arField::getIndex ( )

Definition at line 195 of file class.arField.php.

195 : bool
196 {
197 return $this->index;
198 }

References $index.

◆ getLength()

arField::getLength ( )

Definition at line 145 of file class.arField.php.

145 : ?int
146 {
147 return $this->length;
148 }

References $length.

◆ getName()

arField::getName ( )

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

155 : string
156 {
157 return $this->name;
158 }
string $name

References $name.

◆ getNotNull()

arField::getNotNull ( )

Definition at line 165 of file class.arField.php.

165 : bool
166 {
167 return $this->not_null;
168 }

References $not_null.

◆ getPrimary()

arField::getPrimary ( )

Definition at line 175 of file class.arField.php.

175 : bool
176 {
177 return $this->is_primary;
178 }
bool $is_primary

References $is_primary.

◆ getSequence()

arField::getSequence ( )

Definition at line 185 of file class.arField.php.

185 : bool
186 {
187 return $this->sequence;
188 }
bool $sequence

References $sequence.

◆ isAllowedAttribute()

static arField::isAllowedAttribute ( string  $type,
string  $field_name 
)
static

Definition at line 200 of file class.arField.php.

200 : bool
201 {
202 if ($field_name === arFieldList::FIELDTYPE) {
203 return true;
204 }
205 if ($field_name === arFieldList::HAS_FIELD) {
206 return true;
207 }
208 return in_array($field_name, self::$allowed_attributes[$type], true);
209 }

References arFieldList\FIELDTYPE, and arFieldList\HAS_FIELD.

Referenced by getAttributesForConnector(), and getAttributesForDescription().

+ Here is the caller graph for this function:

◆ isDateField()

arField::isDateField ( )

Definition at line 106 of file class.arField.php.

106 : bool
107 {
108 return self::isDateFieldType($this->getFieldType());
109 }
static isDateFieldType($field_type)

References getFieldType(), and isDateFieldType().

+ Here is the call graph for this function:

◆ isDateFieldType()

static arField::isDateFieldType (   $field_type)
static

Definition at line 211 of file class.arField.php.

211 : bool
212 {
213 return in_array($field_type, self::$date_fields, true);
214 }

Referenced by isDateField().

+ Here is the caller graph for this function:

◆ loadFromArray()

arField::loadFromArray ( string  $name,
array  $array 
)

Definition at line 55 of file class.arField.php.

55 : void
56 {
57 $this->setName($name);
58 foreach ($array as $key => $value) {
59 $this->{$key} = match ($value) {
60 'true' => true,
61 'false' => false,
62 default => $value,
63 };
64 }
65 }
setName(string $name)

References setName().

Referenced by loadFromStdClass().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadFromStdClass()

arField::loadFromStdClass ( string  $name,
stdClass  $stdClass 
)

Definition at line 67 of file class.arField.php.

67 : void
68 {
69 $array = (array) $stdClass;
70 $this->loadFromArray($name, $array);
71 }
loadFromArray(string $name, array $array)

References loadFromArray().

+ Here is the call graph for this function:

◆ setFieldType()

arField::setFieldType ( string  $field_type)

Definition at line 120 of file class.arField.php.

120 : void
121 {
122 $this->fieldtype = $field_type;
123 }

◆ setHasField()

arField::setHasField ( bool  $has_field)

Definition at line 130 of file class.arField.php.

130 : void
131 {
132 $this->has_field = $has_field;
133 }

References $has_field.

◆ setIndex()

arField::setIndex ( bool  $index)

Definition at line 190 of file class.arField.php.

190 : void
191 {
192 $this->index = $index;
193 }

References $index.

◆ setLength()

arField::setLength ( int  $length)

Definition at line 140 of file class.arField.php.

140 : void
141 {
142 $this->length = $length;
143 }

References $length.

◆ setName()

arField::setName ( string  $name)

Definition at line 150 of file class.arField.php.

150 : void
151 {
152 $this->name = $name;
153 }

References $name.

Referenced by loadFromArray().

+ Here is the caller graph for this function:

◆ setNotNull()

arField::setNotNull ( bool  $not_null)

Definition at line 160 of file class.arField.php.

160 : void
161 {
162 $this->not_null = $not_null;
163 }

References $not_null.

◆ setPrimary()

arField::setPrimary ( bool  $primary)

Definition at line 170 of file class.arField.php.

170 : void
171 {
172 $this->is_primary = $primary;
173 }

◆ setSequence()

arField::setSequence ( bool  $sequence)

Definition at line 180 of file class.arField.php.

180 : void
181 {
182 $this->sequence = $sequence;
183 }

References $sequence.

Field Documentation

◆ $allowed_attributes

array arField::$allowed_attributes
staticprotected
Initial value:
= [
self::FIELD_TYPE_TEXT => [
],
self::FIELD_TYPE_INTEGER => [
],
self::FIELD_TYPE_FLOAT => [arFieldList::IS_NOTNULL],
self::FIELD_TYPE_DATE => [arFieldList::IS_NOTNULL],
self::FIELD_TYPE_TIME => [arFieldList::IS_NOTNULL],
self::FIELD_TYPE_TIMESTAMP => [arFieldList::IS_NOTNULL],
self::FIELD_TYPE_CLOB => [arFieldList::IS_NOTNULL]
]

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

◆ $date_fields

array arField::$date_fields = [self::FIELD_TYPE_DATE, self::FIELD_TYPE_TIME, self::FIELD_TYPE_TIMESTAMP]
staticprotected

Definition at line 53 of file class.arField.php.

◆ $fieldtype

string arField::$fieldtype
protected

Definition at line 111 of file class.arField.php.

Referenced by getFieldType().

◆ $has_field

bool arField::$has_field = false
protected

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

Referenced by getHasField(), and setHasField().

◆ $index

bool arField::$index = false
protected

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

Referenced by getIndex(), and setIndex().

◆ $is_notnull

bool arField::$is_notnull = false
protected

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

◆ $is_primary

bool arField::$is_primary = false
protected

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

Referenced by getPrimary().

◆ $is_unique

bool arField::$is_unique = false
protected

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

◆ $length

int arField::$length = null
protected

Definition at line 112 of file class.arField.php.

Referenced by getLength(), and setLength().

◆ $name

string arField::$name = ''
protected

Definition at line 114 of file class.arField.php.

Referenced by getName(), and setName().

◆ $not_null

arField::$not_null

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

Referenced by getNotNull(), and setNotNull().

◆ $sequence

bool arField::$sequence = false
protected

Definition at line 117 of file class.arField.php.

Referenced by getSequence(), and setSequence().

◆ FIELD_TYPE_CLOB

const arField::FIELD_TYPE_CLOB = 'clob'

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

◆ FIELD_TYPE_DATE

const arField::FIELD_TYPE_DATE = 'date'

Definition at line 31 of file class.arField.php.

◆ FIELD_TYPE_FLOAT

const arField::FIELD_TYPE_FLOAT = 'float'

Definition at line 30 of file class.arField.php.

◆ FIELD_TYPE_INTEGER

const arField::FIELD_TYPE_INTEGER = 'integer'

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

Referenced by arBuilder\generateDBUpdateForInstallation().

◆ FIELD_TYPE_TEXT

const arField::FIELD_TYPE_TEXT = 'text'

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

Referenced by ilADTTextActiveRecordBridge\getActiveRecordFields().

◆ FIELD_TYPE_TIME

const arField::FIELD_TYPE_TIME = 'time'

Definition at line 32 of file class.arField.php.

◆ FIELD_TYPE_TIMESTAMP

const arField::FIELD_TYPE_TIMESTAMP = 'timestamp'

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


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