ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
ilDclBaseFieldModel Class Reference
+ Inheritance diagram for ilDclBaseFieldModel:
+ Collaboration diagram for ilDclBaseFieldModel:

Public Member Functions

 __construct (int $a_id=0)
 
 setId ($a_id)
 Set field id. More...
 
 getId ()
 Get field id. More...
 
 setTableId (int $a_id)
 Set table id. More...
 
 getTableId ()
 Get table id. More...
 
 setTitle (string $a_title)
 Set title. More...
 
 getTitle ()
 Get title. More...
 
 setDescription (string $a_desc)
 Set description. More...
 
 getDescription ()
 Get description. More...
 
 setDatatypeId (int $a_id)
 Set datatype id. More...
 
 getDatatypeId ()
 Get datatype_id. More...
 
 getDatatype ()
 
 getDatatypeTitle ()
 
 getPresentationTitle ()
 
 getPresentationDescription ()
 
 getStorageLocation ()
 Get storage location for the model. More...
 
 getExportable ()
 
 toArray ()
 
 isStandardField ()
 
 doRead ()
 
 buildFromDBRecord (array $rec)
 Builds model from db record. More...
 
 doCreate ()
 
 doUpdate ()
 
 updateProperties ()
 Update properties of this field in Database. More...
 
 doDelete ()
 Remove field and properties. More...
 
 getViewSettings ()
 
 getViewSetting (int $tableview_id)
 
 getOrder ()
 
 setOrder (int $order)
 
 hasProperty (string $key)
 Checks if a certain property for a field is set. More...
 
 getProperty (string $key)
 
 getPropertyInstance (string $key)
 
 setProperty (string $key, $value)
 
 getValidFieldProperties ()
 Returns all valid properties for a field-type. More...
 
 checkValidityFromForm (ilPropertyFormGUI &$form, ?int $record_id)
 
 checkValidity ($value, ?int $record_id)
 Check if input is valid. More...
 
 cloneStructure (int $original_id)
 
 afterClone (array $records)
 
 cloneProperties (ilDclBaseFieldModel $originalField)
 
 setExportable (bool $exportable)
 
 allowFilterInListView ()
 
 getRecordQuerySortObject (string $direction="asc", bool $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...
 
 checkUniqueProp (ilPropertyFormGUI $form)
 
 checkUnique ($value, ?int $record_id)
 
 getStorageLocationOverride ()
 
 setStorageLocationOverride (?int $storage_location_override)
 
 fillHeaderExcel (ilExcel $worksheet, int &$row, int &$col)
 
 checkTitlesForImport (array &$titles, array &$import_fields)
 
 storePropertiesFromForm (ilPropertyFormGUI $form)
 called when saving the 'edit field' form More...
 
 fillPropertiesForm (ilPropertyFormGUI &$form)
 called to fill the 'edit field' form More...
 
 isConfirmationRequired (ilPropertyFormGUI $form)
 called by ilDclFieldEditGUI when updating field properties if you overwrite this method, remember to also overwrite getConfirmationGUI More...
 
 getConfirmationGUI (ilPropertyFormGUI $form)
 called by ilDclFieldEditGUI if isConfirmationRequired returns true More...
 

Static Public Member Functions

static _getTitleInvalidChars (bool $a_as_regex=true)
 All valid chars for filed titles. More...
 
static _getFieldIdByTitle (string $title, int $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_REFERENCE_LINK = "reference_link"
 
const PROP_UNIQUE = "unique"
 
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_text"
 
const PROP_LINK_DETAIL_PAGE_MOB = "link_detail_page_mob"
 
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...
 
 areEqual ($value_1, $value_2)
 
 normalizeValue (mixed $value)
 

Protected Attributes

string $id = ""
 
int $table_id = 0
 
string $title = ""
 
string $description = ""
 
int $datatype_id = 0
 
int $order = null
 
array $property = []
 
bool $exportable = false
 
ilDclDatatype $datatype = null
 
int $storage_location_override = null
 With this property the datatype-storage-location can be overwritten. More...
 
ilDBInterface $db
 
ilLanguage $lng
 

Private Member Functions

 loadExportability ()
 Load exportability. More...
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilDclBaseFieldModel::__construct ( int  $a_id = 0)

Reimplemented in ilDclFileFieldModel, and ilDclMobFieldModel.

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

63 {
64 global $DIC;
65 $this->db = $DIC->database();
66 $this->lng = $DIC->language();
67
68 if ($a_id != 0) {
69 $this->id = (string) $a_id;
70 $this->doRead();
71 }
72 }
global $DIC
Definition: shib_login.php:26

References $DIC, doRead(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ _getFieldIdByTitle()

static ilDclBaseFieldModel::_getFieldIdByTitle ( string  $title,
int  $table_id 
)
static

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

86 : int
87 {
88 global $DIC;
89 $ilDB = $DIC->database();
90
91 $result = $ilDB->query(
92 'SELECT id FROM il_dcl_field WHERE title = ' . $ilDB->quote($title, 'text') . ' AND table_id = '
93 . $ilDB->quote($table_id, 'integer')
94 );
95 $id = 0;
96 while ($rec = $ilDB->fetchAssoc($result)) {
97 $id = $rec['id'];
98 }
99
100 return $id;
101 }

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

◆ _getTitleInvalidChars()

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

All valid chars for filed titles.

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

77 : string
78 {
79 if ($a_as_regex) {
80 return '/^[^<>\\\\":]*$/i';
81 } else {
82 return '\ < > " :';
83 }
84 }

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 342 of file class.ilDclBaseFieldModel.php.

342 : void
343 {
344 foreach (ilDclTableView::getAllForTableId($this->table_id) as $tableview) {
345 $tableview->createFieldSetting($this->id);
346 }
347 }
static getAllForTableId(int $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 ( array  $records)

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

558 {
559 foreach ($records as $rec) {
560 ilDclCache::getRecordFieldCache($rec, $this)->afterClone();
561 }
562 }
static getRecordFieldCache(object $record, object $field)

References ilDclCache\getRecordFieldCache().

+ Here is the call graph for this function:

◆ allowFilterInListView()

ilDclBaseFieldModel::allowFilterInListView ( )

Reimplemented in ilDclStandardField, ilDclFileFieldModel, ilDclFormulaFieldModel, ilDclPluginFieldModel, and ilDclReferenceFieldModel.

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

599 : bool
600 {
601 return true;
602 }

◆ areEqual()

ilDclBaseFieldModel::areEqual (   $value_1,
  $value_2 
)
protected

Reimplemented in ilDclTextFieldModel.

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

525 : bool
526 {
527 return $this->normalizeValue($value_1) === $this->normalizeValue($value_2);
528 }

References normalizeValue().

+ Here is the call graph for this function:

◆ buildFromDBRecord()

ilDclBaseFieldModel::buildFromDBRecord ( array  $rec)

Builds model from db record.

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

308 : void
309 {
310 $this->setId($rec["id"]);
311 $this->setTableId($rec["table_id"]);
312 $this->setTitle($rec["title"]);
313 $this->setDescription($rec["description"]);
314 $this->setDatatypeId($rec["datatype_id"]);
315 }
setDatatypeId(int $a_id)
Set datatype id.
setTitle(string $a_title)
Set title.
setDescription(string $a_desc)
Set description.
setTableId(int $a_id)
Set table id.

References setDatatypeId(), setDescription(), setId(), setTableId(), and setTitle().

+ Here is the call graph for this function:

◆ checkFieldCreationInput()

ilDclBaseFieldModel::checkFieldCreationInput ( ilPropertyFormGUI  $form)

Checks input of specific fields befor saving.

Parameters
ilPropertyFormGUI$form
Returns
bool if checkInput was successful

Reimplemented in ilDclIliasReferenceFieldModel, ilDclSelectionFieldModel, and ilDclTextFieldModel.

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

663 : bool
664 {
665 return true;
666 }

◆ checkTitlesForImport()

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

Reimplemented in ilDclTextFieldModel.

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

724 : void
725 {
726 foreach ($titles as $k => $title) {
727 if (!mb_detect_encoding($title, "UTF-8", true) == "UTF-8") {
728 $title = mb_convert_encoding($title, 'UTF-8', 'ISO-8859-1');
729 }
730 if ($title == $this->getTitle()) {
731 $import_fields[$k] = $this;
732 }
733 }
734 }

References ILIAS\GlobalScreen\Scope\Footer\Factory\getTitle().

+ Here is the call graph for this function:

◆ checkUnique()

ilDclBaseFieldModel::checkUnique (   $value,
?int  $record_id 
)

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

686 : bool
687 {
688 if ($value && $this->getProperty(ilDclBaseFieldModel::PROP_UNIQUE) === '1') {
689 foreach (ilDclCache::getTableCache($this->getTableId())->getRecords() as $record) {
690 if ($record->getId() !== $record_id) {
691 $x = $record->getRecordFieldValue($this->getId());
692 if ($this->areEqual($record->getRecordFieldValue($this->getId()), $value)) {
694 }
695 }
696 }
697 }
698
699 return true;
700 }
static getTableCache(?int $table_id=null)

References ILIAS\Survey\Mode\getId(), ilDclCache\getTableCache(), PROP_UNIQUE, and ilDclInputException\UNIQUE_EXCEPTION.

+ Here is the call graph for this function:

◆ checkUniqueProp()

ilDclBaseFieldModel::checkUniqueProp ( ilPropertyFormGUI  $form)

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

668 : bool
669 {
670 if ($this->getId() !== '' && $form->getInput('prop_' . ilDclBaseFieldModel::PROP_UNIQUE) === '1') {
671 $values = [];
672 foreach (ilDclCache::getTableCache($this->getTableId())->getRecords() as $record) {
673 $new = $record->getRecordFieldValue($this->getId());
674 foreach ($values as $value) {
675 if ($this->areEqual($new, $value)) {
676 $form->getItemByPostVar('prop_' . ilDclBaseFieldModel::PROP_UNIQUE)->setAlert($this->lng->txt('duplicate_entries_exist'));
677 return false;
678 }
679 }
680 $values[] = $new;
681 }
682 }
683 return true;
684 }
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
getItemByPostVar(string $a_post_var)

References ILIAS\Survey\Mode\getId(), ilPropertyFormGUI\getInput(), ilPropertyFormGUI\getItemByPostVar(), ilDclCache\getTableCache(), ILIAS\Repository\lng(), and PROP_UNIQUE.

+ Here is the call graph for this function:

◆ checkValidity()

ilDclBaseFieldModel::checkValidity (   $value,
?int  $record_id 
)

Check if input is valid.

Parameters
float | int | string | array | null$value
Exceptions
ilDclInputException

Reimplemented in ilDclIliasReferenceFieldModel, ilDclNumberFieldModel, ilDclSelectionFieldModel, and ilDclTextFieldModel.

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

520 : bool
521 {
522 return true;
523 }

Referenced by checkValidityFromForm().

+ Here is the caller graph for this function:

◆ checkValidityFromForm()

ilDclBaseFieldModel::checkValidityFromForm ( ilPropertyFormGUI $form,
?int  $record_id 
)

Reimplemented in ilDclBooleanFieldModel, and ilDclTextFieldModel.

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

509 : void
510 {
511 $value = $form->getInput('field_' . $this->getId());
512 $this->checkValidity($value, $record_id);
513 }
checkValidity($value, ?int $record_id)
Check if input is valid.

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

+ Here is the call graph for this function:

◆ cloneProperties()

ilDclBaseFieldModel::cloneProperties ( ilDclBaseFieldModel  $originalField)

Reimplemented in ilDclSelectionFieldModel.

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

564 : void
565 {
566 $orgProps = $originalField->getValidFieldProperties();
567 if (count($orgProps) == 0) {
568 return;
569 }
570 foreach ($orgProps as $prop_name) {
571 $fieldprop_obj = new ilDclFieldProperty();
572 $fieldprop_obj->setFieldId((int) $this->getId());
573 $fieldprop_obj->setName($prop_name);
574
575 $value = $originalField->getProperty($prop_name);
576
577 if (
579 (
582 )
583 ) {
584 $value = null;
585 }
586
587 if ($value) {
588 $fieldprop_obj->setValue($value);
589 $fieldprop_obj->create();
590 }
591 }
592 }
getValidFieldProperties()
Returns all valid properties for a field-type.

References getDatatypeId(), getId(), getProperty(), getValidFieldProperties(), ilDclDatatype\INPUTFORMAT_COPY, 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 ( int  $original_id)
Exceptions
ilException

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

542 : void
543 {
544 $original = ilDclCache::getFieldCache($original_id);
545 $this->setTitle($original->getTitle());
546 $this->setDatatypeId($original->getDatatypeId());
547 $this->setDescription($original->getDescription());
548 $this->setOrder($original->getOrder());
549 $this->setExportable($original->getExportable());
550 $this->doCreate();
551 $this->cloneProperties($original);
552
553 // mandatory for all cloning functions
554 ilDclCache::setCloneOf($original_id, (int) $this->getId(), ilDclCache::TYPE_FIELD);
555 }
cloneProperties(ilDclBaseFieldModel $originalField)
static getFieldCache(int $field_id=0)
static setCloneOf(int $old, int $new, string $type)

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

+ Here is the call graph for this function:

◆ doCreate()

ilDclBaseFieldModel::doCreate ( )

Reimplemented in ilDclStandardField.

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

317 : void
318 {
319 if (!ilDclTable::_tableExists($this->getTableId())) {
320 throw new ilException("The field does not have a related table!");
321 }
322
323 $id = $this->db->nextId("il_dcl_field");
324 $this->setId($id);
325 $query = "INSERT INTO il_dcl_field (" . "id" . ", table_id" . ", datatype_id" . ", title" . ", description"
326 . " ) VALUES (" . $this->db->quote($this->getId(), "integer") . "," . $this->db->quote(
327 $this->getTableId(),
328 "integer"
329 ) . ","
330 . $this->db->quote($this->getDatatypeId(), "integer") . "," . $this->db->quote($this->getTitle(), "text") . ","
331 . $this->db->quote($this->getDescription(), "text") . ")";
332 $this->db->manipulate($query);
333
335
336 $this->addToTableViews();
337 }
updateTableFieldSetting()
update exportable and fieldorder
addToTableViews()
create ilDclTableViewFieldSettings for this field in each tableview
static _tableExists(int $table_id)
Base class for ILIAS Exception handling.

References $id, ilDclTable\_tableExists(), addToTableViews(), getDatatypeId(), getDescription(), getId(), getTableId(), getTitle(), setId(), 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.

Reimplemented in ilDclSelectionFieldModel.

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

406 : void
407 {
408 // delete tablefield setting.
409 ilDclTableFieldSetting::getInstance($this->getTableId(), $this->getId())->delete();
410
411 $query = "DELETE FROM il_dcl_field_prop WHERE field_id = " . $this->db->quote($this->getId(), "text");
412 $this->db->manipulate($query);
413
414 $query = "DELETE FROM il_dcl_field WHERE id = " . $this->db->quote($this->getId(), "text");
415 $this->db->manipulate($query);
416
417 foreach ($this->getViewSettings() as $field_setting) {
418 $field_setting->delete();
419 }
420 }
static getInstance(int $table_id, string $field)

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

+ Here is the call graph for this function:

◆ doRead()

ilDclBaseFieldModel::doRead ( )

Reimplemented in ilDclStandardField.

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

283 : void
284 {
285 //THEN 1 ELSE 0 END AS has_options FROM il_dcl_field f WHERE id = ".$ilDB->quote($this->getId(),"integer");
286 $query = "SELECT * FROM il_dcl_field WHERE id = " . $this->db->quote($this->getId(), "integer");
287 $set = $this->db->query($query);
288 $rec = $this->db->fetchAssoc($set);
289
290 if ($rec) {
291 $this->setTableId($rec["table_id"]);
292 if (null !== $rec["title"]) {
293 $this->setTitle($rec["title"]);
294 }
295 if (null !== $rec["description"]) {
296 $this->setDescription($rec["description"]);
297 }
298 $this->setDatatypeId($rec["datatype_id"]);
299 }
300
301 $this->loadProperties();
302 $this->loadTableFieldSetting();
303 }
loadTableFieldSetting()
loadTableFieldSetting
loadProperties()
Get all properties of a field.

References getId(), loadProperties(), loadTableFieldSetting(), setDatatypeId(), setDescription(), setTableId(), and setTitle().

Referenced by __construct().

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

◆ doUpdate()

ilDclBaseFieldModel::doUpdate ( )

Reimplemented in ilDclStandardField.

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

349 : void
350 {
351 $this->db->update(
352 "il_dcl_field",
353 [
354 "table_id" => [
355 "integer",
356 $this->getTableId(),
357 ],
358 "datatype_id" => [
359 "text",
360 $this->getDatatypeId(),
361 ],
362 "title" => [
363 "text",
364 $this->getTitle(),
365 ],
366 "description" => [
367 "text",
368 $this->getDescription(),
369 ],
370 ],
371 [
372 "id" => [
373 "integer",
374 $this->getId(),
375 ],
376 ]
377 );
379 $this->updateProperties();
380 }
updateProperties()
Update properties of this field in Database.

References getDatatypeId(), getDescription(), getId(), getTableId(), getTitle(), updateProperties(), and updateTableFieldSetting().

+ Here is the call graph for this function:

◆ fillHeaderExcel()

ilDclBaseFieldModel::fillHeaderExcel ( ilExcel  $worksheet,
int &  $row,
int &  $col 
)

Reimplemented in ilDclStandardField, and ilDclTextFieldModel.

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

718 : void
719 {
720 $worksheet->setCell($row, $col, $this->getTitle());
721 $col++;
722 }
setCell(int $a_row, int $col, $value, ?string $datatype=null)
Set cell value.

References ILIAS\GlobalScreen\Scope\Footer\Factory\getTitle(), and ilExcel\setCell().

+ Here is the call graph for this function:

◆ fillPropertiesForm()

ilDclBaseFieldModel::fillPropertiesForm ( ilPropertyFormGUI $form)

called to fill the 'edit field' form

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

757 : bool
758 {
759 $values = [
760 'table_id' => $this->getTableId(),
761 'field_id' => $this->getId(),
762 'title' => $this->getTitle(),
763 'datatype' => $this->getDatatypeId(),
764 'description' => $this->getDescription(),
765 ];
766
767 $properties = $this->getValidFieldProperties();
768 foreach ($properties as $prop) {
769 $values['prop_' . $prop] = $this->getProperty($prop);
770 }
771
772 $form->setValuesByArray($values);
773
774 return true;
775 }
setValuesByArray(array $a_values, bool $a_restrict_to_value_keys=false)

References ILIAS\Survey\Mode\getId(), ILIAS\GlobalScreen\Scope\Footer\Factory\getTitle(), and ilPropertyFormGUI\setValuesByArray().

+ Here is the call graph for this function:

◆ getConfirmationGUI()

ilDclBaseFieldModel::getConfirmationGUI ( ilPropertyFormGUI  $form)

called by ilDclFieldEditGUI if isConfirmationRequired returns true

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

790 {
791 $ilConfirmationGUI = new ilConfirmationGUI();
792 $ilConfirmationGUI->setFormAction($form->getFormAction());
793 $ilConfirmationGUI->addHiddenItem('confirmed', "1");
794 $ilConfirmationGUI->addHiddenItem('field_id', $form->getInput('field_id'));
795 $ilConfirmationGUI->addHiddenItem('title', $form->getInput('title'));
796 $ilConfirmationGUI->addHiddenItem('description', $form->getInput('description'));
797 $ilConfirmationGUI->addHiddenItem('datatype', $form->getInput('datatype'));
798 $ilConfirmationGUI->setConfirm($this->lng->txt('dcl_update_field'), 'update');
799 $ilConfirmationGUI->setCancel($this->lng->txt('cancel'), 'edit');
800
801 return $ilConfirmationGUI;
802 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ilFormGUI\getFormAction(), ilPropertyFormGUI\getInput(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getDatatype()

ilDclBaseFieldModel::getDatatype ( )

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

195 {
196 $this->loadDatatype();
197
198 return $this->datatype;
199 }
loadDatatype()
Load datatype for model.

References $datatype, and loadDatatype().

Referenced by ilDclFieldFactory\getClassPathByInstance(), ilDclFieldFactory\getFieldTypeByInstance(), ilDclPluginFieldModel\getPresentationDescription(), and ilDclPluginFieldModel\getPresentationTitle().

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

◆ getDatatypeId()

ilDclBaseFieldModel::getDatatypeId ( )

◆ getDatatypeTitle()

ilDclBaseFieldModel::getDatatypeTitle ( )

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

201 : string
202 {
203 $this->loadDatatype();
204 return $this->datatype->getTitle();
205 }

References loadDatatype().

Referenced by getPresentationDescription(), and getPresentationTitle().

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

◆ getDescription()

ilDclBaseFieldModel::getDescription ( )

Get description.

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

167 : string
168 {
169 return $this->description;
170 }

References $description.

Referenced by doCreate(), doUpdate(), ilDclFieldListTableGUI\fillRowFromObject(), and ilDclBaseFieldRepresentation\setupInputField().

+ Here is the caller graph for this function:

◆ getExportable()

ilDclBaseFieldModel::getExportable ( )
Returns
bool

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

254 : bool
255 {
256 if (!isset($this->exportable)) {
257 $this->loadExportability();
258 }
259
260 return $this->exportable;
261 }
loadExportability()
Load exportability.

References $exportable, and loadExportability().

Referenced by ilDclStandardField\clone(), and ilDclFieldListTableGUI\fillRowFromObject().

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

◆ getId()

◆ getOrder()

ilDclBaseFieldModel::getOrder ( )

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

435 : int
436 {
437 if ($this->order == null) {
438 $this->loadTableFieldSetting();
439 }
440
441 return !$this->order ? 0 : $this->order;
442 }

References $order, and loadTableFieldSetting().

Referenced by ilDclStandardField\clone(), and updateTableFieldSetting().

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

◆ getPresentationDescription()

ilDclBaseFieldModel::getPresentationDescription ( )

Reimplemented in ilDclCopyFieldModel, and ilDclPluginFieldModel.

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

212 : string
213 {
214 return $this->lng->txt('dcl_' . $this->getDatatypeTitle() . '_desc');
215 }

References getDatatypeTitle(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getPresentationTitle()

ilDclBaseFieldModel::getPresentationTitle ( )

Reimplemented in ilDclCopyFieldModel, and ilDclPluginFieldModel.

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

207 : string
208 {
209 return $this->lng->txt('dcl_' . $this->getDatatypeTitle());
210 }

References getDatatypeTitle(), and ILIAS\Repository\lng().

Referenced by ilDclFieldListTableGUI\fillRowFromObject().

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

◆ getProperty()

ilDclBaseFieldModel::getProperty ( string  $key)

Reimplemented in ilDclSelectionFieldModel.

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

467 : mixed
468 {
469 $instance = $this->getPropertyInstance($key);
470
471 return ($instance !== null) ? $instance->getValue() : null;
472 }

References getPropertyInstance().

Referenced by cloneProperties(), and ilDclFileFieldModel\getExtensions().

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

◆ getPropertyInstance()

ilDclBaseFieldModel::getPropertyInstance ( string  $key)

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

475 {
476 $this->loadProperties();
477 if ($this->hasProperty($key)) {
478 return $this->property[$key];
479 }
480
481 return null;
482 }
hasProperty(string $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 | int$filter_value

Reimplemented in ilDclStandardField, ilDclBooleanFieldModel, ilDclCopyFieldModel, ilDclDateFieldModel, ilDclIliasReferenceFieldModel, ilDclNumberFieldModel, ilDclRatingFieldModel, ilDclReferenceFieldModel, ilDclSelectionFieldModel, and ilDclTextFieldModel.

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

◆ getRecordQuerySortObject()

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

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

Parameters
bool$sort_by_statusThe specific sort object is a status field

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

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

612 $sql_obj = new ilDclRecordQueryObject();
613
614 $select_str = "sort_stloc_{$this->getId()}.value AS field_{$this->getId()}";
615 $join_str
616 = "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 = "
617 . $this->db->quote($this->getId(), 'integer') . ") ";
618 $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)";
619
620 $sql_obj->setSelectStatement($select_str);
621 $sql_obj->setJoinStatement($join_str);
622 $sql_obj->setOrderStatement("field_{$this->getId()} $direction, ID ASC");
623
624 return $sql_obj;
625 }

◆ getSortField()

ilDclBaseFieldModel::getSortField ( )

Returns the sort-field id.

Reimplemented in ilDclStandardField.

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

641 : string
642 {
643 return $this->getTitle();
644 }

References ILIAS\GlobalScreen\Scope\Footer\Factory\getTitle().

+ Here is the call graph for this function:

◆ getStorageLocation()

ilDclBaseFieldModel::getStorageLocation ( )

Get storage location for the model.

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

220 : ?int
221 {
222 if ($this->getStorageLocationOverride() !== null) {
223 return $this->getStorageLocationOverride();
224 }
225
226 $this->loadDatatype();
227
228 return $this->datatype->getStorageLocation();
229 }

References getStorageLocationOverride(), and loadDatatype().

+ Here is the call graph for this function:

◆ getStorageLocationOverride()

ilDclBaseFieldModel::getStorageLocationOverride ( )
Deprecated:

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

705 : ?int
706 {
708 }
int $storage_location_override
With this property the datatype-storage-location can be overwritten.

Referenced by getStorageLocation().

+ Here is the caller graph for this function:

◆ getTableId()

ilDclBaseFieldModel::getTableId ( )

Get table id.

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

131 : int
132 {
133 return $this->table_id;
134 }

References $table_id.

Referenced by doCreate(), doDelete(), doUpdate(), ilDclReferenceRecordFieldModel\getReferenceFromValue(), loadTableFieldSetting(), and updateTableFieldSetting().

+ Here is the caller graph for this function:

◆ getTitle()

◆ getValidFieldProperties()

ilDclBaseFieldModel::getValidFieldProperties ( )

Returns all valid properties for a field-type.

Reimplemented in ilDclCopyFieldModel, ilDclFileFieldModel, ilDclFormulaFieldModel, ilDclIliasReferenceFieldModel, ilDclMobFieldModel, ilDclPluginFieldModel, ilDclReferenceFieldModel, ilDclSelectionFieldModel, and ilDclTextFieldModel.

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

504 : array
505 {
506 return [];
507 }

Referenced by cloneProperties().

+ Here is the caller graph for this function:

◆ getViewSetting()

ilDclBaseFieldModel::getViewSetting ( int  $tableview_id)

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

References getId(), and ilDclTableViewFieldSetting\getTableViewFieldSetting().

+ Here is the call graph for this function:

◆ getViewSettings()

ilDclBaseFieldModel::getViewSettings ( )
Returns
ilDclTableViewFieldSetting[]

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

425 : array
426 {
427 return ilDclTableViewFieldSetting::where(['field' => $this->getId()])->get();
428 }
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:

◆ hasNumericSorting()

ilDclBaseFieldModel::hasNumericSorting ( )

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

Reimplemented in ilDclStandardField, and ilDclNumberFieldModel.

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

649 : bool
650 {
652 return true;
653 }
654
655 return false;
656 }

References ilDclDatatype\INPUTFORMAT_NUMBER.

◆ hasProperty()

ilDclBaseFieldModel::hasProperty ( string  $key)

Checks if a certain property for a field is set.

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

460 : bool
461 {
462 $this->loadProperties();
463
464 return (isset($this->property[$key]) && $this->property[$key]->getValue() != null);
465 }
getValue()
Get the value that is displayed in the input client side.
Definition: Group.php:49

References ILIAS\UI\Implementation\Component\Input\getValue(), and loadProperties().

Referenced by getPropertyInstance().

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

◆ isConfirmationRequired()

ilDclBaseFieldModel::isConfirmationRequired ( ilPropertyFormGUI  $form)

called by ilDclFieldEditGUI when updating field properties if you overwrite this method, remember to also overwrite getConfirmationGUI

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

781 : bool
782 {
783 return false;
784 }

◆ isStandardField()

ilDclBaseFieldModel::isStandardField ( )

Reimplemented in ilDclStandardField.

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

278 : bool
279 {
280 return false;
281 }

Referenced by ilDclFieldListTableGUI\fillRowFromObject(), and getDatatypeId().

+ Here is the caller graph for this function:

◆ loadDatatype()

ilDclBaseFieldModel::loadDatatype ( )
protected

Load datatype for model.

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

234 : void
235 {
236 if ($this->datatype == null) {
237 $this->datatype = ilDclCache::getDatatype($this->datatype_id);
238 }
239 }
static getDatatype(int $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 266 of file class.ilDclBaseFieldModel.php.

266 : void
267 {
268 if ($this->exportable == null) {
269 $this->loadTableFieldSetting();
270 }
271 }

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.

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

452 : void
453 {
454 $this->property = ilDclCache::getFieldProperties($this->getId());
455 }
static getFieldProperties(string $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 244 of file class.ilDclBaseFieldModel.php.

244 : void
245 {
246 $tablefield_setting = ilDclTableFieldSetting::getInstance($this->getTableId(), $this->getId());
247 $this->exportable = $tablefield_setting->isExportable();
248 $this->order = $tablefield_setting->getFieldOrder();
249 }

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 ( mixed  $value)
protected

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

531 {
532 if (is_string($value)) {
533 $value = trim(preg_replace("/\\s+/uism", " ", $value));
534 }
535
536 return $value;
537 }

Referenced by areEqual().

+ Here is the caller graph for this function:

◆ setDatatypeId()

ilDclBaseFieldModel::setDatatypeId ( int  $a_id)

Set datatype id.

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

175 : void
176 {
177 //unset the cached datatype.
178 $this->datatype = null;
179 $this->datatype_id = $a_id;
180 }

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

+ Here is the caller graph for this function:

◆ setDescription()

ilDclBaseFieldModel::setDescription ( string  $a_desc)

Set description.

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

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

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

+ Here is the caller graph for this function:

◆ setExportable()

ilDclBaseFieldModel::setExportable ( bool  $exportable)

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

594 : void
595 {
596 $this->exportable = $exportable;
597 }

References $exportable.

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

+ Here is the caller graph for this function:

◆ setId()

ilDclBaseFieldModel::setId (   $a_id)

Set field id.

Parameters
int|string

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

107 : void
108 {
109 $this->id = (string) $a_id;
110 }

Referenced by buildFromDBRecord(), and doCreate().

+ Here is the caller graph for this function:

◆ setOrder()

ilDclBaseFieldModel::setOrder ( int  $order)

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

444 : void
445 {
446 $this->order = $order;
447 }

References $order.

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

+ Here is the caller graph for this function:

◆ setProperty()

ilDclBaseFieldModel::setProperty ( string  $key,
  $value 
)

Reimplemented in ilDclSelectionFieldModel.

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

485 {
486 $this->loadProperties();
487 if (isset($this->property[$key])) {
488 $this->property[$key]->setValue($value);
489 } else {
491 $property->setName($key);
492 $property->setFieldId((int) $this->getId());
493 $property->setValue($value);
494
495 $this->property[$key] = $property;
496 }
497
498 return $this->property[$key];
499 }

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

+ Here is the call graph for this function:

◆ setStorageLocationOverride()

ilDclBaseFieldModel::setStorageLocationOverride ( ?int  $storage_location_override)
Deprecated:
override ilDclFieldTypePlugin::getStorageLocation() instead

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

713 : void
714 {
715 $this->storage_location_override = $storage_location_override;
716 }

◆ setTableId()

ilDclBaseFieldModel::setTableId ( int  $a_id)

Set table id.

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

123 : void
124 {
125 $this->table_id = $a_id;
126 }

Referenced by buildFromDBRecord(), and doRead().

+ Here is the caller graph for this function:

◆ setTitle()

ilDclBaseFieldModel::setTitle ( string  $a_title)

Set title.

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

139 : void
140 {
141 //title cannot begin with _ as this is saved for other purposes. make __ instead.
142 if (substr($a_title, 0, 1) == "_" && substr($a_title, 0, 2) != "__") {
143 $a_title = "_" . $a_title;
144 }
145 $this->title = $a_title;
146 }

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

+ Here is the caller graph for this function:

◆ storePropertiesFromForm()

ilDclBaseFieldModel::storePropertiesFromForm ( ilPropertyFormGUI  $form)

called when saving the 'edit field' form

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

739 : void
740 {
741 $field_props = $this->getValidFieldProperties();
743
744 foreach ($field_props as $property) {
745 $value = $form->getInput($representation->getPropertyInputFieldId($property));
746
747 // save non empty values and set them to null, when they already exist. Do not override plugin-hook when already set.
748 if (!empty($value) || ($this->getPropertyInstance($property) != null && $property != self::PROP_PLUGIN_HOOK_NAME)) {
749 $this->setProperty($property, $value)?->store();
750 }
751 }
752 }
setProperty(string $key, $value)
static getFieldRepresentationInstance(ilDclBaseFieldModel $field)

References ilDclFieldFactory\getFieldRepresentationInstance(), and ilPropertyFormGUI\getInput().

+ Here is the call graph for this function:

◆ toArray()

ilDclBaseFieldModel::toArray ( )

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

273 : array
274 {
275 return (array) $this;
276 }

◆ updateProperties()

ilDclBaseFieldModel::updateProperties ( )

Update properties of this field in Database.

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

385 : void
386 {
387 foreach ($this->property as $prop) {
388 $prop->store();
389 }
390 }

Referenced by doUpdate().

+ Here is the caller graph for this function:

◆ updateTableFieldSetting()

ilDclBaseFieldModel::updateTableFieldSetting ( )
protected

update exportable and fieldorder

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

395 : void
396 {
397 $tablefield_setting = ilDclTableFieldSetting::getInstance($this->getTableId(), $this->getId());
398 $tablefield_setting->setExportable($this->exportable);
399 $tablefield_setting->setFieldOrder($this->getOrder());
400 $tablefield_setting->store();
401 }

References getId(), ilDclTableFieldSetting\getInstance(), getOrder(), 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

ilDclDatatype ilDclBaseFieldModel::$datatype = null
protected

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

Referenced by getDatatype().

◆ $datatype_id

int ilDclBaseFieldModel::$datatype_id = 0
protected

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

Referenced by getDatatypeId().

◆ $db

ilDBInterface ilDclBaseFieldModel::$db
protected

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

◆ $description

string ilDclBaseFieldModel::$description = ""
protected

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

Referenced by getDescription().

◆ $exportable

bool ilDclBaseFieldModel::$exportable = false
protected

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

Referenced by getExportable(), and setExportable().

◆ $id

◆ $lng

ilLanguage ilDclBaseFieldModel::$lng
protected

◆ $order

int ilDclBaseFieldModel::$order = null
protected

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

Referenced by getOrder(), and setOrder().

◆ $property

array ilDclBaseFieldModel::$property = []
protected

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

Referenced by setProperty().

◆ $storage_location_override

int ilDclBaseFieldModel::$storage_location_override = null
protected

With this property the datatype-storage-location can be overwritten.

This need to be done in plugins.

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

◆ $table_id

int ilDclBaseFieldModel::$table_id = 0
protected

◆ $title

string ilDclBaseFieldModel::$title = ""
protected

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

Referenced by _getFieldIdByTitle(), and getTitle().

◆ EDIT_VIEW

const ilDclBaseFieldModel::EDIT_VIEW = 2

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

◆ EXPORTABLE_VIEW

const ilDclBaseFieldModel::EXPORTABLE_VIEW = 4

Definition at line 57 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_ILIAS_REFERENCE_LINK

const ilDclBaseFieldModel::PROP_ILIAS_REFERENCE_LINK = "ILIAS_reference_link"

◆ PROP_LEARNING_PROGRESS

const ilDclBaseFieldModel::PROP_LEARNING_PROGRESS = "learning_progress"

◆ PROP_LENGTH

◆ PROP_LINK_DETAIL_PAGE_MOB

const ilDclBaseFieldModel::PROP_LINK_DETAIL_PAGE_MOB = "link_detail_page_mob"

◆ PROP_LINK_DETAIL_PAGE_TEXT

const ilDclBaseFieldModel::PROP_LINK_DETAIL_PAGE_TEXT = "link_detail_page_text"

◆ PROP_N_REFERENCE

◆ PROP_PLUGIN_HOOK_NAME

const ilDclBaseFieldModel::PROP_PLUGIN_HOOK_NAME = "plugin_hook_name"

◆ PROP_REFERENCE

◆ PROP_REFERENCE_LINK

◆ PROP_REGEX

◆ PROP_SUPPORTED_FILE_TYPES

const ilDclBaseFieldModel::PROP_SUPPORTED_FILE_TYPES = "supported_file_types"

◆ PROP_UNIQUE

◆ PROP_URL


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