ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 (?string $field_id)
 Get Field Value. More...
 
 fillRecordFieldExcelExport (ilExcel $worksheet, int &$row, int &$col, $field_id)
 
 getRecordFieldFormulaValue ($field_id)
 
 getRecordFieldHTML ($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 23 of file class.ilDclBaseRecordModel.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

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

References $DIC, doRead(), ILIAS\FileDelivery\http(), ILIAS\Repository\refinery(), renderer(), 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 601 of file class.ilDclBaseRecordModel.php.

601 : void
602 {
603 $original = ilDclCache::getRecordCache($original_id);
604 $this->setCreateDate($original->getCreateDate());
605 $this->setLastEditBy($original->getLastEditBy());
606 $this->setLastUpdate($original->getLastUpdate());
607 $this->setOwner($original->getOwner());
608 $this->doCreate();
609 foreach ($new_fields as $old => $new) {
610 $old_rec_field = $original->getRecordField($old);
611 $new_rec_field = ilDclCache::getRecordFieldCache($this, $new);
612 $new_rec_field->cloneStructure($old_rec_field);
613 $this->recordfields[] = $new_rec_field;
614 }
615
616 // mandatory for all cloning functions
618 }
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 177 of file class.ilDclBaseRecordModel.php.

177 : void
178 {
179 $this->loadRecordFields();
180 $this->recordfields[$field_id]->delete();
181 if (count($this->recordfields) == 1) {
182 $this->doDelete();
183 }
184 }
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 620 of file class.ilDclBaseRecordModel.php.

620 : void
621 {
622 if (ilObject2::_exists($obj_id, false)) {
623 $file = new ilObjFile($obj_id, false);
624 $file->delete();
625 }
626 }
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 628 of file class.ilDclBaseRecordModel.php.

628 : void
629 {
630 if (ilObject2::_lookupObjId($obj_id)) {
631 $mob = new ilObjMediaObject($obj_id);
632 $mob->delete();
633 }
634 }
static _lookupObjId(int $ref_id)

References ilObject\_lookupObjId().

+ Here is the call graph for this function:

◆ doCreate()

ilDclBaseRecordModel::doCreate ( )
Exceptions
ilException

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

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

References $id, 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 566 of file class.ilDclBaseRecordModel.php.

566 : void
567 {
568 $this->loadRecordFields();
569 foreach ($this->recordfields as $recordfield) {
570 if ($recordfield->getField()->getDatatypeId() == ilDclDatatype::INPUTFORMAT_MOB) {
571 $this->deleteMob((int) $recordfield->getValue());
572 }
573
574 $recordfield->delete();
575 }
576
577 $query = "DELETE FROM il_dcl_record WHERE id = " . $this->db->quote($this->getId(), "integer");
578 $this->db->manipulate($query);
579
580 $this->table->loadRecords();
581
582 if (!$omit_notification) {
583 $ref_id = $this->http->wrapper()->query()->retrieve('ref_id', $this->refinery->kindlyTo()->int());
584 $objDataCollection = new ilObjDataCollection($ref_id);
585 $objDataCollection->sendRecordNotification(ilDclNotificationType::RECORD_DELETE, $this);
586
587 $this->event->raise(
588 'components/ILIAS/DataCollection',
589 'deleteRecord',
590 [
591 'dcl' => ilDclCache::getTableCache($this->getTableId())->getCollectionObject(),
592 'table_id' => $this->table_id,
593 'record_id' => $this->getId(),
594 'record' => $this,
595 ]
596 );
597 }
598 }
static getTableCache(?int $table_id=null)
$ref_id
Definition: ltiauth.php:66

References $ref_id, ILIAS\Survey\Mode\getId(), ilDclCache\getTableCache(), ILIAS\FileDelivery\http(), ilDclDatatype\INPUTFORMAT_MOB, RECORD_DELETE, 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 109 of file class.ilDclBaseRecordModel.php.

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

References 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 66 of file class.ilDclBaseRecordModel.php.

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

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 330 of file class.ilDclBaseRecordModel.php.

330 : void
331 {
332 $this->loadRecordFields();
334 if ($field_id === 'owner') {
335 $worksheet->setCell($row, $col, ilObjUser::_lookupLogin($this->getOwner()));
336 $col++;
337 $name_array = ilObjUser::_lookupName($this->getOwner());
338 $worksheet->setCell($row, $col, $name_array['lastname'] . ', ' . $name_array['firstname']);
339 } elseif ($field_id === 'last_update') {
340 $date_time = $this->getLastUpdate()->get(IL_CAL_DATETIME, '', $this->user->getTimeZone());
341 $worksheet->setCell($row, $col, $date_time);
342 } elseif ($field_id === 'create_date') {
343 $date_time = $this->getCreateDate()->get(IL_CAL_DATETIME, '', $this->user->getTimeZone());
344 $worksheet->setCell($row, $col, $date_time);
345 } else {
346 $worksheet->setCell($row, $col, $this->getStandardFieldHTML($field_id));
347 }
348 $col++;
349 } else {
350 $this->recordfields[$field_id]->fillExcelExport($worksheet, $row, $col);
351 }
352 }
getStandardFieldHTML(string $field_id, array $options=[])
static _isStandardField($field_id)
setCell(int $a_row, int $col, $value, ?string $datatype=null, bool $disable_strip_tags_for_strings=false)
Set cell value.
static _lookupName(int $a_user_id)
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 416 of file class.ilDclBaseRecordModel.php.

416 : void
417 {
418 $this->loadRecordFields();
420 $this->fillStandardFieldFormInput($field_id, $form);
421 } else {
422 $this->recordfields[$field_id]->getRecordRepresentation()->fillFormInput($form);
423 }
424 }
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 452 of file class.ilDclBaseRecordModel.php.

452 : void
453 {
454 if ($item = $form->getItemByPostVar('field_' . $field_id)) {
455 $item->setValue($this->getStandardField($field_id));
456 }
457 }
getItemByPostVar(string $a_post_var)

References ilPropertyFormGUI\getItemByPostVar().

+ Here is the call graph for this function:

◆ getCreateDate()

ilDclBaseRecordModel::getCreateDate ( )

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

211 : ilDateTime
212 {
213 return $this->create_date;
214 }

References $create_date.

Referenced by doCreate().

+ Here is the caller graph for this function:

◆ getId()

ilDclBaseRecordModel::getId ( )

◆ getLastEditBy()

ilDclBaseRecordModel::getLastEditBy ( )

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

236 : ?int
237 {
238 return $this->last_edit_by;
239 }

References $last_edit_by.

Referenced by doCreate(), and doUpdate().

+ Here is the caller graph for this function:

◆ getLastUpdate()

ilDclBaseRecordModel::getLastUpdate ( )

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

221 : ilDateTime
222 {
223 return $this->last_update;
224 }

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 671 of file class.ilDclBaseRecordModel.php.

671 : int
672 {
673 if ($this->nr_of_comments === null) {
674 $context = $this->notes
675 ->data()
676 ->context(
677 $this->table->getCollectionObject()->getId(),
678 $this->getId(),
679 'dcl'
680 );
681 $this->nr_of_comments = $this->notes
682 ->domain()
683 ->getNrOfCommentsForContext($context);
684 }
685
687 }
$context
Definition: webdav.php:31

References $context.

◆ getOwner()

ilDclBaseRecordModel::getOwner ( )

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

231 : int
232 {
233 return $this->owner;
234 }

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 559 of file class.ilDclBaseRecordModel.php.

560 {
561 $this->loadRecordFields();
562
563 return $this->recordfields[$field_id];
564 }

Referenced by ilDclReferenceRecordFieldModel\getReferenceFromValue().

+ Here is the caller graph for this function:

◆ getRecordFieldFormulaValue()

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

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

357 : string
358 {
359 $this->loadRecordFields();
361 $value = $this->getStandardFieldFormulaValue($field_id);
362 } else {
363 if (is_object($this->recordfields[$field_id])) {
364 $value = $this->recordfields[$field_id]->getFormulaValue();
365 } else {
366 $value = '';
367 }
368 }
369
370 return $value;
371 }

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 376 of file class.ilDclBaseRecordModel.php.

376 : string
377 {
378 $this->loadRecordFields();
380 $html = $this->getStandardFieldHTML($field_id, $options);
381 } else {
382 if (array_key_exists($field_id, $this->recordfields) && is_object($this->recordfields[$field_id])) {
383 $html = $this->recordfields[$field_id]->getRecordRepresentation()->getHTML(true, $options);
384 } else {
385 $html = '';
386 }
387 }
388
389 return $html;
390 }

References ilDclStandardField\_isStandardField().

Referenced by ilDclReferenceRecordRepresentation\getLinkHTML().

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

◆ getRecordFields()

ilDclBaseRecordModel::getRecordFields ( )
Returns
ilDclBaseRecordFieldModel[]

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

654 : array
655 {
656 $this->loadRecordFields();
657
658 return $this->recordfields;
659 }

Referenced by doCreate(), and doUpdate().

+ Here is the caller graph for this function:

◆ getRecordFieldValue()

ilDclBaseRecordModel::getRecordFieldValue ( ?string  $field_id)

◆ getRecordFieldValueFromExcel()

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

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

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

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

+ Here is the call graph for this function:

◆ getRecordFieldValues()

ilDclBaseRecordModel::getRecordFieldValues ( )

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

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

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 462 of file class.ilDclBaseRecordModel.php.

462 : string
463 {
464 switch ($field_id) {
465 case "last_edit_by":
466 return ilObjUser::_lookupName($this->getLastEditBy())['login'];
467 case 'owner':
468 return ilObjUser::_lookupName($this->getOwner())['login'];
469 }
470
471 return $this->{$field_id};
472 }

References ilObjUser\_lookupName().

+ Here is the call graph for this function:

◆ getStandardFieldFormulaValue()

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

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

477 : string
478 {
479 return $this->getStandardFieldHTML($field_id);
480 }

◆ getStandardFieldHTML()

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

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

482 : string
483 {
484 switch ($field_id) {
485 case 'id':
486 return (string) $this->getId();
487 case 'owner':
489 case 'last_edit_by':
491 case 'last_update':
493 case 'create_date':
495 case 'comments':
496
497 $ref_id = $this->http->wrapper()->query()->retrieve('ref_id', $this->refinery->kindlyTo()->int());
498
500 1,
501 $ref_id,
502 'dcl',
503 $this->table->getCollectionObject()
504 ->getId(),
505 'dcl',
506 $this->getId()
507 );
508 $update_code = "il.UI.counter.getCounterObject($(\".ilc_page_Page\")).incrementStatusCount(1);";
509 $ajax_link = ilNoteGUI::getListCommentsJSCall($ajax_hash, $update_code);
510 $nr_comments = $this->getNrOfComments();
511
512 $comment_glyph = $this->ui_factory->symbol()->glyph()->comment()->withCounter(
513 $this->ui_factory->counter()->status($nr_comments)
514 )->withAdditionalOnLoadCode(function ($id) use ($ajax_link): string {
515 return "document.getElementById('$id').onclick = function (event) { $ajax_link; };";
516 });
517 return $this->renderer->render($comment_glyph);
518 }
519
520 return "";
521 }
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, ?ilObjUser $user=null,)
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=null)
Default behaviour is:

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

+ Here is the call graph for this function:

◆ getStandardFieldPlainText()

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

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

528 {
529 switch ($field_id) {
530 case 'comments':
531 return $this->getNrOfComments();
532 default:
533 return strip_tags($this->getStandardFieldHTML($field_id));
534 }
535 }

◆ getTable()

ilDclBaseRecordModel::getTable ( )

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

661 : ilDclTable
662 {
663 $this->loadTable();
664
665 return $this->table;
666 }

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

+ Here is the caller graph for this function:

◆ getTableId()

ilDclBaseRecordModel::getTableId ( )

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

201 : int
202 {
203 return $this->table_id;
204 }

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 641 of file class.ilDclBaseRecordModel.php.

641 : bool
642 {
643 return $this->getTable()->hasPermissionToDeleteRecord($ref_id, $this);
644 }

References $ref_id.

◆ hasPermissionToEdit()

ilDclBaseRecordModel::hasPermissionToEdit ( int  $ref_id)

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

636 : bool
637 {
638 return $this->getTable()->hasPermissionToEditRecord($ref_id, $this);
639 }

References $ref_id.

Referenced by ilDclRecordEditGUI\save().

+ Here is the caller graph for this function:

◆ hasPermissionToView()

ilDclBaseRecordModel::hasPermissionToView ( int  $ref_id)

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

646 : bool
647 {
648 return $this->getTable()->hasPermissionToViewRecord($ref_id, $this);
649 }

References $ref_id.

◆ loadRecordFields()

ilDclBaseRecordModel::loadRecordFields ( )
private

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

537 : void
538 {
539 if ($this->recordfields == null) {
540 $this->loadTable();
541 $recordfields = [];
542 foreach ($this->table->getRecordFields() as $field) {
543 if (($recordfields[$field->getId()] ?? null) === null) {
544 $recordfields[$field->getId()] = ilDclCache::getRecordFieldCache($this, $field);
545 }
546 }
547
548 $this->recordfields = $recordfields;
549 }
550 }

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 552 of file class.ilDclBaseRecordModel.php.

552 : void
553 {
554 if ($this->table === null) {
555 $this->table = ilDclCache::getTableCache($this->getTableId());
556 }
557 }

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 206 of file class.ilDclBaseRecordModel.php.

206 : void
207 {
208 $this->create_date = $a_datetime;
209 }

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

+ Here is the caller graph for this function:

◆ setId()

ilDclBaseRecordModel::setId ( int  $a_id)

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

186 : void
187 {
188 $this->id = $a_id;
189 }

Referenced by doCreate().

+ Here is the caller graph for this function:

◆ setLastEditBy()

ilDclBaseRecordModel::setLastEditBy ( ?int  $last_edit_by)

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

241 : void
242 {
243 $this->last_edit_by = $last_edit_by;
244 }

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 216 of file class.ilDclBaseRecordModel.php.

216 : void
217 {
218 $this->last_update = $a_datetime;
219 }

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

+ Here is the caller graph for this function:

◆ setOwner()

ilDclBaseRecordModel::setOwner ( int  $a_id)

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

226 : void
227 {
228 $this->owner = $a_id;
229 }

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 251 of file class.ilDclBaseRecordModel.php.

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

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 266 of file class.ilDclBaseRecordModel.php.

266 : void
267 {
268 $this->loadRecordFields();
270 $this->setStandardFieldFromForm($field_id, $form);
271 } else {
272 $this->loadTable();
273 $this->recordfields[$field_id]->setValueFromForm($form);
274 }
275 }
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 440 of file class.ilDclBaseRecordModel.php.

441 {
442 if ($field_id == "last_edit_by") {
443 $this->setLastEditBy($value);
444 return;
445 }
446 $this->{$field_id} = $value;
447 }

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 429 of file class.ilDclBaseRecordModel.php.

429 : void
430 {
431 if ($item = $form->getItemByPostVar("field_" . $field_id)) {
432 $this->setStandardField($field_id, $item->getValue());
433 }
434 }

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 287 of file class.ilDclBaseRecordModel.php.

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

References ilDclBaseFieldModel\getId().

+ Here is the call graph for this function:

◆ setTableId()

ilDclBaseRecordModel::setTableId ( int  $a_id)

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

196 : void
197 {
198 $this->table_id = $a_id;
199 }

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 39 of file class.ilDclBaseRecordModel.php.

Referenced by getCreateDate().

◆ $db

ilDBInterface ilDclBaseRecordModel::$db
protected

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

◆ $event

ilAppEventHandler ilDclBaseRecordModel::$event
protected

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

◆ $http

ILIAS HTTP Services ilDclBaseRecordModel::$http
protected

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

◆ $id

int ilDclBaseRecordModel::$id = 0
protected

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

Referenced by doCreate(), and getId().

◆ $last_edit_by

int ilDclBaseRecordModel::$last_edit_by = null
protected

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

Referenced by getLastEditBy(), and setLastEditBy().

◆ $last_update

ilDateTime ilDclBaseRecordModel::$last_update
protected

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

Referenced by getLastUpdate().

◆ $notes

Service ilDclBaseRecordModel::$notes
protected

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

◆ $nr_of_comments

int ilDclBaseRecordModel::$nr_of_comments = null
protected

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

◆ $owner

int ilDclBaseRecordModel::$owner = 0
protected

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

Referenced by getOwner().

◆ $recordfields

array ilDclBaseRecordModel::$recordfields = null
protected

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

◆ $refinery

ILIAS Refinery Factory ilDclBaseRecordModel::$refinery
protected

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

◆ $renderer

ILIAS UI Renderer ilDclBaseRecordModel::$renderer
protected

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

◆ $table

ilDclTable ilDclBaseRecordModel::$table = null
protected

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

◆ $table_id

int ilDclBaseRecordModel::$table_id
protected

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

Referenced by getTableId().

◆ $ui_factory

ILIAS UI Factory ilDclBaseRecordModel::$ui_factory
protected

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

◆ $user

ilObjUser ilDclBaseRecordModel::$user
private

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


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