31 protected int $id = 0;
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();
54 if ($a_id && $a_id != 0) {
59 $this->notes = $DIC->notes();
60 $this->
http = $DIC->http();
64 public function doUpdate(
bool $omit_notification =
false): void
96 $recordfield->doUpdate();
100 if (!$omit_notification) {
101 $ref_id = $this->
http->wrapper()->query()->retrieve(
'ref_id', $this->
refinery->kindlyTo()->int());
103 $objDataCollection->sendNotification(
"update_record", $this->
getTableId(), $this->
id);
110 $query =
"Select * From il_dcl_record WHERE id = " . $this->db->quote($this->
getId(),
"integer") .
" ORDER BY id";
112 $set = $this->db->query(
$query);
113 $rec = $this->db->fetchAssoc($set);
122 if (null !== $rec[
"create_date"]) {
125 if (null !== $rec[
"last_update"]) {
130 $this->
setOwner((
int) $rec[
"owner"]);
131 if (null !== $rec[
"last_edit_by"]) {
142 throw new ilException(
"The field does not have a related table!");
145 $id = $this->db->nextId(
"il_dcl_record");
148 =
"INSERT INTO il_dcl_record ( 155 ) VALUES (" . $this->db->quote($this->
getId(),
"integer") .
"," . $this->db->quote(
163 . $this->db->quote($this->
getOwner(),
"integer") .
"," . $this->db->quote($this->
getLastEditBy(),
"integer") .
" 165 $this->db->manipulate(
$query);
169 $recordField->doCreate();
178 $this->recordfields[$field_id]->delete();
179 if (count($this->recordfields) == 1) {
184 public function setId(
int $a_id): void
196 $this->table_id = $a_id;
206 $this->create_date = $a_datetime;
216 $this->last_update = $a_datetime;
226 $this->owner = $a_id;
256 $this->recordfields[$field_id]->setValue($value);
271 $this->recordfields[$field_id]->setValueFromForm($form);
282 return $this->recordfields[$field->
getId()]->getValueFromExcel($excel, $row, $col);
291 $value = $field->getValueFromExcel($excel, $row, $col);
293 $this->{$field->
getId()} = $value;
301 foreach ($this->recordfields as $id => $record_field) {
302 $return[
$id] = $record_field->getValue();
314 if ($field_id === null) {
321 return $this->recordfields[$field_id]->getValue();
332 if ($field_id === null) {
339 return $this->recordfields[$field_id]->getValueForRepresentation();
354 return $this->recordfields[$field_id]->getExportValue();
369 return $this->recordfields[$field_id]->getPlainText();
380 if ($field_id ==
'owner') {
384 $worksheet->
setCell($row, $col, $name_array[
'lastname'] .
', ' . $name_array[
'firstname']);
385 } elseif (
'last_update') {
387 $worksheet->
setCell($row, $col, $date_time);
388 } elseif (
'create_date') {
390 $worksheet->
setCell($row, $col, $date_time);
396 $this->recordfields[$field_id]->fillExcelExport($worksheet, $row, $col);
409 if (is_object($this->recordfields[$field_id])) {
410 $value = $this->recordfields[$field_id]->getFormulaValue();
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);
447 if (is_object($this->recordfields[$field_id])) {
448 $html = $this->recordfields[$field_id]->getSortingValue();
460 public function getRecordFieldSingleHTML($field_id, array $options = []):
string 467 $field = $this->recordfields[$field_id];
472 $html = $field->getRecordRepresentation()->getSingleHTML($options,
false);
487 $this->recordfields[$field_id]->getRecordRepresentation()->fillFormInput($form);
507 if ($field_id ==
"last_edit_by") {
511 $this->{$field_id} = $value;
534 return $usr_data[
'login'];
537 return $this->{$field_id};
552 return $this->
getId();
563 $ref_id = $this->
http->wrapper()->query()->retrieve(
'ref_id', $this->
refinery->kindlyTo()->int());
569 $this->table->getCollectionObject()
574 $update_code =
"il.UI.counter.getCounterObject($(\".ilc_page_Page\")).incrementStatusCount(1);";
579 $comment_glyph = $this->ui_factory->symbol()->glyph()->comment()->withCounter(
580 $this->ui_factory->counter()->status($nr_comments)
582 return "document.getElementById('$id').onclick = function (event) { $ajax_link; };";
584 return $this->renderer->render($comment_glyph);
606 if ($this->recordfields == null) {
609 foreach ($this->table->getRecordFields() as $field) {
610 if (($recordfields[$field->getId()] ?? null) === null) {
621 if ($this->table === null) {
630 return $this->recordfields[$field_id];
633 public function doDelete(
bool $omit_notification =
false): void
636 foreach ($this->recordfields as $recordfield) {
638 $this->
deleteFile((
int) $recordfield->getValue());
642 $this->
deleteMob((
int) $recordfield->getValue());
645 $recordfield->delete();
648 $query =
"DELETE FROM il_dcl_record WHERE id = " . $this->db->quote($this->
getId(),
"integer");
649 $this->db->manipulate(
$query);
651 $this->table->loadRecords();
653 if (!$omit_notification) {
654 $ref_id = $this->
http->wrapper()->query()->retrieve(
'ref_id', $this->
refinery->kindlyTo()->int());
656 $objDataCollection->sendNotification(
"delete_record", $this->
getTableId(), $this->
getId());
659 'Modules/DataCollection',
663 'table_id' => $this->table_id,
664 'record_id' => $this->
getId(),
678 $this->
setOwner($original->getOwner());
680 foreach ($new_fields as $old => $new) {
681 $old_rec_field = $original->getRecordField($old);
683 $new_rec_field->cloneStructure($old_rec_field);
684 $this->recordfields[] = $new_rec_field;
709 return $this->
getTable()->hasPermissionToEditRecord($ref_id, $this);
714 return $this->
getTable()->hasPermissionToDeleteRecord($ref_id, $this);
719 return $this->
getTable()->hasPermissionToViewRecord($ref_id, $this);
744 if ($this->nr_of_comments === null) {
748 $this->table->getCollectionObject()->getId(),
752 $this->nr_of_comments = $this->notes
754 ->getNrOfCommentsForContext(
$context);
getRecordFieldHTML($field_id, array $options=[])
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getStandardFieldFormulaValue($field_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
hasPermissionToView(int $ref_id)
getRecordFieldExportValue($field_id)
Get Field Export Value.
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:
setStandardFieldFromForm($field_id, ilPropertyFormGUI $form)
doUpdate(bool $omit_notification=false)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
setStandardFieldValueFromExcel(ilExcel $excel, int $row, int $col, ilDclBaseFieldModel $field)
withAdditionalOnLoadCode(Closure $binder)
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.
hasPermissionToEdit(int $ref_id)
getStandardFieldHTML(string $field_id, array $options=[])
setRecordFieldValue($field_id, $value)
__construct(?int $a_id=0)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setStandardField($field_id, $value)
ILIAS UI Factory $ui_factory
getRecordField(int $field_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjId(int $ref_id)
setRecordFieldValueFromForm(int $field_id, ilPropertyFormGUI $form)
Set a field value.
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
getRecordFieldValue(?int $field_id)
Get Field Value.
getRecordFieldFormulaValue($field_id)
static http()
Fetches the global http state from ILIAS.
static getTableCache(int $table_id=null)
ILIAS Refinery Factory $refinery
getRecordFieldSortingValue($field_id, array $options=[])
getNrOfComments()
Get nr of comments of this record.
getStandardFieldPlainText(string $field_id)
ILIAS UI Renderer $renderer
static setCloneOf(int $old, int $new, string $type)
getRecordFieldValueFromExcel(ilExcel $excel, int $row, int $col, ilDclBaseFieldModel $field)
static _isStandardField($field_id)
fillRecordFieldExcelExport(ilExcel $worksheet, int &$row, int &$col, $field_id)
getRecordFieldPlainText($field_id)
Get Field Export Value.
hasPermissionToDelete(int $ref_id)
setLastEditBy(?int $last_edit_by)
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 getRecordCache(?int $record_id)
setCreateDate(ilDateTime $a_datetime)
getRecordFieldRepresentationValue($field_id)
Get Field Value for Representation in a Form.
getStandardField($field_id)
setLastUpdate(ilDateTime $a_datetime)
ILIAS HTTP Services $http
static getRecordFieldCache(object $record, object $field)
deleteField(int $field_id)
cloneStructure(int $original_id, array $new_fields)
static getListCommentsJSCall(string $a_hash, string $a_update_code=null)
Get list comments js call.
doDelete(bool $omit_notification=false)
fillRecordFieldFormInput($field_id, ilPropertyFormGUI $form)
static _tableExists(int $table_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
fillStandardFieldFormInput($field_id, ilPropertyFormGUI $form)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupLogin(int $a_user_id)