ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 872 of file class.ilDclBaseRecordModel.php.

873 {
874 $original = ilDclCache::getRecordCache($original_id);
875 $this->setCreateDate($original->getCreateDate());
876 $this->setLastEditBy($original->getLastEditBy());
877 $this->setLastUpdate($original->getLastUpdate());
878 $this->setOwner($original->getOwner());
879 $this->doCreate();
880 foreach ($new_fields as $old => $new) {
881 $old_rec_field = $original->getRecordField($old);
882 $new_rec_field = ilDclCache::getRecordFieldCache($this, $new);
883 $new_rec_field->cloneStructure($old_rec_field);
884 $this->recordfields[] = $new_rec_field;
885 }
886
887 // mandatory for all cloning functions
889 }
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 191 of file class.ilDclBaseRecordModel.php.

192 {
193 $this->loadRecordFields();
194 $this->recordfields[$field_id]->delete();
195 if (count($this->recordfields) == 1) {
196 $this->doDelete();
197 }
198 }
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 897 of file class.ilDclBaseRecordModel.php.

898 {
899 if (ilObject2::_exists($obj_id, false)) {
900 $file = new ilObjFile($obj_id, false);
901 $file->delete();
902 }
903 }
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 911 of file class.ilDclBaseRecordModel.php.

912 {
913 if (ilObject2::_lookupObjId($obj_id)) {
914 $mob = new ilObjMediaObject($obj_id);
915 $mob->delete();
916 }
917 }
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 154 of file class.ilDclBaseRecordModel.php.

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

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

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

References $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 133 of file class.ilDclBaseRecordModel.php.

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

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 ilObjDataCollection::sendNotification("update_record", $this->getTableId(), $this->id);
126 }
127 }

References $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 498 of file class.ilDclBaseRecordModel.php.

499 {
500 $this->loadRecordFields();
502 if ($field_id == 'owner') {
503 $worksheet->setCell($row, $col, ilObjUser::_lookupLogin($this->getOwner()));
504 $col++;
505 $name_array = ilObjUser::_lookupName($this->getOwner());
506 $worksheet->setCell($row, $col, $name_array['lastname'] . ', ' . $name_array['firstname']);
507 $col++;
508 } else {
509 $worksheet->setCell($row, $col, $this->getStandardFieldHTML($field_id));
510 $col++;
511 }
512 } else {
513 $this->recordfields[$field_id]->fillExcelExport($worksheet, $row, $col);
514 }
515 }
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 628 of file class.ilDclBaseRecordModel.php.

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

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

+ Here is the call graph for this function:

◆ fillStandardFieldFormInput()

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

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

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

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

1003 {
1004 if ($this->comments === null) {
1005 $this->comments = ilNote::_getNotesOfObject($this->table->getCollectionObject()->getId(), $this->getId(), 'dcl', IL_NOTE_PUBLIC);
1006 }
1007
1008 return $this->comments;
1009 }
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 261 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 217 of file class.ilDclBaseRecordModel.php.

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

References $id.

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

+ Here is the caller graph for this function:

◆ getLastEditBy()

ilDclBaseRecordModel::getLastEditBy ( )

Definition at line 314 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 283 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 305 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 811 of file class.ilDclBaseRecordModel.php.

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

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

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

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

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

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

546 {
547 $this->loadRecordFields();
549 $html = $this->getStandardFieldHTML($field_id, $options);
550 } else {
551 if (is_object($this->recordfields[$field_id])) {
552 $html = $this->recordfields[$field_id]->getRecordRepresentation()->getHTML();
553 } else {
554 $html = '';
555 }
556 }
557
558 // 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
559 // SW 16.07.2014 Uncommented again, as some fields are outputting javascript that was broken due to entity encode the curly brackets
560 // $html = str_ireplace("{", "{", $html);
561 // $html = str_ireplace("}", "}", $html);
562
563 return $html;
564 }

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

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

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

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

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

+ Here is the call graph for this function:

◆ getRecordFields()

ilDclBaseRecordModel::getRecordFields ( )
Returns
ilDclBaseRecordFieldModel[]

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

979 {
980 $this->loadRecordFields();
981
982 return $this->recordfields;
983 }

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

574 {
575 $this->loadRecordFields();
577 $html = $this->getStandardFieldHTML($field_id, $options);
578 } else {
579 if (is_object($this->recordfields[$field_id])) {
580 $html = $this->recordfields[$field_id]->getSortingValue();
581 } else {
582 $html = '';
583 }
584 }
585
586 // 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
587 // SW 16.07.2014 Uncommented again, as some fields are outputting javascript that was broken due to entity encode the curly brackets
588 // $html = str_ireplace("{", "{", $html);
589 // $html = str_ireplace("}", "}", $html);
590
591 return $html;
592 }

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

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

References loadRecordFields().

+ Here is the call graph for this function:

◆ getRecordFieldValues()

ilDclBaseRecordModel::getRecordFieldValues ( )
Returns
array
Deprecated:

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

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

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

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

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

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

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

718 {
719 switch ($field_id) {
720 case 'id':
721 return $this->getId();
722 case 'owner':
724 case 'last_edit_by':
726 case 'last_update':
728 case 'create_date':
730 case 'comments':
731 $nComments = count($this->getComments());
733 1,
734 $_GET['ref_id'],
735 'dcl',
736 $this->table->getCollectionObject()
737 ->getId(),
738 'dcl',
739 $this->getId()
740 );
741 $ajax_link = ilNoteGUI::getListCommentsJSCall($ajax_hash, '');
742
743 return "<a class='dcl_comment' href='#' onclick=\"return " . $ajax_link . "\">
744 <img src='" . ilUtil::getImagePath("comment_unlabeled.svg")
745 . "' alt='{$nComments} Comments'><span class='ilHActProp'>{$nComments}</span></a>";
746 }
747 }
$_GET["client_id"]
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 755 of file class.ilDclBaseRecordModel.php.

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

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

+ Here is the call graph for this function:

◆ getTable()

ilDclBaseRecordModel::getTable ( )
Returns
ilDclTable

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

990 {
991 $this->loadTable();
992
993 return $this->table;
994 }

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 239 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 958 of file class.ilDclBaseRecordModel.php.

959 {
960 return $this->getTable()->hasPermissionToDeleteRecord($ref_id, $this);
961 }

References getTable().

+ Here is the call graph for this function:

◆ hasPermissionToEdit()

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

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

948 {
949 return $this->getTable()->hasPermissionToEditRecord($ref_id, $this);
950 }

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

970 {
971 return $this->getTable()->hasPermissionToViewRecord($ref_id, $this);
972 }

References getTable().

+ Here is the call graph for this function:

◆ loadRecordFields()

ilDclBaseRecordModel::loadRecordFields ( )
private

Load record fields.

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

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

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

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

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

926 {
927 $this->loadTable();
928 // If one field returns false, the whole record does not pass the filter #performance-improvements
929 foreach ($this->table->getFilterableFields() as $field) {
930 if (!isset($filter["filter_" . $field->getId()]) || !$filter["filter_" . $field->getId()]) {
931 continue;
932 }
933 if (!ilDclCache::getFieldRepresentation($field)->passThroughFilter($this, $filter["filter_" . $field->getId()])) {
934 return false;
935 }
936 }
937
938 return true;
939 }
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 250 of file class.ilDclBaseRecordModel.php.

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

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

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

Referenced by doCreate().

+ Here is the caller graph for this function:

◆ setLastEditBy()

ilDclBaseRecordModel::setLastEditBy (   $last_edit_by)

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

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

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

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

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

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

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

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

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

+ Here is the call graph for this function:

◆ setRecordFieldValueFromForm()

ilDclBaseRecordModel::setRecordFieldValueFromForm (   $field_id,
$form 
)

Set a field value.

Parameters
int$field_id
string$value

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

356 {
357 $this->loadRecordFields();
359 $this->setStandardFieldFromForm($field_id, $form);
360 } else {
361 $this->loadTable();
362 $this->recordfields[$field_id]->setValueFromForm($form);
363 }
364 }
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 655 of file class.ilDclBaseRecordModel.php.

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

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

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

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

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

◆ setTableId()

ilDclBaseRecordModel::setTableId (   $a_id)

Set Table ID.

Parameters
int$a_id

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

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

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: