ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilADTMultiEnumDBBridge Class Reference
+ Inheritance diagram for ilADTMultiEnumDBBridge:
+ Collaboration diagram for ilADTMultiEnumDBBridge:

Public Member Functions

 setFakeSingle ($a_status)
 readRecord (array $a_row)
 Import DB values to ADT.
 prepareInsert (array &$a_fields)
 Prepare ADT values for insert.
- Public Member Functions inherited from ilADTMultiDBBridge
 afterInsert ()
 After insert hook to enable sub-tables.
 afterUpdate ()
 After update hook to enable sub-tables.
 afterDelete ()
 After delete hook to enable sub-tables.
- Public Member Functions inherited from ilADTDBBridge
 __construct (ilADT $a_adt)
 Constructor.
 getADT ()
 Get ADT.
 setTable ($a_table)
 Set table name.
 getTable ()
 Get table name.
 setElementId ($a_value)
 Set element id (aka DB column[s] [prefix])
 getElementId ()
 Get element id.
 setPrimary (array $a_value)
 Set primary fields (in MDB2 format)
 getPrimary ()
 Get primary fields.
 buildPrimaryWhere ()
 Convert primary keys array to sql string.
 prepareUpdate (array &$a_fields)
 Prepare ADT values for update.

Data Fields

const SEPARATOR = "~|~"

Protected Member Functions

 isValidADT (ilADT $a_adt)
 Check if given ADT is valid.
 doSingleFake ()
 readMultiRecord ($a_set)
 Import record-rows from sub-table.
 prepareMultiInsert ()
 Build insert-fields for each "value".
- Protected Member Functions inherited from ilADTMultiDBBridge
 getSubTableName ()
 Build sub-table name.
- Protected Member Functions inherited from ilADTDBBridge
 setADT (ilADT $a_adt)
 Set ADT.

Protected Attributes

 $fake_single

Detailed Description

Definition at line 5 of file class.ilADTMultiEnumDBBridge.php.

Member Function Documentation

ilADTMultiEnumDBBridge::doSingleFake ( )
protected

Definition at line 21 of file class.ilADTMultiEnumDBBridge.php.

References $fake_single.

Referenced by prepareInsert(), and readRecord().

{
}

+ Here is the caller graph for this function:

ilADTMultiEnumDBBridge::isValidADT ( ilADT  $a_adt)
protected

Check if given ADT is valid.

:TODO: This could be avoided with type-specifc constructors :TODO: bridge base class?

Parameters
ilADT$a_adt

Reimplemented from ilADTDBBridge.

Definition at line 11 of file class.ilADTMultiEnumDBBridge.php.

{
return ($a_adt instanceof ilADTMultiEnum);
}
ilADTMultiEnumDBBridge::prepareInsert ( array &  $a_fields)

Prepare ADT values for insert.

Parameters
array&$a_fields

Reimplemented from ilADTMultiDBBridge.

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

References doSingleFake(), ilADTDBBridge\getADT(), and ilADTDBBridge\getElementId().

{
if($this->doSingleFake())
{
$values = (array)$this->getADT()->getSelections();
if(sizeof($values))
{
$values = self::SEPARATOR.implode(self::SEPARATOR, $values).self::SEPARATOR;
}
$a_fields[$this->getElementId()] = array("text", $values);
}
}

+ Here is the call graph for this function:

ilADTMultiEnumDBBridge::prepareMultiInsert ( )
protected

Build insert-fields for each "value".

Returns
array

Reimplemented from ilADTMultiDBBridge.

Definition at line 78 of file class.ilADTMultiEnumDBBridge.php.

References $res, ilADTDBBridge\getADT(), and ilADTDBBridge\getElementId().

{
$res = array();
$type = ($this->getADT() instanceof ilADTMultiEnumNumeric)
? "integer"
: "text";
foreach((array)$this->getADT()->getSelections() as $element)
{
$res[] = array($this->getElementId() => array($type, $element));
}
return $res;
}

+ Here is the call graph for this function:

ilADTMultiEnumDBBridge::readMultiRecord (   $a_set)
protected

Import record-rows from sub-table.

Parameters
object$a_set

Reimplemented from ilADTMultiDBBridge.

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

References $ilDB, $row, ilADTDBBridge\getADT(), and ilADTDBBridge\getElementId().

Referenced by readRecord().

{
global $ilDB;
$elements = array();
while($row = $ilDB->fetchAssoc($a_set))
{
$elements[] = $row[$this->getElementId()];
}
$this->getADT()->setSelections($elements);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilADTMultiEnumDBBridge::readRecord ( array  $a_row)

Import DB values to ADT.

Parameters
array$a_row

Reimplemented from ilADTMultiDBBridge.

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

References $ilDB, doSingleFake(), ilADTDBBridge\getADT(), ilADTDBBridge\getElementId(), and readMultiRecord().

{
global $ilDB;
if(!$this->doSingleFake())
{
$sql = "SELECT ".$this->getElementId().
" FROM ".$this->getSubTableName().
" WHERE ".$this->buildPrimaryWhere();
$set = $ilDB->query($sql);
$this->readMultiRecord($set);
}
else
{
if(trim($a_row[$this->getElementId()]))
{
$value = explode(self::SEPARATOR, $a_row[$this->getElementId()]);
array_pop($value);
array_shift($value);
$this->getADT()->setSelections($value);
}
}
}

+ Here is the call graph for this function:

ilADTMultiEnumDBBridge::setFakeSingle (   $a_status)

Definition at line 16 of file class.ilADTMultiEnumDBBridge.php.

{
$this->fake_single = (bool)$a_status;
}

Field Documentation

ilADTMultiEnumDBBridge::$fake_single
protected

Definition at line 7 of file class.ilADTMultiEnumDBBridge.php.

Referenced by doSingleFake().

const ilADTMultiEnumDBBridge::SEPARATOR = "~|~"

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