ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilADTMultiEnumDBBridge Class Reference
+ Inheritance diagram for ilADTMultiEnumDBBridge:
+ Collaboration diagram for ilADTMultiEnumDBBridge:

Public Member Functions

 __construct (ilADT $a_adt)
 
 getTable ()
 
 setFakeSingle ($a_status)
 
 readRecord (array $a_row)
 
 afterInsert ()
 
 afterUpdate ()
 
 prepareInsert (array &$a_fields)
 
 supportsDefaultValueColumn ()
 
- 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...
 
 supportsDefaultValueColumn ()
 true if table storage relies on the default 'value' column More...
 

Data Fields

const TABLE_NAME = 'adv_md_values_enum'
 
const SEPARATOR = "~|~"
 

Protected Member Functions

 isValidADT (ilADT $a_adt)
 
 doSingleFake ()
 
 deleteIndices ()
 
 insertIndices ()
 
- 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

 $db
 
 $fake_single
 
- Protected Attributes inherited from ilADTDBBridge
 $adt
 
 $table
 
 $id
 
 $primary = []
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilADTMultiEnumDBBridge::__construct ( ilADT  $a_adt)

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

References $DIC, and ILIAS\GlobalScreen\Provider\__construct().

19  {
20  global $DIC;
21 
22  $this->db = $DIC->database();
23  parent::__construct($a_adt);
24  }
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ afterInsert()

ilADTMultiEnumDBBridge::afterInsert ( )

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

References afterUpdate().

54  {
55  return $this->afterUpdate();
56  }
+ Here is the call graph for this function:

◆ afterUpdate()

ilADTMultiEnumDBBridge::afterUpdate ( )

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

References deleteIndices(), and insertIndices().

Referenced by afterInsert().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteIndices()

ilADTMultiEnumDBBridge::deleteIndices ( )
protected

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

References ilADTDBBridge\buildPrimaryWhere(), and getTable().

Referenced by afterUpdate().

70  {
71  $this->db->query(
72  'delete from ' . $this->getTable() . ' ' .
73  'where ' . $this->buildPrimaryWhere()
74  );
75  }
buildPrimaryWhere()
Convert primary keys array to sql string.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doSingleFake()

ilADTMultiEnumDBBridge::doSingleFake ( )
protected

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

References $fake_single.

◆ getTable()

ilADTMultiEnumDBBridge::getTable ( )

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

Referenced by deleteIndices(), and insertIndices().

26  : string
27  {
28  return self::TABLE_NAME;
29  }
+ Here is the caller graph for this function:

◆ insertIndices()

ilADTMultiEnumDBBridge::insertIndices ( )
protected

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

References $index, ilADTDBBridge\getADT(), ilLoggerFactory\getLogger(), ilADTDBBridge\getPrimary(), getTable(), and ilDBConstants\T_INTEGER.

Referenced by afterUpdate().

78  {
79  foreach ($this->getADT()->getSelections() as $index)
80  {
81  $fields = $this->getPrimary();
82  $fields['value_index'] = [ilDBConstants::T_INTEGER, $index];
83  $num_row = $this->db->insert($this->getTable(), $fields);
84  ilLoggerFactory::getLogger('amet')->dump($num_row);
85  }
86  }
getPrimary()
Get primary fields.
$index
Definition: metadata.php:128
static getLogger($a_component_id)
Get component logger.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isValidADT()

ilADTMultiEnumDBBridge::isValidADT ( ilADT  $a_adt)
protected

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

32  {
33  return ($a_adt instanceof ilADTMultiEnum);
34  }

◆ prepareInsert()

ilADTMultiEnumDBBridge::prepareInsert ( array &  $a_fields)

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

65  {
66  $a_fields = [];
67  }

◆ readRecord()

ilADTMultiEnumDBBridge::readRecord ( array  $a_row)

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

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

47  {
48  if (isset($a_row[$this->getElementId()])) {
49  $this->getADT()->addSelection($a_row[$this->getElementId()]);
50  }
51  }
getElementId()
Get element id.
+ Here is the call graph for this function:

◆ setFakeSingle()

ilADTMultiEnumDBBridge::setFakeSingle (   $a_status)

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

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

◆ supportsDefaultValueColumn()

ilADTMultiEnumDBBridge::supportsDefaultValueColumn ( )

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

88  : bool
89  {
90  return false;
91  }

Field Documentation

◆ $db

ilADTMultiEnumDBBridge::$db
protected

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

◆ $fake_single

ilADTMultiEnumDBBridge::$fake_single
protected

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

Referenced by doSingleFake().

◆ SEPARATOR

const ilADTMultiEnumDBBridge::SEPARATOR = "~|~"

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

◆ TABLE_NAME

const ilADTMultiEnumDBBridge::TABLE_NAME = 'adv_md_values_enum'

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


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