ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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

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 75 of file class.arField.php.

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

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

◆ getAttributesForDescription()

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

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

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

93  : array
94  {
95  $return = [];
96  foreach (arFieldList::getAllowedDescriptionFields() as $field_name) {
97  if ($this->{$field_name} && self::isAllowedAttribute($this->getFieldType(), $field_name)) {
98  $return[arFieldList::mapKey($field_name)] = $this->{$field_name};
99  }
100  }
101 
102  return $return;
103  }
static mapKey(string $key)
static getAllowedDescriptionFields()
+ Here is the call graph for this function:

◆ getFieldType()

arField::getFieldType ( )

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

References $fieldtype.

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

124  : string
125  {
126  return $this->fieldtype;
127  }
string $fieldtype
+ Here is the caller graph for this function:

◆ getHasField()

arField::getHasField ( )

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

References $has_field.

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

◆ getIndex()

arField::getIndex ( )

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

References $index.

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

◆ getLength()

arField::getLength ( )

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

References $length.

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

◆ getName()

arField::getName ( )

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

References $name.

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

◆ getNotNull()

arField::getNotNull ( )

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

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

◆ getPrimary()

arField::getPrimary ( )

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

References $is_primary.

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

◆ getSequence()

arField::getSequence ( )

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

References $sequence.

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

◆ isAllowedAttribute()

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

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

References arFieldList\FIELDTYPE, and arFieldList\HAS_FIELD.

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

◆ isDateField()

arField::isDateField ( )

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

References getFieldType().

105  : bool
106  {
107  return self::isDateFieldType($this->getFieldType());
108  }
+ Here is the call graph for this function:

◆ isDateFieldType()

static arField::isDateFieldType (   $field_type)
static

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

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

◆ loadFromArray()

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

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

References setName().

Referenced by loadFromStdClass().

54  : void
55  {
56  $this->setName($name);
57  foreach ($array as $key => $value) {
58  $this->{$key} = match ($value) {
59  'true' => true,
60  'false' => false,
61  default => $value,
62  };
63  }
64  }
string $name
setName(string $name)
+ 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 66 of file class.arField.php.

References loadFromArray().

66  : void
67  {
68  $array = (array) $stdClass;
69  $this->loadFromArray($name, $array);
70  }
loadFromArray(string $name, array $array)
string $name
+ Here is the call graph for this function:

◆ setFieldType()

arField::setFieldType ( string  $field_type)

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

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

◆ setHasField()

arField::setHasField ( bool  $has_field)

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

References $has_field.

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

◆ setIndex()

arField::setIndex ( bool  $index)

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

References $index.

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

◆ setLength()

arField::setLength ( int  $length)

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

References $length.

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

◆ setName()

arField::setName ( string  $name)

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

References $name.

Referenced by loadFromArray().

149  : void
150  {
151  $this->name = $name;
152  }
string $name
+ Here is the caller graph for this function:

◆ setNotNull()

arField::setNotNull ( bool  $not_null)

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

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

◆ setPrimary()

arField::setPrimary ( bool  $primary)

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

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

◆ setSequence()

arField::setSequence ( bool  $sequence)

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

References $sequence.

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

Field Documentation

◆ $allowed_attributes

array arField::$allowed_attributes
staticprotected
Initial value:

Definition at line 34 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 52 of file class.arField.php.

◆ $fieldtype

string arField::$fieldtype
protected

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

Referenced by getFieldType().

◆ $has_field

bool arField::$has_field = false
protected

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

Referenced by getHasField(), and setHasField().

◆ $index

bool arField::$index = false
protected

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

Referenced by getIndex(), and setIndex().

◆ $is_notnull

bool arField::$is_notnull = false
protected

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

◆ $is_primary

bool arField::$is_primary = false
protected

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

Referenced by getPrimary().

◆ $is_unique

bool arField::$is_unique = false
protected

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

◆ $length

int arField::$length = null
protected

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

Referenced by getLength(), and setLength().

◆ $name

string arField::$name = ''
protected

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

Referenced by getName(), and setName().

◆ $sequence

bool arField::$sequence = false
protected

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

Referenced by getSequence(), and setSequence().

◆ FIELD_TYPE_CLOB

const arField::FIELD_TYPE_CLOB = 'clob'

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

◆ FIELD_TYPE_DATE

const arField::FIELD_TYPE_DATE = 'date'

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

◆ FIELD_TYPE_FLOAT

const arField::FIELD_TYPE_FLOAT = 'float'

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

◆ FIELD_TYPE_INTEGER

const arField::FIELD_TYPE_INTEGER = 'integer'

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

Referenced by arBuilder\generateDBUpdateForInstallation().

◆ FIELD_TYPE_TEXT

const arField::FIELD_TYPE_TEXT = 'text'

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

Referenced by ilADTTextActiveRecordBridge\getActiveRecordFields().

◆ FIELD_TYPE_TIME

const arField::FIELD_TYPE_TIME = 'time'

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

◆ FIELD_TYPE_TIMESTAMP

const arField::FIELD_TYPE_TIMESTAMP = 'timestamp'

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


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