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;
299 $this->loadRecordFields();
301 foreach ($this->recordfields as
$id => $record_field) {
302 $return[
$id] = $record_field->getValue();
314 if ($field_id ===
null) {
317 $this->loadRecordFields();
319 return $this->getStandardField($field_id);
321 return $this->recordfields[$field_id]->getValue();
332 if ($field_id ===
null) {
335 $this->loadRecordFields();
337 return $this->getStandardField($field_id);
339 return $this->recordfields[$field_id]->getValueForRepresentation();
350 $this->loadRecordFields();
352 return $this->getStandardFieldHTML($field_id);
354 return $this->recordfields[$field_id]->getExportValue();
365 $this->loadRecordFields();
367 return $this->getStandardFieldHTML($field_id);
369 return $this->recordfields[$field_id]->getPlainText();
378 $this->loadRecordFields();
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);
392 $worksheet->
setCell($row, $col, $this->getStandardFieldHTML($field_id));
396 $this->recordfields[$field_id]->fillExcelExport($worksheet, $row, $col);
405 $this->loadRecordFields();
407 $value = $this->getStandardFieldFormulaValue($field_id);
409 if (is_object($this->recordfields[$field_id])) {
410 $value = $this->recordfields[$field_id]->getFormulaValue();
424 $this->loadRecordFields();
426 $html = $this->getStandardFieldHTML($field_id, $options);
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);
443 $this->loadRecordFields();
445 $html = $this->getStandardFieldHTML($field_id, $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
462 $this->loadRecordFields();
465 $html = $this->getStandardFieldHTML($field_id);
467 $field = $this->recordfields[$field_id];
472 $html = $field->getRecordRepresentation()->getSingleHTML($options,
false);
483 $this->loadRecordFields();
485 $this->fillStandardFieldFormInput($field_id, $form);
487 $this->recordfields[$field_id]->getRecordRepresentation()->fillFormInput($form);
497 $this->setStandardField($field_id, $item->getValue());
507 if ($field_id ==
"last_edit_by") {
508 $this->setLastEditBy($value);
511 $this->{$field_id} = $value;
520 $item->setValue($this->getStandardField($field_id));
531 return $this->getLastEditBy();
534 return $usr_data[
'login'];
537 return $this->{$field_id};
545 return $this->getStandardFieldHTML($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);";
577 $nr_comments = $this->getNrOfComments();
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; };";
584 return $this->renderer->render($comment_glyph);
598 return $this->getNrOfComments();
600 return strip_tags($this->getStandardFieldHTML($field_id));
606 if ($this->recordfields ==
null) {
609 foreach ($this->table->getRecordFields() as $field) {
610 if (($recordfields[$field->getId()] ??
null) ===
null) {
615 $this->recordfields = $recordfields;
621 if ($this->table ===
null) {
628 $this->loadRecordFields();
630 return $this->recordfields[$field_id];
633 public function doDelete(
bool $omit_notification =
false): void
635 $this->loadRecordFields();
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(),
675 $this->setCreateDate($original->getCreateDate());
676 $this->setLastEditBy($original->getLastEditBy());
677 $this->setLastUpdate($original->getLastUpdate());
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);
727 $this->loadRecordFields();
729 return $this->recordfields;
744 if ($this->nr_of_comments ===
null) {
748 $this->table->getCollectionObject()->getId(),
752 $this->nr_of_comments = $this->notes
754 ->getNrOfCommentsForContext(
$context);
757 return $this->nr_of_comments;
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static buildAjaxHash(int $node_type, ?int $node_id, string $obj_type, int $obj_id, string $sub_type=null, int $sub_id=null, int $news_id=0)
Build ajax hash.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
@classDescription Date and time handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS HTTP Services $http
getRecordField(int $field_id)
setLastUpdate(ilDateTime $a_datetime)
getNrOfComments()
Get nr of comments of this record.
deleteField(int $field_id)
doDelete(bool $omit_notification=false)
setStandardField($field_id, $value)
fillRecordFieldExcelExport(ilExcel $worksheet, int &$row, int &$col, $field_id)
getRecordFieldSortingValue($field_id, array $options=[])
fillRecordFieldFormInput($field_id, ilPropertyFormGUI $form)
fillStandardFieldFormInput($field_id, ilPropertyFormGUI $form)
getRecordFieldExportValue($field_id)
Get Field Export Value.
getRecordFieldPlainText($field_id)
Get Field Export Value.
setLastEditBy(?int $last_edit_by)
getRecordFieldHTML($field_id, array $options=[])
setStandardFieldValueFromExcel(ilExcel $excel, int $row, int $col, ilDclBaseFieldModel $field)
getRecordFieldFormulaValue($field_id)
hasPermissionToEdit(int $ref_id)
__construct(?int $a_id=0)
getStandardField($field_id)
hasPermissionToDelete(int $ref_id)
ILIAS UI Factory $ui_factory
getRecordFieldValueFromExcel(ilExcel $excel, int $row, int $col, ilDclBaseFieldModel $field)
getStandardFieldHTML(string $field_id, array $options=[])
getStandardFieldFormulaValue($field_id)
setCreateDate(ilDateTime $a_datetime)
ILIAS Refinery Factory $refinery
getRecordFieldValue(?int $field_id)
Get Field Value.
getRecordFieldRepresentationValue($field_id)
Get Field Value for Representation in a Form.
getStandardFieldPlainText(string $field_id)
setStandardFieldFromForm($field_id, ilPropertyFormGUI $form)
cloneStructure(int $original_id, array $new_fields)
ILIAS UI Renderer $renderer
doUpdate(bool $omit_notification=false)
hasPermissionToView(int $ref_id)
setRecordFieldValueFromForm(int $field_id, ilPropertyFormGUI $form)
Set a field value.
setRecordFieldValue($field_id, $value)
static getRecordCache(?int $record_id)
static getRecordFieldCache(object $record, object $field)
static getTableCache(int $table_id=null)
static setCloneOf(int $old, int $new, string $type)
static _isStandardField($field_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _tableExists(int $table_id)
setCell(int $a_row, int $a_col, $a_value, ?string $a_datatype=null)
Set cell value.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getListCommentsJSCall(string $a_hash, string $a_update_code=null)
Get list comments js call.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupName(int $a_user_id)
lookup user name
static _lookupLogin(int $a_user_id)
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
static _lookupObjId(int $ref_id)
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link="", bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
static http()
Fetches the global http state from ILIAS.