ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilADTDateTimeDBBridge.php
Go to the documentation of this file.
1 <?php
2 
3 require_once "Services/ADT/classes/Bridges/class.ilADTDBBridge.php";
4 
6 {
7  protected function isValidADT(ilADT $a_adt)
8  {
9  return ($a_adt instanceof ilADTDateTime);
10  }
11 
12  // CRUD
13 
14  public function readRecord(array $a_row)
15  {
16  $date = null;
17  if ($a_row[$this->getElementId()]) {
18  $date = new ilDateTime($a_row[$this->getElementId()], IL_CAL_DATETIME);
19  }
20  $this->getADT()->setDate($date);
21  }
22 
23  public function prepareInsert(array &$a_fields)
24  {
25  $date = $this->getADT()->getDate();
26  if ($date instanceof ilDateTime) {
27  $date = $date->get(IL_CAL_DATETIME);
28  }
29  $a_fields[$this->getElementId()] = array("timestamp", $date);
30  }
31 }
const IL_CAL_DATETIME
getElementId()
Get element id.
ADT base class.
Definition: class.ilADT.php:11
ADT DB bridge base class.
Date and time handling