ILIAS  Release_4_4_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)
 Constructor public.
 doUpdate ()
 doUpdate
 doRead ()
 Read record.
 doCreate ()
 Create new record.
 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 Field Value.
 getRecordFieldValues ()
 getRecordFieldValues
 getRecordFieldValue ($field_id)
 Get Field Value.
 getRecordFieldExportValue ($field_id)
 Get Field Export Value.
 getRecordFieldHTML ($field_id, array $options=array())
 getRecordFieldSingleHTML ($field_id, array $options=array())
 getRecordFieldFormInput ($field_id)
 getRecordField ($field_id)
 doDelete ()
 deleteFile ($obj_id)
 deleteMob ($obj_id)
 passThroughFilter (array $filter)
 hasPermissionToEdit ($ref)
 hasPermissionToDelete ($ref)
 getRecordFields ()
 getTable ()

Private Member Functions

 setStandardField ($field_id, $value)
 getStandardField ($field_id)
 getStandardFieldHTML ($field_id)
 loadRecordFields ()
 loadTable ()

Private Attributes

 $recordfields
 $id
 $table_id
 $table
 $last_edit_by

Detailed Description

Constructor & Destructor Documentation

ilDataCollectionRecord::__construct (   $a_id = 0)

Constructor public.

Parameters
integerfiel_id

Definition at line 41 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)

Definition at line 134 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)

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

References $file, and ilObject2\_exists().

Referenced by doDelete().

{
if(ilObject2::_exists($obj_id)){
$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)

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

Create new record.

Parameters
array$all_fields

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

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

{
global $ilDB;
throw new ilException("The field does not have a related table!");
// Record erzeugen
$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);
include_once "./Modules/DataCollection/classes/class.ilObjDataCollection.php";
}

+ Here is the call graph for this function:

ilDataCollectionRecord::doDelete ( )

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

References $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);
include_once "./Modules/DataCollection/classes/class.ilObjDataCollection.php";
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 79 of file class.ilDataCollectionRecord.php.

References $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 54 of file class.ilDataCollectionRecord.php.

References 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();
}
include_once "./Modules/DataCollection/classes/class.ilObjDataCollection.php";
ilObjDataCollection::sendNotification("update_record", $this->getTableId(), $this->id);
}

+ Here is the call graph for this function:

ilDataCollectionRecord::getCreateDate ( )

Get Creation Date.

Returns
ilDateTime

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

Referenced by doCreate(), and getStandardFieldHTML().

{
return $this->create_date;
}

+ Here is the caller graph for this function:

ilDataCollectionRecord::getId ( )

Get field id.

Returns
int

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

References $id.

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

{
return $this->id;
}

+ Here is the caller graph for this function:

ilDataCollectionRecord::getLastEditBy ( )

Definition at line 245 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 217 of file class.ilDataCollectionRecord.php.

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

{
return $this->last_update;
}

+ Here is the caller graph for this function:

ilDataCollectionRecord::getOwner ( )

Get Owner.

Returns
int

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

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

{
return $this->owner;
}

+ Here is the caller graph for this function:

ilDataCollectionRecord::getRecordField (   $field_id)

Definition at line 515 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 324 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)

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

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

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

{
$this->loadRecordFields();
$html = "";
{
$html = $this->getStandardFieldHTML($field_id);
}
else
{
$html = $this->recordfields[$field_id]->getHTML($options);
}
// 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
$html = str_ireplace("{", "{", $html);
$html = str_ireplace("}", "}", $html);
return $html;
}

+ Here is the call graph for this function:

ilDataCollectionRecord::getRecordFields ( )

Definition at line 610 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::getRecordFieldSingleHTML (   $field_id,
array  $options = array() 
)

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

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

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

+ Here is the call graph for this function:

ilDataCollectionRecord::getRecordFieldValue (   $field_id)

Get Field Value.

Parameters
int$field_id
Returns
array

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

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

Referenced by ilDataCollectionDatatype\passThroughFilter().

{
$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 ( )

getRecordFieldValues

Returns
array

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

References $id, and loadRecordFields().

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

+ Here is the call graph for this function:

ilDataCollectionRecord::getStandardField (   $field_id)
private

Definition at line 438 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)
private

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

References ilDatePresentation\formatDate(), getCreateDate(), getLastEditBy(), getLastUpdate(), ilUserUtil\getNamePresentation(), getOwner(), and IL_CAL_DATETIME.

Referenced by getRecordFieldExportValue(), getRecordFieldHTML(), and getRecordFieldSingleHTML().

{
switch($field_id)
{
case 'owner':
case 'last_edit_by':
case 'last_update':
case 'create_date':
}
return $this->$field_id;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionRecord::getTable ( )
Returns
ilDataCollectionTable

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

References $table, and loadTable().

Referenced by hasPermissionToDelete(), hasPermissionToEdit(), 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 177 of file class.ilDataCollectionRecord.php.

References $table_id.

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

{
}

+ Here is the caller graph for this function:

ilDataCollectionRecord::hasPermissionToDelete (   $ref)

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

References getTable().

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

+ Here is the call graph for this function:

ilDataCollectionRecord::hasPermissionToEdit (   $ref)

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

References getTable().

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

+ Here is the call graph for this function:

ilDataCollectionRecord::loadRecordFields ( )
private

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

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

Referenced by deleteField(), doDelete(), getRecordField(), getRecordFieldExportValue(), getRecordFieldFormInput(), getRecordFieldHTML(), getRecordFields(), getRecordFieldSingleHTML(), 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

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

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

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

{
include_once("class.ilDataCollectionTable.php");
if($this->table == NULL)
{
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionRecord::passThroughFilter ( array  $filter)

Definition at line 577 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 187 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 147 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 253 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 207 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 227 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 Field Value.

Parameters
string$a_value
int$a_id

Definition at line 265 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 
)
private

Definition at line 420 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 167 of file class.ilDataCollectionRecord.php.

Referenced by doRead().

{
$this->table_id = $a_id;
}

+ Here is the caller graph for this function:

Field Documentation

ilDataCollectionRecord::$id
private

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

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

ilDataCollectionRecord::$last_edit_by
private

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

Referenced by getLastEditBy(), and setLastEditBy().

ilDataCollectionRecord::$recordfields
private

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

Referenced by getRecordFields(), and loadRecordFields().

ilDataCollectionRecord::$table
private

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

Referenced by getTable().

ilDataCollectionRecord::$table_id
private

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

Referenced by getTableId().


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