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

Class ilDataCollectionField. More...

+ Inheritance diagram for ilDataCollectionRecordField:
+ Collaboration diagram for ilDataCollectionRecordField:

Public Member Functions

 __construct (ilDataCollectionRecord $record, ilDataCollectionField $field)
 doUpdate ()
 Update object in database.
 delete ()
 Delete record field in database.
 getValue ()
 setValue ($value, $omit_parsing=false)
 Set value for record field.
 getFormInput ()
 getExportValue ()
 getPlainText ()
 getHTML ($link=true)
 getSortingValue ($link=true)
 getSingleHTML ()
 getField ()
 getId ()
 getRecord ()

Protected Member Functions

 doRead ()
 Read object data from database.
 doCreate ()
 Create object in database.
 loadValue ()
 Load the value.

Protected Attributes

 $id
 $field
 $record
 $value
 $lng
 $user
 $ctrl
 $db

Detailed Description

Constructor & Destructor Documentation

ilDataCollectionRecordField::__construct ( ilDataCollectionRecord  $record,
ilDataCollectionField  $field 
)
Parameters
ilDataCollectionRecord$record
ilDataCollectionField$field

Reimplemented in ilDataCollectionReferenceField, ilDataCollectionFormulaField, ilDataCollectionILIASRefField, and ilDataCollectionRatingField.

Definition at line 58 of file class.ilDataCollectionRecordField.php.

References $field, $ilCtrl, $ilDB, $ilUser, $lng, $record, and doRead().

{
$this->record = $record;
$this->field = $field;
$this->lng = $lng;
$this->ctrl = $ilCtrl;
$this->user = $ilUser;
$this->db = $ilDB;
$this->doRead();
}

+ Here is the call graph for this function:

Member Function Documentation

ilDataCollectionRecordField::delete ( )

Delete record field in database.

Reimplemented in ilDataCollectionRatingField, and ilDataCollectionFormulaField.

Definition at line 126 of file class.ilDataCollectionRecordField.php.

References $query.

{
$datatype = $this->field->getDatatype();
$query = "DELETE FROM il_dcl_stloc" . $datatype->getStorageLocation() . "_value WHERE record_field_id = "
. $this->db->quote($this->id, "integer");
$this->db->manipulate($query);
$query2 = "DELETE FROM il_dcl_record_field WHERE id = " . $this->db->quote($this->id, "integer");
$this->db->manipulate($query2);
}
ilDataCollectionRecordField::doCreate ( )
protected

Create object in database.

Definition at line 90 of file class.ilDataCollectionRecordField.php.

References $id, and $query.

Referenced by doRead().

{
$id = $this->db->nextId("il_dcl_record_field");
$query = "INSERT INTO il_dcl_record_field (id, record_id, field_id) VALUES (" . $this->db->quote($id, "integer") . ", "
. $this->db->quote($this->record->getId(), "integer") . ", " . $this->db->quote($this->field->getId(), "text") . ")";
$this->db->manipulate($query);
$this->id = $id;
}

+ Here is the caller graph for this function:

ilDataCollectionRecordField::doRead ( )
protected

Read object data from database.

Reimplemented in ilDataCollectionFormulaField, and ilDataCollectionRatingField.

Definition at line 73 of file class.ilDataCollectionRecordField.php.

References $query, doCreate(), and loadValue().

Referenced by __construct().

{
$query = "SELECT * FROM il_dcl_record_field WHERE field_id = " . $this->db->quote($this->field->getId(), "integer") . " AND record_id = "
. $this->db->quote($this->record->getId(), "integer");
$set = $this->db->query($query);
$rec = $this->db->fetchAssoc($set);
$this->id = $rec['id'];
if ($this->id == NULL) {
$this->doCreate();
}
$this->loadValue();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionRecordField::doUpdate ( )

Update object in database.

Reimplemented in ilDataCollectionFormulaField, ilDataCollectionRatingField, and ilDataCollectionNReferenceField.

Definition at line 102 of file class.ilDataCollectionRecordField.php.

References $query, and $value.

{
//$this->loadValue(); //Removed Mantis #0011799
$datatype = $this->field->getDatatype();
$query = "DELETE FROM il_dcl_stloc" . $datatype->getStorageLocation() . "_value WHERE record_field_id = "
. $this->db->quote($this->id, "integer");
$this->db->manipulate($query);
$next_id = $this->db->nextId("il_dcl_stloc" . $datatype->getStorageLocation() . "_value");
// This is a workaround to ensure that date values in stloc3 are never stored as NULL, which is not allowed
if ($datatype->getStorageLocation() == 3 && (is_null($this->value) || empty($this->value))) {
$this->value = '0000-00-00 00:00:00';
}
$this->db->insert("il_dcl_stloc" . $datatype->getStorageLocation() . "_value", array(
"value" => array( $datatype->getDbType(), $this->value ),
"record_field_id " => array( "integer", $this->id ),
"id" => array( "integer", $next_id )
));
}
ilDataCollectionRecordField::getExportValue ( )
Returns
int|string

Reimplemented in ilDataCollectionNReferenceField, ilDataCollectionReferenceField, ilDataCollectionFormulaField, ilDataCollectionILIASRefField, and ilDataCollectionRatingField.

Definition at line 186 of file class.ilDataCollectionRecordField.php.

References getValue().

Referenced by getPlainText().

{
$datatype = $this->field->getDatatype();
return $datatype->parseExportValue($this->getValue());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionRecordField::getFormInput ( )
Returns
mixed

Reimplemented in ilDataCollectionFormulaField, and ilDataCollectionRatingField.

Definition at line 176 of file class.ilDataCollectionRecordField.php.

References getValue().

{
$datatype = $this->field->getDatatype();
return $datatype->parseFormInput($this->getValue(), $this);
}

+ Here is the call graph for this function:

ilDataCollectionRecordField::getHTML (   $link = true)
Returns
string

Definition at line 204 of file class.ilDataCollectionRecordField.php.

References getValue().

Referenced by getSingleHTML().

{
$datatype = $this->field->getDatatype();
return $datatype->parseHTML($this->getValue(), $this, $link);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionRecordField::getPlainText ( )
Returns
mixed used for the sorting.

Definition at line 196 of file class.ilDataCollectionRecordField.php.

References getExportValue().

{
return $this->getExportValue();
}

+ Here is the call graph for this function:

ilDataCollectionRecordField::getSingleHTML ( )
Returns
string This method is used in the view definition of a single record (detail view)

Definition at line 224 of file class.ilDataCollectionRecordField.php.

References getHTML().

{
return $this->getHTML(false);
}

+ Here is the call graph for this function:

ilDataCollectionRecordField::getSortingValue (   $link = true)
Returns
string

Definition at line 213 of file class.ilDataCollectionRecordField.php.

References getValue().

{
$datatype = $this->field->getDatatype();
return $datatype->parseSortingValue($this->getValue(), $this, $link);
}

+ Here is the call graph for this function:

ilDataCollectionRecordField::loadValue ( )
protected

Load the value.

Reimplemented in ilDataCollectionFormulaField, ilDataCollectionNReferenceField, and ilDataCollectionRatingField.

Definition at line 232 of file class.ilDataCollectionRecordField.php.

References $query, and ilDataCollectionDatatype\INPUTFORMAT_RATING.

Referenced by doRead(), getValue(), and setValue().

{
if ($this->value === NULL) {
$datatype = $this->field->getDatatype();
switch ($datatype->getId()) {
return true;
}
$query = "SELECT * FROM il_dcl_stloc" . $datatype->getStorageLocation() . "_value WHERE record_field_id = "
. $this->db->quote($this->id, "integer");
$set = $this->db->query($query);
$rec = $this->db->fetchAssoc($set);
$this->value = $rec['value'];
}
}

+ Here is the caller graph for this function:

ilDataCollectionRecordField::setValue (   $value,
  $omit_parsing = false 
)

Set value for record field.

Parameters
mixed$value
bool$omit_parsingIf true, does not parse the value and stores it in the given format

Definition at line 153 of file class.ilDataCollectionRecordField.php.

References $value, ilDataCollectionDatatype\INPUTFORMAT_FILE, and loadValue().

{
$this->loadValue();
if (! $omit_parsing) {
$tmp = $this->field->getDatatype()->parseValue($value, $this);
$old = $this->value;
//if parse value fails keep the old value
if ($tmp !== false) {
$this->value = $tmp;
//delete old file from filesystem
// TODO Does not belong here, create separate class ilDataCollectionFileField and overwrite setValue method
if ($old && $this->field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_FILE) {
// $this->record->deleteFile($old); // Removed due to #0018064
}
}
} else {
$this->value = $value;
}
}

+ Here is the call graph for this function:

Field Documentation

ilDataCollectionRecordField::$ctrl
protected

Definition at line 47 of file class.ilDataCollectionRecordField.php.

ilDataCollectionRecordField::$db
protected

Definition at line 51 of file class.ilDataCollectionRecordField.php.

ilDataCollectionRecordField::$field
protected

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

Referenced by __construct(), and getField().

ilDataCollectionRecordField::$id
protected
ilDataCollectionRecordField::$lng
protected
ilDataCollectionRecordField::$record
protected

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

Referenced by __construct(), and getRecord().

ilDataCollectionRecordField::$user
protected

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


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