ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilDataCollectionRecord Class Reference

Class ilDataCollectionRecord. More...

+ Collaboration diagram for ilDataCollectionRecord:

Public Member Functions

 __construct ($a_id=0)
 doUpdate ()
 doUpdate
 doRead ()
 Read record.
 doCreate ()
 deleteField ($field_id)
 setId ($a_id)
 Set field id.
 getId ()
 Get field id.
 setTableId ($a_id)
 Set Table ID.
 getTableId ()
 Get Table ID.
 setCreateDate ($a_datetime)
 Set Creation Date.
 getCreateDate ()
 Get Creation Date.
 setLastUpdate ($a_datetime)
 Set Last Update Date.
 getLastUpdate ()
 Get Last Update Date.
 setOwner ($a_id)
 Set Owner.
 getOwner ()
 Get Owner.
 getLastEditBy ()
 setLastEditBy ($last_edit_by)
 setRecordFieldValue ($field_id, $value)
 Set a field value.
 getRecordFieldValues ()
 getRecordFieldValue ($field_id)
 Get Field Value.
 getRecordFieldExportValue ($field_id)
 Get Field Export Value.
 getRecordFieldHTML ($field_id, array $options=array())
 getRecordFieldSortingValue ($field_id, array $options=array())
 getRecordFieldFormInput ($field_id)
 getRecordField ($field_id)
 doDelete ()
 Delete.
 deleteFile ($obj_id)
 Delete a file.
 deleteMob ($obj_id)
 Delete MOB.
 passThroughFilter (array $filter)
 hasPermissionToEdit ($ref_id)
 hasPermissionToDelete ($ref_id)
 hasPermissionToView ($ref_id)
 getRecordFields ()
 getTable ()
 getComments ()
 Get all comments of this record.

Protected Member Functions

 setStandardField ($field_id, $value)
 getStandardField ($field_id)

Protected Attributes

 $recordfields
 $id
 $table_id
 $table
 $last_edit_by
 $owner
 $last_update
 $create_date
 $comments

Private Member Functions

 getStandardFieldHTML ($field_id, array $options=array())
 loadRecordFields ()
 Load record fields.
 loadTable ()
 Load table.

Detailed Description

Constructor & Destructor Documentation

ilDataCollectionRecord::__construct (   $a_id = 0)
Parameters
int$a_id

Definition at line 71 of file class.ilDataCollectionRecord.php.

References doRead().

{
if ($a_id != 0) {
$this->id = $a_id;
$this->doRead();
}
}

+ Here is the call graph for this function:

Member Function Documentation

ilDataCollectionRecord::deleteField (   $field_id)
Parameters
$field_id

Definition at line 166 of file class.ilDataCollectionRecord.php.

References doDelete(), and loadRecordFields().

{
$this->loadRecordFields();
$this->recordfields[$field_id]->delete();
if (count($this->recordfields) == 1) {
$this->doDelete();
}
}

+ Here is the call graph for this function:

ilDataCollectionRecord::deleteFile (   $obj_id)

Delete a file.

Parameters
$original_idinteger
$new_fieldsarray($old_field_id => $new_field)
$obj_id

Definition at line 610 of file class.ilDataCollectionRecord.php.

References $file, and ilObject2\_exists().

Referenced by doDelete().

{
if (ilObject2::_exists($obj_id, false)) {
$file = new ilObjFile($obj_id, false);
$file->delete();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionRecord::deleteMob (   $obj_id)

Delete MOB.

Parameters
$obj_id

Definition at line 623 of file class.ilDataCollectionRecord.php.

References ilObject2\_exists().

Referenced by doDelete().

{
if (ilObject2::_exists($obj_id)) {
$mob = new ilObjMediaObject($obj_id);
$mob->delete();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionRecord::doCreate ( )
Exceptions
ilException

Definition at line 139 of file class.ilDataCollectionRecord.php.

References $id, $ilDB, $query, ilDataCollectionTable\_tableExists(), getCreateDate(), getId(), getLastEditBy(), getLastUpdate(), getOwner(), getTableId(), and setId().

{
global $ilDB;
throw new ilException("The field does not have a related table!");
}
$id = $ilDB->nextId("il_dcl_record");
$this->setId($id);
$query = "INSERT INTO il_dcl_record (
id,
table_id,
create_date,
Last_update,
owner,
last_edit_by
) VALUES (" . $ilDB->quote($this->getId(), "integer") . "," . $ilDB->quote($this->getTableId(), "integer") . ","
. $ilDB->quote($this->getCreateDate(), "timestamp") . "," . $ilDB->quote($this->getLastUpdate(), "timestamp") . ","
. $ilDB->quote($this->getOwner(), "integer") . "," . $ilDB->quote($this->getLastEditBy(), "integer") . "
)";
$ilDB->manipulate($query);
}

+ Here is the call graph for this function:

ilDataCollectionRecord::doDelete ( )

Delete.

Definition at line 561 of file class.ilDataCollectionRecord.php.

References $ilDB, $query, deleteFile(), deleteMob(), getId(), getTableId(), ilDataCollectionDatatype\INPUTFORMAT_FILE, ilDataCollectionDatatype\INPUTFORMAT_MOB, loadRecordFields(), and ilObjDataCollection\sendNotification().

Referenced by deleteField().

{
global $ilDB;
$this->loadRecordFields();
foreach ($this->recordfields as $recordfield) {
if ($recordfield->getField()->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_FILE) {
$this->deleteFile($recordfield->getValue());
}
if ($recordfield->getField()->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_MOB) {
$this->deleteMob($recordfield->getValue());
}
$recordfield->delete();
}
$query = "DELETE FROM il_dcl_record WHERE id = " . $ilDB->quote($this->getId(), "integer");
$ilDB->manipulate($query);
ilObjDataCollection::sendNotification("delete_record", $this->getTableId(), $this->getId());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionRecord::doRead ( )

Read record.

Definition at line 120 of file class.ilDataCollectionRecord.php.

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

Referenced by __construct().

{
global $ilDB;
//build query
$query = "Select * From il_dcl_record WHERE id = " . $ilDB->quote($this->getId(), "integer") . " ORDER BY id";
$set = $ilDB->query($query);
$rec = $ilDB->fetchAssoc($set);
$this->setTableId($rec["table_id"]);
$this->setCreateDate($rec["create_date"]);
$this->setLastUpdate($rec["last_update"]);
$this->setOwner($rec["owner"]);
$this->setLastEditBy($rec["last_edit_by"]);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionRecord::doUpdate ( )

doUpdate

Definition at line 82 of file class.ilDataCollectionRecord.php.

References $ilDB, getLastEditBy(), getLastUpdate(), getOwner(), getRecordFields(), getTableId(), and ilObjDataCollection\sendNotification().

{
global $ilDB;
$ilDB->update("il_dcl_record", array(
"table_id" => array(
"integer",
$this->getTableId()
),
"last_update" => array(
"date",
$this->getLastUpdate()
),
"owner" => array(
"text",
$this->getOwner()
),
"last_edit_by" => array(
"text",
$this->getLastEditBy()
)
), array(
"id" => array(
"integer",
$this->id
)
));
foreach ($this->getRecordFields() as $recordfield) {
$recordfield->doUpdate();
}
ilObjDataCollection::sendNotification("update_record", $this->getTableId(), $this->id);
}

+ Here is the call graph for this function:

ilDataCollectionRecord::getComments ( )

Get all comments of this record.

Returns
array ilNote[]

Definition at line 707 of file class.ilDataCollectionRecord.php.

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

Referenced by getStandardFieldHTML().

{
if ($this->comments === NULL) {
$this->comments = ilNote::_getNotesOfObject($this->table->getCollectionObject()->getId(), $this->getId(), 'dcl', IL_NOTE_PUBLIC);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionRecord::getCreateDate ( )

Get Creation Date.

Returns
ilDateTime

Definition at line 230 of file class.ilDataCollectionRecord.php.

References $create_date.

Referenced by doCreate(), and getStandardFieldHTML().

{
}

+ Here is the caller graph for this function:

ilDataCollectionRecord::getId ( )

Get field id.

Returns
int

Definition at line 190 of file class.ilDataCollectionRecord.php.

References $id.

Referenced by doCreate(), doDelete(), doRead(), getComments(), and getStandardFieldHTML().

{
return $this->id;
}

+ Here is the caller graph for this function:

ilDataCollectionRecord::getLastEditBy ( )

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

References $last_edit_by.

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

{
}

+ Here is the caller graph for this function:

ilDataCollectionRecord::getLastUpdate ( )

Get Last Update Date.

Returns
ilDateTime

Definition at line 250 of file class.ilDataCollectionRecord.php.

References $last_update.

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

{
}

+ Here is the caller graph for this function:

ilDataCollectionRecord::getOwner ( )

Get Owner.

Returns
int

Definition at line 270 of file class.ilDataCollectionRecord.php.

References $owner.

Referenced by ilDataCollectionTable\checkEditByOwner(), doCreate(), doUpdate(), getStandardField(), and getStandardFieldHTML().

{
return $this->owner;
}

+ Here is the caller graph for this function:

ilDataCollectionRecord::getRecordField (   $field_id)
Parameters
$field_id
Returns
ilDataCollectionRecordField

Definition at line 551 of file class.ilDataCollectionRecord.php.

References loadRecordFields().

{
$this->loadRecordFields();
return $this->recordfields[$field_id];
}

+ Here is the call graph for this function:

ilDataCollectionRecord::getRecordFieldExportValue (   $field_id)

Get Field Export Value.

Parameters
int$field_id
Returns
array

Definition at line 350 of file class.ilDataCollectionRecord.php.

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

{
$this->loadRecordFields();
return $this->getStandardFieldHTML($field_id);
} else {
return $this->recordfields[$field_id]->getExportValue();
}
}

+ Here is the call graph for this function:

ilDataCollectionRecord::getRecordFieldFormInput (   $field_id)
Parameters
$field_id
Returns
int

Definition at line 441 of file class.ilDataCollectionRecord.php.

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

{
$this->loadRecordFields();
return $this->getStandardField($field_id);
} else {
return $this->recordfields[$field_id]->getFormInput();
}
}

+ Here is the call graph for this function:

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

Definition at line 366 of file class.ilDataCollectionRecord.php.

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

{
$this->loadRecordFields();
$html = $this->getStandardFieldHTML($field_id, $options);
} else {
if (is_object($this->recordfields[$field_id])) {
$html = $this->recordfields[$field_id]->getHTML();
} else {
$html = '';
}
}
// 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
// SW 16.07.2014 Uncommented again, as some fields are outputting javascript that was broken due to entity encode the curly brackets
// $html = str_ireplace("{", "{", $html);
// $html = str_ireplace("}", "}", $html);
return $html;
}

+ Here is the call graph for this function:

ilDataCollectionRecord::getRecordFields ( )
Returns
ilDataCollectionRecordField[]

Definition at line 685 of file class.ilDataCollectionRecord.php.

References $recordfields, and loadRecordFields().

Referenced by doUpdate().

{
$this->loadRecordFields();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionRecord::getRecordFieldSortingValue (   $field_id,
array  $options = array() 
)
Parameters
$field_id
array$options
Returns
array|mixed|string

Definition at line 393 of file class.ilDataCollectionRecord.php.

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

{
$this->loadRecordFields();
$sort = $this->getStandardFieldHTML($field_id, $options);
} else {
if (is_object($this->recordfields[$field_id])) {
$sort = $this->recordfields[$field_id]->getSortingValue();
} else {
$sort = '';
}
}
return $sort;
}

+ Here is the call graph for this function:

ilDataCollectionRecord::getRecordFieldValue (   $field_id)

Get Field Value.

Parameters
int$field_id
Returns
array

Definition at line 330 of file class.ilDataCollectionRecord.php.

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

Referenced by ilDataCollectionDatatype\passThroughFilter().

{
if ($field_id === NULL) {
return NULL;
}
$this->loadRecordFields();
return $this->getStandardField($field_id);
} else {
return $this->recordfields[$field_id]->getValue();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionRecord::getRecordFieldValues ( )
Deprecated:
Returns
array

Definition at line 312 of file class.ilDataCollectionRecord.php.

References $id, and loadRecordFields().

{
$this->loadRecordFields();
$return = array();
foreach ($this->recordfields as $id => $record_field) {
$return[$id] = $record_field->getValue();
}
return $return;
}

+ Here is the call graph for this function:

ilDataCollectionRecord::getStandardField (   $field_id)
protected
Parameters
$field_id
Returns
int

Definition at line 471 of file class.ilDataCollectionRecord.php.

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

Referenced by getRecordFieldFormInput(), and getRecordFieldValue().

{
switch ($field_id) {
case "last_edit_by":
return $this->getLastEditBy();
break;
case 'owner':
$usr_data = ilObjUser::_lookupName($this->getOwner());
return $usr_data['login'];
break;
}
return $this->$field_id;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 493 of file class.ilDataCollectionRecord.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 getRecordFieldExportValue(), getRecordFieldHTML(), and getRecordFieldSortingValue().

{
switch ($field_id) {
case 'id':
return $this->getId();
case 'owner':
case 'last_edit_by':
case 'last_update':
case 'create_date':
case 'comments':
$nComments = count($this->getComments());
$ajax_hash = ilCommonActionDispatcherGUI::buildAjaxHash(1, $_GET['ref_id'], 'dcl', $this->table->getCollectionObject()
->getId(), 'dcl', $this->getId());
$ajax_link = ilNoteGUI::getListCommentsJSCall($ajax_hash, '');
return "<a class='dcl_comment' href='#' onclick=\"return " . $ajax_link . "\">
<img src='" . ilUtil::getImagePath("comment_unlabeled.svg")
. "' alt='{$nComments} Comments'><span class='ilHActProp'>{$nComments}</span></a>";
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionRecord::getTable ( )
Returns
ilDataCollectionTable

Definition at line 695 of file class.ilDataCollectionRecord.php.

References $table, and loadTable().

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

{
$this->loadTable();
return $this->table;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionRecord::getTableId ( )

Get Table ID.

Returns
int

Definition at line 210 of file class.ilDataCollectionRecord.php.

References $table_id.

Referenced by ilDataCollectionRecordViewGUI\_getViewDefinitionId(), doCreate(), doDelete(), doUpdate(), ilDataCollectionRecordViewGUI\hasValidViewDefinition(), and loadTable().

{
}

+ Here is the caller graph for this function:

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

Definition at line 667 of file class.ilDataCollectionRecord.php.

References $ref_id, and getTable().

{
return $this->getTable()->hasPermissionToDeleteRecord($ref_id, $this);
}

+ Here is the call graph for this function:

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

Definition at line 657 of file class.ilDataCollectionRecord.php.

References $ref_id, and getTable().

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

+ Here is the call graph for this function:

ilDataCollectionRecord::hasPermissionToView (   $ref_id)
Parameters
$ref_id
Returns
bool

Definition at line 677 of file class.ilDataCollectionRecord.php.

References $ref_id, and getTable().

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

+ Here is the call graph for this function:

ilDataCollectionRecord::loadRecordFields ( )
private

Load record fields.

Definition at line 521 of file class.ilDataCollectionRecord.php.

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

Referenced by deleteField(), doDelete(), getRecordField(), getRecordFieldExportValue(), getRecordFieldFormInput(), getRecordFieldHTML(), getRecordFields(), getRecordFieldSortingValue(), getRecordFieldValue(), getRecordFieldValues(), and setRecordFieldValue().

{
if ($this->recordfields == NULL) {
$this->loadTable();
$recordfields = array();
foreach ($this->table->getRecordFields() as $field) {
if ($recordfields[$field->getId()] == NULL) {
$recordfields[$field->getId()] = ilDataCollectionCache::getRecordFieldCache($this, $field);
}
}
$this->recordfields = $recordfields;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionRecord::loadTable ( )
private

Load table.

Definition at line 539 of file class.ilDataCollectionRecord.php.

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

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

{
if ($this->table == NULL) {
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionRecord::passThroughFilter ( array  $filter)
Parameters
array$filter
Returns
bool

Definition at line 636 of file class.ilDataCollectionRecord.php.

References loadTable(), and ilDataCollectionDatatype\passThroughFilter().

{
$this->loadTable();
// If one field returns false, the whole record does not pass the filter #performance-improvements
foreach ($this->table->getFilterableFields() as $field) {
if (! isset($filter["filter_" . $field->getId()]) || ! $filter["filter_" . $field->getId()]) {
continue;
}
if (! ilDataCollectionDatatype::passThroughFilter($this, $field, $filter["filter_" . $field->getId()])) {
return false;
}
}
return true;
}

+ Here is the call graph for this function:

ilDataCollectionRecord::setCreateDate (   $a_datetime)

Set Creation Date.

Parameters
ilDateTime$a_datetime

Definition at line 220 of file class.ilDataCollectionRecord.php.

Referenced by doRead().

{
$this->create_date = $a_datetime;
}

+ Here is the caller graph for this function:

ilDataCollectionRecord::setId (   $a_id)

Set field id.

Parameters
int$a_id

Definition at line 180 of file class.ilDataCollectionRecord.php.

Referenced by doCreate().

{
$this->id = $a_id;
}

+ Here is the caller graph for this function:

ilDataCollectionRecord::setLastEditBy (   $last_edit_by)

Definition at line 286 of file class.ilDataCollectionRecord.php.

References $last_edit_by.

Referenced by doRead(), and setStandardField().

{
$this->last_edit_by = $last_edit_by;
}

+ Here is the caller graph for this function:

ilDataCollectionRecord::setLastUpdate (   $a_datetime)

Set Last Update Date.

Parameters
ilDateTime$a_datetime

Definition at line 240 of file class.ilDataCollectionRecord.php.

Referenced by doRead().

{
$this->last_update = $a_datetime;
}

+ Here is the caller graph for this function:

ilDataCollectionRecord::setOwner (   $a_id)

Set Owner.

Parameters
int$a_id

Definition at line 260 of file class.ilDataCollectionRecord.php.

Referenced by doRead().

{
$this->owner = $a_id;
}

+ Here is the caller graph for this function:

ilDataCollectionRecord::setRecordFieldValue (   $field_id,
  $value 
)

Set a field value.

Parameters
int$field_id
string$value

Definition at line 297 of file class.ilDataCollectionRecord.php.

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

{
$this->loadRecordFields();
$this->setStandardField($field_id, $value);
} else {
$this->loadTable();
$this->recordfields[$field_id]->setValue($value);
}
}

+ Here is the call graph for this function:

ilDataCollectionRecord::setStandardField (   $field_id,
  $value 
)
protected
Parameters
$field_id
$value

Definition at line 455 of file class.ilDataCollectionRecord.php.

References setLastEditBy().

Referenced by setRecordFieldValue().

{
switch ($field_id) {
case "last_edit_by":
$this->setLastEditBy($value);
return;
}
$this->$field_id = $value;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionRecord::setTableId (   $a_id)

Set Table ID.

Parameters
int$a_id

Definition at line 200 of file class.ilDataCollectionRecord.php.

Referenced by doRead().

{
$this->table_id = $a_id;
}

+ Here is the caller graph for this function:

Field Documentation

ilDataCollectionRecord::$comments
protected

Definition at line 65 of file class.ilDataCollectionRecord.php.

Referenced by getComments().

ilDataCollectionRecord::$create_date
protected

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

Referenced by getCreateDate().

ilDataCollectionRecord::$id
protected

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

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

ilDataCollectionRecord::$last_edit_by
protected

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

Referenced by getLastEditBy(), and setLastEditBy().

ilDataCollectionRecord::$last_update
protected

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

Referenced by getLastUpdate().

ilDataCollectionRecord::$owner
protected

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

Referenced by getOwner().

ilDataCollectionRecord::$recordfields
protected

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

Referenced by getRecordFields(), and loadRecordFields().

ilDataCollectionRecord::$table
protected

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

Referenced by getTable().

ilDataCollectionRecord::$table_id
protected

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

Referenced by getTableId().


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