ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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.

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

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

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

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
617  ilDclCache::setCloneOf($original_id, $this->getId(), ilDclCache::TYPE_RECORD);
618  }
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 177 of file class.ilDclBaseRecordModel.php.

References doDelete(), and loadRecordFields().

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

◆ deleteFile()

ilDclBaseRecordModel::deleteFile ( int  $obj_id)

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

References ilObject\_exists().

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

◆ deleteMob()

ilDclBaseRecordModel::deleteMob ( int  $obj_id)

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

References ilObject\_lookupObjId().

Referenced by doDelete().

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

◆ doCreate()

ilDclBaseRecordModel::doCreate ( )
Exceptions
ilException

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

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

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

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

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

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

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(ilDataCollectionMailNotification::TYPE_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 http()
Fetches the global http state from ILIAS.
$ref_id
Definition: ltiauth.php:65
static getTableCache(?int $table_id=null)
+ 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.

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

Referenced by __construct().

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  }
const IL_CAL_DATETIME
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 66 of file class.ilDclBaseRecordModel.php.

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

Referenced by ilDclRecordEditGUI\save().

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(ilDataCollectionMailNotification::TYPE_RECORD_UPDATE, $this);
106  }
107  }
const IL_CAL_DATETIME
static http()
Fetches the global http state from ILIAS.
$ref_id
Definition: ltiauth.php:65
+ 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.

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().

330  : void
331  {
332  $this->loadRecordFields();
333  if (ilDclStandardField::_isStandardField($field_id)) {
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  }
const IL_CAL_DATETIME
static _lookupName(int $a_user_id)
lookup user name
getStandardFieldHTML(string $field_id, array $options=[])
setCell(int $a_row, int $col, $value, ?string $datatype=null, bool $disable_strip_tags_for_strings=false)
Set cell value.
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 416 of file class.ilDclBaseRecordModel.php.

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

Referenced by ilDclRecordEditGUI\sendFailure().

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

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

Referenced by fillRecordFieldFormInput().

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

◆ getCreateDate()

ilDclBaseRecordModel::getCreateDate ( )

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

References $create_date.

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

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

◆ getId()

◆ getLastEditBy()

ilDclBaseRecordModel::getLastEditBy ( )

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

References $last_edit_by.

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

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

◆ getLastUpdate()

ilDclBaseRecordModel::getLastUpdate ( )

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

References $last_update.

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

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

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

Referenced by getStandardFieldHTML(), and getStandardFieldPlainText().

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 
686  return $this->nr_of_comments;
687  }
$context
Definition: webdav.php:31
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOwner()

ilDclBaseRecordModel::getOwner ( )

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

References $owner.

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

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

◆ getRecordField()

ilDclBaseRecordModel::getRecordField ( int  $field_id)

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

References loadRecordFields().

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

560  {
561  $this->loadRecordFields();
562 
563  return $this->recordfields[$field_id];
564  }
+ Here is the call graph for this function:
+ 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.

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

357  : string
358  {
359  $this->loadRecordFields();
360  if (ilDclStandardField::_isStandardField($field_id)) {
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  }
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 376 of file class.ilDclBaseRecordModel.php.

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

Referenced by ilDclReferenceRecordRepresentation\getLinkHTML().

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

References $recordfields, and loadRecordFields().

Referenced by doCreate(), and doUpdate().

654  : array
655  {
656  $this->loadRecordFields();
657 
658  return $this->recordfields;
659  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRecordFieldValue()

ilDclBaseRecordModel::getRecordFieldValue ( ?string  $field_id)

Get Field Value.

Returns
int|string|array|null

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

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

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

315  {
316  if ($field_id === null) {
317  return null;
318  }
319  $this->loadRecordFields();
320  if (ilDclStandardField::_isStandardField($field_id)) {
321  return $this->getStandardField($field_id);
322  } else {
323  return $this->recordfields[$field_id]->getValue();
324  }
325  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 280 of file class.ilDclBaseRecordModel.php.

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

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

◆ getRecordFieldValues()

ilDclBaseRecordModel::getRecordFieldValues ( )

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

References $id, and loadRecordFields().

Referenced by ilDclRecordEditGUI\getRecordData().

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

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

Referenced by fillStandardFieldFormInput(), and getRecordFieldValue().

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

References getStandardFieldHTML().

Referenced by getRecordFieldFormulaValue().

477  : string
478  {
479  return $this->getStandardFieldHTML($field_id);
480  }
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 482 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(), renderer(), and ILIAS\UI\Implementation\Component\withAdditionalOnLoadCode().

Referenced by fillRecordFieldExcelExport(), getRecordFieldHTML(), getStandardFieldFormulaValue(), and getStandardFieldPlainText().

482  : string
483  {
484  switch ($field_id) {
485  case 'id':
486  return (string) $this->getId();
487  case 'owner':
488  return ilUserUtil::getNamePresentation($this->getOwner());
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  }
renderer()
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 http()
Fetches the global http state from ILIAS.
$ref_id
Definition: ltiauth.php:65
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:
getNrOfComments()
Get nr of comments of this record.
static getListCommentsJSCall(string $a_hash, ?string $a_update_code=null)
Get list comments js call.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
+ 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 527 of file class.ilDclBaseRecordModel.php.

References getNrOfComments(), and getStandardFieldHTML().

528  {
529  switch ($field_id) {
530  case 'comments':
531  return $this->getNrOfComments();
532  default:
533  return strip_tags($this->getStandardFieldHTML($field_id));
534  }
535  }
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 661 of file class.ilDclBaseRecordModel.php.

References $table, and loadTable().

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

661  : ilDclTable
662  {
663  $this->loadTable();
664 
665  return $this->table;
666  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTableId()

ilDclBaseRecordModel::getTableId ( )

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

References $table_id.

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

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

◆ hasPermissionToDelete()

ilDclBaseRecordModel::hasPermissionToDelete ( int  $ref_id)

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

References getTable().

641  : bool
642  {
643  return $this->getTable()->hasPermissionToDeleteRecord($ref_id, $this);
644  }
$ref_id
Definition: ltiauth.php:65
+ Here is the call graph for this function:

◆ hasPermissionToEdit()

ilDclBaseRecordModel::hasPermissionToEdit ( int  $ref_id)

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

References getTable().

Referenced by ilDclRecordEditGUI\save().

636  : bool
637  {
638  return $this->getTable()->hasPermissionToEditRecord($ref_id, $this);
639  }
$ref_id
Definition: ltiauth.php:65
+ 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 646 of file class.ilDclBaseRecordModel.php.

References getTable().

646  : bool
647  {
648  return $this->getTable()->hasPermissionToViewRecord($ref_id, $this);
649  }
$ref_id
Definition: ltiauth.php:65
+ Here is the call graph for this function:

◆ loadRecordFields()

ilDclBaseRecordModel::loadRecordFields ( )
private

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

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

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

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  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 552 of file class.ilDclBaseRecordModel.php.

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

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

552  : void
553  {
554  if ($this->table === null) {
555  $this->table = ilDclCache::getTableCache($this->getTableId());
556  }
557  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 206 of file class.ilDclBaseRecordModel.php.

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

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

◆ setId()

ilDclBaseRecordModel::setId ( int  $a_id)

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

Referenced by doCreate().

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

◆ setLastEditBy()

ilDclBaseRecordModel::setLastEditBy ( ?int  $last_edit_by)

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

References $last_edit_by.

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

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

◆ setLastUpdate()

ilDclBaseRecordModel::setLastUpdate ( ilDateTime  $a_datetime)

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

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

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

◆ setOwner()

ilDclBaseRecordModel::setOwner ( int  $a_id)

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

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

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

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

Referenced by ilDclRecordEditGUI\save().

251  : void
252  {
253  $this->loadRecordFields();
254  if (ilDclStandardField::_isStandardField($field_id)) {
255  $this->setStandardField($field_id, $value);
256  } else {
257  $this->loadTable();
258  $this->recordfields[$field_id]->setValue($value);
259  }
260  }
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 266 of file class.ilDclBaseRecordModel.php.

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

Referenced by ilDclRecordEditGUI\save().

266  : void
267  {
268  $this->loadRecordFields();
269  if (ilDclStandardField::_isStandardField($field_id)) {
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)
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 440 of file class.ilDclBaseRecordModel.php.

References setLastEditBy().

Referenced by setRecordFieldValue(), and setStandardFieldFromForm().

441  {
442  if ($field_id == "last_edit_by") {
443  $this->setLastEditBy($value);
444  return;
445  }
446  $this->{$field_id} = $value;
447  }
+ 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 429 of file class.ilDclBaseRecordModel.php.

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

Referenced by setRecordFieldValueFromForm().

429  : void
430  {
431  if ($item = $form->getItemByPostVar("field_" . $field_id)) {
432  $this->setStandardField($field_id, $item->getValue());
433  }
434  }
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 287 of file class.ilDclBaseRecordModel.php.

References ilDclBaseFieldModel\getId().

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

◆ setTableId()

ilDclBaseRecordModel::setTableId ( int  $a_id)

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

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

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

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

Referenced by getNrOfComments().

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

Referenced by getRecordFields(), and loadRecordFields().

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

Referenced by getTable().

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