ILIAS  release_7 Revision v7.30-3-g800a261c036
ilDclBaseRecordModel Class Reference

Class ilDclBaseRecordModel. More...

+ Collaboration diagram for ilDclBaseRecordModel:

Public Member Functions

 __construct ($a_id=0)
 
 doUpdate ($omit_notification=false)
 doUpdate More...
 
 doRead ()
 Read record. More...
 
 doCreate ()
 
 deleteField ($field_id)
 
 setId ($a_id)
 Set field id. More...
 
 getId ()
 Get field id. More...
 
 setTableId ($a_id)
 Set Table ID. More...
 
 getTableId ()
 Get Table ID. More...
 
 setCreateDate ($a_datetime)
 Set Creation Date. More...
 
 getCreateDate ()
 Get Creation Date. More...
 
 setLastUpdate ($a_datetime)
 Set Last Update Date. More...
 
 getLastUpdate ()
 Get Last Update Date. More...
 
 setOwner ($a_id)
 Set Owner. More...
 
 getOwner ()
 Get Owner. More...
 
 getLastEditBy ()
 
 setLastEditBy ($last_edit_by)
 
 setRecordFieldValue ($field_id, $value)
 Set a field value. More...
 
 setRecordFieldValueFromForm ($field_id, &$form)
 Set a field value. More...
 
 getRecordFieldValueFromExcel ($excel, $row, $col, $field)
 
 setStandardFieldValueFromExcel ($excel, $row, $col, $field)
 
 getRecordFieldValues ()
 
 getRecordFieldValue ($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, &$row, &$col, $field_id)
 
 getRecordFieldFormulaValue ($field_id)
 
 getRecordFieldHTML ($field_id, array $options=array())
 
 getRecordFieldSortingValue ($field_id, array $options=array())
 
 fillRecordFieldFormInput ($field_id, &$form)
 
 getStandardFieldFormulaValue ($field_id)
 
 getStandardFieldHTML ($field_id, array $options=array())
 
 getStandardFieldPlainText ($field_id)
 
 getRecordField ($field_id)
 
 doDelete ($omit_notification=false)
 Delete. More...
 
 cloneStructure ($original_id, $new_fields)
 
 deleteFile ($obj_id)
 Delete a file. More...
 
 deleteMob ($obj_id)
 Delete MOB. More...
 
 passThroughFilter (array $filter)
 
 hasPermissionToEdit ($ref_id)
 
 hasPermissionToDelete ($ref_id)
 
 hasPermissionToView ($ref_id)
 
 getRecordFields ()
 
 getTable ()
 
 getComments ()
 Get all comments of this record. More...
 

Protected Member Functions

 setStandardFieldFromForm ($field_id, &$form)
 
 setStandardField ($field_id, $value)
 
 fillStandardFieldFormInput ($field_id, &$form)
 
 getStandardField ($field_id)
 

Protected Attributes

 $recordfields
 
 $id
 
 $table_id
 
 $table
 
 $last_edit_by
 
 $owner
 
 $last_update
 
 $create_date
 
 $comments
 

Private Member Functions

 fixDate ($value)
 
 loadRecordFields ()
 Load record fields. More...
 
 loadTable ()
 Load table. More...
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDclBaseRecordModel::__construct (   $a_id = 0)
Parameters
int$a_id

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

63 {
64 if ($a_id != 0) {
65 $this->id = $a_id;
66 $this->doRead();
67 }
68 }

References doRead().

+ Here is the call graph for this function:

Member Function Documentation

◆ cloneStructure()

ilDclBaseRecordModel::cloneStructure (   $original_id,
  $new_fields 
)
Parameters
$original_idinteger
$new_fieldsarray($old_field_id => $new_field)

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

875 {
876 $original = ilDclCache::getRecordCache($original_id);
877 $this->setCreateDate($original->getCreateDate());
878 $this->setLastEditBy($original->getLastEditBy());
879 $this->setLastUpdate($original->getLastUpdate());
880 $this->setOwner($original->getOwner());
881 $this->doCreate();
882 foreach ($new_fields as $old => $new) {
883 $old_rec_field = $original->getRecordField($old);
884 $new_rec_field = ilDclCache::getRecordFieldCache($this, $new);
885 $new_rec_field->cloneStructure($old_rec_field);
886 $this->recordfields[] = $new_rec_field;
887 }
888
889 // mandatory for all cloning functions
891 }
setLastUpdate($a_datetime)
Set Last Update Date.
setCreateDate($a_datetime)
Set Creation Date.
static getRecordFieldCache($record, $field)
static getRecordCache($record_id=0)
static setCloneOf($old, $new, $type)

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

+ Here is the call graph for this function:

◆ deleteField()

ilDclBaseRecordModel::deleteField (   $field_id)
Parameters
$field_id

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

193 {
194 $this->loadRecordFields();
195 $this->recordfields[$field_id]->delete();
196 if (count($this->recordfields) == 1) {
197 $this->doDelete();
198 }
199 }
loadRecordFields()
Load record fields.
doDelete($omit_notification=false)
Delete.

References doDelete(), and loadRecordFields().

+ Here is the call graph for this function:

◆ deleteFile()

ilDclBaseRecordModel::deleteFile (   $obj_id)

Delete a file.

Parameters
$obj_id

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

900 {
901 if (ilObject2::_exists($obj_id, false)) {
902 $file = new ilObjFile($obj_id, false);
903 $file->delete();
904 }
905 }
Class ilObjFile.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public

References ilObject2\_exists().

Referenced by doDelete().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteMob()

ilDclBaseRecordModel::deleteMob (   $obj_id)

Delete MOB.

Parameters
$obj_id

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

914 {
915 if (ilObject2::_lookupObjId($obj_id)) {
916 $mob = new ilObjMediaObject($obj_id);
917 $mob->delete();
918 }
919 }
Class ilObjMediaObject.
static _lookupObjId($a_id)

References ilObject2\_lookupObjId().

Referenced by doDelete().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doCreate()

ilDclBaseRecordModel::doCreate ( )
Exceptions
ilException

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

156 {
157 global $DIC;
158 $ilDB = $DIC['ilDB'];
159
160 if (!ilDclTable::_tableExists($this->getTableId())) {
161 throw new ilException("The field does not have a related table!");
162 }
163
164 $id = $ilDB->nextId("il_dcl_record");
165 $this->setId($id);
166 $query
167 = "INSERT INTO il_dcl_record (
168 id,
169 table_id,
170 create_date,
171 Last_update,
172 owner,
173 last_edit_by
174 ) VALUES (" . $ilDB->quote($this->getId(), "integer") . "," . $ilDB->quote($this->getTableId(), "integer") . ","
175 . $ilDB->quote($this->getCreateDate(), "timestamp") . "," . $ilDB->quote($this->getLastUpdate(), "timestamp") . ","
176 . $ilDB->quote($this->getOwner(), "integer") . "," . $ilDB->quote($this->getLastEditBy(), "integer") . "
177 )";
178 $ilDB->manipulate($query);
179
180 $this->loadRecordFields();
181 foreach ($this->getRecordFields() as $recordField) {
182 $recordField->doCreate();
183 }
184
185 $this->getTable()->loadRecords();
186 }
getLastUpdate()
Get Last Update Date.
static _tableExists($table_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: goto.php:24
$query
global $ilDB

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

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doDelete()

ilDclBaseRecordModel::doDelete (   $omit_notification = false)

Delete.

Parameters
bool$omit_notification

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

826 {
827 global $DIC;
828 $ilDB = $DIC['ilDB'];
829 $ilAppEventHandler = $DIC['ilAppEventHandler'];
830
831 $this->loadRecordFields();
832 foreach ($this->recordfields as $recordfield) {
833 if ($recordfield->getField()->getDatatypeId() == ilDclDatatype::INPUTFORMAT_FILE) {
834 $this->deleteFile($recordfield->getValue());
835 }
836
837 if ($recordfield->getField()->getDatatypeId() == ilDclDatatype::INPUTFORMAT_MOB) {
838 $this->deleteMob($recordfield->getValue());
839 }
840
841 $recordfield->delete();
842 }
843
844 $query = "DELETE FROM il_dcl_record WHERE id = " . $ilDB->quote($this->getId(), "integer");
845 $ilDB->manipulate($query);
846
847 $this->table->loadRecords();
848
849 if (!$omit_notification) {
850 $objDataCollection = new ilObjDataCollection($_GET['ref_id']);
851 $objDataCollection->sendNotification("delete_record", $this->getTableId(), $this->getId());
852
853 $ilAppEventHandler->raise(
854 'Modules/DataCollection',
855 'deleteRecord',
856 array(
857 'dcl' => ilDclCache::getTableCache($this->getTableId())->getCollectionObject(),
858 'table_id' => $this->table_id,
859 'record_id' => $this->getId(),
860 'record' => $this,
861 )
862 );
863 }
864 }
$_GET["client_id"]
deleteFile($obj_id)
Delete a file.
static getTableCache($table_id=0)
Class ilObjDataCollection.

References $_GET, $DIC, $ilDB, $query, deleteFile(), deleteMob(), getId(), ilDclCache\getTableCache(), getTableId(), ilDclDatatype\INPUTFORMAT_FILE, ilDclDatatype\INPUTFORMAT_MOB, and loadRecordFields().

Referenced by deleteField().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doRead()

ilDclBaseRecordModel::doRead ( )

Read record.

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

135 {
136 global $DIC;
137 $ilDB = $DIC['ilDB'];
138 //build query
139 $query = "Select * From il_dcl_record WHERE id = " . $ilDB->quote($this->getId(), "integer") . " ORDER BY id";
140
141 $set = $ilDB->query($query);
142 $rec = $ilDB->fetchAssoc($set);
143
144 $this->setTableId($rec["table_id"]);
145 $this->setCreateDate($rec["create_date"]);
146 $this->setLastUpdate($rec["last_update"]);
147 $this->setOwner($rec["owner"]);
148 $this->setLastEditBy($rec["last_edit_by"]);
149 }

References $DIC, $ilDB, $query, getId(), setCreateDate(), setLastEditBy(), setLastUpdate(), setOwner(), and setTableId().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doUpdate()

ilDclBaseRecordModel::doUpdate (   $omit_notification = false)

doUpdate

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

86 {
87 global $DIC;
88 $ilDB = $DIC['ilDB'];
89
90 $values = array(
91 "table_id" => array(
92 "integer",
93 $this->getTableId(),
94 ),
95 "last_update" => array(
96 "date",
97 $this->fixDate($this->getLastUpdate()),
98 ),
99 "owner" => array(
100 "text",
101 $this->getOwner(),
102 ),
103 "last_edit_by" => array(
104 "text",
105 $this->getLastEditBy(),
106 ),
107 );
108 $ilDB->update(
109 "il_dcl_record",
110 $values,
111 array(
112 "id" => array(
113 "integer",
114 $this->id,
115 ),
116 )
117 );
118
119 foreach ($this->getRecordFields() as $recordfield) {
120 $recordfield->doUpdate();
121 }
122
123 //TODO: add event raise
124 if (!$omit_notification) {
125 $objDataCollection = new ilObjDataCollection($_GET['ref_id']);
126 $objDataCollection->sendNotification("update_record", $this->getTableId(), $this->id);
127 }
128 }

References $_GET, $DIC, $ilDB, fixDate(), getLastEditBy(), getLastUpdate(), getOwner(), getRecordFields(), and getTableId().

Referenced by ilDclRecordEditGUI\save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fillRecordFieldExcelExport()

ilDclBaseRecordModel::fillRecordFieldExcelExport ( ilExcel  $worksheet,
$row,
$col,
  $field_id 
)
Parameters
$worksheet
$row
$col
$field_id

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

500 {
501 $this->loadRecordFields();
503 if ($field_id == 'owner') {
504 $worksheet->setCell($row, $col, ilObjUser::_lookupLogin($this->getOwner()));
505 $col++;
506 $name_array = ilObjUser::_lookupName($this->getOwner());
507 $worksheet->setCell($row, $col, $name_array['lastname'] . ', ' . $name_array['firstname']);
508 $col++;
509 } else {
510 $worksheet->setCell($row, $col, $this->getStandardFieldHTML($field_id));
511 $col++;
512 }
513 } else {
514 $this->recordfields[$field_id]->fillExcelExport($worksheet, $row, $col);
515 }
516 }
getStandardFieldHTML($field_id, array $options=array())
static _isStandardField($field_id)
setCell($a_row, $a_col, $a_value, $a_datatype=null)
Set cell value.
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name

References ilDclStandardField\_isStandardField(), ilObjUser\_lookupLogin(), ilObjUser\_lookupName(), getOwner(), getStandardFieldHTML(), loadRecordFields(), and ilExcel\setCell().

Referenced by ilDclContentExporter\fillRowExcel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fillRecordFieldFormInput()

ilDclBaseRecordModel::fillRecordFieldFormInput (   $field_id,
$form 
)
Parameters
$field_id
$formilPropertyFormGUI

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

630 {
631 $this->loadRecordFields();
633 $this->fillStandardFieldFormInput($field_id, $form);
634 } else {
635 $this->recordfields[$field_id]->getRecordRepresentation()->fillFormInput($form);
636 }
637 }
fillStandardFieldFormInput($field_id, &$form)

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

Referenced by ilDclRecordEditGUI\sendFailure().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fillStandardFieldFormInput()

ilDclBaseRecordModel::fillStandardFieldFormInput (   $field_id,
$form 
)
protected
Parameters
$field_id
$form

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

673 {
674 if ($item = $form->getItemByPostVar('field_' . $field_id)) {
675 $item->setValue($this->getStandardField($field_id));
676 }
677 }

References getStandardField().

Referenced by fillRecordFieldFormInput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fixDate()

ilDclBaseRecordModel::fixDate (   $value)
private
Parameters
$value
Returns
string

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

77 {
78 return $value;
79 }

Referenced by doUpdate().

+ Here is the caller graph for this function:

◆ getComments()

ilDclBaseRecordModel::getComments ( )

Get all comments of this record.

Returns
array ilNote[]

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

1005 {
1006 if ($this->comments === null) {
1007 $this->comments = ilNote::_getNotesOfObject($this->table->getCollectionObject()->getId(), $this->getId(), 'dcl', IL_NOTE_PUBLIC);
1008 }
1009
1010 return $this->comments;
1011 }
const IL_NOTE_PUBLIC
Definition: class.ilNote.php:6
static _getNotesOfObject( $a_rep_obj_id, $a_obj_id, $a_obj_type, $a_type=IL_NOTE_PRIVATE, $a_incl_sub=false, $a_filter="", $a_all_public="y", $a_repository_mode=true, $a_sort_ascending=false, $a_news_id=0)
get all notes related to a specific object

References $comments, ilNote\_getNotesOfObject(), and IL_NOTE_PUBLIC.

Referenced by getStandardFieldHTML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCreateDate()

ilDclBaseRecordModel::getCreateDate ( )

Get Creation Date.

Returns
ilDateTime

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

References $create_date.

Referenced by doCreate(), and getStandardFieldHTML().

+ Here is the caller graph for this function:

◆ getId()

ilDclBaseRecordModel::getId ( )

Get field id.

Returns
int

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

219 {
220 return $this->id;
221 }

References $id.

Referenced by cloneStructure(), doCreate(), doDelete(), doRead(), ilDclFieldFactory\getRecordFieldInstance(), getStandardFieldHTML(), ilDclRecordEditGUI\save(), and ilDclRecordEditGUI\sendFailure().

+ Here is the caller graph for this function:

◆ getLastEditBy()

ilDclBaseRecordModel::getLastEditBy ( )

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

References $last_edit_by.

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

+ Here is the caller graph for this function:

◆ getLastUpdate()

ilDclBaseRecordModel::getLastUpdate ( )

Get Last Update Date.

Returns
ilDateTime

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

References $last_update.

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

+ Here is the caller graph for this function:

◆ getOwner()

ilDclBaseRecordModel::getOwner ( )

Get Owner.

Returns
int

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

References $owner.

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

+ Here is the caller graph for this function:

◆ getRecordField()

ilDclBaseRecordModel::getRecordField (   $field_id)
Parameters
$field_id
Returns
ilDclBaseRecordFieldModel

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

813 {
814 $this->loadRecordFields();
815
816 return $this->recordfields[$field_id];
817 }

References loadRecordFields().

+ Here is the call graph for this function:

◆ getRecordFieldExportValue()

ilDclBaseRecordModel::getRecordFieldExportValue (   $field_id)

Get Field Export Value.

Parameters
int$field_id
Returns
array

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

465 {
466 $this->loadRecordFields();
468 return $this->getStandardFieldHTML($field_id);
469 } else {
470 return $this->recordfields[$field_id]->getExportValue();
471 }
472 }

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

+ Here is the call graph for this function:

◆ getRecordFieldFormulaValue()

ilDclBaseRecordModel::getRecordFieldFormulaValue (   $field_id)
Parameters
int | string$field_id
Returns
array|mixed|string

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

525 {
526 $this->loadRecordFields();
528 $value = $this->getStandardFieldFormulaValue($field_id);
529 } else {
530 if (is_object($this->recordfields[$field_id])) {
531 $value = $this->recordfields[$field_id]->getFormulaValue();
532 } else {
533 $value = '';
534 }
535 }
536
537 return $value;
538 }

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

+ Here is the call graph for this function:

◆ getRecordFieldHTML()

ilDclBaseRecordModel::getRecordFieldHTML (   $field_id,
array  $options = array() 
)
Parameters
$field_id
array$options
Returns
array|mixed|string

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

547 {
548 $this->loadRecordFields();
550 $html = $this->getStandardFieldHTML($field_id, $options);
551 } else {
552 if (is_object($this->recordfields[$field_id])) {
553 $html = $this->recordfields[$field_id]->getRecordRepresentation()->getHTML();
554 } else {
555 $html = '';
556 }
557 }
558
559 // This is a workaround as templating in ILIAS currently has some issues with curly brackets.see: http://www.ilias.de/mantis/view.php?id=12681#bugnotes
560 // SW 16.07.2014 Uncommented again, as some fields are outputting javascript that was broken due to entity encode the curly brackets
561 // $html = str_ireplace("{", "{", $html);
562 // $html = str_ireplace("}", "}", $html);
563
564 return $html;
565 }

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

+ Here is the call graph for this function:

◆ getRecordFieldPlainText()

ilDclBaseRecordModel::getRecordFieldPlainText (   $field_id)

Get Field Export Value.

Parameters
int$field_id
Returns
array

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

483 {
484 $this->loadRecordFields();
486 return $this->getStandardFieldHTML($field_id);
487 } else {
488 return $this->recordfields[$field_id]->getPlainText();
489 }
490 }

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

+ Here is the call graph for this function:

◆ getRecordFieldRepresentationValue()

ilDclBaseRecordModel::getRecordFieldRepresentationValue (   $field_id)

Get Field Value for Representation in a Form.

Parameters
$field_id
Returns
array|int|null|string

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

444 {
445 if ($field_id === null) {
446 return null;
447 }
448 $this->loadRecordFields();
450 return $this->getStandardField($field_id);
451 } else {
452 return $this->recordfields[$field_id]->getValueForRepresentation();
453 }
454 }

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

+ Here is the call graph for this function:

◆ getRecordFields()

ilDclBaseRecordModel::getRecordFields ( )
Returns
ilDclBaseRecordFieldModel[]

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

981 {
982 $this->loadRecordFields();
983
984 return $this->recordfields;
985 }

References $recordfields, and loadRecordFields().

Referenced by doCreate(), and doUpdate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRecordFieldSortingValue()

ilDclBaseRecordModel::getRecordFieldSortingValue (   $field_id,
array  $options = array() 
)
Parameters
$field_id
array$options
Returns
array|mixed|string

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

575 {
576 $this->loadRecordFields();
578 $html = $this->getStandardFieldHTML($field_id, $options);
579 } else {
580 if (is_object($this->recordfields[$field_id])) {
581 $html = $this->recordfields[$field_id]->getSortingValue();
582 } else {
583 $html = '';
584 }
585 }
586
587 // This is a workaround as templating in ILIAS currently has some issues with curly brackets.see: http://www.ilias.de/mantis/view.php?id=12681#bugnotes
588 // SW 16.07.2014 Uncommented again, as some fields are outputting javascript that was broken due to entity encode the curly brackets
589 // $html = str_ireplace("{", "{", $html);
590 // $html = str_ireplace("}", "}", $html);
591
592 return $html;
593 }

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

+ Here is the call graph for this function:

◆ getRecordFieldValue()

ilDclBaseRecordModel::getRecordFieldValue (   $field_id)

◆ getRecordFieldValueFromExcel()

ilDclBaseRecordModel::getRecordFieldValueFromExcel (   $excel,
  $row,
  $col,
  $field 
)
Parameters
$excelilExcel
$row
$col
$fieldilDclBaseFieldModel
Returns
array|string

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

377 {
378 $this->loadRecordFields();
379
380 return $this->recordfields[$field->getId()]->getValueFromExcel($excel, $row, $col);
381 }

References loadRecordFields().

+ Here is the call graph for this function:

◆ getRecordFieldValues()

ilDclBaseRecordModel::getRecordFieldValues ( )
Returns
array
Deprecated:

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

404 {
405 $this->loadRecordFields();
406 $return = array();
407 foreach ($this->recordfields as $id => $record_field) {
408 $return[$id] = $record_field->getValue();
409 }
410
411 return $return;
412 }

References $id, and loadRecordFields().

+ Here is the call graph for this function:

◆ getStandardField()

ilDclBaseRecordModel::getStandardField (   $field_id)
protected
Parameters
$field_id
Returns
int

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

686 {
687 switch ($field_id) {
688 case "last_edit_by":
689 return $this->getLastEditBy();
690 break;
691 case 'owner':
692 $usr_data = ilObjUser::_lookupName($this->getOwner());
693
694 return $usr_data['login'];
695 break;
696 }
697
698 return $this->$field_id;
699 }

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

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStandardFieldFormulaValue()

ilDclBaseRecordModel::getStandardFieldFormulaValue (   $field_id)
Parameters
$field_id
Returns
array|string

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

708 {
709 return $this->getStandardFieldHTML($field_id);
710 }

References getStandardFieldHTML().

Referenced by getRecordFieldFormulaValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStandardFieldHTML()

ilDclBaseRecordModel::getStandardFieldHTML (   $field_id,
array  $options = array() 
)
Parameters
string$field_id
array$options
Returns
array|string

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

719 {
720 switch ($field_id) {
721 case 'id':
722 return $this->getId();
723 case 'owner':
725 case 'last_edit_by':
727 case 'last_update':
729 case 'create_date':
731 case 'comments':
732 $nComments = count($this->getComments());
734 1,
735 $_GET['ref_id'],
736 'dcl',
737 $this->table->getCollectionObject()
738 ->getId(),
739 'dcl',
740 $this->getId()
741 );
742 $ajax_link = ilNoteGUI::getListCommentsJSCall($ajax_hash, '');
743
744 return "<a class='dcl_comment' href='#' onclick=\"return " . $ajax_link . "\">
745 <img src='" . ilUtil::getImagePath("comment_unlabeled.svg")
746 . "' alt='{$nComments} Comments'><span class='ilHActProp'>{$nComments}</span></a>";
747 }
748 }
const IL_CAL_DATETIME
static buildAjaxHash( $a_node_type, $a_node_id, $a_obj_type, $a_obj_id, $a_sub_type=null, $a_sub_id=null, $a_news_id=0)
Build ajax hash.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
@classDescription Date and time handling
getComments()
Get all comments of this record.
static getListCommentsJSCall($a_hash, $a_update_code=null)
Get list comments js call.
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)

References $_GET, ilCommonActionDispatcherGUI\buildAjaxHash(), ilDatePresentation\formatDate(), getComments(), getCreateDate(), getId(), ilUtil\getImagePath(), getLastEditBy(), getLastUpdate(), ilNoteGUI\getListCommentsJSCall(), ilUserUtil\getNamePresentation(), getOwner(), and IL_CAL_DATETIME.

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStandardFieldPlainText()

ilDclBaseRecordModel::getStandardFieldPlainText (   $field_id)
Parameters
string$field_id
Returns
array|string

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

757 {
758 switch ($field_id) {
759 case 'comments':
760 return count(ilNote::_getNotesOfObject(
761 $this->table->getCollectionObject()->getId(),
762 $this->getId(),
763 "dcl",
764 2,
765 false,
766 "",
767 "y",
768 true,
769 true
770 ));
771 default:
772 return strip_tags($this->getStandardFieldHTML($field_id));
773 }
774 }

References ilNote\_getNotesOfObject(), and getStandardFieldHTML().

+ Here is the call graph for this function:

◆ getTable()

ilDclBaseRecordModel::getTable ( )
Returns
ilDclTable

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

992 {
993 $this->loadTable();
994
995 return $this->table;
996 }

References $table, and loadTable().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTableId()

ilDclBaseRecordModel::getTableId ( )

Get Table ID.

Returns
int

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

References $table_id.

Referenced by doCreate(), doDelete(), doUpdate(), and loadTable().

+ Here is the caller graph for this function:

◆ hasPermissionToDelete()

ilDclBaseRecordModel::hasPermissionToDelete (   $ref_id)
Parameters
int$ref_id
Returns
bool

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

961 {
962 return $this->getTable()->hasPermissionToDeleteRecord($ref_id, $this);
963 }

References getTable().

+ Here is the call graph for this function:

◆ hasPermissionToEdit()

ilDclBaseRecordModel::hasPermissionToEdit (   $ref_id)
Parameters
int$ref_id
Returns
bool

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

950 {
951 return $this->getTable()->hasPermissionToEditRecord($ref_id, $this);
952 }

References getTable().

Referenced by ilDclRecordEditGUI\save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasPermissionToView()

ilDclBaseRecordModel::hasPermissionToView (   $ref_id)
Parameters
$ref_id
Returns
bool

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

972 {
973 return $this->getTable()->hasPermissionToViewRecord($ref_id, $this);
974 }

References getTable().

+ Here is the call graph for this function:

◆ loadRecordFields()

ilDclBaseRecordModel::loadRecordFields ( )
private

Load record fields.

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

781 {
782 if ($this->recordfields == null) {
783 $this->loadTable();
784 $recordfields = array();
785 foreach ($this->table->getRecordFields() as $field) {
786 if ($recordfields[$field->getId()] == null) {
787 $recordfields[$field->getId()] = ilDclCache::getRecordFieldCache($this, $field);
788 }
789 }
790
791 $this->recordfields = $recordfields;
792 }
793 }

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

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadTable()

ilDclBaseRecordModel::loadTable ( )
private

Load table.

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

800 {
801 if ($this->table == null) {
802 $this->table = ilDclCache::getTableCache($this->getTableId());
803 }
804 }

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

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ passThroughFilter()

ilDclBaseRecordModel::passThroughFilter ( array  $filter)
Parameters
array$filter
Returns
bool

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

928 {
929 $this->loadTable();
930 // If one field returns false, the whole record does not pass the filter #performance-improvements
931 foreach ($this->table->getFilterableFields() as $field) {
932 if (!isset($filter["filter_" . $field->getId()]) || !$filter["filter_" . $field->getId()]) {
933 continue;
934 }
935 if (!ilDclCache::getFieldRepresentation($field)->passThroughFilter($this, $filter["filter_" . $field->getId()])) {
936 return false;
937 }
938 }
939
940 return true;
941 }
static getFieldRepresentation(ilDclBaseFieldModel $field)

References ilDclCache\getFieldRepresentation(), loadTable(), and passThroughFilter().

Referenced by passThroughFilter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCreateDate()

ilDclBaseRecordModel::setCreateDate (   $a_datetime)

Set Creation Date.

Parameters
ilDateTime$a_datetime

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

252 {
253 $this->create_date = $a_datetime;
254 }

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

+ Here is the caller graph for this function:

◆ setId()

ilDclBaseRecordModel::setId (   $a_id)

Set field id.

Parameters
int$a_id

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

208 {
209 $this->id = $a_id;
210 }

Referenced by doCreate().

+ Here is the caller graph for this function:

◆ setLastEditBy()

ilDclBaseRecordModel::setLastEditBy (   $last_edit_by)

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

325 {
326 $this->last_edit_by = $last_edit_by;
327 }

References $last_edit_by.

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

+ Here is the caller graph for this function:

◆ setLastUpdate()

ilDclBaseRecordModel::setLastUpdate (   $a_datetime)

Set Last Update Date.

Parameters
ilDateTime$a_datetime

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

274 {
275 $this->last_update = $a_datetime;
276 }

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

+ Here is the caller graph for this function:

◆ setOwner()

ilDclBaseRecordModel::setOwner (   $a_id)

Set Owner.

Parameters
int$a_id

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

296 {
297 $this->owner = $a_id;
298 }

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

+ Here is the caller graph for this function:

◆ setRecordFieldValue()

ilDclBaseRecordModel::setRecordFieldValue (   $field_id,
  $value 
)

Set a field value.

Parameters
int$field_id
string$value

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

337 {
338 $this->loadRecordFields();
340 $this->setStandardField($field_id, $value);
341 } else {
342 $this->loadTable();
343 $record_field = $this->recordfields[$field_id];
344
345 $this->recordfields[$field_id]->setValue($value);
346 }
347 }

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

Referenced by ilDclRecordEditGUI\save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setRecordFieldValueFromForm()

ilDclBaseRecordModel::setRecordFieldValueFromForm (   $field_id,
$form 
)

Set a field value.

Parameters
int$field_id
string$value

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

357 {
358 $this->loadRecordFields();
360 $this->setStandardFieldFromForm($field_id, $form);
361 } else {
362 $this->loadTable();
363 $this->recordfields[$field_id]->setValueFromForm($form);
364 }
365 }
setStandardFieldFromForm($field_id, &$form)

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

Referenced by ilDclRecordEditGUI\save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setStandardField()

ilDclBaseRecordModel::setStandardField (   $field_id,
  $value 
)
protected
Parameters
$field_id
$value

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

657 {
658 switch ($field_id) {
659 case "last_edit_by":
660 $this->setLastEditBy($value);
661
662 return;
663 }
664 $this->$field_id = $value;
665 }

References setLastEditBy().

Referenced by setRecordFieldValue(), and setStandardFieldFromForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setStandardFieldFromForm()

ilDclBaseRecordModel::setStandardFieldFromForm (   $field_id,
$form 
)
protected
Parameters
$field_id
ilPropertyFormGUI$form

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

645 {
646 if ($item = $form->getItemByPostVar("field_" . $field_id)) {
647 $this->setStandardField($item->getValue());
648 }
649 }

References setStandardField().

Referenced by setRecordFieldValueFromForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setStandardFieldValueFromExcel()

ilDclBaseRecordModel::setStandardFieldValueFromExcel (   $excel,
  $row,
  $col,
  $field 
)
Parameters
$excelilExcel
$row
$col
$fieldilDclStandardField

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

391 {
392 $value = $field->getValueFromExcel($excel, $row, $col);
393 if ($value) {
394 $this->{$field->getId()} = $value;
395 }
396 }

◆ setTableId()

ilDclBaseRecordModel::setTableId (   $a_id)

Set Table ID.

Parameters
int$a_id

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

230 {
231 $this->table_id = $a_id;
232 }

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

+ Here is the caller graph for this function:

Field Documentation

◆ $comments

ilDclBaseRecordModel::$comments
protected

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

Referenced by getComments().

◆ $create_date

ilDclBaseRecordModel::$create_date
protected

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

Referenced by getCreateDate().

◆ $id

ilDclBaseRecordModel::$id
protected

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

Referenced by doCreate(), getId(), and getRecordFieldValues().

◆ $last_edit_by

ilDclBaseRecordModel::$last_edit_by
protected

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

Referenced by getLastEditBy(), and setLastEditBy().

◆ $last_update

ilDclBaseRecordModel::$last_update
protected

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

Referenced by getLastUpdate().

◆ $owner

ilDclBaseRecordModel::$owner
protected

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

Referenced by getOwner().

◆ $recordfields

ilDclBaseRecordModel::$recordfields
protected

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

Referenced by getRecordFields(), and loadRecordFields().

◆ $table

ilDclBaseRecordModel::$table
protected

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

Referenced by getTable().

◆ $table_id

ilDclBaseRecordModel::$table_id
protected

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

Referenced by getTableId().


The documentation for this class was generated from the following file: