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.

References doRead().

63  {
64  if ($a_id != 0) {
65  $this->id = $a_id;
66  $this->doRead();
67  }
68  }
+ 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.

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

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
890  ilDclCache::setCloneOf($original_id, $this->getId(), ilDclCache::TYPE_RECORD);
891  }
static setCloneOf($old, $new, $type)
setCreateDate($a_datetime)
Set Creation Date.
setLastUpdate($a_datetime)
Set Last Update Date.
static getRecordCache($record_id=0)
static getRecordFieldCache($record, $field)
+ 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.

References doDelete(), and loadRecordFields().

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

References ilObject2\_exists().

Referenced by doDelete().

900  {
901  if (ilObject2::_exists($obj_id, false)) {
902  $file = new ilObjFile($obj_id, false);
903  $file->delete();
904  }
905  }
static _exists($a_id, $a_reference=false, $a_type=null)
+ 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.

References ilObject2\_lookupObjId().

Referenced by doDelete().

914  {
916  $mob = new ilObjMediaObject($obj_id);
917  $mob->delete();
918  }
919  }
static _lookupObjId($a_id)
Class ilObjMediaObject.
+ 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.

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

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

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  }
getCreateDate()
Get Creation Date.
loadRecordFields()
Load record fields.
static _tableExists($table_id)
global $DIC
Definition: goto.php:24
$query
getLastUpdate()
Get Last Update Date.
global $ilDB
+ 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.

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

Referenced by deleteField().

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"]
static getTableCache($table_id=0)
loadRecordFields()
Load record fields.
global $DIC
Definition: goto.php:24
$query
deleteFile($obj_id)
Delete a file.
global $ilDB
Class ilObjDataCollection.
+ 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.

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

Referenced by __construct().

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  }
setCreateDate($a_datetime)
Set Creation Date.
setLastUpdate($a_datetime)
Set Last Update Date.
global $DIC
Definition: goto.php:24
$query
global $ilDB
+ 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.

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

Referenced by ilDclRecordEditGUI\save().

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  }
$_GET["client_id"]
global $DIC
Definition: goto.php:24
getLastUpdate()
Get Last Update Date.
global $ilDB
Class ilObjDataCollection.
+ 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.

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

Referenced by ilDclContentExporter\fillRowExcel().

500  {
501  $this->loadRecordFields();
502  if (ilDclStandardField::_isStandardField($field_id)) {
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  }
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
getStandardFieldHTML($field_id, array $options=array())
loadRecordFields()
Load record fields.
setCell($a_row, $a_col, $a_value, $a_datatype=null)
Set cell value.
static _isStandardField($field_id)
+ 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.

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

Referenced by ilDclRecordEditGUI\sendFailure().

630  {
631  $this->loadRecordFields();
632  if (ilDclStandardField::_isStandardField($field_id)) {
633  $this->fillStandardFieldFormInput($field_id, $form);
634  } else {
635  $this->recordfields[$field_id]->getRecordRepresentation()->fillFormInput($form);
636  }
637  }
loadRecordFields()
Load record fields.
static _isStandardField($field_id)
fillStandardFieldFormInput($field_id, &$form)
+ 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.

References getStandardField().

Referenced by fillRecordFieldFormInput().

673  {
674  if ($item = $form->getItemByPostVar('field_' . $field_id)) {
675  $item->setValue($this->getStandardField($field_id));
676  }
677  }
+ 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.

Referenced by doUpdate().

77  {
78  return $value;
79  }
+ 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.

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

Referenced by getStandardFieldHTML().

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  }
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
const IL_NOTE_PUBLIC
Definition: class.ilNote.php:6
+ 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().

263  {
264  return $this->create_date;
265  }
+ Here is the caller graph for this function:

◆ getId()

ilDclBaseRecordModel::getId ( )

◆ 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().

285  {
286  return $this->last_update;
287  }
+ 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().

307  {
308  return $this->owner;
309  }
+ 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.

References loadRecordFields().

Referenced by ilDclRecordEditGUI\cancelSave().

813  {
814  $this->loadRecordFields();
815 
816  return $this->recordfields[$field_id];
817  }
loadRecordFields()
Load record fields.
+ Here is the call graph for this function:
+ Here is the caller 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.

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

465  {
466  $this->loadRecordFields();
467  if (ilDclStandardField::_isStandardField($field_id)) {
468  return $this->getStandardFieldHTML($field_id);
469  } else {
470  return $this->recordfields[$field_id]->getExportValue();
471  }
472  }
getStandardFieldHTML($field_id, array $options=array())
loadRecordFields()
Load record fields.
static _isStandardField($field_id)
+ 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.

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

525  {
526  $this->loadRecordFields();
527  if (ilDclStandardField::_isStandardField($field_id)) {
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  }
loadRecordFields()
Load record fields.
static _isStandardField($field_id)
+ 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.

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

547  {
548  $this->loadRecordFields();
549  if (ilDclStandardField::_isStandardField($field_id)) {
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  }
getStandardFieldHTML($field_id, array $options=array())
loadRecordFields()
Load record fields.
static _isStandardField($field_id)
+ 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.

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

483  {
484  $this->loadRecordFields();
485  if (ilDclStandardField::_isStandardField($field_id)) {
486  return $this->getStandardFieldHTML($field_id);
487  } else {
488  return $this->recordfields[$field_id]->getPlainText();
489  }
490  }
getStandardFieldHTML($field_id, array $options=array())
loadRecordFields()
Load record fields.
static _isStandardField($field_id)
+ 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.

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

444  {
445  if ($field_id === null) {
446  return null;
447  }
448  $this->loadRecordFields();
449  if (ilDclStandardField::_isStandardField($field_id)) {
450  return $this->getStandardField($field_id);
451  } else {
452  return $this->recordfields[$field_id]->getValueForRepresentation();
453  }
454  }
loadRecordFields()
Load record fields.
static _isStandardField($field_id)
+ Here is the call graph for this function:

◆ getRecordFields()

ilDclBaseRecordModel::getRecordFields ( )
Returns
ilDclBaseRecordFieldModel[]

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

References $recordfields, and loadRecordFields().

Referenced by doCreate(), and doUpdate().

981  {
982  $this->loadRecordFields();
983 
984  return $this->recordfields;
985  }
loadRecordFields()
Load record fields.
+ 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.

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

575  {
576  $this->loadRecordFields();
577  if (ilDclStandardField::_isStandardField($field_id)) {
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  }
getStandardFieldHTML($field_id, array $options=array())
loadRecordFields()
Load record fields.
static _isStandardField($field_id)
+ Here is the call graph for this function:

◆ getRecordFieldValue()

ilDclBaseRecordModel::getRecordFieldValue (   $field_id)

Get Field Value.

Parameters
int$field_id
Returns
array

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

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

Referenced by ilDclTextFieldRepresentation\passThroughFilter(), ilDclIliasReferenceFieldRepresentation\passThroughFilter(), ilDclDatetimeFieldRepresentation\passThroughFilter(), ilDclRatingFieldRepresentation\passThroughFilter(), ilDclNumberFieldRepresentation\passThroughFilter(), ilDclMobFieldRepresentation\passThroughFilter(), ilDclBooleanFieldRepresentation\passThroughFilter(), ilDclFileuploadFieldRepresentation\passThroughFilter(), ilDclBaseFieldRepresentation\passThroughFilter(), and ilDclReferenceFieldRepresentation\passThroughFilter().

423  {
424  if ($field_id === null) {
425  return null;
426  }
427  $this->loadRecordFields();
428  if (ilDclStandardField::_isStandardField($field_id)) {
429  return $this->getStandardField($field_id);
430  } else {
431  return $this->recordfields[$field_id]->getValue();
432  }
433  }
loadRecordFields()
Load record fields.
static _isStandardField($field_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRecordFieldValueFromExcel()

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

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

References loadRecordFields().

377  {
378  $this->loadRecordFields();
379 
380  return $this->recordfields[$field->getId()]->getValueFromExcel($excel, $row, $col);
381  }
loadRecordFields()
Load record fields.
+ Here is the call graph for this function:

◆ getRecordFieldValues()

ilDclBaseRecordModel::getRecordFieldValues ( )
Returns
array
Deprecated:

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

References $id, and loadRecordFields().

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  }
loadRecordFields()
Load record fields.
+ 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.

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

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

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  }
static _lookupName($a_user_id)
lookup user name
+ 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.

References getStandardFieldHTML().

Referenced by getRecordFieldFormulaValue().

708  {
709  return $this->getStandardFieldHTML($field_id);
710  }
getStandardFieldHTML($field_id, array $options=array())
+ 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.

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().

719  {
720  switch ($field_id) {
721  case 'id':
722  return $this->getId();
723  case 'owner':
724  return ilUserUtil::getNamePresentation($this->getOwner());
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
getCreateDate()
Get Creation Date.
$_GET["client_id"]
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
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 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 getListCommentsJSCall($a_hash, $a_update_code=null)
Get list comments js call.
getLastUpdate()
Get Last Update Date.
getComments()
Get all comments of this record.
+ 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.

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

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  }
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
getStandardFieldHTML($field_id, array $options=array())
+ Here is the call graph for this function:

◆ getTable()

ilDclBaseRecordModel::getTable ( )
Returns
ilDclTable

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

References $table, and loadTable().

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

992  {
993  $this->loadTable();
994 
995  return $this->table;
996  }
+ 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().

241  {
242  return $this->table_id;
243  }
+ 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.

References getTable().

961  {
962  return $this->getTable()->hasPermissionToDeleteRecord($ref_id, $this);
963  }
+ 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.

References getTable().

Referenced by ilDclRecordEditGUI\save().

950  {
951  return $this->getTable()->hasPermissionToEditRecord($ref_id, $this);
952  }
+ 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.

References getTable().

972  {
973  return $this->getTable()->hasPermissionToViewRecord($ref_id, $this);
974  }
+ Here is the call graph for this function:

◆ loadRecordFields()

ilDclBaseRecordModel::loadRecordFields ( )
private

Load record fields.

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

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().

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  }
static getRecordFieldCache($record, $field)
+ 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.

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

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

800  {
801  if ($this->table == null) {
802  $this->table = ilDclCache::getTableCache($this->getTableId());
803  }
804  }
static getTableCache($table_id=0)
+ 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.

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

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)
+ Here is the call 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.

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

252  {
253  $this->create_date = $a_datetime;
254  }
+ 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.

Referenced by doCreate().

208  {
209  $this->id = $a_id;
210  }
+ Here is the caller graph for this function:

◆ setLastEditBy()

ilDclBaseRecordModel::setLastEditBy (   $last_edit_by)

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

References $last_edit_by.

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

325  {
326  $this->last_edit_by = $last_edit_by;
327  }
+ 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.

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

274  {
275  $this->last_update = $a_datetime;
276  }
+ 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.

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

296  {
297  $this->owner = $a_id;
298  }
+ 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.

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

Referenced by ilDclRecordEditGUI\save().

337  {
338  $this->loadRecordFields();
339  if (ilDclStandardField::_isStandardField($field_id)) {
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  }
loadRecordFields()
Load record fields.
static _isStandardField($field_id)
+ 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.

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

Referenced by ilDclRecordEditGUI\save().

357  {
358  $this->loadRecordFields();
359  if (ilDclStandardField::_isStandardField($field_id)) {
360  $this->setStandardFieldFromForm($field_id, $form);
361  } else {
362  $this->loadTable();
363  $this->recordfields[$field_id]->setValueFromForm($form);
364  }
365  }
loadRecordFields()
Load record fields.
setStandardFieldFromForm($field_id, &$form)
static _isStandardField($field_id)
+ 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.

References setLastEditBy().

Referenced by setRecordFieldValue(), and setStandardFieldFromForm().

657  {
658  switch ($field_id) {
659  case "last_edit_by":
660  $this->setLastEditBy($value);
661 
662  return;
663  }
664  $this->$field_id = $value;
665  }
+ 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.

References setStandardField().

Referenced by setRecordFieldValueFromForm().

645  {
646  if ($item = $form->getItemByPostVar("field_" . $field_id)) {
647  $this->setStandardField($item->getValue());
648  }
649  }
+ 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.

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

230  {
231  $this->table_id = $a_id;
232  }
+ 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: