ILIAS  release_8 Revision v8.24
ilDclBaseRecordModel Class Reference
+ Collaboration diagram for ilDclBaseRecordModel:

Public Member Functions

 __construct (?int $a_id=0)
 
 doUpdate (bool $omit_notification=false)
 
 doRead ()
 
 doCreate ()
 
 deleteField (int $field_id)
 
 setId (int $a_id)
 
 getId ()
 
 setTableId (int $a_id)
 
 getTableId ()
 
 setCreateDate (ilDateTime $a_datetime)
 
 getCreateDate ()
 
 setLastUpdate (ilDateTime $a_datetime)
 
 getLastUpdate ()
 
 setOwner (int $a_id)
 
 getOwner ()
 
 getLastEditBy ()
 
 setLastEditBy (?int $last_edit_by)
 
 setRecordFieldValue ($field_id, $value)
 
 setRecordFieldValueFromForm (int $field_id, ilPropertyFormGUI $form)
 Set a field value. More...
 
 getRecordFieldValueFromExcel (ilExcel $excel, int $row, int $col, ilDclBaseFieldModel $field)
 
 setStandardFieldValueFromExcel (ilExcel $excel, int $row, int $col, ilDclBaseFieldModel $field)
 
 getRecordFieldValues ()
 
 getRecordFieldValue (?int $field_id)
 Get Field Value. More...
 
 getRecordFieldRepresentationValue ($field_id)
 Get Field Value for Representation in a Form. More...
 
 getRecordFieldExportValue ($field_id)
 Get Field Export Value. More...
 
 getRecordFieldPlainText ($field_id)
 Get Field Export Value. More...
 
 fillRecordFieldExcelExport (ilExcel $worksheet, int &$row, int &$col, $field_id)
 
 getRecordFieldFormulaValue ($field_id)
 
 getRecordFieldHTML ($field_id, array $options=[])
 
 getRecordFieldSortingValue ($field_id, array $options=[])
 
 fillRecordFieldFormInput ($field_id, ilPropertyFormGUI $form)
 
 getStandardFieldFormulaValue ($field_id)
 
 getStandardFieldHTML (string $field_id, array $options=[])
 
 getStandardFieldPlainText (string $field_id)
 
 getRecordField (int $field_id)
 
 doDelete (bool $omit_notification=false)
 
 cloneStructure (int $original_id, array $new_fields)
 
 deleteFile (int $obj_id)
 
 deleteMob (int $obj_id)
 
 hasPermissionToEdit (int $ref_id)
 
 hasPermissionToDelete (int $ref_id)
 
 hasPermissionToView (int $ref_id)
 
 getRecordFields ()
 
 getTable ()
 
 getNrOfComments ()
 Get nr of comments of this record. More...
 

Protected Member Functions

 setStandardFieldFromForm ($field_id, ilPropertyFormGUI $form)
 
 setStandardField ($field_id, $value)
 
 fillStandardFieldFormInput ($field_id, ilPropertyFormGUI $form)
 
 getStandardField ($field_id)
 

Protected Attributes

ILIAS UI Factory $ui_factory
 
ILIAS UI Renderer $renderer
 
Service $notes
 
array $recordfields = null
 
int $id = 0
 
int $table_id
 
ilDclTable $table = null
 
int $last_edit_by = null
 
int $owner = 0
 
ilDateTime $last_update
 
ilDateTime $create_date
 
int $nr_of_comments = null
 
ILIAS HTTP Services $http
 
ILIAS Refinery Factory $refinery
 
ilDBInterface $db
 
ilAppEventHandler $event
 

Private Member Functions

 loadRecordFields ()
 
 loadTable ()
 

Private Attributes

ilObjUser $user
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilDclBaseRecordModel::__construct ( ?int  $a_id = 0)

Definition at line 45 of file class.ilDclBaseRecordModel.php.

46 {
47 global $DIC;
48 $this->db = $DIC->database();
49 $this->event = $DIC->event();
50 $this->user = $DIC->user();
51 $this->ui_factory = $DIC->ui()->factory();
52 $this->renderer = $DIC->ui()->renderer();
53
54 if ($a_id && $a_id != 0) {
55 $this->id = $a_id;
56 $this->doRead();
57 }
58
59 $this->notes = $DIC->notes();
60 $this->http = $DIC->http();
61 $this->refinery = $DIC->refinery();
62 }
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.

References $DIC, doRead(), ILIAS\FileDelivery\http(), ILIAS\Repository\refinery(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ cloneStructure()

ilDclBaseRecordModel::cloneStructure ( int  $original_id,
array  $new_fields 
)

Definition at line 672 of file class.ilDclBaseRecordModel.php.

672 : void
673 {
674 $original = ilDclCache::getRecordCache($original_id);
675 $this->setCreateDate($original->getCreateDate());
676 $this->setLastEditBy($original->getLastEditBy());
677 $this->setLastUpdate($original->getLastUpdate());
678 $this->setOwner($original->getOwner());
679 $this->doCreate();
680 foreach ($new_fields as $old => $new) {
681 $old_rec_field = $original->getRecordField($old);
682 $new_rec_field = ilDclCache::getRecordFieldCache($this, $new);
683 $new_rec_field->cloneStructure($old_rec_field);
684 $this->recordfields[] = $new_rec_field;
685 }
686
687 // mandatory for all cloning functions
689 }
setLastUpdate(ilDateTime $a_datetime)
setCreateDate(ilDateTime $a_datetime)
static getRecordCache(?int $record_id)
static getRecordFieldCache(object $record, object $field)
static setCloneOf(int $old, int $new, string $type)

References ILIAS\Survey\Mode\getId(), ilDclCache\getRecordCache(), ilDclCache\getRecordFieldCache(), ilDclCache\setCloneOf(), and ilDclCache\TYPE_RECORD.

+ Here is the call graph for this function:

◆ deleteField()

ilDclBaseRecordModel::deleteField ( int  $field_id)

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

175 : void
176 {
177 $this->loadRecordFields();
178 $this->recordfields[$field_id]->delete();
179 if (count($this->recordfields) == 1) {
180 $this->doDelete();
181 }
182 }
doDelete(bool $omit_notification=false)

References doDelete(), and loadRecordFields().

+ Here is the call graph for this function:

◆ deleteFile()

ilDclBaseRecordModel::deleteFile ( int  $obj_id)

Definition at line 691 of file class.ilDclBaseRecordModel.php.

691 : void
692 {
693 if (ilObject2::_exists($obj_id, false)) {
694 $file = new ilObjFile($obj_id, false);
695 $file->delete();
696 }
697 }
Class ilObjFile.
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data

References ilObject\_exists().

+ Here is the call graph for this function:

◆ deleteMob()

ilDclBaseRecordModel::deleteMob ( int  $obj_id)

Definition at line 699 of file class.ilDclBaseRecordModel.php.

699 : void
700 {
701 if (ilObject2::_lookupObjId($obj_id)) {
702 $mob = new ilObjMediaObject($obj_id);
703 $mob->delete();
704 }
705 }
static _lookupObjId(int $ref_id)

References ilObject\_lookupObjId().

+ Here is the call graph for this function:

◆ doCreate()

ilDclBaseRecordModel::doCreate ( )
Exceptions
ilException

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

139 : void
140 {
141 if (!ilDclTable::_tableExists($this->getTableId())) {
142 throw new ilException("The field does not have a related table!");
143 }
144
145 $id = $this->db->nextId("il_dcl_record");
146 $this->setId($id);
147 $query
148 = "INSERT INTO il_dcl_record (
149 id,
150 table_id,
151 create_date,
152 Last_update,
153 owner,
154 last_edit_by
155 ) VALUES (" . $this->db->quote($this->getId(), "integer") . "," . $this->db->quote(
156 $this->getTableId(),
157 "integer"
158 ) . ","
159 . $this->db->quote($this->getCreateDate()->get(IL_CAL_DATETIME), "timestamp") . "," . $this->db->quote(
160 $this->getLastUpdate()->get(IL_CAL_DATETIME),
161 "timestamp"
162 ) . ","
163 . $this->db->quote($this->getOwner(), "integer") . "," . $this->db->quote($this->getLastEditBy(), "integer") . "
164 )";
165 $this->db->manipulate($query);
166
167 $this->loadRecordFields();
168 foreach ($this->getRecordFields() as $recordField) {
169 $recordField->doCreate();
170 }
171
172 $this->getTable()->loadRecords();
173 }
const IL_CAL_DATETIME
static _tableExists(int $table_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$query

References $id, $query, ilDclTable\_tableExists(), getCreateDate(), getId(), getLastEditBy(), getLastUpdate(), getOwner(), getRecordFields(), getTable(), getTableId(), IL_CAL_DATETIME, loadRecordFields(), and setId().

Referenced by ilDclRecordEditGUI\save().

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

◆ doDelete()

ilDclBaseRecordModel::doDelete ( bool  $omit_notification = false)

Definition at line 633 of file class.ilDclBaseRecordModel.php.

633 : void
634 {
635 $this->loadRecordFields();
636 foreach ($this->recordfields as $recordfield) {
637 if ($recordfield->getField()->getDatatypeId() == ilDclDatatype::INPUTFORMAT_FILE) {
638 $this->deleteFile((int) $recordfield->getValue());
639 }
640
641 if ($recordfield->getField()->getDatatypeId() == ilDclDatatype::INPUTFORMAT_MOB) {
642 $this->deleteMob((int) $recordfield->getValue());
643 }
644
645 $recordfield->delete();
646 }
647
648 $query = "DELETE FROM il_dcl_record WHERE id = " . $this->db->quote($this->getId(), "integer");
649 $this->db->manipulate($query);
650
651 $this->table->loadRecords();
652
653 if (!$omit_notification) {
654 $ref_id = $this->http->wrapper()->query()->retrieve('ref_id', $this->refinery->kindlyTo()->int());
655 $objDataCollection = new ilObjDataCollection($ref_id);
656 $objDataCollection->sendNotification("delete_record", $this->getTableId(), $this->getId());
657
658 $this->event->raise(
659 'Modules/DataCollection',
660 'deleteRecord',
661 [
662 'dcl' => ilDclCache::getTableCache($this->getTableId())->getCollectionObject(),
663 'table_id' => $this->table_id,
664 'record_id' => $this->getId(),
665 'record' => $this,
666 ]
667 );
668 }
669 }
static getTableCache(int $table_id=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:67

References $query, $ref_id, ILIAS\Survey\Mode\getId(), ilDclCache\getTableCache(), ILIAS\FileDelivery\http(), ilDclDatatype\INPUTFORMAT_FILE, ilDclDatatype\INPUTFORMAT_MOB, and ILIAS\Repository\refinery().

Referenced by ilDclRecordEditGUI\delete(), and deleteField().

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

◆ doRead()

ilDclBaseRecordModel::doRead ( )

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

107 : void
108 {
109 //build query
110 $query = "Select * From il_dcl_record WHERE id = " . $this->db->quote($this->getId(), "integer") . " ORDER BY id";
111
112 $set = $this->db->query($query);
113 $rec = $this->db->fetchAssoc($set);
114
115 if (!$rec) {
116 $this->id = 0;
117 return;
118 }
119
120 $this->setTableId((int) $rec["table_id"]);
121 $this->loadTable();
122 if (null !== $rec["create_date"]) {
123 $this->setCreateDate(new ilDateTime($rec["create_date"], IL_CAL_DATETIME));
124 }
125 if (null !== $rec["last_update"]) {
126 $this->setLastUpdate(new ilDateTime($rec["last_update"], IL_CAL_DATETIME));
127 } else {
128 $this->setLastUpdate(new ilDateTime($rec["create_date"], IL_CAL_DATETIME));
129 }
130 $this->setOwner((int) $rec["owner"]);
131 if (null !== $rec["last_edit_by"]) {
132 $this->setLastEditBy((int) $rec["last_edit_by"]);
133 }
134 }
@classDescription Date and time handling

References $query, getId(), IL_CAL_DATETIME, loadTable(), setCreateDate(), setLastEditBy(), setLastUpdate(), setOwner(), and setTableId().

Referenced by __construct().

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

◆ doUpdate()

ilDclBaseRecordModel::doUpdate ( bool  $omit_notification = false)

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

64 : void
65 {
66 $values = [
67 "table_id" => [
68 "integer",
69 $this->getTableId(),
70 ],
71 "last_update" => [
72 "date",
73 $this->getLastUpdate()->get(IL_CAL_DATETIME),
74 ],
75 "owner" => [
76 "integer",
77 $this->getOwner(),
78 ],
79 "last_edit_by" => [
80 "integer",
81 $this->getLastEditBy(),
82 ],
83 ];
84 $this->db->update(
85 "il_dcl_record",
86 $values,
87 [
88 "id" => [
89 "integer",
90 $this->id,
91 ],
92 ]
93 );
94
95 foreach ($this->getRecordFields() as $recordfield) {
96 $recordfield->doUpdate();
97 }
98
99 //TODO: add event raise
100 if (!$omit_notification) {
101 $ref_id = $this->http->wrapper()->query()->retrieve('ref_id', $this->refinery->kindlyTo()->int());
102 $objDataCollection = new ilObjDataCollection($ref_id);
103 $objDataCollection->sendNotification("update_record", $this->getTableId(), $this->id);
104 }
105 }

References $ref_id, getLastEditBy(), getLastUpdate(), getOwner(), getRecordFields(), getTableId(), ILIAS\FileDelivery\http(), IL_CAL_DATETIME, and ILIAS\Repository\refinery().

Referenced by ilDclRecordEditGUI\save().

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

◆ fillRecordFieldExcelExport()

ilDclBaseRecordModel::fillRecordFieldExcelExport ( ilExcel  $worksheet,
int &  $row,
int &  $col,
  $field_id 
)
Parameters
int | string$field_id

Definition at line 376 of file class.ilDclBaseRecordModel.php.

376 : void
377 {
378 $this->loadRecordFields();
380 if ($field_id == 'owner') {
381 $worksheet->setCell($row, $col, ilObjUser::_lookupLogin($this->getOwner()));
382 $col++;
383 $name_array = ilObjUser::_lookupName($this->getOwner());
384 $worksheet->setCell($row, $col, $name_array['lastname'] . ', ' . $name_array['firstname']);
385 } elseif ('last_update') {
386 $date_time = $this->getLastUpdate()->get(IL_CAL_DATETIME, '', $this->user->getTimeZone());
387 $worksheet->setCell($row, $col, $date_time);
388 } elseif ('create_date') {
389 $date_time = $this->getCreateDate()->get(IL_CAL_DATETIME, '', $this->user->getTimeZone());
390 $worksheet->setCell($row, $col, $date_time);
391 } else {
392 $worksheet->setCell($row, $col, $this->getStandardFieldHTML($field_id));
393 }
394 $col++;
395 } else {
396 $this->recordfields[$field_id]->fillExcelExport($worksheet, $row, $col);
397 }
398 }
getStandardFieldHTML(string $field_id, array $options=[])
static _isStandardField($field_id)
setCell(int $a_row, int $a_col, $a_value, ?string $a_datatype=null)
Set cell value.
static _lookupName(int $a_user_id)
lookup user name
static _lookupLogin(int $a_user_id)

References ilDclStandardField\_isStandardField(), ilObjUser\_lookupLogin(), ilObjUser\_lookupName(), IL_CAL_DATETIME, ilExcel\setCell(), and ILIAS\Repository\user().

Referenced by ilDclContentExporter\fillRowExcel().

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

◆ fillRecordFieldFormInput()

ilDclBaseRecordModel::fillRecordFieldFormInput (   $field_id,
ilPropertyFormGUI  $form 
)
Parameters
int | string$field_id

Definition at line 481 of file class.ilDclBaseRecordModel.php.

481 : void
482 {
483 $this->loadRecordFields();
485 $this->fillStandardFieldFormInput($field_id, $form);
486 } else {
487 $this->recordfields[$field_id]->getRecordRepresentation()->fillFormInput($form);
488 }
489 }
fillStandardFieldFormInput($field_id, ilPropertyFormGUI $form)

References ilDclStandardField\_isStandardField().

Referenced by ilDclRecordEditGUI\sendFailure().

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

◆ fillStandardFieldFormInput()

ilDclBaseRecordModel::fillStandardFieldFormInput (   $field_id,
ilPropertyFormGUI  $form 
)
protected
Parameters
int | string$field_id

Definition at line 517 of file class.ilDclBaseRecordModel.php.

517 : void
518 {
519 if ($item = $form->getItemByPostVar('field_' . $field_id)) {
520 $item->setValue($this->getStandardField($field_id));
521 }
522 }
getItemByPostVar(string $a_post_var)

References ilPropertyFormGUI\getItemByPostVar().

+ Here is the call graph for this function:

◆ getCreateDate()

ilDclBaseRecordModel::getCreateDate ( )

Definition at line 209 of file class.ilDclBaseRecordModel.php.

209 : ilDateTime
210 {
211 return $this->create_date;
212 }

References $create_date.

Referenced by doCreate().

+ Here is the caller graph for this function:

◆ getId()

ilDclBaseRecordModel::getId ( )

◆ getLastEditBy()

ilDclBaseRecordModel::getLastEditBy ( )

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

234 : ?int
235 {
236 return $this->last_edit_by;
237 }

References $last_edit_by.

Referenced by doCreate(), and doUpdate().

+ Here is the caller graph for this function:

◆ getLastUpdate()

ilDclBaseRecordModel::getLastUpdate ( )

Definition at line 219 of file class.ilDclBaseRecordModel.php.

219 : ilDateTime
220 {
221 return $this->last_update;
222 }

References $last_update.

Referenced by doCreate(), and doUpdate().

+ Here is the caller graph for this function:

◆ getNrOfComments()

ilDclBaseRecordModel::getNrOfComments ( )

Get nr of comments of this record.

Definition at line 742 of file class.ilDclBaseRecordModel.php.

742 : int
743 {
744 if ($this->nr_of_comments === null) {
745 $context = $this->notes
746 ->data()
747 ->context(
748 $this->table->getCollectionObject()->getId(),
749 $this->getId(),
750 'dcl'
751 );
752 $this->nr_of_comments = $this->notes
753 ->domain()
754 ->getNrOfCommentsForContext($context);
755 }
756
758 }
$context
Definition: webdav.php:29

References $context.

◆ getOwner()

ilDclBaseRecordModel::getOwner ( )

Definition at line 229 of file class.ilDclBaseRecordModel.php.

229 : int
230 {
231 return $this->owner;
232 }

References $owner.

Referenced by doCreate(), ilDclTable\doesRecordBelongToUser(), doUpdate(), and ilDclTable\hasPermissionToViewRecord().

+ Here is the caller graph for this function:

◆ getRecordField()

ilDclBaseRecordModel::getRecordField ( int  $field_id)

Definition at line 626 of file class.ilDclBaseRecordModel.php.

627 {
628 $this->loadRecordFields();
629
630 return $this->recordfields[$field_id];
631 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

Referenced by ilDclReferenceRecordFieldModel\getReferenceFromValue().

+ Here is the caller graph for this function:

◆ getRecordFieldExportValue()

ilDclBaseRecordModel::getRecordFieldExportValue (   $field_id)

Get Field Export Value.

Parameters
?int|string$field_id
Returns
int|string

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

349 {
350 $this->loadRecordFields();
352 return $this->getStandardFieldHTML($field_id);
353 } else {
354 return $this->recordfields[$field_id]->getExportValue();
355 }
356 }

References ilDclStandardField\_isStandardField().

+ Here is the call graph for this function:

◆ getRecordFieldFormulaValue()

ilDclBaseRecordModel::getRecordFieldFormulaValue (   $field_id)
Parameters
int | string$field_id

Definition at line 403 of file class.ilDclBaseRecordModel.php.

403 : string
404 {
405 $this->loadRecordFields();
407 $value = $this->getStandardFieldFormulaValue($field_id);
408 } else {
409 if (is_object($this->recordfields[$field_id])) {
410 $value = $this->recordfields[$field_id]->getFormulaValue();
411 } else {
412 $value = '';
413 }
414 }
415
416 return $value;
417 }

References ilDclStandardField\_isStandardField().

+ Here is the call graph for this function:

◆ getRecordFieldHTML()

ilDclBaseRecordModel::getRecordFieldHTML (   $field_id,
array  $options = [] 
)
Parameters
int | string$field_id

Definition at line 422 of file class.ilDclBaseRecordModel.php.

422 : string
423 {
424 $this->loadRecordFields();
426 $html = $this->getStandardFieldHTML($field_id, $options);
427 } else {
428 if (array_key_exists($field_id, $this->recordfields) && is_object($this->recordfields[$field_id])) {
429 $html = $this->recordfields[$field_id]->getRecordRepresentation()->getHTML(true, $options);
430 } else {
431 $html = '';
432 }
433 }
434
435 return $html;
436 }

References ilDclStandardField\_isStandardField().

+ Here is the call graph for this function:

◆ getRecordFieldPlainText()

ilDclBaseRecordModel::getRecordFieldPlainText (   $field_id)

Get Field Export Value.

Parameters
int | string$field_id
Returns
int|string

Definition at line 363 of file class.ilDclBaseRecordModel.php.

364 {
365 $this->loadRecordFields();
367 return $this->getStandardFieldHTML($field_id);
368 } else {
369 return $this->recordfields[$field_id]->getPlainText();
370 }
371 }

References ilDclStandardField\_isStandardField().

+ Here is the call graph for this function:

◆ getRecordFieldRepresentationValue()

ilDclBaseRecordModel::getRecordFieldRepresentationValue (   $field_id)

Get Field Value for Representation in a Form.

Parameters
?int|string$field_id
Returns
array|int|null|string

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

331 {
332 if ($field_id === null) {
333 return null;
334 }
335 $this->loadRecordFields();
337 return $this->getStandardField($field_id);
338 } else {
339 return $this->recordfields[$field_id]->getValueForRepresentation();
340 }
341 }

References ilDclStandardField\_isStandardField().

+ Here is the call graph for this function:

◆ getRecordFields()

ilDclBaseRecordModel::getRecordFields ( )
Returns
ilDclBaseRecordFieldModel[]

Definition at line 725 of file class.ilDclBaseRecordModel.php.

725 : array
726 {
727 $this->loadRecordFields();
728
729 return $this->recordfields;
730 }

Referenced by doCreate(), and doUpdate().

+ Here is the caller graph for this function:

◆ getRecordFieldSortingValue()

ilDclBaseRecordModel::getRecordFieldSortingValue (   $field_id,
array  $options = [] 
)
Parameters
int | string$field_id

Definition at line 441 of file class.ilDclBaseRecordModel.php.

441 : string
442 {
443 $this->loadRecordFields();
445 $html = $this->getStandardFieldHTML($field_id, $options);
446 } else {
447 if (is_object($this->recordfields[$field_id])) {
448 $html = $this->recordfields[$field_id]->getSortingValue();
449 } else {
450 $html = '';
451 }
452 }
453
454 return $html;
455 }

References ilDclStandardField\_isStandardField().

+ Here is the call graph for this function:

◆ getRecordFieldValue()

◆ getRecordFieldValueFromExcel()

ilDclBaseRecordModel::getRecordFieldValueFromExcel ( ilExcel  $excel,
int  $row,
int  $col,
ilDclBaseFieldModel  $field 
)
Returns
int|string

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

279 {
280 $this->loadRecordFields();
281
282 return $this->recordfields[$field->getId()]->getValueFromExcel($excel, $row, $col);
283 }

References ilDclBaseFieldModel\getId(), and loadRecordFields().

+ Here is the call graph for this function:

◆ getRecordFieldValues()

ilDclBaseRecordModel::getRecordFieldValues ( )

Definition at line 297 of file class.ilDclBaseRecordModel.php.

297 : array
298 {
299 $this->loadRecordFields();
300 $return = [];
301 foreach ($this->recordfields as $id => $record_field) {
302 $return[$id] = $record_field->getValue();
303 }
304
305 return $return;
306 }

References $id.

Referenced by ilDclRecordEditGUI\getRecordData().

+ Here is the caller graph for this function:

◆ getStandardField()

ilDclBaseRecordModel::getStandardField (   $field_id)
protected
Parameters
int | string$field_id

Definition at line 527 of file class.ilDclBaseRecordModel.php.

527 : string
528 {
529 switch ($field_id) {
530 case "last_edit_by":
531 return $this->getLastEditBy();
532 case 'owner':
533 $usr_data = ilObjUser::_lookupName($this->getOwner());
534 return $usr_data['login'];
535 }
536
537 return $this->{$field_id};
538 }

References ilObjUser\_lookupName().

+ Here is the call graph for this function:

◆ getStandardFieldFormulaValue()

ilDclBaseRecordModel::getStandardFieldFormulaValue (   $field_id)
Parameters
int | string$field_id

Definition at line 543 of file class.ilDclBaseRecordModel.php.

543 : string
544 {
545 return $this->getStandardFieldHTML($field_id);
546 }

◆ getStandardFieldHTML()

ilDclBaseRecordModel::getStandardFieldHTML ( string  $field_id,
array  $options = [] 
)

Definition at line 548 of file class.ilDclBaseRecordModel.php.

548 : string
549 {
550 switch ($field_id) {
551 case 'id':
552 return $this->getId();
553 case 'owner':
555 case 'last_edit_by':
557 case 'last_update':
559 case 'create_date':
561 case 'comments':
562
563 $ref_id = $this->http->wrapper()->query()->retrieve('ref_id', $this->refinery->kindlyTo()->int());
564
566 1,
567 $ref_id,
568 'dcl',
569 $this->table->getCollectionObject()
570 ->getId(),
571 'dcl',
572 $this->getId()
573 );
574 $update_code = "il.UI.counter.getCounterObject($(\".ilc_page_Page\")).incrementStatusCount(1);";
575 $ajax_link = ilNoteGUI::getListCommentsJSCall($ajax_hash, $update_code);
576
577 $nr_comments = $this->getNrOfComments();
578
579 $comment_glyph = $this->ui_factory->symbol()->glyph()->comment()->withCounter(
580 $this->ui_factory->counter()->status($nr_comments)
581 )->withAdditionalOnLoadCode(function ($id) use ($ajax_link): string {
582 return "document.getElementById('$id').onclick = function (event) { $ajax_link; };";
583 });
584 return $this->renderer->render($comment_glyph);
585 }
586
587 return "";
588 }
static buildAjaxHash(int $node_type, ?int $node_id, string $obj_type, int $obj_id, string $sub_type=null, int $sub_id=null, int $news_id=0)
Build ajax hash.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
getNrOfComments()
Get nr of comments of this record.
static getListCommentsJSCall(string $a_hash, string $a_update_code=null)
Get list comments js call.
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link="", bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:

References $id, $ref_id, ilCommonActionDispatcherGUI\buildAjaxHash(), ilDatePresentation\formatDate(), ILIAS\Survey\Mode\getId(), ilNoteGUI\getListCommentsJSCall(), ilUserUtil\getNamePresentation(), ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ getStandardFieldPlainText()

ilDclBaseRecordModel::getStandardFieldPlainText ( string  $field_id)
Parameters
string$field_id
Returns
int|string

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

595 {
596 switch ($field_id) {
597 case 'comments':
598 return $this->getNrOfComments();
599 default:
600 return strip_tags($this->getStandardFieldHTML($field_id));
601 }
602 }

◆ getTable()

ilDclBaseRecordModel::getTable ( )

Definition at line 732 of file class.ilDclBaseRecordModel.php.

732 : ilDclTable
733 {
734 $this->loadTable();
735
736 return $this->table;
737 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

Referenced by doCreate(), and ilDclRecordListGUI\recordBelongsToCollection().

+ Here is the caller graph for this function:

◆ getTableId()

ilDclBaseRecordModel::getTableId ( )

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

199 : int
200 {
201 return $this->table_id;
202 }

References $table_id.

Referenced by doCreate(), doUpdate(), and ilDclReferenceRecordRepresentation\getLinkHTML().

+ Here is the caller graph for this function:

◆ hasPermissionToDelete()

ilDclBaseRecordModel::hasPermissionToDelete ( int  $ref_id)

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

712 : bool
713 {
714 return $this->getTable()->hasPermissionToDeleteRecord($ref_id, $this);
715 }

References $ref_id.

◆ hasPermissionToEdit()

ilDclBaseRecordModel::hasPermissionToEdit ( int  $ref_id)

Definition at line 707 of file class.ilDclBaseRecordModel.php.

707 : bool
708 {
709 return $this->getTable()->hasPermissionToEditRecord($ref_id, $this);
710 }

References $ref_id.

Referenced by ilDclRecordEditGUI\save().

+ Here is the caller graph for this function:

◆ hasPermissionToView()

ilDclBaseRecordModel::hasPermissionToView ( int  $ref_id)

Definition at line 717 of file class.ilDclBaseRecordModel.php.

717 : bool
718 {
719 return $this->getTable()->hasPermissionToViewRecord($ref_id, $this);
720 }

References $ref_id.

◆ loadRecordFields()

ilDclBaseRecordModel::loadRecordFields ( )
private

Definition at line 604 of file class.ilDclBaseRecordModel.php.

604 : void
605 {
606 if ($this->recordfields == null) {
607 $this->loadTable();
608 $recordfields = [];
609 foreach ($this->table->getRecordFields() as $field) {
610 if (($recordfields[$field->getId()] ?? null) === null) {
611 $recordfields[$field->getId()] = ilDclCache::getRecordFieldCache($this, $field);
612 }
613 }
614
615 $this->recordfields = $recordfields;
616 }
617 }

References ilDclCache\getRecordFieldCache().

Referenced by deleteField(), doCreate(), getRecordFieldValueFromExcel(), setRecordFieldValue(), and setRecordFieldValueFromForm().

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

◆ loadTable()

ilDclBaseRecordModel::loadTable ( )
private

Definition at line 619 of file class.ilDclBaseRecordModel.php.

619 : void
620 {
621 if ($this->table === null) {
622 $this->table = ilDclCache::getTableCache($this->getTableId());
623 }
624 }

References ilDclCache\getTableCache().

Referenced by doRead(), setRecordFieldValue(), and setRecordFieldValueFromForm().

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

◆ setCreateDate()

ilDclBaseRecordModel::setCreateDate ( ilDateTime  $a_datetime)

Definition at line 204 of file class.ilDclBaseRecordModel.php.

204 : void
205 {
206 $this->create_date = $a_datetime;
207 }

Referenced by doRead(), and ilDclRecordEditGUI\save().

+ Here is the caller graph for this function:

◆ setId()

ilDclBaseRecordModel::setId ( int  $a_id)

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

184 : void
185 {
186 $this->id = $a_id;
187 }

Referenced by doCreate().

+ Here is the caller graph for this function:

◆ setLastEditBy()

ilDclBaseRecordModel::setLastEditBy ( ?int  $last_edit_by)

Definition at line 239 of file class.ilDclBaseRecordModel.php.

239 : void
240 {
241 $this->last_edit_by = $last_edit_by;
242 }

References $last_edit_by.

Referenced by doRead(), and ilDclRecordEditGUI\save().

+ Here is the caller graph for this function:

◆ setLastUpdate()

ilDclBaseRecordModel::setLastUpdate ( ilDateTime  $a_datetime)

Definition at line 214 of file class.ilDclBaseRecordModel.php.

214 : void
215 {
216 $this->last_update = $a_datetime;
217 }

Referenced by doRead(), and ilDclRecordEditGUI\save().

+ Here is the caller graph for this function:

◆ setOwner()

ilDclBaseRecordModel::setOwner ( int  $a_id)

Definition at line 224 of file class.ilDclBaseRecordModel.php.

224 : void
225 {
226 $this->owner = $a_id;
227 }

Referenced by doRead(), and ilDclRecordEditGUI\save().

+ Here is the caller graph for this function:

◆ setRecordFieldValue()

ilDclBaseRecordModel::setRecordFieldValue (   $field_id,
  $value 
)
Parameters
int | string$field_id
int | string$value
Returns
void

Definition at line 249 of file class.ilDclBaseRecordModel.php.

249 : void
250 {
251 $this->loadRecordFields();
253 $this->setStandardField($field_id, $value);
254 } else {
255 $this->loadTable();
256 $this->recordfields[$field_id]->setValue($value);
257 }
258 }

References ilDclStandardField\_isStandardField(), loadRecordFields(), loadTable(), and setStandardField().

Referenced by ilDclRecordEditGUI\save().

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

◆ setRecordFieldValueFromForm()

ilDclBaseRecordModel::setRecordFieldValueFromForm ( int  $field_id,
ilPropertyFormGUI  $form 
)

Set a field value.

Parameters
int | string$field_id

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

264 : void
265 {
266 $this->loadRecordFields();
268 $this->setStandardFieldFromForm($field_id, $form);
269 } else {
270 $this->loadTable();
271 $this->recordfields[$field_id]->setValueFromForm($form);
272 }
273 }
setStandardFieldFromForm($field_id, ilPropertyFormGUI $form)

References ilDclStandardField\_isStandardField(), loadRecordFields(), loadTable(), and setStandardFieldFromForm().

Referenced by ilDclRecordEditGUI\save().

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

◆ setStandardField()

ilDclBaseRecordModel::setStandardField (   $field_id,
  $value 
)
protected
Parameters
int | string$field_id
int | string$value

Definition at line 505 of file class.ilDclBaseRecordModel.php.

506 {
507 if ($field_id == "last_edit_by") {
508 $this->setLastEditBy($value);
509 return;
510 }
511 $this->{$field_id} = $value;
512 }

Referenced by setRecordFieldValue().

+ Here is the caller graph for this function:

◆ setStandardFieldFromForm()

ilDclBaseRecordModel::setStandardFieldFromForm (   $field_id,
ilPropertyFormGUI  $form 
)
protected
Parameters
int | string$field_id

Definition at line 494 of file class.ilDclBaseRecordModel.php.

494 : void
495 {
496 if ($item = $form->getItemByPostVar("field_" . $field_id)) {
497 $this->setStandardField($field_id, $item->getValue());
498 }
499 }

References ilPropertyFormGUI\getItemByPostVar().

Referenced by setRecordFieldValueFromForm().

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

◆ setStandardFieldValueFromExcel()

ilDclBaseRecordModel::setStandardFieldValueFromExcel ( ilExcel  $excel,
int  $row,
int  $col,
ilDclBaseFieldModel  $field 
)

Definition at line 285 of file class.ilDclBaseRecordModel.php.

290 : void {
291 $value = $field->getValueFromExcel($excel, $row, $col);
292 if ($value) {
293 $this->{$field->getId()} = $value;
294 }
295 }

References ilDclBaseFieldModel\getId().

+ Here is the call graph for this function:

◆ setTableId()

ilDclBaseRecordModel::setTableId ( int  $a_id)

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

194 : void
195 {
196 $this->table_id = $a_id;
197 }

Referenced by doRead(), and ilDclRecordEditGUI\save().

+ Here is the caller graph for this function:

Field Documentation

◆ $create_date

ilDateTime ilDclBaseRecordModel::$create_date
protected

Definition at line 37 of file class.ilDclBaseRecordModel.php.

Referenced by getCreateDate().

◆ $db

ilDBInterface ilDclBaseRecordModel::$db
protected

Definition at line 41 of file class.ilDclBaseRecordModel.php.

◆ $event

ilAppEventHandler ilDclBaseRecordModel::$event
protected

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

◆ $http

ILIAS HTTP Services ilDclBaseRecordModel::$http
protected

Definition at line 39 of file class.ilDclBaseRecordModel.php.

◆ $id

int ilDclBaseRecordModel::$id = 0
protected

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

Referenced by doCreate(), and getId().

◆ $last_edit_by

int ilDclBaseRecordModel::$last_edit_by = null
protected

Definition at line 34 of file class.ilDclBaseRecordModel.php.

Referenced by getLastEditBy(), and setLastEditBy().

◆ $last_update

ilDateTime ilDclBaseRecordModel::$last_update
protected

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

Referenced by getLastUpdate().

◆ $notes

Service ilDclBaseRecordModel::$notes
protected

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

◆ $nr_of_comments

int ilDclBaseRecordModel::$nr_of_comments = null
protected

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

◆ $owner

int ilDclBaseRecordModel::$owner = 0
protected

Definition at line 35 of file class.ilDclBaseRecordModel.php.

Referenced by getOwner().

◆ $recordfields

array ilDclBaseRecordModel::$recordfields = null
protected

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

◆ $refinery

ILIAS Refinery Factory ilDclBaseRecordModel::$refinery
protected

Definition at line 40 of file class.ilDclBaseRecordModel.php.

◆ $renderer

ILIAS UI Renderer ilDclBaseRecordModel::$renderer
protected

Definition at line 24 of file class.ilDclBaseRecordModel.php.

◆ $table

ilDclTable ilDclBaseRecordModel::$table = null
protected

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

◆ $table_id

int ilDclBaseRecordModel::$table_id
protected

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

Referenced by getTableId().

◆ $ui_factory

ILIAS UI Factory ilDclBaseRecordModel::$ui_factory
protected

Definition at line 23 of file class.ilDclBaseRecordModel.php.

◆ $user

ilObjUser ilDclBaseRecordModel::$user
private

Definition at line 43 of file class.ilDclBaseRecordModel.php.


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