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.

References doRead().

71  {
72  if ($a_id != 0) {
73  $this->id = $a_id;
74  $this->doRead();
75  }
76  }
+ 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.

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

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

References doDelete(), and loadRecordFields().

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

References $file, and ilObject2\_exists().

Referenced by doDelete().

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)
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ 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.

References ilObject2\_lookupObjId().

Referenced by doDelete().

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

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  }
Base class for ILIAS Exception handling.
getCreateDate()
Get Creation Date.
loadRecordFields()
Load record fields.
static _tableExists($table_id)
getLastUpdate()
Get Last Update Date.
global $ilDB
global $DIC
+ 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.

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

Referenced by deleteField().

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  }
static getTableCache($table_id=0)
loadRecordFields()
Load record fields.
Create styles array
The data for the language used.
deleteFile($obj_id)
Delete a file.
global $ilDB
global $DIC
+ 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.

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

Referenced by __construct().

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

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

Referenced by ilDclRecordEditGUI\save().

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  }
Create styles array
The data for the language used.
getLastUpdate()
Get Last Update Date.
global $ilDB
global $DIC
+ 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.

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

Referenced by ilDclContentExporter\fillRowExcel().

461  {
462  $this->loadRecordFields();
463  if (ilDclStandardField::_isStandardField($field_id)) {
464  $worksheet->setCell($row, $col, $this->getStandardFieldHTML($field_id));
465  $col++;
466  } else {
467  $this->recordfields[$field_id]->fillExcelExport($worksheet, $row, $col);
468  }
469  }
getStandardFieldHTML($field_id, array $options=array())
loadRecordFields()
Load record fields.
static _isStandardField($field_id)
setCell($a_row, $a_col, $a_value)
Set cell value.
+ 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.

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

555  {
556  $this->loadRecordFields();
557  if (ilDclStandardField::_isStandardField($field_id)) {
558  $this->fillStandardFieldFormInput($field_id, $form);
559  } else {
560  $this->recordfields[$field_id]->getRecordRepresentation()->fillFormInput($form);
561  }
562  }
loadRecordFields()
Load record fields.
static _isStandardField($field_id)
fillStandardFieldFormInput($field_id, &$form)
+ 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.

References getStandardField().

Referenced by fillRecordFieldFormInput().

593  {
594  if ($item = $form->getItemByPostVar('field_' . $field_id)) {
595  $item->setValue($this->getStandardField($field_id));
596  }
597  }
+ 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.

References $DIC, and ilDBConstants\TYPE_ORACLE.

Referenced by doUpdate().

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  }
global $DIC
+ 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.

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

Referenced by getStandardFieldHTML().

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
Add comments
+ 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().

260  {
261  return $this->create_date;
262  }
+ 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.

References $id.

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

220  {
221  return $this->id;
222  }
+ 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().

280  {
281  return $this->last_update;
282  }
+ 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().

300  {
301  return $this->owner;
302  }
+ 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.

References loadRecordFields().

Referenced by ilDclRecordEditGUI\cancelSave().

700  {
701  $this->loadRecordFields();
702 
703  return $this->recordfields[$field_id];
704  }
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 430 of file class.ilDclBaseRecordModel.php.

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

430  {
431  $this->loadRecordFields();
432  if (ilDclStandardField::_isStandardField($field_id)) {
433  return $this->getStandardFieldHTML($field_id);
434  } else {
435  return $this->recordfields[$field_id]->getExportValue();
436  }
437  }
getStandardFieldHTML($field_id, array $options=array())
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 477 of file class.ilDclBaseRecordModel.php.

References $html, $options, ilDclStandardField\_isStandardField(), getStandardFieldHTML(), and loadRecordFields().

477  {
478  $this->loadRecordFields();
479  if (ilDclStandardField::_isStandardField($field_id)) {
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  }
getStandardFieldHTML($field_id, array $options=array())
loadRecordFields()
Load record fields.
if(!is_array($argv)) $options
static _isStandardField($field_id)
$html
Definition: example_001.php:87
+ 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.

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

446  {
447  $this->loadRecordFields();
448  if (ilDclStandardField::_isStandardField($field_id)) {
449  return $this->getStandardFieldHTML($field_id);
450  } else {
451  return $this->recordfields[$field_id]->getPlainText();
452  }
453  }
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 410 of file class.ilDclBaseRecordModel.php.

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

410  {
411  if ($field_id === NULL) {
412  return NULL;
413  }
414  $this->loadRecordFields();
415  if (ilDclStandardField::_isStandardField($field_id)) {
416  return $this->getStandardField($field_id);
417  } else {
418  return $this->recordfields[$field_id]->getValueForRepresentation();
419  }
420  }
loadRecordFields()
Load record fields.
static _isStandardField($field_id)
+ Here is the call graph for this function:

◆ getRecordFields()

ilDclBaseRecordModel::getRecordFields ( )
Returns
ilDclBaseRecordFieldModel[]

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

References $recordfields, and loadRecordFields().

Referenced by doCreate(), and doUpdate().

855  {
856  $this->loadRecordFields();
857 
858  return $this->recordfields;
859  }
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 504 of file class.ilDclBaseRecordModel.php.

References $html, $options, ilDclStandardField\_isStandardField(), array, getStandardFieldHTML(), and loadRecordFields().

504  {
505  $this->loadRecordFields();
506  if (ilDclStandardField::_isStandardField($field_id)) {
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  }
getStandardFieldHTML($field_id, array $options=array())
loadRecordFields()
Load record fields.
if(!is_array($argv)) $options
static _isStandardField($field_id)
$html
Definition: example_001.php:87
+ 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 390 of file class.ilDclBaseRecordModel.php.

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

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

390  {
391  if ($field_id === NULL) {
392  return NULL;
393  }
394  $this->loadRecordFields();
395  if (ilDclStandardField::_isStandardField($field_id)) {
396  return $this->getStandardField($field_id);
397  } else {
398  return $this->recordfields[$field_id]->getValue();
399  }
400  }
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
$excel
$row
$col
$fieldilDclBaseFieldModel
Returns
array|string

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

References $row, and loadRecordFields().

363  {
364  $this->loadRecordFields();
365  return $this->recordfields[$field->getId()]->getValueFromExcel($excel, $row, $col);
366  }
loadRecordFields()
Load record fields.
+ Here is the call graph for this function:

◆ getRecordFieldValues()

ilDclBaseRecordModel::getRecordFieldValues ( )
Deprecated:
Returns
array

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

References $id, array, and loadRecordFields().

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  }
loadRecordFields()
Load record fields.
Create styles array
The data for the language used.
+ 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.

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

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

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
+ 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.

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

627  {
628  switch ($field_id) {
629  case 'id':
630  return $this->getId();
631  case 'owner':
632  return ilUserUtil::getNamePresentation($this->getOwner());
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  }
const IL_CAL_DATETIME
getCreateDate()
Get Creation Date.
$_GET["client_id"]
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 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 getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static formatDate(ilDateTime $date)
Format a date public.
Date and time handling
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 656 of file class.ilDclBaseRecordModel.php.

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

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

◆ getTable()

ilDclBaseRecordModel::getTable ( )
Returns
ilDclTable

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

References $table, and loadTable().

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

865  {
866  $this->loadTable();
867 
868  return $this->table;
869  }
+ 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().

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

References $ref_id, and getTable().

837  {
838  return $this->getTable()->hasPermissionToDeleteRecord($ref_id, $this);
839  }
$ref_id
Definition: sahs_server.php:39
+ 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.

References $ref_id, and getTable().

Referenced by ilDclRecordEditGUI\save().

827  {
828  return $this->getTable()->hasPermissionToEditRecord($ref_id, $this);
829  }
$ref_id
Definition: sahs_server.php:39
+ 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.

References $ref_id, and getTable().

847  {
848  return $this->getTable()->hasPermissionToViewRecord($ref_id, $this);
849  }
$ref_id
Definition: sahs_server.php:39
+ Here is the call graph for this function:

◆ loadRecordFields()

ilDclBaseRecordModel::loadRecordFields ( )
private

Load record fields.

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

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

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

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  }
Create styles array
The data for the language used.
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 688 of file class.ilDclBaseRecordModel.php.

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

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

688  {
689  if ($this->table == NULL) {
690  $this->table = ilDclCache::getTableCache($this->getTableId());
691  }
692  }
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 806 of file class.ilDclBaseRecordModel.php.

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

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

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

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

Referenced by doCreate().

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

◆ setLastEditBy()

ilDclBaseRecordModel::setLastEditBy (   $last_edit_by)

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

References $last_edit_by.

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

316  {
317  $this->last_edit_by = $last_edit_by;
318  }
+ 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.

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

270  {
271  $this->last_update = $a_datetime;
272  }
+ 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.

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

290  {
291  $this->owner = $a_id;
292  }
+ 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.

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

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

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

Referenced by ilDclRecordEditGUI\save().

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

References setLastEditBy().

Referenced by setRecordFieldValue(), and setStandardFieldFromForm().

579  {
580  switch ($field_id) {
581  case "last_edit_by":
582  $this->setLastEditBy($value);
583 
584  return;
585  }
586  $this->$field_id = $value;
587  }
+ 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.

References setStandardField().

Referenced by setRecordFieldValueFromForm().

569  {
570  if ($item = $form->getItemByPostVar("field_".$field_id)) {
571  $this->setStandardField($item->getValue());
572  }
573  }
+ 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.

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 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: