ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
arField Class Reference

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

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

Static Protected Attributes

static array $allowed_attributes
 
static array $date_fields
 

Detailed Description

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

Member Function Documentation

◆ getAttributesForConnector()

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

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

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

91  : array
92  {
93  $return = array();
94  foreach (arFieldList::getAllowedConnectorFields() as $field_name) {
95  if (isset($this->{$field_name}) && $this->{$field_name} && self::isAllowedAttribute(
96  $this->getFieldType(),
97  $field_name
98  )) {
99  $return[arFieldList::mapKey($field_name)] = $this->{$field_name};
100  }
101  }
102 
103  return $return;
104  }
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 109 of file class.arField.php.

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

109  : array
110  {
111  $return = array();
112  foreach (arFieldList::getAllowedDescriptionFields() as $field_name) {
113  if ($this->{$field_name} && self::isAllowedAttribute($this->getFieldType(), $field_name)) {
114  $return[arFieldList::mapKey($field_name)] = $this->{$field_name};
115  }
116  }
117 
118  return $return;
119  }
static mapKey(string $key)
static getAllowedDescriptionFields()
+ Here is the call graph for this function:

◆ getFieldType()

arField::getFieldType ( )

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

References $fieldtype.

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

143  : string
144  {
145  return $this->fieldtype;
146  }
string $fieldtype
+ Here is the caller graph for this function:

◆ getHasField()

arField::getHasField ( )

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

References $has_field.

153  : bool
154  {
155  return $this->has_field;
156  }
bool $has_field

◆ getIndex()

arField::getIndex ( )

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

References $index.

213  : bool
214  {
215  return $this->index;
216  }

◆ getLength()

arField::getLength ( )

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

References $length.

163  : ?int
164  {
165  return $this->length;
166  }

◆ getName()

arField::getName ( )

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

References $name.

173  : string
174  {
175  return $this->name;
176  }
string $name

◆ getNotNull()

arField::getNotNull ( )

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

References $not_null.

183  : bool
184  {
185  return $this->not_null;
186  }
bool $not_null

◆ getPrimary()

arField::getPrimary ( )

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

References $is_primary.

193  : bool
194  {
195  return $this->is_primary;
196  }
bool $is_primary

◆ getSequence()

arField::getSequence ( )

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

References $sequence.

203  : bool
204  {
205  return $this->sequence;
206  }
bool $sequence

◆ isAllowedAttribute()

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

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

References arFieldList\FIELDTYPE, and arFieldList\HAS_FIELD.

218  : bool
219  {
220  if ($field_name === arFieldList::FIELDTYPE || $field_name === arFieldList::HAS_FIELD) {
221  return true;
222  }
223 
224  return in_array($field_name, self::$allowed_attributes[$type], true);
225  }
$type

◆ isDateField()

arField::isDateField ( )

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

References getFieldType().

121  : bool
122  {
123  return self::isDateFieldType($this->getFieldType());
124  }
+ Here is the call graph for this function:

◆ isDateFieldType()

static arField::isDateFieldType (   $field_type)
static

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

227  : bool
228  {
229  return in_array($field_type, self::$date_fields, true);
230  }

◆ loadFromArray()

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

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

References ILIAS\LTI\ToolProvider\$key, and setName().

Referenced by loadFromStdClass().

64  : void
65  {
66  $this->setName($name);
67  foreach ($array as $key => $value) {
68  switch ($value) {
69  case 'true':
70  $this->{$key} = true;
71  break;
72  case 'false':
73  $this->{$key} = false;
74  break;
75  default:
76  $this->{$key} = $value;
77  break;
78  }
79  }
80  }
string $key
Consumer key/client ID value.
Definition: System.php:193
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 82 of file class.arField.php.

References loadFromArray().

82  : void
83  {
84  $array = (array) $stdClass;
85  $this->loadFromArray($name, $array);
86  }
loadFromArray(string $name, array $array)
string $name
+ Here is the call graph for this function:

◆ setFieldType()

arField::setFieldType ( string  $field_type)

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

138  : void
139  {
140  $this->fieldtype = $field_type;
141  }

◆ setHasField()

arField::setHasField ( bool  $has_field)

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

References $has_field.

148  : void
149  {
150  $this->has_field = $has_field;
151  }
bool $has_field

◆ setIndex()

arField::setIndex ( bool  $index)

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

References $index.

208  : void
209  {
210  $this->index = $index;
211  }

◆ setLength()

arField::setLength ( int  $length)

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

References $length.

158  : void
159  {
160  $this->length = $length;
161  }

◆ setName()

arField::setName ( string  $name)

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

References $name.

Referenced by loadFromArray().

168  : void
169  {
170  $this->name = $name;
171  }
string $name
+ Here is the caller graph for this function:

◆ setNotNull()

arField::setNotNull ( bool  $not_null)

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

References $not_null.

178  : void
179  {
180  $this->not_null = $not_null;
181  }
bool $not_null

◆ setPrimary()

arField::setPrimary ( bool  $primary)

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

188  : void
189  {
190  $this->is_primary = $primary;
191  }

◆ setSequence()

arField::setSequence ( bool  $sequence)

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

References $sequence.

198  : void
199  {
200  $this->sequence = $sequence;
201  }
bool $sequence

Field Documentation

◆ $allowed_attributes

array arField::$allowed_attributes
staticprotected
Initial value:
= array(
self::FIELD_TYPE_TEXT => array(
),
self::FIELD_TYPE_INTEGER => array(
),
self::FIELD_TYPE_FLOAT => array(
),
self::FIELD_TYPE_DATE => array(
),
self::FIELD_TYPE_TIME => array(
),
self::FIELD_TYPE_TIMESTAMP => array(
),
self::FIELD_TYPE_CLOB => array(
),
)

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

◆ $date_fields

array arField::$date_fields
staticprotected
Initial value:
= array(
self::FIELD_TYPE_DATE,
self::FIELD_TYPE_TIME,
self::FIELD_TYPE_TIMESTAMP
)

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

◆ $fieldtype

string arField::$fieldtype
protected

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

Referenced by getFieldType().

◆ $has_field

bool arField::$has_field = false
protected

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

Referenced by getHasField(), and setHasField().

◆ $index

bool arField::$index = false
protected

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

Referenced by getIndex(), and setIndex().

◆ $is_primary

bool arField::$is_primary = false
protected

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

Referenced by getPrimary().

◆ $length

int arField::$length = null
protected

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

Referenced by getLength(), and setLength().

◆ $name

string arField::$name = ''
protected

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

Referenced by getName(), and setName().

◆ $not_null

bool arField::$not_null = false
protected

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

Referenced by getNotNull(), and setNotNull().

◆ $sequence

bool arField::$sequence = false
protected

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

Referenced by getSequence(), and setSequence().

◆ FIELD_TYPE_CLOB

const arField::FIELD_TYPE_CLOB = 'clob'

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

◆ FIELD_TYPE_DATE

const arField::FIELD_TYPE_DATE = 'date'

◆ FIELD_TYPE_FLOAT

const arField::FIELD_TYPE_FLOAT = 'float'

◆ FIELD_TYPE_INTEGER

const arField::FIELD_TYPE_INTEGER = 'integer'

◆ FIELD_TYPE_TEXT

const arField::FIELD_TYPE_TEXT = 'text'

◆ FIELD_TYPE_TIME

const arField::FIELD_TYPE_TIME = 'time'

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

◆ FIELD_TYPE_TIMESTAMP

const arField::FIELD_TYPE_TIMESTAMP = 'timestamp'

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