ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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)
 
 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)
 
 getRecordFieldHTML ($field_id, array $options=array())
 
 getRecordFieldSortingValue ($field_id, array $options=array())
 
 fillRecordFieldFormInput ($field_id, &$form)
 
 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 71 of file class.ilDclBaseRecordModel.php.

71 {
72 if ($a_id != 0) {
73 $this->id = $a_id;
74 $this->doRead();
75 }
76 }

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

757 {
758 $original = ilDclCache::getRecordCache($original_id);
759 $this->setCreateDate($original->getCreateDate());
760 $this->setLastEditBy($original->getLastEditBy());
761 $this->setLastUpdate($original->getLastUpdate());
762 $this->setOwner($original->getOwner());
763 $this->doCreate();
764 foreach($new_fields as $old => $new){
765 $old_rec_field = $original->getRecordField($old);
766 $new_rec_field = ilDclCache::getRecordFieldCache($this, $new);
767 $new_rec_field->cloneStructure($old_rec_field);
768 $this->recordfields[] = $new_rec_field;
769 }
770
771 // mandatory for all cloning functions
773 }
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)
$old

References $new, $old, 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 196 of file class.ilDclBaseRecordModel.php.

196 {
197 $this->loadRecordFields();
198 $this->recordfields[$field_id]->delete();
199 if (count($this->recordfields) == 1) {
200 $this->doDelete();
201 }
202 }
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 780 of file class.ilDclBaseRecordModel.php.

780 {
781 if (ilObject2::_exists($obj_id, false)) {
782 $file = new ilObjFile($obj_id, false);
783 $file->delete();
784 }
785 }
Class ilObjFile.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file

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

793 {
794 if (ilObject2::_lookupObjId($obj_id)) {
795 $mob = new ilObjMediaObject($obj_id);
796 $mob->delete();
797 }
798 }
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 161 of file class.ilDclBaseRecordModel.php.

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

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

712 {
713 global $DIC;
714 $ilDB = $DIC['ilDB'];
715 $ilAppEventHandler = $DIC['ilAppEventHandler'];
716
717 $this->loadRecordFields();
718 foreach ($this->recordfields as $recordfield) {
719
720 if ($recordfield->getField()->getDatatypeId() == ilDclDatatype::INPUTFORMAT_FILE) {
721 $this->deleteFile($recordfield->getValue());
722 }
723
724 if ($recordfield->getField()->getDatatypeId() == ilDclDatatype::INPUTFORMAT_MOB) {
725 $this->deleteMob($recordfield->getValue());
726 }
727
728 $recordfield->delete();
729 }
730
731 $query = "DELETE FROM il_dcl_record WHERE id = " . $ilDB->quote($this->getId(), "integer");
732 $ilDB->manipulate($query);
733
734 $this->table->loadRecords();
735
736 if (!$omit_notification) {
737 ilObjDataCollection::sendNotification("delete_record", $this->getTableId(), $this->getId());
738
739 $ilAppEventHandler->raise('Modules/DataCollection',
740 'deleteRecord',
741 array(
742 'dcl' => ilDclCache::getTableCache($this->getTableId())->getCollectionObject(),
743 'table_id' => $this->table_id,
744 'record_id' => $this->getId(),
745 'record' => $this,
746 ));
747 }
748
749 }
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 141 of file class.ilDclBaseRecordModel.php.

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

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

98 {
99 global $DIC;
100 $ilDB = $DIC['ilDB'];
101
102 $values = array(
103 "table_id" => array(
104 "integer",
105 $this->getTableId()
106 ),
107 "last_update" => array(
108 "date",
109 $this->fixDate($this->getLastUpdate())
110 ),
111 "owner" => array(
112 "text",
113 $this->getOwner()
114 ),
115 "last_edit_by" => array(
116 "text",
117 $this->getLastEditBy()
118 )
119 );
120 $ilDB->update("il_dcl_record", $values, array(
121 "id" => array(
122 "integer",
123 $this->id
124 )
125 ));
126
127 foreach ($this->getRecordFields() as $recordfield) {
128 $recordfield->doUpdate();
129 }
130
131 //TODO: add event raise
132 if (!$omit_notification) {
133 ilObjDataCollection::sendNotification("update_record", $this->getTableId(), $this->id);
134 }
135 }

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

461 {
462 $this->loadRecordFields();
464 $worksheet->setCell($row, $col, $this->getStandardFieldHTML($field_id));
465 $col++;
466 } else {
467 $this->recordfields[$field_id]->fillExcelExport($worksheet, $row, $col);
468 }
469 }
$worksheet
getStandardFieldHTML($field_id, array $options=array())
static _isStandardField($field_id)

References $row, $worksheet, ilDclStandardField\_isStandardField(), getStandardFieldHTML(), and loadRecordFields().

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

555 {
556 $this->loadRecordFields();
558 $this->fillStandardFieldFormInput($field_id, $form);
559 } else {
560 $this->recordfields[$field_id]->getRecordRepresentation()->fillFormInput($form);
561 }
562 }
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 593 of file class.ilDclBaseRecordModel.php.

593 {
594 if ($item = $form->getItemByPostVar('field_' . $field_id)) {
595 $item->setValue($this->getStandardField($field_id));
596 }
597 }

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

83 {
84 global $DIC;
85 if ($DIC['ilDB']->getDBType() != ilDBConstants::TYPE_ORACLE) {
86 return $value;
87 }
88
89 $date = explode(' ', $value);
90
91 return $date[0];
92 }

References $DIC, and ilDBConstants\TYPE_ORACLE.

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

877 {
878 if ($this->comments === NULL) {
879 $this->comments = ilNote::_getNotesOfObject($this->table->getCollectionObject()->getId(), $this->getId(), 'dcl', IL_NOTE_PUBLIC);
880 }
881
882 return $this->comments;
883 }
const IL_NOTE_PUBLIC
Definition: class.ilNote.php:5
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)
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 260 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 220 of file class.ilDclBaseRecordModel.php.

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

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 308 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 280 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 300 of file class.ilDclBaseRecordModel.php.

References $owner.

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

+ Here is the caller graph for this function:

◆ getRecordField()

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

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

700 {
701 $this->loadRecordFields();
702
703 return $this->recordfields[$field_id];
704 }

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

430 {
431 $this->loadRecordFields();
433 return $this->getStandardFieldHTML($field_id);
434 } else {
435 return $this->recordfields[$field_id]->getExportValue();
436 }
437 }

References ilDclStandardField\_isStandardField(), getStandardFieldHTML(), 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 477 of file class.ilDclBaseRecordModel.php.

477 {
478 $this->loadRecordFields();
480 $html = $this->getStandardFieldHTML($field_id, $options);
481 } else {
482 if (is_object($this->recordfields[$field_id])) {
483 $html = $this->recordfields[$field_id]->getRecordRepresentation()->getHTML();
484 } else {
485 $html = '';
486 }
487 }
488
489 // 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
490 // SW 16.07.2014 Uncommented again, as some fields are outputting javascript that was broken due to entity encode the curly brackets
491 // $html = str_ireplace("{", "{", $html);
492 // $html = str_ireplace("}", "}", $html);
493
494 return $html;
495 }
$html
Definition: example_001.php:87
if(!is_array($argv)) $options

References $html, $options, 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 446 of file class.ilDclBaseRecordModel.php.

446 {
447 $this->loadRecordFields();
449 return $this->getStandardFieldHTML($field_id);
450 } else {
451 return $this->recordfields[$field_id]->getPlainText();
452 }
453 }

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

410 {
411 if ($field_id === NULL) {
412 return NULL;
413 }
414 $this->loadRecordFields();
416 return $this->getStandardField($field_id);
417 } else {
418 return $this->recordfields[$field_id]->getValueForRepresentation();
419 }
420 }

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

+ Here is the call graph for this function:

◆ getRecordFields()

ilDclBaseRecordModel::getRecordFields ( )
Returns
ilDclBaseRecordFieldModel[]

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

855 {
856 $this->loadRecordFields();
857
858 return $this->recordfields;
859 }

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

504 {
505 $this->loadRecordFields();
507 $html = $this->getStandardFieldHTML($field_id, $options);
508 } else {
509 if (is_object($this->recordfields[$field_id])) {
510 $html = $this->recordfields[$field_id]->getSortingValue();
511 } else {
512 $html = '';
513 }
514 }
515
516 // 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
517 // SW 16.07.2014 Uncommented again, as some fields are outputting javascript that was broken due to entity encode the curly brackets
518 // $html = str_ireplace("{", "{", $html);
519 // $html = str_ireplace("}", "}", $html);
520
521 return $html;
522 }

References $html, $options, 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
$excel
$row
$col
$fieldilDclBaseFieldModel
Returns
array|string

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

363 {
364 $this->loadRecordFields();
365 return $this->recordfields[$field->getId()]->getValueFromExcel($excel, $row, $col);
366 }

References $row, and loadRecordFields().

+ Here is the call graph for this function:

◆ getRecordFieldValues()

ilDclBaseRecordModel::getRecordFieldValues ( )
Deprecated:
Returns
array

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

373 {
374 $this->loadRecordFields();
375 $return = array();
376 foreach ($this->recordfields as $id => $record_field) {
377 $return[$id] = $record_field->getValue();
378 }
379
380 return $return;
381 }

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

605 {
606 switch ($field_id) {
607 case "last_edit_by":
608 return $this->getLastEditBy();
609 break;
610 case 'owner':
611 $usr_data = ilObjUser::_lookupName($this->getOwner());
612
613 return $usr_data['login'];
614 break;
615 }
616
617 return $this->$field_id;
618 }
static _lookupName($a_user_id)
lookup user name

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:

◆ getStandardFieldHTML()

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

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

627 {
628 switch ($field_id) {
629 case 'id':
630 return $this->getId();
631 case 'owner':
633 case 'last_edit_by':
635 case 'last_update':
637 case 'create_date':
639 case 'comments':
640 $nComments = count($this->getComments());
641 $ajax_hash = ilCommonActionDispatcherGUI::buildAjaxHash(1, $_GET['ref_id'], 'dcl', $this->table->getCollectionObject()
642 ->getId(), 'dcl', $this->getId());
643 $ajax_link = ilNoteGUI::getListCommentsJSCall($ajax_hash, '');
644
645 return "<a class='dcl_comment' href='#' onclick=\"return " . $ajax_link . "\">
646 <img src='" . ilUtil::getImagePath("comment_unlabeled.svg")
647 . "' alt='{$nComments} Comments'><span class='ilHActProp'>{$nComments}</span></a>";
648 }
649 }
$_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)
Build ajax hash.
static formatDate(ilDateTime $date)
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)
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(), 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 656 of file class.ilDclBaseRecordModel.php.

656 {
657 switch ($field_id) {
658 case 'comments':
659 return count(ilNote::_getNotesOfObject($this->table->getCollectionObject()->getId(), $this->getId(),"dcl", 2,
660 false, "", "y", true, true));
661 default:
662 return strip_tags($this->getStandardFieldHTML($field_id));
663 }
664 }

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

+ Here is the call graph for this function:

◆ getTable()

ilDclBaseRecordModel::getTable ( )
Returns
ilDclTable

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

865 {
866 $this->loadTable();
867
868 return $this->table;
869 }

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

837 {
838 return $this->getTable()->hasPermissionToDeleteRecord($ref_id, $this);
839 }
$ref_id
Definition: sahs_server.php:39

References $ref_id, and getTable().

+ Here is the call graph for this function:

◆ hasPermissionToEdit()

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

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

827 {
828 return $this->getTable()->hasPermissionToEditRecord($ref_id, $this);
829 }

References $ref_id, and 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 847 of file class.ilDclBaseRecordModel.php.

847 {
848 return $this->getTable()->hasPermissionToViewRecord($ref_id, $this);
849 }

References $ref_id, and getTable().

+ Here is the call graph for this function:

◆ loadRecordFields()

ilDclBaseRecordModel::loadRecordFields ( )
private

Load record fields.

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

670 {
671 if ($this->recordfields == NULL) {
672 $this->loadTable();
673 $recordfields = array();
674 foreach ($this->table->getRecordFields() as $field) {
675 if ($recordfields[$field->getId()] == NULL) {
676 $recordfields[$field->getId()] = ilDclCache::getRecordFieldCache($this, $field);
677 }
678 }
679
680 $this->recordfields = $recordfields;
681 }
682 }

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

Referenced by deleteField(), doCreate(), doDelete(), fillRecordFieldExcelExport(), fillRecordFieldFormInput(), getRecordField(), getRecordFieldExportValue(), 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 688 of file class.ilDclBaseRecordModel.php.

688 {
689 if ($this->table == NULL) {
690 $this->table = ilDclCache::getTableCache($this->getTableId());
691 }
692 }

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

806 {
807 $this->loadTable();
808 // If one field returns false, the whole record does not pass the filter #performance-improvements
809 foreach ($this->table->getFilterableFields() as $field) {
810 if (! isset($filter["filter_" . $field->getId()]) || ! $filter["filter_" . $field->getId()]) {
811 continue;
812 }
813 if (! ilDclCache::getFieldRepresentation($field)->passThroughFilter($this, $filter["filter_" . $field->getId()])) {
814 return false;
815 }
816 }
817
818 return true;
819 }
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.

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

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

210 {
211 $this->id = $a_id;
212 }

Referenced by doCreate().

+ Here is the caller graph for this function:

◆ setLastEditBy()

ilDclBaseRecordModel::setLastEditBy (   $last_edit_by)

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

316 {
317 $this->last_edit_by = $last_edit_by;
318 }

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

270 {
271 $this->last_update = $a_datetime;
272 }

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

290 {
291 $this->owner = $a_id;
292 }

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

327 {
328 $this->loadRecordFields();
330 $this->setStandardField($field_id, $value);
331 } else {
332 $this->loadTable();
333 $record_field = $this->recordfields[$field_id];
334
335
336 $this->recordfields[$field_id]->setValue($value);
337 }
338 }

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

346 {
347 $this->loadRecordFields();
349 $this->setStandardFieldFromForm($field_id, $form);
350 } else {
351 $this->loadTable();
352 $this->recordfields[$field_id]->setValueFromForm($form);
353 }
354 }
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 579 of file class.ilDclBaseRecordModel.php.

579 {
580 switch ($field_id) {
581 case "last_edit_by":
582 $this->setLastEditBy($value);
583
584 return;
585 }
586 $this->$field_id = $value;
587 }

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

569 {
570 if ($item = $form->getItemByPostVar("field_".$field_id)) {
571 $this->setStandardField($item->getValue());
572 }
573 }

References setStandardField().

Referenced by setRecordFieldValueFromForm().

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

◆ setTableId()

ilDclBaseRecordModel::setTableId (   $a_id)

Set Table ID.

Parameters
int$a_id

Definition at line 230 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 65 of file class.ilDclBaseRecordModel.php.

Referenced by getComments().

◆ $create_date

ilDclBaseRecordModel::$create_date
protected

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

Referenced by getCreateDate().

◆ $id

ilDclBaseRecordModel::$id
protected

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

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

◆ $last_edit_by

ilDclBaseRecordModel::$last_edit_by
protected

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

Referenced by getLastEditBy(), and setLastEditBy().

◆ $last_update

ilDclBaseRecordModel::$last_update
protected

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

Referenced by getLastUpdate().

◆ $owner

ilDclBaseRecordModel::$owner
protected

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

Referenced by getOwner().

◆ $recordfields

ilDclBaseRecordModel::$recordfields
protected

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

Referenced by getRecordFields(), and loadRecordFields().

◆ $table

ilDclBaseRecordModel::$table
protected

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

Referenced by getTable().

◆ $table_id

ilDclBaseRecordModel::$table_id
protected

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

Referenced by getTableId().


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