ILIAS  trunk Revision v11.0_alpha-1862-g4e205cb56d4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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 (?string $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 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:22
+ Here is the call graph for this function:

Member Function Documentation

◆ cloneStructure()

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

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

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

668  : void
669  {
670  $original = ilDclCache::getRecordCache($original_id);
671  $this->setCreateDate($original->getCreateDate());
672  $this->setLastEditBy($original->getLastEditBy());
673  $this->setLastUpdate($original->getLastUpdate());
674  $this->setOwner($original->getOwner());
675  $this->doCreate();
676  foreach ($new_fields as $old => $new) {
677  $old_rec_field = $original->getRecordField($old);
678  $new_rec_field = ilDclCache::getRecordFieldCache($this, $new);
679  $new_rec_field->cloneStructure($old_rec_field);
680  $this->recordfields[] = $new_rec_field;
681  }
682 
683  // mandatory for all cloning functions
684  ilDclCache::setCloneOf($original_id, $this->getId(), ilDclCache::TYPE_RECORD);
685  }
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 687 of file class.ilDclBaseRecordModel.php.

References ilObject\_exists().

687  : void
688  {
689  if (ilObject2::_exists($obj_id, false)) {
690  $file = new ilObjFile($obj_id, false);
691  $file->delete();
692  }
693  }
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 695 of file class.ilDclBaseRecordModel.php.

References ilObject\_lookupObjId().

Referenced by doDelete().

695  : void
696  {
697  if (ilObject2::_lookupObjId($obj_id)) {
698  $mob = new ilObjMediaObject($obj_id);
699  $mob->delete();
700  }
701  }
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 633 of file class.ilDclBaseRecordModel.php.

References $ref_id, deleteMob(), getId(), ilDclCache\getTableCache(), getTableId(), ILIAS\FileDelivery\http(), 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_MOB) {
638  $this->deleteMob((int) $recordfield->getValue());
639  }
640 
641  $recordfield->delete();
642  }
643 
644  $query = "DELETE FROM il_dcl_record WHERE id = " . $this->db->quote($this->getId(), "integer");
645  $this->db->manipulate($query);
646 
647  $this->table->loadRecords();
648 
649  if (!$omit_notification) {
650  $ref_id = $this->http->wrapper()->query()->retrieve('ref_id', $this->refinery->kindlyTo()->int());
651  $objDataCollection = new ilObjDataCollection($ref_id);
652  $objDataCollection->sendNotification("delete_record", $this->getTableId(), $this->getId());
653 
654  $this->event->raise(
655  'components/ILIAS/DataCollection',
656  'deleteRecord',
657  [
658  'dcl' => ilDclCache::getTableCache($this->getTableId())->getCollectionObject(),
659  'table_id' => $this->table_id,
660  'record_id' => $this->getId(),
661  'record' => $this,
662  ]
663  );
664  }
665  }
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, and ILIAS\Repository\refinery().

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->sendNotification("update_record", $this->getTableId(), $this->id);
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 378 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().

378  : void
379  {
380  $this->loadRecordFields();
381  if (ilDclStandardField::_isStandardField($field_id)) {
382  if ($field_id === 'owner') {
383  $worksheet->setCell($row, $col, ilObjUser::_lookupLogin($this->getOwner()));
384  $col++;
385  $name_array = ilObjUser::_lookupName($this->getOwner());
386  $worksheet->setCell($row, $col, $name_array['lastname'] . ', ' . $name_array['firstname']);
387  } elseif ($field_id === 'last_update') {
388  $date_time = $this->getLastUpdate()->get(IL_CAL_DATETIME, '', $this->user->getTimeZone());
389  $worksheet->setCell($row, $col, $date_time);
390  } elseif ($field_id === 'create_date') {
391  $date_time = $this->getCreateDate()->get(IL_CAL_DATETIME, '', $this->user->getTimeZone());
392  $worksheet->setCell($row, $col, $date_time);
393  } else {
394  $worksheet->setCell($row, $col, $this->getStandardFieldHTML($field_id));
395  }
396  $col++;
397  } else {
398  $this->recordfields[$field_id]->fillExcelExport($worksheet, $row, $col);
399  }
400  }
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 483 of file class.ilDclBaseRecordModel.php.

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

Referenced by ilDclRecordEditGUI\sendFailure().

483  : void
484  {
485  $this->loadRecordFields();
486  if (ilDclStandardField::_isStandardField($field_id)) {
487  $this->fillStandardFieldFormInput($field_id, $form);
488  } else {
489  $this->recordfields[$field_id]->getRecordRepresentation()->fillFormInput($form);
490  }
491  }
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 519 of file class.ilDclBaseRecordModel.php.

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

Referenced by fillRecordFieldFormInput().

519  : void
520  {
521  if ($item = $form->getItemByPostVar('field_' . $field_id)) {
522  $item->setValue($this->getStandardField($field_id));
523  }
524  }
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 738 of file class.ilDclBaseRecordModel.php.

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

Referenced by getStandardFieldHTML(), and getStandardFieldPlainText().

738  : int
739  {
740  if ($this->nr_of_comments === null) {
741  $context = $this->notes
742  ->data()
743  ->context(
744  $this->table->getCollectionObject()->getId(),
745  $this->getId(),
746  'dcl'
747  );
748  $this->nr_of_comments = $this->notes
749  ->domain()
750  ->getNrOfCommentsForContext($context);
751  }
752 
753  return $this->nr_of_comments;
754  }
$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 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  }
+ 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 350 of file class.ilDclBaseRecordModel.php.

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

351  {
352  $this->loadRecordFields();
353  if (ilDclStandardField::_isStandardField($field_id)) {
354  return $this->getStandardFieldHTML($field_id);
355  } else {
356  return $this->recordfields[$field_id]->getExportValue();
357  }
358  }
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 405 of file class.ilDclBaseRecordModel.php.

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

405  : string
406  {
407  $this->loadRecordFields();
408  if (ilDclStandardField::_isStandardField($field_id)) {
409  $value = $this->getStandardFieldFormulaValue($field_id);
410  } else {
411  if (is_object($this->recordfields[$field_id])) {
412  $value = $this->recordfields[$field_id]->getFormulaValue();
413  } else {
414  $value = '';
415  }
416  }
417 
418  return $value;
419  }
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 424 of file class.ilDclBaseRecordModel.php.

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

Referenced by ilDclReferenceRecordRepresentation\getLinkHTML().

424  : string
425  {
426  $this->loadRecordFields();
427  if (ilDclStandardField::_isStandardField($field_id)) {
428  $html = $this->getStandardFieldHTML($field_id, $options);
429  } else {
430  if (array_key_exists($field_id, $this->recordfields) && is_object($this->recordfields[$field_id])) {
431  $html = $this->recordfields[$field_id]->getRecordRepresentation()->getHTML(true, $options);
432  } else {
433  $html = '';
434  }
435  }
436 
437  return $html;
438  }
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:

◆ getRecordFieldPlainText()

ilDclBaseRecordModel::getRecordFieldPlainText (   $field_id)

Get Field Export Value.

Parameters
int | string$field_id
Returns
int|string

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

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

366  {
367  $this->loadRecordFields();
368  if (ilDclStandardField::_isStandardField($field_id)) {
369  return $this->getStandardFieldHTML($field_id);
370  } else {
371  return $this->recordfields[$field_id]->getPlainText();
372  }
373  }
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 332 of file class.ilDclBaseRecordModel.php.

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

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

◆ getRecordFields()

ilDclBaseRecordModel::getRecordFields ( )
Returns
ilDclBaseRecordFieldModel[]

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

References $recordfields, and loadRecordFields().

Referenced by doCreate(), and doUpdate().

721  : array
722  {
723  $this->loadRecordFields();
724 
725  return $this->recordfields;
726  }
+ 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 443 of file class.ilDclBaseRecordModel.php.

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

443  : string
444  {
445  $this->loadRecordFields();
446  if (ilDclStandardField::_isStandardField($field_id)) {
447  $html = $this->getStandardFieldHTML($field_id, $options);
448  } else {
449  if (is_object($this->recordfields[$field_id])) {
450  $html = $this->recordfields[$field_id]->getSortingValue();
451  } else {
452  $html = '';
453  }
454  }
455 
456  return $html;
457  }
getStandardFieldHTML(string $field_id, array $options=[])
static _isStandardField($field_id)
+ Here is the call 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(), ilDclDatetimeFieldRepresentation\passThroughFilter(), ilDclRatingFieldRepresentation\passThroughFilter(), ilDclBooleanFieldRepresentation\passThroughFilter(), ilDclIliasReferenceFieldRepresentation\passThroughFilter(), ilDclNumberFieldRepresentation\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 529 of file class.ilDclBaseRecordModel.php.

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

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

529  : string
530  {
531  switch ($field_id) {
532  case "last_edit_by":
533  return ilObjUser::_lookupName($this->getLastEditBy())['login'];
534  case 'owner':
535  return ilObjUser::_lookupName($this->getOwner())['login'];
536  }
537 
538  return $this->{$field_id};
539  }
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 544 of file class.ilDclBaseRecordModel.php.

References getStandardFieldHTML().

Referenced by getRecordFieldFormulaValue().

544  : string
545  {
546  return $this->getStandardFieldHTML($field_id);
547  }
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 549 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(), getRecordFieldExportValue(), getRecordFieldHTML(), getRecordFieldPlainText(), getRecordFieldSortingValue(), getStandardFieldFormulaValue(), and getStandardFieldPlainText().

549  : string
550  {
551  switch ($field_id) {
552  case 'id':
553  return (string) $this->getId();
554  case 'owner':
555  return ilUserUtil::getNamePresentation($this->getOwner());
556  case 'last_edit_by':
558  case 'last_update':
560  case 'create_date':
562  case 'comments':
563 
564  $ref_id = $this->http->wrapper()->query()->retrieve('ref_id', $this->refinery->kindlyTo()->int());
565 
567  1,
568  $ref_id,
569  'dcl',
570  $this->table->getCollectionObject()
571  ->getId(),
572  'dcl',
573  $this->getId()
574  );
575  $update_code = "il.UI.counter.getCounterObject($(\".ilc_page_Page\")).incrementStatusCount(1);";
576  $ajax_link = ilNoteGUI::getListCommentsJSCall($ajax_hash, $update_code);
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  }
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 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 728 of file class.ilDclBaseRecordModel.php.

References $table, and loadTable().

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

728  : ilDclTable
729  {
730  $this->loadTable();
731 
732  return $this->table;
733  }
+ 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 708 of file class.ilDclBaseRecordModel.php.

References getTable().

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

◆ hasPermissionToEdit()

ilDclBaseRecordModel::hasPermissionToEdit ( int  $ref_id)

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

References getTable().

Referenced by ilDclRecordEditGUI\save().

703  : bool
704  {
705  return $this->getTable()->hasPermissionToEditRecord($ref_id, $this);
706  }
$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 713 of file class.ilDclBaseRecordModel.php.

References getTable().

713  : bool
714  {
715  return $this->getTable()->hasPermissionToViewRecord($ref_id, $this);
716  }
$ref_id
Definition: ltiauth.php:65
+ 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(), loadTable(), and null.

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

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

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

References setLastEditBy().

Referenced by setRecordFieldValue(), and setStandardFieldFromForm().

508  {
509  if ($field_id == "last_edit_by") {
510  $this->setLastEditBy($value);
511  return;
512  }
513  $this->{$field_id} = $value;
514  }
+ 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 496 of file class.ilDclBaseRecordModel.php.

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

Referenced by setRecordFieldValueFromForm().

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