ILIAS  release_4-3 Revision
 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 135 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 550 of file class.ilDataCollectionRecord.php.

References $file, and ilObject2\_lookupObjId().

Referenced by doDelete().

{
$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 562 of file class.ilDataCollectionRecord.php.

References ilObject2\_lookupObjId().

Referenced by doDelete().

{
$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 102 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 521 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 rc WHERE rc.id = ".$ilDB->quote($this->getId(),"integer")." ORDER BY rc.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 198 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 158 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 246 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 218 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 238 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 511 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 325 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 395 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 348 of file class.ilDataCollectionRecord.php.

References $lng, ilDataCollectionStandardField\_isStandardField(), getStandardFieldHTML(), loadRecordFields(), and ilUtil\sendInfo().

{
global $lng;
$this->loadRecordFields();
{
return $this->getStandardFieldHTML($field_id);
}
else
{
if(!$this->recordfields[$field_id]){
ilUtil::sendInfo($lng->txt("dcl_inconsistent"), true);
return "-";
}
return $this->recordfields[$field_id]->getHTML($options);
}
}

+ Here is the call graph for this function:

ilDataCollectionRecord::getRecordFields ( )

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

References 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 304 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 286 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 434 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 456 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 617 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 178 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 599 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 591 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 477 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 498 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 573 of file class.ilDataCollectionRecord.php.

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

{
$pass = true;
$this->loadTable();
foreach($this->table->getFields() as $field)
{
if(!ilDataCollectionDatatype::passThroughFilter($this, $field, $filter["filter_".$field->getId()]))
{
$pass = false;
}
}
return $pass;
}

+ Here is the call graph for this function:

ilDataCollectionRecord::setCreateDate (   $a_datetime)

Set Creation Date.

Parameters
ilDateTime$a_datetime

Definition at line 188 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 148 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 254 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 208 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 228 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 266 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 416 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 168 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: