ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilDclBaseFieldModel Class Reference

Class ilDclBaseFieldModel. More...

+ Inheritance diagram for ilDclBaseFieldModel:
+ Collaboration diagram for ilDclBaseFieldModel:

Public Member Functions

 __construct ($a_id=0)
 
 setId ($a_id)
 Set field id. More...
 
 getId ()
 Get field id. More...
 
 setTableId ($a_id)
 Set table id. More...
 
 getTableId ()
 Get table id. More...
 
 setTitle ($a_title)
 Set title. More...
 
 getTitle ()
 Get title. More...
 
 setDescription ($a_desc)
 Set description. More...
 
 getDescription ()
 Get description. More...
 
 setDatatypeId ($a_id)
 Set datatype id. More...
 
 getDatatypeId ()
 Get datatype_id. More...
 
 setRequired ($a_required)
 Set Required. More...
 
 getRequired ()
 Get Required Required. More...
 
 isUnique ()
 
 setUnique ($unique)
 
 getDatatype ()
 
 getDatatypeTitle ()
 
 getStorageLocation ()
 Get storage location for the model. More...
 
 getExportable ()
 
 toArray ()
 
 isStandardField ()
 
 doRead ()
 Read field. More...
 
 buildFromDBRecord ($rec)
 Builds model from db record. More...
 
 doCreate ()
 Create new field. More...
 
 doUpdate ()
 Update field. More...
 
 updateProperties ()
 Update properties of this field in Database. More...
 
 doDelete ()
 Remove field and properties. More...
 
 getFieldSettings ()
 
 getOrder ()
 
 setOrder ($order)
 
 hasProperty ($key)
 Checks if a certain property for a field is set. More...
 
 getProperty ($key)
 Returns a certain property of a field. More...
 
 getPropertyInstance ($key)
 Return ActiveRecord of property. More...
 
 setProperty ($key, $value)
 Set a property for a field (does not save) More...
 
 getValidFieldProperties ()
 Returns all valid properties for a field-type. More...
 
 setLocked ($locked)
 
 getLocked ()
 
 checkValidityFromForm (ilPropertyFormGUI &$form, $record_id=NULL)
 
 checkValidity ($value, $record_id=NULL)
 Check if input is valid. More...
 
 cloneStructure ($original_id)
 
 afterClone ($records)
 
 cloneProperties (ilDclBaseFieldModel $originalField)
 
 setExportable ($exportable)
 
 allowFilterInListView ()
 
 getRecordQuerySortObject ($direction="asc", $sort_by_status=false)
 Returns a query-object for building the record-loader-sql-query. More...
 
 getRecordQueryFilterObject ($filter_value="", ilDclBaseFieldModel $sort_field=null)
 Returns a query-object for building the record-loader-sql-query. More...
 
 getSortField ()
 Returns the sort-field id. More...
 
 hasNumericSorting ()
 Set to true, when the sorting should be handled numerical. More...
 
 checkFieldCreationInput (ilPropertyFormGUI $form)
 Checks input of specific fields befor saving. More...
 
 getStorageLocationOverride ()
 
 setStorageLocationOverride ($storage_location_override)
 
 fillHeaderExcel (ilExcel $worksheet, &$row, &$col)
 
 checkTitlesForImport (array &$titles, array &$import_fields)
 

Static Public Member Functions

static _getTitleInvalidChars ($a_as_regex=true)
 All valid chars for filed titles. More...
 
static _getFieldIdByTitle ($title, $table_id)
 

Data Fields

const PROP_LENGTH = "lenght"
 General properties. More...
 
const PROP_REGEX = "regex"
 
const PROP_REFERENCE = "table_id"
 
const PROP_URL = "url"
 
const PROP_TEXTAREA = "text_area"
 
const PROP_REFERENCE_LINK = "reference_link"
 
const PROP_WIDTH = "width"
 
const PROP_HEIGHT = "height"
 
const PROP_LEARNING_PROGRESS = "learning_progress"
 
const PROP_ILIAS_REFERENCE_LINK = "ILIAS_reference_link"
 
const PROP_N_REFERENCE = "multiple_selection"
 
const PROP_FORMULA_EXPRESSION = "expression"
 
const PROP_DISPLAY_COPY_LINK_ACTION_MENU = "display_action_menu"
 
const PROP_LINK_DETAIL_PAGE_TEXT = "link_detail_page"
 
const PROP_SUPPORTED_FILE_TYPES = "supported_file_types"
 
const PROP_PLUGIN_HOOK_NAME = "plugin_hook_name"
 
const EDIT_VIEW = 2
 
const EXPORTABLE_VIEW = 4
 

Protected Member Functions

 loadDatatype ()
 Load datatype for model. More...
 
 loadTableFieldSetting ()
 loadTableFieldSetting More...
 
 addToTableViews ()
 create ilDclTableViewFieldSettings for this field in each tableview More...
 
 updateTableFieldSetting ()
 update exportable and fieldorder More...
 
 loadProperties ()
 Get all properties of a field. More...
 
 normalizeValue ($value)
 

Protected Attributes

 $id
 
 $table_id
 
 $title
 
 $description
 
 $datatypeId
 
 $required
 
 $order
 
 $unique
 
 $locked
 
 $property = array()
 
 $exportable
 
 $datatype
 
 $storage_location_override = null
 

Private Member Functions

 loadExportability ()
 Load exportability. More...
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDclBaseFieldModel::__construct (   $a_id = 0)
Parameters
int$a_id

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

105 {
106 if ($a_id != 0) {
107 $this->id = $a_id;
108 $this->doRead();
109 }
110 }

References doRead().

+ Here is the call graph for this function:

Member Function Documentation

◆ _getFieldIdByTitle()

static ilDclBaseFieldModel::_getFieldIdByTitle (   $title,
  $table_id 
)
static
Parameters
$titleTitle of the field
$table_idID of table where the field belongs to
Returns
int

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

135 {
136 global $DIC;
137 $ilDB = $DIC['ilDB'];
138 $result = $ilDB->query('SELECT id FROM il_dcl_field WHERE title = ' . $ilDB->quote($title, 'text') . ' AND table_id = '
139 . $ilDB->quote($table_id, 'integer'));
140 $id = 0;
141 while ($rec = $ilDB->fetchAssoc($result)) {
142 $id = $rec['id'];
143 }
144
145 return $id;
146 }
$result
global $ilDB
global $DIC

References $DIC, $id, $ilDB, $result, $table_id, and $title.

◆ _getTitleInvalidChars()

static ilDclBaseFieldModel::_getTitleInvalidChars (   $a_as_regex = true)
static

All valid chars for filed titles.

Parameters
bool$a_as_regex
Returns
string

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

120 {
121 if ($a_as_regex) {
122 return '/^[^<>\\\\":]*$/i';
123 } else {
124 return '\ < > " :';
125 }
126 }

Referenced by ilDclFieldEditGUI\initForm().

+ Here is the caller graph for this function:

◆ addToTableViews()

ilDclBaseFieldModel::addToTableViews ( )
protected

create ilDclTableViewFieldSettings for this field in each tableview

Definition at line 451 of file class.ilDclBaseFieldModel.php.

452 {
453 foreach (ilDclTableView::getAllForTableId($this->table_id) as $tableview)
454 {
455 $tableview->createFieldSetting($this->id);
456 }
457 }
static getAllForTableId($table_id)

References ilDclTableView\getAllForTableId().

Referenced by doCreate().

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

◆ afterClone()

ilDclBaseFieldModel::afterClone (   $records)
Parameters
$records

Reimplemented in ilDclStandardField.

Definition at line 747 of file class.ilDclBaseFieldModel.php.

747 {
748 foreach ($records as $rec) {
749 ilDclCache::getRecordFieldCache($rec, $this)->afterClone();
750 }
751 }
static getRecordFieldCache($record, $field)
$records
Definition: simple_test.php:22

References $records, and ilDclCache\getRecordFieldCache().

+ Here is the call graph for this function:

◆ allowFilterInListView()

ilDclBaseFieldModel::allowFilterInListView ( )

◆ buildFromDBRecord()

ilDclBaseFieldModel::buildFromDBRecord (   $rec)

Builds model from db record.

Parameters
$rec

Definition at line 410 of file class.ilDclBaseFieldModel.php.

410 {
411 $this->setId($rec["id"]);
412 $this->setTableId($rec["table_id"]);
413 $this->setTitle($rec["title"]);
414 $this->setDescription($rec["description"]);
415 $this->setDatatypeId($rec["datatype_id"]);
416 $this->setRequired($rec["required"]);
417 $this->setUnique($rec["is_unique"]);
418 $this->setLocked($rec["is_locked"]);
419 }
setDatatypeId($a_id)
Set datatype id.
setRequired($a_required)
Set Required.
setDescription($a_desc)
Set description.
setTableId($a_id)
Set table id.

References setDatatypeId(), setDescription(), setId(), setLocked(), setRequired(), setTableId(), setTitle(), and setUnique().

+ Here is the call graph for this function:

◆ checkFieldCreationInput()

ilDclBaseFieldModel::checkFieldCreationInput ( ilPropertyFormGUI  $form)

Checks input of specific fields befor saving.

Parameters
ilPropertyFormGUI$form
Returns
boolean if checkInput was successful

Reimplemented in ilDclTextFieldModel.

Definition at line 860 of file class.ilDclBaseFieldModel.php.

860 {
861 return true;
862 }

◆ checkTitlesForImport()

ilDclBaseFieldModel::checkTitlesForImport ( array &  $titles,
array &  $import_fields 
)
Parameters
array$titles
array$import_fields

Reimplemented in ilDclTextFieldModel.

Definition at line 896 of file class.ilDclBaseFieldModel.php.

896 {
897 foreach ($titles as $k => $title) {
898 if (!ilStr::isUtf8($title)) {
899 $title = utf8_encode($title);
900 }
901 if ($title == $this->getTitle()) {
902 $import_fields[$k] = $this;
903 }
904 }
905 }
static isUtf8($a_str)
Check whether string is utf-8.

References $title, getTitle(), and ilStr\isUtf8().

+ Here is the call graph for this function:

◆ checkValidity()

ilDclBaseFieldModel::checkValidity (   $value,
  $record_id = NULL 
)

Check if input is valid.

Parameters
$value
null$record_id
Returns
bool
Exceptions
ilDclInputException

Reimplemented in ilDclDatetimeFieldModel, ilDclFileuploadFieldModel, ilDclNumberFieldModel, and ilDclTextFieldModel.

Definition at line 687 of file class.ilDclBaseFieldModel.php.

687 {
688 //Don't check empty values
689 if ($value == NULL) {
690 return true;
691 }
692
693 if ($this->isUnique()) {
694 $table = ilDclCache::getTableCache($this->getTableId());
695 foreach ($table->getRecords() as $record) {
696 if ($this->normalizeValue($record->getRecordFieldValue($this->getId())) == $this->normalizeValue($value) &&
697 ($record->getId() != $record_id || $record_id == 0)) {
699 }
700 }
701 }
702
703 return true;
704 }
static getTableCache($table_id=0)
Class ilDclBaseFieldModel.

References ilDclCache\getTableCache(), getTableId(), isUnique(), normalizeValue(), and ilDclInputException\UNIQUE_EXCEPTION.

Referenced by checkValidityFromForm().

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

◆ checkValidityFromForm()

ilDclBaseFieldModel::checkValidityFromForm ( ilPropertyFormGUI $form,
  $record_id = NULL 
)
Parameters
ilPropertyFormGUI$form
null$record_id

Reimplemented in ilDclTextFieldModel.

Definition at line 675 of file class.ilDclBaseFieldModel.php.

675 {
676 $value = $form->getInput('field_' . $this->getId());
677 $this->checkValidity($value, $record_id);
678 }
checkValidity($value, $record_id=NULL)
Check if input is valid.
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.

References checkValidity(), getId(), and ilPropertyFormGUI\getInput().

+ Here is the call graph for this function:

◆ cloneProperties()

ilDclBaseFieldModel::cloneProperties ( ilDclBaseFieldModel  $originalField)
Parameters
ilDclBaseFieldModel$originalField

Definition at line 756 of file class.ilDclBaseFieldModel.php.

756 {
757 $orgProps = $originalField->getValidFieldProperties();
758 if (count($orgProps) == 0) {
759 return;
760 }
761 foreach ($orgProps as $prop_name) {
762 $fieldprop_obj = new ilDclFieldProperty();
763 $fieldprop_obj->setFieldId($this->getId());
764 $fieldprop_obj->setName($prop_name);
765
766 $value = $originalField->getProperty($prop_name);
767
768 // If reference field, we must reset the referenced field, otherwise it will point to the old ID
770 $value = NULL;
771 }
772
773 $fieldprop_obj->setValue($value);
774 $fieldprop_obj->create();
775 }
776 }
getValidFieldProperties()
Returns all valid properties for a field-type.
getProperty($key)
Returns a certain property of a field.
Class ilDclFieldProperty.

References getDatatypeId(), getId(), getProperty(), getValidFieldProperties(), ilDclDatatype\INPUTFORMAT_REFERENCE, and PROP_REFERENCE.

Referenced by cloneStructure().

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

◆ cloneStructure()

ilDclBaseFieldModel::cloneStructure (   $original_id)
Parameters
$original_id
Exceptions
ilException

Reimplemented in ilDclStandardField.

Definition at line 726 of file class.ilDclBaseFieldModel.php.

726 {
727 $original = ilDclCache::getFieldCache($original_id);
728 $this->setTitle($original->getTitle());
729 $this->setDatatypeId($original->getDatatypeId());
730 $this->setDescription($original->getDescription());
731 $this->setLocked($original->getLocked());
732 $this->setOrder($original->getOrder());
733 $this->setRequired($original->getRequired());
734 $this->setUnique($original->isUnique());
735 $this->setExportable($original->getExportable());
736 $this->doCreate();
737 $this->cloneProperties($original);
738
739 // mandatory for all cloning functions
740 ilDclCache::setCloneOf($original_id, $this->getId(), ilDclCache::TYPE_FIELD);
741 }
cloneProperties(ilDclBaseFieldModel $originalField)
static setCloneOf($old, $new, $type)
static getFieldCache($field_id=0)

References cloneProperties(), doCreate(), ilDclCache\getFieldCache(), getId(), ilDclCache\setCloneOf(), setDatatypeId(), setDescription(), setExportable(), setLocked(), setOrder(), setRequired(), setTitle(), setUnique(), and ilDclCache\TYPE_FIELD.

+ Here is the call graph for this function:

◆ doCreate()

ilDclBaseFieldModel::doCreate ( )

Create new field.

Reimplemented in ilDclStandardField.

Definition at line 425 of file class.ilDclBaseFieldModel.php.

425 {
426 global $DIC;
427 $ilDB = $DIC['ilDB'];
428 $this->getLocked() == NULL ? $this->setLocked(false) : true;
429
430 if (! ilDclTable::_tableExists($this->getTableId())) {
431 throw new ilException("The field does not have a related table!");
432 }
433
434 $id = $ilDB->nextId("il_dcl_field");
435 $this->setId($id);
436 $query = "INSERT INTO il_dcl_field (" . "id" . ", table_id" . ", datatype_id" . ", title" . ", description" . ", required" . ", is_unique"
437 . ", is_locked" . " ) VALUES (" . $ilDB->quote($this->getId(), "integer") . "," . $ilDB->quote($this->getTableId(), "integer") . ","
438 . $ilDB->quote($this->getDatatypeId(), "integer") . "," . $ilDB->quote($this->getTitle(), "text") . ","
439 . $ilDB->quote($this->getDescription(), "text") . "," . $ilDB->quote($this->getRequired(), "integer") . ","
440 . $ilDB->quote($this->isUnique(), "integer") . "," . $ilDB->quote($this->getLocked() ? 1 : 0, "integer") . ")";
441 $ilDB->manipulate($query);
442
444
445 $this->addToTableViews();
446 }
updateTableFieldSetting()
update exportable and fieldorder
getRequired()
Get Required Required.
addToTableViews()
create ilDclTableViewFieldSettings for this field in each tableview
static _tableExists($table_id)
Base class for ILIAS Exception handling.

References $DIC, $id, $ilDB, $query, ilDclTable\_tableExists(), addToTableViews(), getDatatypeId(), getDescription(), getId(), getLocked(), getRequired(), getTableId(), getTitle(), isUnique(), setId(), setLocked(), and updateTableFieldSetting().

Referenced by cloneStructure().

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

◆ doDelete()

ilDclBaseFieldModel::doDelete ( )

Remove field and properties.

Definition at line 531 of file class.ilDclBaseFieldModel.php.

531 {
532 global $DIC;
533 $ilDB = $DIC['ilDB'];
534
535 // delete tablefield setting.
536 ilDclTableFieldSetting::getInstance($this->getTableId(), $this->getId())->delete();
537
538 $query = "DELETE FROM il_dcl_field_prop WHERE field_id = " . $ilDB->quote($this->getId(), "text");
539 $ilDB->manipulate($query);
540
541 $query = "DELETE FROM il_dcl_field WHERE id = " . $ilDB->quote($this->getId(), "text");
542 $ilDB->manipulate($query);
543
544 foreach ($this->getFieldSettings() as $field_setting)
545 {
546 $field_setting->delete();
547 }
548 }
static getInstance($table_id, $field)

References $DIC, $ilDB, $query, getFieldSettings(), getId(), ilDclTableFieldSetting\getInstance(), and getTableId().

+ Here is the call graph for this function:

◆ doRead()

ilDclBaseFieldModel::doRead ( )

Read field.

Reimplemented in ilDclStandardField.

Definition at line 385 of file class.ilDclBaseFieldModel.php.

385 {
386 global $DIC;
387 $ilDB = $DIC['ilDB'];
388
389 //THEN 1 ELSE 0 END AS has_options FROM il_dcl_field f WHERE id = ".$ilDB->quote($this->getId(),"integer");
390 $query = "SELECT * FROM il_dcl_field WHERE id = " . $ilDB->quote($this->getId(), "integer");
391 $set = $ilDB->query($query);
392 $rec = $ilDB->fetchAssoc($set);
393
394 $this->setTableId($rec["table_id"]);
395 $this->setTitle($rec["title"]);
396 $this->setDescription($rec["description"]);
397 $this->setDatatypeId($rec["datatype_id"]);
398 $this->setRequired($rec["required"]);
399 $this->setUnique($rec["is_unique"]);
400 $this->setLocked($rec["is_locked"]);
401 $this->loadProperties();
402 $this->loadTableFieldSetting();
403 }
loadTableFieldSetting()
loadTableFieldSetting
loadProperties()
Get all properties of a field.

References $DIC, $ilDB, $query, getId(), loadProperties(), loadTableFieldSetting(), setDatatypeId(), setDescription(), setLocked(), setRequired(), setTableId(), setTitle(), and setUnique().

Referenced by __construct().

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

◆ doUpdate()

ilDclBaseFieldModel::doUpdate ( )

Update field.

Reimplemented in ilDclStandardField.

Definition at line 463 of file class.ilDclBaseFieldModel.php.

463 {
464 global $DIC;
465 $ilDB = $DIC['ilDB'];
466
467 $ilDB->update("il_dcl_field", array(
468 "table_id" => array(
469 "integer",
470 $this->getTableId()
471 ),
472 "datatype_id" => array(
473 "text",
474 $this->getDatatypeId()
475 ),
476 "title" => array(
477 "text",
478 $this->getTitle()
479 ),
480 "description" => array(
481 "text",
482 $this->getDescription()
483 ),
484 "required" => array(
485 "integer",
486 $this->getRequired()
487 ),
488 "is_unique" => array(
489 "integer",
490 $this->isUnique()
491 ),
492 "is_locked" => array(
493 "integer",
494 $this->getLocked() ? 1 : 0
495 ),
496 ), array(
497 "id" => array(
498 "integer",
499 $this->getId()
500 )
501 ));
503 $this->updateProperties();
504 }
updateProperties()
Update properties of this field in Database.

References $DIC, $ilDB, getDatatypeId(), getDescription(), getId(), getLocked(), getRequired(), getTableId(), getTitle(), isUnique(), updateProperties(), and updateTableFieldSetting().

+ Here is the call graph for this function:

◆ fillHeaderExcel()

ilDclBaseFieldModel::fillHeaderExcel ( ilExcel  $worksheet,
$row,
$col 
)
Parameters
ilExcel$worksheet
$row
$col

Reimplemented in ilDclTextFieldModel.

Definition at line 886 of file class.ilDclBaseFieldModel.php.

886 {
887 $worksheet->setCell($row, $col, $this->getTitle());
888 $col++;
889 }
$worksheet

References $row, $worksheet, and getTitle().

+ Here is the call graph for this function:

◆ getDatatype()

ilDclBaseFieldModel::getDatatype ( )
Returns
ilDclDatatype

Definition at line 296 of file class.ilDclBaseFieldModel.php.

296 {
297 $this->loadDatatype();
298
299 return $this->datatype;
300 }
loadDatatype()
Load datatype for model.

References $datatype, and loadDatatype().

Referenced by ilDclFieldFactory\getClassPathByInstance(), and ilDclFieldFactory\getFieldTypeByInstance().

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

◆ getDatatypeId()

ilDclBaseFieldModel::getDatatypeId ( )

Get datatype_id.

Returns
int

Definition at line 250 of file class.ilDclBaseFieldModel.php.

250 {
251 if ($this->isStandardField()) {
253 }
254
255 return $this->datatypeId;
256 }
static _getDatatypeForId($id)
gives you the datatype id of a specified standard field.

References $datatypeId, ilDclStandardField\_getDatatypeForId(), getId(), and isStandardField().

Referenced by cloneProperties(), doCreate(), doUpdate(), ilDclStandardField\getRecordQueryFilterObject(), and hasNumericSorting().

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

◆ getDatatypeTitle()

ilDclBaseFieldModel::getDatatypeTitle ( )
Returns
string

Definition at line 306 of file class.ilDclBaseFieldModel.php.

306 {
307 $this->loadDatatype();
308
309 return $this->datatype->getTitle();
310 }

References loadDatatype().

+ Here is the call graph for this function:

◆ getDescription()

ilDclBaseFieldModel::getDescription ( )

Get description.

Returns
string

Definition at line 228 of file class.ilDclBaseFieldModel.php.

References $description.

Referenced by doCreate(), and doUpdate().

+ Here is the caller graph for this function:

◆ getExportable()

ilDclBaseFieldModel::getExportable ( )
Returns
bool

Definition at line 348 of file class.ilDclBaseFieldModel.php.

348 {
349 if (! isset($this->exportable)) {
350 $this->loadExportability();
351 }
352
353 return $this->exportable;
354 }
loadExportability()
Load exportability.

References $exportable, and loadExportability().

+ Here is the call graph for this function:

◆ getFieldSettings()

ilDclBaseFieldModel::getFieldSettings ( )

Definition at line 550 of file class.ilDclBaseFieldModel.php.

550 {
551 return ilDclTableViewFieldSetting::where(array('field' => $this->getId()))->get();
552 }
static where($where, $operator=null)

References getId(), and ActiveRecord\where().

Referenced by doDelete().

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

◆ getId()

ilDclBaseFieldModel::getId ( )

◆ getLocked()

ilDclBaseFieldModel::getLocked ( )
Returns
boolean

Reimplemented in ilDclStandardField.

Definition at line 666 of file class.ilDclBaseFieldModel.php.

References $locked.

Referenced by doCreate(), and doUpdate().

+ Here is the caller graph for this function:

◆ getOrder()

ilDclBaseFieldModel::getOrder ( )
Returns
int

Definition at line 557 of file class.ilDclBaseFieldModel.php.

557 {
558 if ($this->order == null) {
559 $this->loadTableFieldSetting();
560 }
561
562 return ! $this->order ? 0 : $this->order;
563 }

References $order, and loadTableFieldSetting().

+ Here is the call graph for this function:

◆ getProperty()

ilDclBaseFieldModel::getProperty (   $key)

Returns a certain property of a field.

Parameters
$key
Returns
null

Definition at line 600 of file class.ilDclBaseFieldModel.php.

600 {
601 $instance = $this->getPropertyInstance($key);
602
603 return ($instance !== NULL)? $instance->getValue() : null;
604 }
getPropertyInstance($key)
Return ActiveRecord of property.

References getPropertyInstance().

Referenced by ilDclTextFieldModel\checkRegexAndLength(), ilDclTextFieldModel\checkValidity(), ilDclTextFieldModel\checkValidityFromForm(), cloneProperties(), ilDclTextFieldModel\fillHeaderExcel(), ilDclFieldFactory\getClassPathByInstance(), ilDclReferenceFieldModel\getFieldRef(), ilDclFieldFactory\getFieldTypeByInstance(), ilDclReferenceFieldModel\getRecordQueryFilterObject(), ilDclReferenceFieldModel\getRecordQuerySortObject(), and ilDclFileuploadFieldModel\getSupportedExtensions().

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

◆ getPropertyInstance()

ilDclBaseFieldModel::getPropertyInstance (   $key)

Return ActiveRecord of property.

Parameters
$key
Returns
null

Definition at line 614 of file class.ilDclBaseFieldModel.php.

614 {
615 $this->loadProperties();
616 if($this->hasProperty($key)) {
617 $value = $this->property[$key];
618 return $value;
619 }
620 return null;
621 }
hasProperty($key)
Checks if a certain property for a field is set.

References hasProperty(), and loadProperties().

Referenced by getProperty().

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

◆ getRecordQueryFilterObject()

ilDclBaseFieldModel::getRecordQueryFilterObject (   $filter_value = "",
ilDclBaseFieldModel  $sort_field = null 
)

Returns a query-object for building the record-loader-sql-query.

Parameters
string$filter_value
ilDclBaseFieldModel | null$sort_field
Returns
null|ilDclRecordQueryObject

Reimplemented in ilDclStandardField, ilDclBooleanFieldModel, ilDclDatetimeFieldModel, ilDclFileuploadFieldModel, ilDclIliasReferenceFieldModel, ilDclNumberFieldModel, ilDclRatingFieldModel, ilDclReferenceFieldModel, and ilDclTextFieldModel.

Definition at line 828 of file class.ilDclBaseFieldModel.php.

828 {
829 return null;
830 }

◆ getRecordQuerySortObject()

ilDclBaseFieldModel::getRecordQuerySortObject (   $direction = "asc",
  $sort_by_status = false 
)

Returns a query-object for building the record-loader-sql-query.

Parameters
string$direction
boolean$sort_by_statusThe specific sort object is a status field
Returns
null|ilDclRecordQueryObject

Reimplemented in ilDclStandardField, ilDclFileuploadFieldModel, ilDclFormulaFieldModel, ilDclIliasReferenceFieldModel, ilDclRatingFieldModel, ilDclReferenceFieldModel, and ilDclTextFieldModel.

Definition at line 802 of file class.ilDclBaseFieldModel.php.

802 {
803 global $DIC;
804 $ilDB = $DIC['ilDB'];
805
806 $sql_obj = new ilDclRecordQueryObject();
807
808 $select_str = "sort_stloc_{$this->getId()}.value AS field_{$this->getId()}";
809 $join_str = "LEFT JOIN il_dcl_record_field AS sort_record_field_{$this->getId()} ON (sort_record_field_{$this->getId()}.record_id = record.id AND sort_record_field_{$this->getId()}.field_id = "
810 . $ilDB->quote($this->getId(), 'integer') . ") ";
811 $join_str .= "LEFT JOIN il_dcl_stloc{$this->getStorageLocation()}_value AS sort_stloc_{$this->getId()} ON (sort_stloc_{$this->getId()}.record_field_id = sort_record_field_{$this->getId()}.id)";
812
813 $sql_obj->setSelectStatement($select_str);
814 $sql_obj->setJoinStatement($join_str);
815 $sql_obj->setOrderStatement("field_{$this->getId()} ".$direction);
816
817 return $sql_obj;
818 }
Class ilDclRecordQueryObject.

References $DIC, $ilDB, and getId().

+ Here is the call graph for this function:

◆ getRequired()

ilDclBaseFieldModel::getRequired ( )

Get Required Required.

Returns
boolean

Definition at line 274 of file class.ilDclBaseFieldModel.php.

References $required.

Referenced by doCreate(), and doUpdate().

+ Here is the caller graph for this function:

◆ getSortField()

ilDclBaseFieldModel::getSortField ( )

Returns the sort-field id.

Returns
string

Reimplemented in ilDclStandardField.

Definition at line 837 of file class.ilDclBaseFieldModel.php.

837 {
838 return $this->getTitle();
839 }

References getTitle().

+ Here is the call graph for this function:

◆ getStorageLocation()

ilDclBaseFieldModel::getStorageLocation ( )

Get storage location for the model.

Returns
int|null

Definition at line 317 of file class.ilDclBaseFieldModel.php.

317 {
318 if($this->getStorageLocationOverride() !== null) {
319 return $this->getStorageLocationOverride();
320 }
321
322 $this->loadDatatype();
323 return $this->datatype->getStorageLocation();
324 }

References getStorageLocationOverride(), and loadDatatype().

+ Here is the call graph for this function:

◆ getStorageLocationOverride()

ilDclBaseFieldModel::getStorageLocationOverride ( )
Returns
int|null

Definition at line 868 of file class.ilDclBaseFieldModel.php.

References $storage_location_override.

Referenced by getStorageLocation().

+ Here is the caller graph for this function:

◆ getTableId()

◆ getTitle()

ilDclBaseFieldModel::getTitle ( )

Get title.

Returns
string

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

208 {
209 return $this->title;
210 }

References $title.

Referenced by checkTitlesForImport(), ilDclTextFieldModel\checkTitlesForImport(), doCreate(), doUpdate(), fillHeaderExcel(), ilDclTextFieldModel\fillHeaderExcel(), ilDclFieldFactory\getClassPathByInstance(), and getSortField().

+ Here is the caller graph for this function:

◆ getValidFieldProperties()

ilDclBaseFieldModel::getValidFieldProperties ( )

Returns all valid properties for a field-type.

Returns
array

Reimplemented in ilDclFileuploadFieldModel, ilDclFormulaFieldModel, ilDclIliasReferenceFieldModel, ilDclMobFieldModel, ilDclPluginFieldModel, ilDclReferenceFieldModel, and ilDclTextFieldModel.

Definition at line 651 of file class.ilDclBaseFieldModel.php.

651 {
652 return array();
653 }

Referenced by cloneProperties().

+ Here is the caller graph for this function:

◆ hasNumericSorting()

ilDclBaseFieldModel::hasNumericSorting ( )

Set to true, when the sorting should be handled numerical.

Returns
bool

Reimplemented in ilDclStandardField, and ilDclNumberFieldModel.

Definition at line 846 of file class.ilDclBaseFieldModel.php.

846 {
848 return true;
849 }
850 return false;
851 }

References getDatatypeId(), and ilDclDatatype\INPUTFORMAT_NUMBER.

+ Here is the call graph for this function:

◆ hasProperty()

ilDclBaseFieldModel::hasProperty (   $key)

Checks if a certain property for a field is set.

Parameters
$key
Returns
bool

Definition at line 588 of file class.ilDclBaseFieldModel.php.

588 {
589 $this->loadProperties();
590 return (isset($this->property[$key]) && $this->property[$key]->getValue() != NULL);
591 }

References loadProperties().

Referenced by ilDclTextFieldModel\checkTitlesForImport(), ilDclFieldFactory\getClassPathByInstance(), ilDclFieldFactory\getFieldTypeByInstance(), getPropertyInstance(), ilDclReferenceFieldModel\getRecordQuerySortObject(), ilDclTextFieldModel\getRecordQuerySortObject(), and ilDclFileuploadFieldModel\getSupportedExtensions().

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

◆ isStandardField()

ilDclBaseFieldModel::isStandardField ( )
Returns
bool

Reimplemented in ilDclStandardField.

Definition at line 377 of file class.ilDclBaseFieldModel.php.

377 {
378 return false;
379 }

Referenced by getDatatypeId().

+ Here is the caller graph for this function:

◆ isUnique()

ilDclBaseFieldModel::isUnique ( )

◆ loadDatatype()

ilDclBaseFieldModel::loadDatatype ( )
protected

Load datatype for model.

Definition at line 330 of file class.ilDclBaseFieldModel.php.

330 {
331 if ($this->datatype == NULL) {
332 $this->datatype = ilDclCache::getDatatype($this->datatypeId);
333 }
334 }
static getDatatype($datatyp_id)
Get cached datatypes.

References ilDclCache\getDatatype().

Referenced by getDatatype(), getDatatypeTitle(), and getStorageLocation().

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

◆ loadExportability()

ilDclBaseFieldModel::loadExportability ( )
private

Load exportability.

Definition at line 359 of file class.ilDclBaseFieldModel.php.

359 {
360 if ($this->exportable == NULL) {
361 $this->loadTableFieldSetting();
362 }
363 }

References loadTableFieldSetting().

Referenced by getExportable().

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

◆ loadProperties()

ilDclBaseFieldModel::loadProperties ( )
protected

Get all properties of a field.

Returns
array

Definition at line 578 of file class.ilDclBaseFieldModel.php.

578 {
579 $this->property = ilDclCache::getFieldProperties($this->getId());
580 }
static getFieldProperties($field_id)
Cache Field properties.

References ilDclCache\getFieldProperties(), and getId().

Referenced by doRead(), getPropertyInstance(), hasProperty(), and setProperty().

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

◆ loadTableFieldSetting()

ilDclBaseFieldModel::loadTableFieldSetting ( )
protected

loadTableFieldSetting

Definition at line 339 of file class.ilDclBaseFieldModel.php.

339 {
340 $tablefield_setting = ilDclTableFieldSetting::getInstance($this->getTableId(), $this->getId());
341 $this->exportable = $tablefield_setting->isExportable();
342 $this->order = $tablefield_setting->getFieldOrder();
343 }

References getId(), ilDclTableFieldSetting\getInstance(), and getTableId().

Referenced by doRead(), getOrder(), and loadExportability().

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

◆ normalizeValue()

ilDclBaseFieldModel::normalizeValue (   $value)
protected
Parameters
$value
Returns
string

Definition at line 712 of file class.ilDclBaseFieldModel.php.

712 {
713 if (is_string($value)) {
714 $value = trim(preg_replace("/\\s+/uism", " ", $value));
715 }
716
717 return $value;
718 }

Referenced by checkValidity(), ilDclFileuploadFieldModel\checkValidity(), and ilDclTextFieldModel\checkValidity().

+ Here is the caller graph for this function:

◆ setDatatypeId()

ilDclBaseFieldModel::setDatatypeId (   $a_id)

Set datatype id.

Parameters
int$a_id

Definition at line 238 of file class.ilDclBaseFieldModel.php.

238 {
239 //unset the cached datatype.
240 $this->datatype = NULL;
241 $this->datatypeId = $a_id;
242 }

Referenced by buildFromDBRecord(), cloneStructure(), and doRead().

+ Here is the caller graph for this function:

◆ setDescription()

ilDclBaseFieldModel::setDescription (   $a_desc)

Set description.

Parameters
string$a_desc

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

218 {
219 $this->description = $a_desc;
220 }

Referenced by buildFromDBRecord(), cloneStructure(), and doRead().

+ Here is the caller graph for this function:

◆ setExportable()

ilDclBaseFieldModel::setExportable (   $exportable)
Parameters
boolean$exportable

Definition at line 782 of file class.ilDclBaseFieldModel.php.

782 {
783 $this->exportable = $exportable;
784 }

References $exportable.

Referenced by cloneStructure(), and ilDclStandardField\cloneStructure().

+ Here is the caller graph for this function:

◆ setId()

ilDclBaseFieldModel::setId (   $a_id)

Set field id.

Parameters
int$a_id

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

154 {
155 $this->id = $a_id;
156 }

Referenced by buildFromDBRecord(), and doCreate().

+ Here is the caller graph for this function:

◆ setLocked()

ilDclBaseFieldModel::setLocked (   $locked)
Parameters
boolean$locked

Definition at line 658 of file class.ilDclBaseFieldModel.php.

658 {
659 $this->locked = $locked;
660 }

References $locked.

Referenced by buildFromDBRecord(), cloneStructure(), ilDclStandardField\cloneStructure(), doCreate(), and doRead().

+ Here is the caller graph for this function:

◆ setOrder()

ilDclBaseFieldModel::setOrder (   $order)
Parameters
$order

Definition at line 569 of file class.ilDclBaseFieldModel.php.

569 {
570 $this->order = $order;
571 }

References $order.

Referenced by cloneStructure(), and ilDclStandardField\cloneStructure().

+ Here is the caller graph for this function:

◆ setProperty()

ilDclBaseFieldModel::setProperty (   $key,
  $value 
)

Set a property for a field (does not save)

Parameters
$key
$value

Definition at line 630 of file class.ilDclBaseFieldModel.php.

630 {
631 $this->loadProperties();
632 if(isset($this->property[$key])) {
633 $this->property[$key]->setValue($value);
634 } else {
636 $property->setName($key);
637 $property->setFieldId($this->getId());
638 $property->setValue($value);
639
640 $this->property[$key] = $property;
641 }
642
643 return $this->property[$key];
644 }

References $property, getId(), and loadProperties().

+ Here is the call graph for this function:

◆ setRequired()

ilDclBaseFieldModel::setRequired (   $a_required)

Set Required.

Parameters
boolean$a_requiredRequired

Definition at line 264 of file class.ilDclBaseFieldModel.php.

264 {
265 $this->required = $a_required;
266 }

Referenced by buildFromDBRecord(), cloneStructure(), ilDclStandardField\cloneStructure(), and doRead().

+ Here is the caller graph for this function:

◆ setStorageLocationOverride()

ilDclBaseFieldModel::setStorageLocationOverride (   $storage_location_override)
Parameters
int | null$storage_location_override

Definition at line 876 of file class.ilDclBaseFieldModel.php.

876 {
877 $this->storage_location_override = $storage_location_override;
878 }

References $storage_location_override.

◆ setTableId()

ilDclBaseFieldModel::setTableId (   $a_id)

Set table id.

Parameters
int$a_id

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

174 {
175 $this->table_id = $a_id;
176 }

Referenced by buildFromDBRecord(), and doRead().

+ Here is the caller graph for this function:

◆ setTitle()

ilDclBaseFieldModel::setTitle (   $a_title)

Set title.

Parameters
string$a_title

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

194 {
195 //title cannot begin with _ as this is saved for other purposes. make __ instead.
196 if (substr($a_title, 0, 1) == "_" && substr($a_title, 0, 2) != "__") {
197 $a_title = "_" . $a_title;
198 }
199 $this->title = $a_title;
200 }

Referenced by buildFromDBRecord(), cloneStructure(), and doRead().

+ Here is the caller graph for this function:

◆ setUnique()

ilDclBaseFieldModel::setUnique (   $unique)
Parameters
bool$unique

Definition at line 289 of file class.ilDclBaseFieldModel.php.

289 {
290 $this->unique = $unique ? 1 : 0;
291 }

References $unique.

Referenced by buildFromDBRecord(), cloneStructure(), ilDclStandardField\cloneStructure(), and doRead().

+ Here is the caller graph for this function:

◆ toArray()

ilDclBaseFieldModel::toArray ( )
Returns
array

Definition at line 369 of file class.ilDclBaseFieldModel.php.

369 {
370 return (array)$this;
371 }

◆ updateProperties()

ilDclBaseFieldModel::updateProperties ( )

Update properties of this field in Database.

Definition at line 510 of file class.ilDclBaseFieldModel.php.

510 {
511 foreach ($this->property as $prop) {
512 $prop->store();
513 }
514 }

Referenced by doUpdate().

+ Here is the caller graph for this function:

◆ updateTableFieldSetting()

ilDclBaseFieldModel::updateTableFieldSetting ( )
protected

update exportable and fieldorder

Definition at line 521 of file class.ilDclBaseFieldModel.php.

521 {
522 $tablefield_setting = ilDclTableFieldSetting::getInstance($this->getTableId(), $this->getId());
523 $tablefield_setting->setExportable($this->exportable);
524 $tablefield_setting->setFieldOrder($this->order);
525 $tablefield_setting->store();
526 }

References getId(), ilDclTableFieldSetting\getInstance(), and getTableId().

Referenced by doCreate(), doUpdate(), and ilDclStandardField\doUpdate().

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

Field Documentation

◆ $datatype

ilDclBaseFieldModel::$datatype
protected

◆ $datatypeId

ilDclBaseFieldModel::$datatypeId
protected

Definition at line 42 of file class.ilDclBaseFieldModel.php.

Referenced by getDatatypeId().

◆ $description

ilDclBaseFieldModel::$description
protected

Definition at line 38 of file class.ilDclBaseFieldModel.php.

Referenced by getDescription().

◆ $exportable

ilDclBaseFieldModel::$exportable
protected

Definition at line 66 of file class.ilDclBaseFieldModel.php.

Referenced by getExportable(), and setExportable().

◆ $id

◆ $locked

ilDclBaseFieldModel::$locked
protected

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

Referenced by getLocked(), and setLocked().

◆ $order

ilDclBaseFieldModel::$order
protected

Definition at line 50 of file class.ilDclBaseFieldModel.php.

Referenced by getOrder(), and setOrder().

◆ $property

ilDclBaseFieldModel::$property = array()
protected

Definition at line 62 of file class.ilDclBaseFieldModel.php.

Referenced by setProperty().

◆ $required

ilDclBaseFieldModel::$required
protected

Definition at line 46 of file class.ilDclBaseFieldModel.php.

Referenced by getRequired().

◆ $storage_location_override

ilDclBaseFieldModel::$storage_location_override = null
protected

◆ $table_id

ilDclBaseFieldModel::$table_id
protected

◆ $title

◆ $unique

ilDclBaseFieldModel::$unique
protected

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

Referenced by isUnique(), and setUnique().

◆ EDIT_VIEW

const ilDclBaseFieldModel::EDIT_VIEW = 2

Definition at line 99 of file class.ilDclBaseFieldModel.php.

◆ EXPORTABLE_VIEW

const ilDclBaseFieldModel::EXPORTABLE_VIEW = 4

Definition at line 100 of file class.ilDclBaseFieldModel.php.

◆ PROP_DISPLAY_COPY_LINK_ACTION_MENU

const ilDclBaseFieldModel::PROP_DISPLAY_COPY_LINK_ACTION_MENU = "display_action_menu"

◆ PROP_FORMULA_EXPRESSION

const ilDclBaseFieldModel::PROP_FORMULA_EXPRESSION = "expression"

◆ PROP_HEIGHT

const ilDclBaseFieldModel::PROP_HEIGHT = "height"

◆ PROP_ILIAS_REFERENCE_LINK

◆ PROP_LEARNING_PROGRESS

const ilDclBaseFieldModel::PROP_LEARNING_PROGRESS = "learning_progress"

◆ PROP_LENGTH

◆ PROP_LINK_DETAIL_PAGE_TEXT

◆ PROP_N_REFERENCE

◆ PROP_PLUGIN_HOOK_NAME

◆ PROP_REFERENCE

◆ PROP_REFERENCE_LINK

const ilDclBaseFieldModel::PROP_REFERENCE_LINK = "reference_link"

◆ PROP_REGEX

◆ PROP_SUPPORTED_FILE_TYPES

const ilDclBaseFieldModel::PROP_SUPPORTED_FILE_TYPES = "supported_file_types"

◆ PROP_TEXTAREA

◆ PROP_URL

◆ PROP_WIDTH

const ilDclBaseFieldModel::PROP_WIDTH = "width"

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