ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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.

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

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()
+ 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.

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

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 mapKey(string $key)
static getAllowedDescriptionFields()
+ Here is the call graph for this function:

◆ getFieldType()

arField::getFieldType ( )

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

References $fieldtype.

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

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

◆ getHasField()

arField::getHasField ( )

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

References $has_field.

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

◆ getIndex()

arField::getIndex ( )

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

References $index.

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

◆ getLength()

arField::getLength ( )

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

References $length.

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

◆ getName()

arField::getName ( )

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

References $name.

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

◆ getNotNull()

arField::getNotNull ( )

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

References $not_null.

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

◆ getPrimary()

arField::getPrimary ( )

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

References $is_primary.

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

◆ getSequence()

arField::getSequence ( )

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

References $sequence.

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

◆ isAllowedAttribute()

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

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

References arFieldList\FIELDTYPE, and arFieldList\HAS_FIELD.

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  }

◆ isDateField()

arField::isDateField ( )

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

References getFieldType().

106  : bool
107  {
108  return self::isDateFieldType($this->getFieldType());
109  }
+ 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  }

◆ loadFromArray()

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

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

References setName().

Referenced by loadFromStdClass().

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

References loadFromArray().

67  : void
68  {
69  $array = (array) $stdClass;
70  $this->loadFromArray($name, $array);
71  }
loadFromArray(string $name, array $array)
string $name
+ 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.

References $has_field.

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

◆ setIndex()

arField::setIndex ( bool  $index)

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

References $index.

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

◆ setLength()

arField::setLength ( int  $length)

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

References $length.

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

◆ setName()

arField::setName ( string  $name)

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

References $name.

Referenced by loadFromArray().

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

◆ setNotNull()

arField::setNotNull ( bool  $not_null)

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

References $not_null.

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

◆ 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.

References $sequence.

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

Field Documentation

◆ $allowed_attributes

array arField::$allowed_attributes
staticprotected
Initial value:

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: