ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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)
 
 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 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 825 of file class.ilDclBaseRecordModel.php.

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

826  {
827  $original = ilDclCache::getRecordCache($original_id);
828  $this->setCreateDate($original->getCreateDate());
829  $this->setLastEditBy($original->getLastEditBy());
830  $this->setLastUpdate($original->getLastUpdate());
831  $this->setOwner($original->getOwner());
832  $this->doCreate();
833  foreach ($new_fields as $old => $new) {
834  $old_rec_field = $original->getRecordField($old);
835  $new_rec_field = ilDclCache::getRecordFieldCache($this, $new);
836  $new_rec_field->cloneStructure($old_rec_field);
837  $this->recordfields[] = $new_rec_field;
838  }
839 
840  // mandatory for all cloning functions
841  ilDclCache::setCloneOf($original_id, $this->getId(), ilDclCache::TYPE_RECORD);
842  }
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 197 of file class.ilDclBaseRecordModel.php.

References doDelete(), and loadRecordFields().

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

References $file, and ilObject2\_exists().

Referenced by doDelete().

850  {
851  if (ilObject2::_exists($obj_id, false)) {
852  $file = new ilObjFile($obj_id, false);
853  $file->delete();
854  }
855  }
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 863 of file class.ilDclBaseRecordModel.php.

References ilObject2\_lookupObjId().

Referenced by doDelete().

864  {
865  if (ilObject2::_lookupObjId($obj_id)) {
866  $mob = new ilObjMediaObject($obj_id);
867  $mob->delete();
868  }
869  }
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().

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

780  {
781  global $DIC;
782  $ilDB = $DIC['ilDB'];
783  $ilAppEventHandler = $DIC['ilAppEventHandler'];
784 
785  $this->loadRecordFields();
786  foreach ($this->recordfields as $recordfield) {
787  if ($recordfield->getField()->getDatatypeId() == ilDclDatatype::INPUTFORMAT_FILE) {
788  $this->deleteFile($recordfield->getValue());
789  }
790 
791  if ($recordfield->getField()->getDatatypeId() == ilDclDatatype::INPUTFORMAT_MOB) {
792  $this->deleteMob($recordfield->getValue());
793  }
794 
795  $recordfield->delete();
796  }
797 
798  $query = "DELETE FROM il_dcl_record WHERE id = " . $ilDB->quote($this->getId(), "integer");
799  $ilDB->manipulate($query);
800 
801  $this->table->loadRecords();
802 
803  if (!$omit_notification) {
804  ilObjDataCollection::sendNotification("delete_record", $this->getTableId(), $this->getId());
805 
806  $ilAppEventHandler->raise(
807  'Modules/DataCollection',
808  'deleteRecord',
809  array(
810  'dcl' => ilDclCache::getTableCache($this->getTableId())->getCollectionObject(),
811  'table_id' => $this->table_id,
812  'record_id' => $this->getId(),
813  'record' => $this,
814  )
815  );
816  }
817  }
global $DIC
Definition: saml.php:7
static getTableCache($table_id=0)
loadRecordFields()
Load record fields.
$query
Create styles array
The data for the language used.
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 140 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  }
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 96 of file class.ilDclBaseRecordModel.php.

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

Referenced by ilDclRecordEditGUI\save().

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

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

Referenced by ilDclContentExporter\fillRowExcel().

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

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

604  {
605  $this->loadRecordFields();
606  if (ilDclStandardField::_isStandardField($field_id)) {
607  $this->fillStandardFieldFormInput($field_id, $form);
608  } else {
609  $this->recordfields[$field_id]->getRecordRepresentation()->fillFormInput($form);
610  }
611  }
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 644 of file class.ilDclBaseRecordModel.php.

References $form, and getStandardField().

Referenced by fillRecordFieldFormInput().

645  {
646  if ($item = $form->getItemByPostVar('field_' . $field_id)) {
647  $item->setValue($this->getStandardField($field_id));
648  }
649  }
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 80 of file class.ilDclBaseRecordModel.php.

References $DIC, and ilDBConstants\TYPE_ORACLE.

Referenced by doUpdate().

81  {
82  global $DIC;
83  if ($DIC['ilDB']->getDBType() != ilDBConstants::TYPE_ORACLE) {
84  return $value;
85  }
86 
87  $date = explode(' ', $value);
88 
89  return $date[0];
90  }
global $DIC
Definition: saml.php:7
+ Here is the caller graph for this function:

◆ getComments()

ilDclBaseRecordModel::getComments ( )

Get all comments of this record.

Returns
array ilNote[]

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

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

Referenced by getStandardFieldHTML().

955  {
956  if ($this->comments === null) {
957  $this->comments = ilNote::_getNotesOfObject($this->table->getCollectionObject()->getId(), $this->getId(), 'dcl', IL_NOTE_PUBLIC);
958  }
959 
960  return $this->comments;
961  }
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 267 of file class.ilDclBaseRecordModel.php.

References $create_date.

Referenced by doCreate(), and getStandardFieldHTML().

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

◆ getId()

ilDclBaseRecordModel::getId ( )

Get field id.

Returns
int

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

References $id.

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

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

◆ getLastEditBy()

ilDclBaseRecordModel::getLastEditBy ( )

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

References $last_update.

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

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

◆ getOwner()

ilDclBaseRecordModel::getOwner ( )

Get Owner.

Returns
int

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

References $owner.

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

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

◆ getRecordField()

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

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

References loadRecordFields().

Referenced by ilDclRecordEditGUI\cancelSave().

767  {
768  $this->loadRecordFields();
769 
770  return $this->recordfields[$field_id];
771  }
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:

◆ getRecordFieldHTML()

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

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

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

523  {
524  $this->loadRecordFields();
525  if (ilDclStandardField::_isStandardField($field_id)) {
526  $html = $this->getStandardFieldHTML($field_id, $options);
527  } else {
528  if (is_object($this->recordfields[$field_id])) {
529  $html = $this->recordfields[$field_id]->getRecordRepresentation()->getHTML();
530  } else {
531  $html = '';
532  }
533  }
534 
535  // 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
536  // SW 16.07.2014 Uncommented again, as some fields are outputting javascript that was broken due to entity encode the curly brackets
537  // $html = str_ireplace("{", "{", $html);
538  // $html = str_ireplace("}", "}", $html);
539 
540  return $html;
541  }
getStandardFieldHTML($field_id, array $options=array())
loadRecordFields()
Load record fields.
static _isStandardField($field_id)
$html
Definition: example_001.php:87
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
+ Here is the call graph for this function:

◆ getRecordFieldPlainText()

ilDclBaseRecordModel::getRecordFieldPlainText (   $field_id)

Get Field Export Value.

Parameters
int$field_id
Returns
array

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

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

482  {
483  $this->loadRecordFields();
484  if (ilDclStandardField::_isStandardField($field_id)) {
485  return $this->getStandardFieldHTML($field_id);
486  } else {
487  return $this->recordfields[$field_id]->getPlainText();
488  }
489  }
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 930 of file class.ilDclBaseRecordModel.php.

References $recordfields, and loadRecordFields().

Referenced by doCreate(), and doUpdate().

931  {
932  $this->loadRecordFields();
933 
934  return $this->recordfields;
935  }
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 550 of file class.ilDclBaseRecordModel.php.

References $html, $options, ilDclStandardField\_isStandardField(), array, 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]->getSortingValue();
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
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
+ 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(), ilDclDatetimeFieldRepresentation\passThroughFilter(), ilDclIliasReferenceFieldRepresentation\passThroughFilter(), ilDclNumberFieldRepresentation\passThroughFilter(), ilDclRatingFieldRepresentation\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 379 of file class.ilDclBaseRecordModel.php.

References $row, and loadRecordFields().

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

◆ getRecordFieldValues()

ilDclBaseRecordModel::getRecordFieldValues ( )
Deprecated:
Returns
array

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

References $id, array, and loadRecordFields().

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

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

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

658  {
659  switch ($field_id) {
660  case "last_edit_by":
661  return $this->getLastEditBy();
662  break;
663  case 'owner':
664  $usr_data = ilObjUser::_lookupName($this->getOwner());
665 
666  return $usr_data['login'];
667  break;
668  }
669 
670  return $this->$field_id;
671  }
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 680 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().

681  {
682  switch ($field_id) {
683  case 'id':
684  return $this->getId();
685  case 'owner':
686  return ilUserUtil::getNamePresentation($this->getOwner());
687  case 'last_edit_by':
689  case 'last_update':
691  case 'create_date':
693  case 'comments':
694  $nComments = count($this->getComments());
695  $ajax_hash = ilCommonActionDispatcherGUI::buildAjaxHash(1, $_GET['ref_id'], 'dcl', $this->table->getCollectionObject()
696  ->getId(), 'dcl', $this->getId());
697  $ajax_link = ilNoteGUI::getListCommentsJSCall($ajax_hash, '');
698 
699  return "<a class='dcl_comment' href='#' onclick=\"return " . $ajax_link . "\">
700  <img src='" . ilUtil::getImagePath("comment_unlabeled.svg")
701  . "' alt='{$nComments} Comments'><span class='ilHActProp'>{$nComments}</span></a>";
702  }
703  }
const IL_CAL_DATETIME
getCreateDate()
Get Creation Date.
$_GET["client_id"]
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
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)
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 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 710 of file class.ilDclBaseRecordModel.php.

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

711  {
712  switch ($field_id) {
713  case 'comments':
714  return count(ilNote::_getNotesOfObject(
715  $this->table->getCollectionObject()->getId(),
716  $this->getId(),
717  "dcl",
718  2,
719  false,
720  "",
721  "y",
722  true,
723  true
724  ));
725  default:
726  return strip_tags($this->getStandardFieldHTML($field_id));
727  }
728  }
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 941 of file class.ilDclBaseRecordModel.php.

References $table, and loadTable().

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

942  {
943  $this->loadTable();
944 
945  return $this->table;
946  }
+ 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 245 of file class.ilDclBaseRecordModel.php.

References $table_id.

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

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

◆ hasPermissionToDelete()

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

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

References getTable().

911  {
912  return $this->getTable()->hasPermissionToDeleteRecord($ref_id, $this);
913  }
+ Here is the call graph for this function:

◆ hasPermissionToEdit()

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

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

References getTable().

Referenced by ilDclRecordEditGUI\save().

900  {
901  return $this->getTable()->hasPermissionToEditRecord($ref_id, $this);
902  }
+ 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 921 of file class.ilDclBaseRecordModel.php.

References getTable().

922  {
923  return $this->getTable()->hasPermissionToViewRecord($ref_id, $this);
924  }
+ Here is the call graph for this function:

◆ loadRecordFields()

ilDclBaseRecordModel::loadRecordFields ( )
private

Load record fields.

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

735  {
736  if ($this->recordfields == null) {
737  $this->loadTable();
738  $recordfields = array();
739  foreach ($this->table->getRecordFields() as $field) {
740  if ($recordfields[$field->getId()] == null) {
741  $recordfields[$field->getId()] = ilDclCache::getRecordFieldCache($this, $field);
742  }
743  }
744 
745  $this->recordfields = $recordfields;
746  }
747  }
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 753 of file class.ilDclBaseRecordModel.php.

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

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

754  {
755  if ($this->table == null) {
756  $this->table = ilDclCache::getTableCache($this->getTableId());
757  }
758  }
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 877 of file class.ilDclBaseRecordModel.php.

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

878  {
879  $this->loadTable();
880  // If one field returns false, the whole record does not pass the filter #performance-improvements
881  foreach ($this->table->getFilterableFields() as $field) {
882  if (!isset($filter["filter_" . $field->getId()]) || !$filter["filter_" . $field->getId()]) {
883  continue;
884  }
885  if (!ilDclCache::getFieldRepresentation($field)->passThroughFilter($this, $filter["filter_" . $field->getId()])) {
886  return false;
887  }
888  }
889 
890  return true;
891  }
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 256 of file class.ilDclBaseRecordModel.php.

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

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

◆ setId()

ilDclBaseRecordModel::setId (   $a_id)

Set field id.

Parameters
int$a_id

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

Referenced by doCreate().

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

◆ setLastEditBy()

ilDclBaseRecordModel::setLastEditBy (   $last_edit_by)

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

References $last_edit_by.

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

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

◆ setLastUpdate()

ilDclBaseRecordModel::setLastUpdate (   $a_datetime)

Set Last Update Date.

Parameters
ilDateTime$a_datetime

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

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

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

◆ setOwner()

ilDclBaseRecordModel::setOwner (   $a_id)

Set Owner.

Parameters
int$a_id

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

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

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

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

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

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

Referenced by ilDclRecordEditGUI\save().

362  {
363  $this->loadRecordFields();
364  if (ilDclStandardField::_isStandardField($field_id)) {
365  $this->setStandardFieldFromForm($field_id, $form);
366  } else {
367  $this->loadTable();
368  $this->recordfields[$field_id]->setValueFromForm($form);
369  }
370  }
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 629 of file class.ilDclBaseRecordModel.php.

References setLastEditBy().

Referenced by setRecordFieldValue(), and setStandardFieldFromForm().

630  {
631  switch ($field_id) {
632  case "last_edit_by":
633  $this->setLastEditBy($value);
634 
635  return;
636  }
637  $this->$field_id = $value;
638  }
+ 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 618 of file class.ilDclBaseRecordModel.php.

References $form, and setStandardField().

Referenced by setRecordFieldValueFromForm().

619  {
620  if ($item = $form->getItemByPostVar("field_" . $field_id)) {
621  $this->setStandardField($item->getValue());
622  }
623  }
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 392 of file class.ilDclBaseRecordModel.php.

References $row.

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

◆ setTableId()

ilDclBaseRecordModel::setTableId (   $a_id)

Set Table ID.

Parameters
int$a_id

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

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

235  {
236  $this->table_id = $a_id;
237  }
+ 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: