ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

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

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.
+ 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.

References doCreate(), getId(), ilDclCache\getRecordCache(), ilDclCache\getRecordFieldCache(), ilDclCache\setCloneOf(), setCreateDate(), setLastEditBy(), setLastUpdate(), setOwner(), and ilDclCache\TYPE_RECORD.

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
688  ilDclCache::setCloneOf($original_id, $this->getId(), ilDclCache::TYPE_RECORD);
689  }
static setCloneOf(int $old, int $new, string $type)
static getRecordCache(?int $record_id)
setCreateDate(ilDateTime $a_datetime)
setLastUpdate(ilDateTime $a_datetime)
static getRecordFieldCache(object $record, object $field)
+ Here is the call graph for this function:

◆ deleteField()

ilDclBaseRecordModel::deleteField ( int  $field_id)

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

References doDelete(), and loadRecordFields().

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)
+ Here is the call graph for this function:

◆ deleteFile()

ilDclBaseRecordModel::deleteFile ( int  $obj_id)

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

References ilObject\_exists().

Referenced by doDelete().

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

◆ deleteMob()

ilDclBaseRecordModel::deleteMob ( int  $obj_id)

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

References ilObject\_lookupObjId().

Referenced by doDelete().

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)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doCreate()

ilDclBaseRecordModel::doCreate ( )
Exceptions
ilException

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

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

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

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
$query
static _tableExists(int $table_id)
+ 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.

References $query, $ref_id, deleteFile(), deleteMob(), getId(), ilDclCache\getTableCache(), getTableId(), ILIAS\FileDelivery\http(), ilDclDatatype\INPUTFORMAT_FILE, ilDclDatatype\INPUTFORMAT_MOB, loadRecordFields(), and ILIAS\Repository\refinery().

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

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 http()
Fetches the global http state from ILIAS.
$ref_id
Definition: ltiauth.php:67
static getTableCache(int $table_id=null)
$query
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ 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.

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

Referenced by __construct().

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  }
const IL_CAL_DATETIME
$query
setCreateDate(ilDateTime $a_datetime)
setLastUpdate(ilDateTime $a_datetime)
+ 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.

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

Referenced by ilDclRecordEditGUI\save().

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  }
const IL_CAL_DATETIME
static http()
Fetches the global http state from ILIAS.
$ref_id
Definition: ltiauth.php:67
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ 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.

References ilDclStandardField\_isStandardField(), ilObjUser\_lookupLogin(), ilObjUser\_lookupName(), getCreateDate(), getLastUpdate(), getOwner(), getStandardFieldHTML(), IL_CAL_DATETIME, loadRecordFields(), ilExcel\setCell(), and ILIAS\Repository\user().

Referenced by ilDclContentExporter\fillRowExcel().

376  : void
377  {
378  $this->loadRecordFields();
379  if (ilDclStandardField::_isStandardField($field_id)) {
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  }
const IL_CAL_DATETIME
static _lookupName(int $a_user_id)
lookup user name
setCell(int $a_row, int $a_col, $a_value, ?string $a_datatype=null)
Set cell value.
getStandardFieldHTML(string $field_id, array $options=[])
static _isStandardField($field_id)
static _lookupLogin(int $a_user_id)
+ 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.

References ilDclStandardField\_isStandardField(), fillStandardFieldFormInput(), and loadRecordFields().

Referenced by ilDclRecordEditGUI\sendFailure().

481  : void
482  {
483  $this->loadRecordFields();
484  if (ilDclStandardField::_isStandardField($field_id)) {
485  $this->fillStandardFieldFormInput($field_id, $form);
486  } else {
487  $this->recordfields[$field_id]->getRecordRepresentation()->fillFormInput($form);
488  }
489  }
static _isStandardField($field_id)
fillStandardFieldFormInput($field_id, ilPropertyFormGUI $form)
+ 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.

References ilPropertyFormGUI\getItemByPostVar(), and getStandardField().

Referenced by fillRecordFieldFormInput().

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)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCreateDate()

ilDclBaseRecordModel::getCreateDate ( )

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

References $create_date.

Referenced by doCreate(), fillRecordFieldExcelExport(), and getStandardFieldHTML().

209  : ilDateTime
210  {
211  return $this->create_date;
212  }
+ Here is the caller graph for this function:

◆ getId()

◆ getLastEditBy()

ilDclBaseRecordModel::getLastEditBy ( )

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

References $last_edit_by.

Referenced by doCreate(), doUpdate(), getStandardField(), and getStandardFieldHTML().

234  : ?int
235  {
236  return $this->last_edit_by;
237  }
+ Here is the caller graph for this function:

◆ getLastUpdate()

ilDclBaseRecordModel::getLastUpdate ( )

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

References $last_update.

Referenced by doCreate(), doUpdate(), fillRecordFieldExcelExport(), and getStandardFieldHTML().

219  : ilDateTime
220  {
221  return $this->last_update;
222  }
+ 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.

References $context, $nr_of_comments, and getId().

Referenced by getStandardFieldHTML(), and getStandardFieldPlainText().

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 
757  return $this->nr_of_comments;
758  }
$context
Definition: webdav.php:29
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOwner()

ilDclBaseRecordModel::getOwner ( )

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

References $owner.

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

229  : int
230  {
231  return $this->owner;
232  }
+ Here is the caller graph for this function:

◆ getRecordField()

ilDclBaseRecordModel::getRecordField ( int  $field_id)

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

References loadRecordFields().

Referenced by ilDclRecordEditGUI\cancelSave(), and ilDclReferenceRecordFieldModel\getReferenceFromValue().

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...
+ Here is the call graph for this function:
+ 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.

References ilDclStandardField\_isStandardField(), getStandardFieldHTML(), and loadRecordFields().

349  {
350  $this->loadRecordFields();
351  if (ilDclStandardField::_isStandardField($field_id)) {
352  return $this->getStandardFieldHTML($field_id);
353  } else {
354  return $this->recordfields[$field_id]->getExportValue();
355  }
356  }
getStandardFieldHTML(string $field_id, array $options=[])
static _isStandardField($field_id)
+ 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.

References ilDclStandardField\_isStandardField(), getStandardFieldFormulaValue(), and loadRecordFields().

403  : string
404  {
405  $this->loadRecordFields();
406  if (ilDclStandardField::_isStandardField($field_id)) {
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  }
static _isStandardField($field_id)
+ 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.

References ilDclStandardField\_isStandardField(), getStandardFieldHTML(), and loadRecordFields().

422  : string
423  {
424  $this->loadRecordFields();
425  if (ilDclStandardField::_isStandardField($field_id)) {
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  }
getStandardFieldHTML(string $field_id, array $options=[])
static _isStandardField($field_id)
+ 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.

References ilDclStandardField\_isStandardField(), getStandardFieldHTML(), and loadRecordFields().

364  {
365  $this->loadRecordFields();
366  if (ilDclStandardField::_isStandardField($field_id)) {
367  return $this->getStandardFieldHTML($field_id);
368  } else {
369  return $this->recordfields[$field_id]->getPlainText();
370  }
371  }
getStandardFieldHTML(string $field_id, array $options=[])
static _isStandardField($field_id)
+ 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.

References ilDclStandardField\_isStandardField(), getStandardField(), and loadRecordFields().

331  {
332  if ($field_id === null) {
333  return null;
334  }
335  $this->loadRecordFields();
336  if (ilDclStandardField::_isStandardField($field_id)) {
337  return $this->getStandardField($field_id);
338  } else {
339  return $this->recordfields[$field_id]->getValueForRepresentation();
340  }
341  }
static _isStandardField($field_id)
+ Here is the call graph for this function:

◆ getRecordFields()

ilDclBaseRecordModel::getRecordFields ( )
Returns
ilDclBaseRecordFieldModel[]

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

References $recordfields, and loadRecordFields().

Referenced by doCreate(), and doUpdate().

725  : array
726  {
727  $this->loadRecordFields();
728 
729  return $this->recordfields;
730  }
+ Here is the call graph for this function:
+ 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.

References ilDclStandardField\_isStandardField(), getStandardFieldHTML(), and loadRecordFields().

441  : string
442  {
443  $this->loadRecordFields();
444  if (ilDclStandardField::_isStandardField($field_id)) {
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  }
getStandardFieldHTML(string $field_id, array $options=[])
static _isStandardField($field_id)
+ Here is the call graph for this function:

◆ getRecordFieldValue()

ilDclBaseRecordModel::getRecordFieldValue ( ?int  $field_id)

Get Field Value.

Returns
int|string|array|null

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

References ilDclStandardField\_isStandardField(), getStandardField(), and loadRecordFields().

Referenced by ilDclReferenceRecordRepresentation\getLinkHTML(), ilDclTextFieldRepresentation\passThroughFilter(), ilDclDatetimeFieldRepresentation\passThroughFilter(), ilDclRatingFieldRepresentation\passThroughFilter(), ilDclMobFieldRepresentation\passThroughFilter(), ilDclBooleanFieldRepresentation\passThroughFilter(), ilDclNumberFieldRepresentation\passThroughFilter(), ilDclIliasReferenceFieldRepresentation\passThroughFilter(), ilDclBaseFieldRepresentation\passThroughFilter(), ilDclFileuploadFieldRepresentation\passThroughFilter(), ilDclCopyFieldRepresentation\passThroughFilter(), and ilDclReferenceFieldRepresentation\passThroughFilter().

313  {
314  if ($field_id === null) {
315  return null;
316  }
317  $this->loadRecordFields();
318  if (ilDclStandardField::_isStandardField($field_id)) {
319  return $this->getStandardField($field_id);
320  } else {
321  return $this->recordfields[$field_id]->getValue();
322  }
323  }
static _isStandardField($field_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRecordFieldValueFromExcel()

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

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

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

279  {
280  $this->loadRecordFields();
281 
282  return $this->recordfields[$field->getId()]->getValueFromExcel($excel, $row, $col);
283  }
+ Here is the call graph for this function:

◆ getRecordFieldValues()

ilDclBaseRecordModel::getRecordFieldValues ( )

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

References $id, and loadRecordFields().

Referenced by ilDclRecordEditGUI\getRecordData().

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  }
+ Here is the call graph for this function:
+ 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.

References ilObjUser\_lookupName(), getLastEditBy(), and getOwner().

Referenced by fillStandardFieldFormInput(), getRecordFieldRepresentationValue(), and getRecordFieldValue().

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  }
static _lookupName(int $a_user_id)
lookup user name
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStandardFieldFormulaValue()

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

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

References getStandardFieldHTML().

Referenced by getRecordFieldFormulaValue().

543  : string
544  {
545  return $this->getStandardFieldHTML($field_id);
546  }
getStandardFieldHTML(string $field_id, array $options=[])
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStandardFieldHTML()

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

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

References $ref_id, ilCommonActionDispatcherGUI\buildAjaxHash(), ilDatePresentation\formatDate(), getCreateDate(), getId(), getLastEditBy(), getLastUpdate(), ilNoteGUI\getListCommentsJSCall(), ilUserUtil\getNamePresentation(), getNrOfComments(), getOwner(), ILIAS\FileDelivery\http(), ILIAS\Repository\refinery(), and ILIAS\UI\Implementation\Component\withAdditionalOnLoadCode().

Referenced by fillRecordFieldExcelExport(), getRecordFieldExportValue(), getRecordFieldHTML(), getRecordFieldPlainText(), getRecordFieldSortingValue(), getStandardFieldFormulaValue(), and getStandardFieldPlainText().

548  : string
549  {
550  switch ($field_id) {
551  case 'id':
552  return $this->getId();
553  case 'owner':
554  return ilUserUtil::getNamePresentation($this->getOwner());
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 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:
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
static http()
Fetches the global http state from ILIAS.
$ref_id
Definition: ltiauth.php:67
getNrOfComments()
Get nr of comments of this record.
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 getListCommentsJSCall(string $a_hash, string $a_update_code=null)
Get list comments js call.
+ Here is the call graph for this function:
+ Here is the caller 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.

References getNrOfComments(), and getStandardFieldHTML().

595  {
596  switch ($field_id) {
597  case 'comments':
598  return $this->getNrOfComments();
599  default:
600  return strip_tags($this->getStandardFieldHTML($field_id));
601  }
602  }
getStandardFieldHTML(string $field_id, array $options=[])
getNrOfComments()
Get nr of comments of this record.
+ Here is the call graph for this function:

◆ getTable()

ilDclBaseRecordModel::getTable ( )

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

References $table, and loadTable().

Referenced by doCreate(), hasPermissionToDelete(), hasPermissionToEdit(), hasPermissionToView(), and ilDclRecordListGUI\recordBelongsToCollection().

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...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTableId()

ilDclBaseRecordModel::getTableId ( )

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

References $table_id.

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

199  : int
200  {
201  return $this->table_id;
202  }
+ Here is the caller graph for this function:

◆ hasPermissionToDelete()

ilDclBaseRecordModel::hasPermissionToDelete ( int  $ref_id)

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

References getTable().

712  : bool
713  {
714  return $this->getTable()->hasPermissionToDeleteRecord($ref_id, $this);
715  }
$ref_id
Definition: ltiauth.php:67
+ Here is the call graph for this function:

◆ hasPermissionToEdit()

ilDclBaseRecordModel::hasPermissionToEdit ( int  $ref_id)

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

References getTable().

Referenced by ilDclRecordEditGUI\save().

707  : bool
708  {
709  return $this->getTable()->hasPermissionToEditRecord($ref_id, $this);
710  }
$ref_id
Definition: ltiauth.php:67
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasPermissionToView()

ilDclBaseRecordModel::hasPermissionToView ( int  $ref_id)

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

References getTable().

717  : bool
718  {
719  return $this->getTable()->hasPermissionToViewRecord($ref_id, $this);
720  }
$ref_id
Definition: ltiauth.php:67
+ Here is the call graph for this function:

◆ loadRecordFields()

ilDclBaseRecordModel::loadRecordFields ( )
private

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

References $recordfields, ilDclCache\getRecordFieldCache(), and loadTable().

Referenced by deleteField(), doCreate(), doDelete(), fillRecordFieldExcelExport(), fillRecordFieldFormInput(), getRecordField(), getRecordFieldExportValue(), getRecordFieldFormulaValue(), getRecordFieldHTML(), getRecordFieldPlainText(), getRecordFieldRepresentationValue(), getRecordFields(), getRecordFieldSortingValue(), getRecordFieldValue(), getRecordFieldValueFromExcel(), getRecordFieldValues(), setRecordFieldValue(), and setRecordFieldValueFromForm().

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  }
static getRecordFieldCache(object $record, object $field)
+ 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.

References ilDclCache\getTableCache(), and getTableId().

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

619  : void
620  {
621  if ($this->table === null) {
622  $this->table = ilDclCache::getTableCache($this->getTableId());
623  }
624  }
static getTableCache(int $table_id=null)
+ 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.

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

204  : void
205  {
206  $this->create_date = $a_datetime;
207  }
+ Here is the caller graph for this function:

◆ setId()

ilDclBaseRecordModel::setId ( int  $a_id)

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

Referenced by doCreate().

184  : void
185  {
186  $this->id = $a_id;
187  }
+ Here is the caller graph for this function:

◆ setLastEditBy()

ilDclBaseRecordModel::setLastEditBy ( ?int  $last_edit_by)

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

References $last_edit_by.

Referenced by ilDclRecordEditGUI\cancelSave(), cloneStructure(), doRead(), ilDclRecordEditGUI\save(), and setStandardField().

239  : void
240  {
241  $this->last_edit_by = $last_edit_by;
242  }
+ Here is the caller graph for this function:

◆ setLastUpdate()

ilDclBaseRecordModel::setLastUpdate ( ilDateTime  $a_datetime)

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

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

214  : void
215  {
216  $this->last_update = $a_datetime;
217  }
+ Here is the caller graph for this function:

◆ setOwner()

ilDclBaseRecordModel::setOwner ( int  $a_id)

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

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

224  : void
225  {
226  $this->owner = $a_id;
227  }
+ 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.

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

Referenced by ilDclRecordEditGUI\save().

249  : void
250  {
251  $this->loadRecordFields();
252  if (ilDclStandardField::_isStandardField($field_id)) {
253  $this->setStandardField($field_id, $value);
254  } else {
255  $this->loadTable();
256  $this->recordfields[$field_id]->setValue($value);
257  }
258  }
static _isStandardField($field_id)
+ 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.

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

Referenced by ilDclRecordEditGUI\save().

264  : void
265  {
266  $this->loadRecordFields();
267  if (ilDclStandardField::_isStandardField($field_id)) {
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)
static _isStandardField($field_id)
+ 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.

References setLastEditBy().

Referenced by setRecordFieldValue(), and setStandardFieldFromForm().

506  {
507  if ($field_id == "last_edit_by") {
508  $this->setLastEditBy($value);
509  return;
510  }
511  $this->{$field_id} = $value;
512  }
+ Here is the call graph for this function:
+ 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.

References ilPropertyFormGUI\getItemByPostVar(), and setStandardField().

Referenced by setRecordFieldValueFromForm().

494  : void
495  {
496  if ($item = $form->getItemByPostVar("field_" . $field_id)) {
497  $this->setStandardField($field_id, $item->getValue());
498  }
499  }
getItemByPostVar(string $a_post_var)
+ 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.

References ilDclBaseFieldModel\getId().

290  : void {
291  $value = $field->getValueFromExcel($excel, $row, $col);
292  if ($value) {
293  $this->{$field->getId()} = $value;
294  }
295  }
+ Here is the call graph for this function:

◆ setTableId()

ilDclBaseRecordModel::setTableId ( int  $a_id)

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

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

194  : void
195  {
196  $this->table_id = $a_id;
197  }
+ 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 getId(), and getRecordFieldValues().

◆ $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.

Referenced by getNrOfComments().

◆ $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.

Referenced by getRecordFields(), and loadRecordFields().

◆ $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.

Referenced by getTable().

◆ $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: