ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilADTMultiEnumDBBridge Class Reference
+ Inheritance diagram for ilADTMultiEnumDBBridge:
+ Collaboration diagram for ilADTMultiEnumDBBridge:

Public Member Functions

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

Data Fields

const SEPARATOR = "~|~"
 

Protected Member Functions

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

Protected Attributes

 $fake_single
 
- Protected Attributes inherited from ilADTDBBridge
 $adt
 
 $table
 
 $id
 
 $primary
 

Detailed Description

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

Member Function Documentation

◆ doSingleFake()

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:

◆ isValidADT()

ilADTMultiEnumDBBridge::isValidADT ( ilADT  $a_adt)
protected

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

12  {
13  return ($a_adt instanceof ilADTMultiEnum);
14  }

◆ prepareInsert()

ilADTMultiEnumDBBridge::prepareInsert ( array $a_fields)

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

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

66  {
67  if($this->doSingleFake())
68  {
69  $values = (array)$this->getADT()->getSelections();
70  if(sizeof($values))
71  {
72  $values = self::SEPARATOR.implode(self::SEPARATOR, $values).self::SEPARATOR;
73  }
74  $a_fields[$this->getElementId()] = array("text", $values);
75  }
76  }
getElementId()
Get element id.
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ prepareMultiInsert()

ilADTMultiEnumDBBridge::prepareMultiInsert ( )
protected

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

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

79  {
80  $res = array();
81 
82  $type = ($this->getADT() instanceof ilADTMultiEnumNumeric)
83  ? "integer"
84  : "text";
85 
86  foreach((array)$this->getADT()->getSelections() as $element)
87  {
88  $res[] = array($this->getElementId() => array($type, $element));
89  }
90 
91  return $res;
92  }
foreach( $files as $file)
getElementId()
Get element id.
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ readMultiRecord()

ilADTMultiEnumDBBridge::readMultiRecord (   $a_set)
protected

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

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

Referenced by readRecord().

52  {
53  global $ilDB;
54 
55  $elements = array();
56 
57  while($row = $ilDB->fetchAssoc($a_set))
58  {
59  $elements[] = $row[$this->getElementId()];
60  }
61 
62  $this->getADT()->setSelections($elements);
63  }
getElementId()
Get element id.
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readRecord()

ilADTMultiEnumDBBridge::readRecord ( array  $a_row)

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

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

27  {
28  global $ilDB;
29 
30  if(!$this->doSingleFake())
31  {
32  $sql = "SELECT ".$this->getElementId().
33  " FROM ".$this->getSubTableName().
34  " WHERE ".$this->buildPrimaryWhere();
35  $set = $ilDB->query($sql);
36 
37  $this->readMultiRecord($set);
38  }
39  else
40  {
41  if(trim($a_row[$this->getElementId()]))
42  {
43  $value = explode(self::SEPARATOR, $a_row[$this->getElementId()]);
44  array_pop($value);
45  array_shift($value);
46  $this->getADT()->setSelections($value);
47  }
48  }
49  }
getElementId()
Get element id.
global $ilDB
+ Here is the call graph for this function:

◆ setFakeSingle()

ilADTMultiEnumDBBridge::setFakeSingle (   $a_status)

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

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

Field Documentation

◆ $fake_single

ilADTMultiEnumDBBridge::$fake_single
protected

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

Referenced by doSingleFake().

◆ SEPARATOR

const ilADTMultiEnumDBBridge::SEPARATOR = "~|~"

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