ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 67 of file class.ilDclBaseRecordModel.php.

References doRead().

68  {
69  if ($a_id != 0) {
70  $this->id = $a_id;
71  $this->doRead();
72  }
73  }
+ 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 876 of file class.ilDclBaseRecordModel.php.

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

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

References doDelete(), and loadRecordFields().

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

References ilObject2\_exists().

Referenced by doDelete().

902  {
903  if (ilObject2::_exists($obj_id, false)) {
904  $file = new ilObjFile($obj_id, false);
905  $file->delete();
906  }
907  }
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 915 of file class.ilDclBaseRecordModel.php.

References ilObject2\_lookupObjId().

Referenced by doDelete().

916  {
917  if (ilObject2::_lookupObjId($obj_id)) {
918  $mob = new ilObjMediaObject($obj_id);
919  $mob->delete();
920  }
921  }
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 159 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().

160  {
161  global $DIC;
162  $ilDB = $DIC['ilDB'];
163 
164  if (!ilDclTable::_tableExists($this->getTableId())) {
165  throw new ilException("The field does not have a related table!");
166  }
167 
168  $id = $ilDB->nextId("il_dcl_record");
169  $this->setId($id);
170  $query
171  = "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  }
getCreateDate()
Get Creation Date.
global $DIC
Definition: saml.php:7
loadRecordFields()
Load record fields.
static _tableExists($table_id)
$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 828 of file class.ilDclBaseRecordModel.php.

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

Referenced by deleteField().

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

◆ doRead()

ilDclBaseRecordModel::doRead ( )

Read record.

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

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

Referenced by __construct().

139  {
140  global $DIC;
141  $ilDB = $DIC['ilDB'];
142  //build query
143  $query = "Select * From il_dcl_record WHERE id = " . $ilDB->quote($this->getId(), "integer") . " ORDER BY id";
144 
145  $set = $ilDB->query($query);
146  $rec = $ilDB->fetchAssoc($set);
147 
148  $this->setTableId($rec["table_id"]);
149  $this->setCreateDate($rec["create_date"]);
150  $this->setLastUpdate($rec["last_update"]);
151  $this->setOwner($rec["owner"]);
152  $this->setLastEditBy($rec["last_edit_by"]);
153  }
global $DIC
Definition: saml.php:7
setCreateDate($a_datetime)
Set Creation Date.
setLastUpdate($a_datetime)
Set Last Update Date.
$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 90 of file class.ilDclBaseRecordModel.php.

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

Referenced by ilDclRecordEditGUI\save().

91  {
92  global $DIC;
93  $ilDB = $DIC['ilDB'];
94 
95  $values = array(
96  "table_id" => array(
97  "integer",
98  $this->getTableId(),
99  ),
100  "last_update" => array(
101  "date",
102  $this->fixDate($this->getLastUpdate()),
103  ),
104  "owner" => array(
105  "text",
106  $this->getOwner(),
107  ),
108  "last_edit_by" => array(
109  "text",
110  $this->getLastEditBy(),
111  ),
112  );
113  $ilDB->update(
114  "il_dcl_record",
115  $values,
116  array(
117  "id" => array(
118  "integer",
119  $this->id,
120  ),
121  )
122  );
123 
124  foreach ($this->getRecordFields() as $recordfield) {
125  $recordfield->doUpdate();
126  }
127 
128  //TODO: add event raise
129  if (!$omit_notification) {
130  ilObjDataCollection::sendNotification("update_record", $this->getTableId(), $this->id);
131  }
132  }
global $DIC
Definition: saml.php:7
$values
getLastUpdate()
Get Last Update Date.
global $ilDB
+ 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 503 of file class.ilDclBaseRecordModel.php.

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

Referenced by ilDclContentExporter\fillRowExcel().

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

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

634  {
635  $this->loadRecordFields();
636  if (ilDclStandardField::_isStandardField($field_id)) {
637  $this->fillStandardFieldFormInput($field_id, $form);
638  } else {
639  $this->recordfields[$field_id]->getRecordRepresentation()->fillFormInput($form);
640  }
641  }
loadRecordFields()
Load record fields.
if(isset($_POST['submit'])) $form
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 676 of file class.ilDclBaseRecordModel.php.

References $form, and getStandardField().

Referenced by fillRecordFieldFormInput().

677  {
678  if ($item = $form->getItemByPostVar('field_' . $field_id)) {
679  $item->setValue($this->getStandardField($field_id));
680  }
681  }
if(isset($_POST['submit'])) $form
+ 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 81 of file class.ilDclBaseRecordModel.php.

Referenced by doUpdate().

82  {
83  return $value;
84  }
+ Here is the caller graph for this function:

◆ getComments()

ilDclBaseRecordModel::getComments ( )

Get all comments of this record.

Returns
array ilNote[]

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

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

Referenced by getStandardFieldHTML().

1007  {
1008  if ($this->comments === null) {
1009  $this->comments = ilNote::_getNotesOfObject($this->table->getCollectionObject()->getId(), $this->getId(), 'dcl', IL_NOTE_PUBLIC);
1010  }
1011 
1012  return $this->comments;
1013  }
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 266 of file class.ilDclBaseRecordModel.php.

References $create_date.

Referenced by doCreate(), and getStandardFieldHTML().

267  {
268  return $this->create_date;
269  }
+ Here is the caller graph for this function:

◆ getId()

ilDclBaseRecordModel::getId ( )

Get field id.

Returns
int

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

References $id.

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

223  {
224  return $this->id;
225  }
+ Here is the caller graph for this function:

◆ getLastEditBy()

ilDclBaseRecordModel::getLastEditBy ( )

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

References $last_update.

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

289  {
290  return $this->last_update;
291  }
+ Here is the caller graph for this function:

◆ getOwner()

ilDclBaseRecordModel::getOwner ( )

Get Owner.

Returns
int

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

References $owner.

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

311  {
312  return $this->owner;
313  }
+ Here is the caller graph for this function:

◆ getRecordField()

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

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

References loadRecordFields().

Referenced by ilDclRecordEditGUI\cancelSave().

816  {
817  $this->loadRecordFields();
818 
819  return $this->recordfields[$field_id];
820  }
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 468 of file class.ilDclBaseRecordModel.php.

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

469  {
470  $this->loadRecordFields();
471  if (ilDclStandardField::_isStandardField($field_id)) {
472  return $this->getStandardFieldHTML($field_id);
473  } else {
474  return $this->recordfields[$field_id]->getExportValue();
475  }
476  }
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 528 of file class.ilDclBaseRecordModel.php.

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

529  {
530  $this->loadRecordFields();
531  if (ilDclStandardField::_isStandardField($field_id)) {
532  $value = $this->getStandardFieldFormulaValue($field_id);
533  } else {
534  if (is_object($this->recordfields[$field_id])) {
535  $value = $this->recordfields[$field_id]->getFormulaValue();
536  } else {
537  $value = '';
538  }
539  }
540 
541  return $value;
542  }
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 550 of file class.ilDclBaseRecordModel.php.

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

551  {
552  $this->loadRecordFields();
553  if (ilDclStandardField::_isStandardField($field_id)) {
554  $html = $this->getStandardFieldHTML($field_id, $options);
555  } else {
556  if (is_object($this->recordfields[$field_id])) {
557  $html = $this->recordfields[$field_id]->getRecordRepresentation()->getHTML();
558  } else {
559  $html = '';
560  }
561  }
562 
563  // 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
564  // SW 16.07.2014 Uncommented again, as some fields are outputting javascript that was broken due to entity encode the curly brackets
565  // $html = str_ireplace("{", "{", $html);
566  // $html = str_ireplace("}", "}", $html);
567 
568  return $html;
569  }
getStandardFieldHTML($field_id, array $options=array())
loadRecordFields()
Load record fields.
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 486 of file class.ilDclBaseRecordModel.php.

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

487  {
488  $this->loadRecordFields();
489  if (ilDclStandardField::_isStandardField($field_id)) {
490  return $this->getStandardFieldHTML($field_id);
491  } else {
492  return $this->recordfields[$field_id]->getPlainText();
493  }
494  }
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 447 of file class.ilDclBaseRecordModel.php.

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

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

◆ getRecordFields()

ilDclBaseRecordModel::getRecordFields ( )
Returns
ilDclBaseRecordFieldModel[]

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

References $recordfields, and loadRecordFields().

Referenced by doCreate(), and doUpdate().

983  {
984  $this->loadRecordFields();
985 
986  return $this->recordfields;
987  }
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 578 of file class.ilDclBaseRecordModel.php.

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

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

427  {
428  if ($field_id === null) {
429  return null;
430  }
431  $this->loadRecordFields();
432  if (ilDclStandardField::_isStandardField($field_id)) {
433  return $this->getStandardField($field_id);
434  } else {
435  return $this->recordfields[$field_id]->getValue();
436  }
437  }
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 380 of file class.ilDclBaseRecordModel.php.

References $row, and loadRecordFields().

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

◆ getRecordFieldValues()

ilDclBaseRecordModel::getRecordFieldValues ( )
Deprecated:
Returns
array

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

References $id, and loadRecordFields().

408  {
409  $this->loadRecordFields();
410  $return = array();
411  foreach ($this->recordfields as $id => $record_field) {
412  $return[$id] = $record_field->getValue();
413  }
414 
415  return $return;
416  }
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 689 of file class.ilDclBaseRecordModel.php.

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

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

690  {
691  switch ($field_id) {
692  case "last_edit_by":
693  return $this->getLastEditBy();
694  break;
695  case 'owner':
696  $usr_data = ilObjUser::_lookupName($this->getOwner());
697 
698  return $usr_data['login'];
699  break;
700  }
701 
702  return $this->$field_id;
703  }
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 711 of file class.ilDclBaseRecordModel.php.

References getStandardFieldHTML().

Referenced by getRecordFieldFormulaValue().

712  {
713  return $this->getStandardFieldHTML($field_id);
714  }
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 722 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().

723  {
724  switch ($field_id) {
725  case 'id':
726  return $this->getId();
727  case 'owner':
728  return ilUserUtil::getNamePresentation($this->getOwner());
729  case 'last_edit_by':
731  case 'last_update':
733  case 'create_date':
735  case 'comments':
736  $nComments = count($this->getComments());
738  1,
739  $_GET['ref_id'],
740  'dcl',
741  $this->table->getCollectionObject()
742  ->getId(),
743  'dcl',
744  $this->getId()
745  );
746  $ajax_link = ilNoteGUI::getListCommentsJSCall($ajax_hash, '');
747 
748  return "<a class='dcl_comment' href='#' onclick=\"return " . $ajax_link . "\">
749  <img src='" . ilUtil::getImagePath("comment_unlabeled.svg")
750  . "' alt='{$nComments} Comments'><span class='ilHActProp'>{$nComments}</span></a>";
751  }
752  }
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)
Date and time handling
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 759 of file class.ilDclBaseRecordModel.php.

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

760  {
761  switch ($field_id) {
762  case 'comments':
763  return count(ilNote::_getNotesOfObject(
764  $this->table->getCollectionObject()->getId(),
765  $this->getId(),
766  "dcl",
767  2,
768  false,
769  "",
770  "y",
771  true,
772  true
773  ));
774  default:
775  return strip_tags($this->getStandardFieldHTML($field_id));
776  }
777  }
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 993 of file class.ilDclBaseRecordModel.php.

References $table, and loadTable().

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

994  {
995  $this->loadTable();
996 
997  return $this->table;
998  }
+ 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 244 of file class.ilDclBaseRecordModel.php.

References $table_id.

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

245  {
246  return $this->table_id;
247  }
+ Here is the caller graph for this function:

◆ hasPermissionToDelete()

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

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

References getTable().

963  {
964  return $this->getTable()->hasPermissionToDeleteRecord($ref_id, $this);
965  }
+ Here is the call graph for this function:

◆ hasPermissionToEdit()

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

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

References getTable().

Referenced by ilDclRecordEditGUI\save().

952  {
953  return $this->getTable()->hasPermissionToEditRecord($ref_id, $this);
954  }
+ 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 973 of file class.ilDclBaseRecordModel.php.

References getTable().

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

◆ loadRecordFields()

ilDclBaseRecordModel::loadRecordFields ( )
private

Load record fields.

Definition at line 783 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().

784  {
785  if ($this->recordfields == null) {
786  $this->loadTable();
787  $recordfields = array();
788  foreach ($this->table->getRecordFields() as $field) {
789  if ($recordfields[$field->getId()] == null) {
790  $recordfields[$field->getId()] = ilDclCache::getRecordFieldCache($this, $field);
791  }
792  }
793 
794  $this->recordfields = $recordfields;
795  }
796  }
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 802 of file class.ilDclBaseRecordModel.php.

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

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

803  {
804  if ($this->table == null) {
805  $this->table = ilDclCache::getTableCache($this->getTableId());
806  }
807  }
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 929 of file class.ilDclBaseRecordModel.php.

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

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

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

256  {
257  $this->create_date = $a_datetime;
258  }
+ Here is the caller graph for this function:

◆ setId()

ilDclBaseRecordModel::setId (   $a_id)

Set field id.

Parameters
int$a_id

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

Referenced by doCreate().

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

◆ setLastEditBy()

ilDclBaseRecordModel::setLastEditBy (   $last_edit_by)

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

References $last_edit_by.

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

329  {
330  $this->last_edit_by = $last_edit_by;
331  }
+ Here is the caller graph for this function:

◆ setLastUpdate()

ilDclBaseRecordModel::setLastUpdate (   $a_datetime)

Set Last Update Date.

Parameters
ilDateTime$a_datetime

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

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

278  {
279  $this->last_update = $a_datetime;
280  }
+ Here is the caller graph for this function:

◆ setOwner()

ilDclBaseRecordModel::setOwner (   $a_id)

Set Owner.

Parameters
int$a_id

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

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

300  {
301  $this->owner = $a_id;
302  }
+ 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 340 of file class.ilDclBaseRecordModel.php.

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

341  {
342  $this->loadRecordFields();
343  if (ilDclStandardField::_isStandardField($field_id)) {
344  $this->setStandardField($field_id, $value);
345  } else {
346  $this->loadTable();
347  $record_field = $this->recordfields[$field_id];
348 
349  $this->recordfields[$field_id]->setValue($value);
350  }
351  }
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 360 of file class.ilDclBaseRecordModel.php.

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

Referenced by ilDclRecordEditGUI\save().

361  {
362  $this->loadRecordFields();
363  if (ilDclStandardField::_isStandardField($field_id)) {
364  $this->setStandardFieldFromForm($field_id, $form);
365  } else {
366  $this->loadTable();
367  $this->recordfields[$field_id]->setValueFromForm($form);
368  }
369  }
loadRecordFields()
Load record fields.
setStandardFieldFromForm($field_id, &$form)
if(isset($_POST['submit'])) $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 660 of file class.ilDclBaseRecordModel.php.

References setLastEditBy().

Referenced by setRecordFieldValue(), and setStandardFieldFromForm().

661  {
662  switch ($field_id) {
663  case "last_edit_by":
664  $this->setLastEditBy($value);
665 
666  return;
667  }
668  $this->$field_id = $value;
669  }
+ 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 648 of file class.ilDclBaseRecordModel.php.

References $form, and setStandardField().

Referenced by setRecordFieldValueFromForm().

649  {
650  if ($item = $form->getItemByPostVar("field_" . $field_id)) {
651  $this->setStandardField($item->getValue());
652  }
653  }
if(isset($_POST['submit'])) $form
+ 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 394 of file class.ilDclBaseRecordModel.php.

References $row.

395  {
396  $value = $field->getValueFromExcel($excel, $row, $col);
397  if ($value) {
398  $this->{$field->getId()} = $value;
399  }
400  }
$row

◆ setTableId()

ilDclBaseRecordModel::setTableId (   $a_id)

Set Table ID.

Parameters
int$a_id

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

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

234  {
235  $this->table_id = $a_id;
236  }
+ Here is the caller graph for this function:

Field Documentation

◆ $comments

ilDclBaseRecordModel::$comments
protected

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

Referenced by getComments().

◆ $create_date

ilDclBaseRecordModel::$create_date
protected

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

Referenced by getCreateDate().

◆ $id

ilDclBaseRecordModel::$id
protected

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

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

◆ $last_edit_by

ilDclBaseRecordModel::$last_edit_by
protected

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

Referenced by getLastEditBy(), and setLastEditBy().

◆ $last_update

ilDclBaseRecordModel::$last_update
protected

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

Referenced by getLastUpdate().

◆ $owner

ilDclBaseRecordModel::$owner
protected

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

Referenced by getOwner().

◆ $recordfields

ilDclBaseRecordModel::$recordfields
protected

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

Referenced by getRecordFields(), and loadRecordFields().

◆ $table

ilDclBaseRecordModel::$table
protected

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

Referenced by getTable().

◆ $table_id

ilDclBaseRecordModel::$table_id
protected

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

Referenced by getTableId().


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