ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
class.ilDclDatetimeFieldModel.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 {
23  public const string FORMAT = 'Y-m-d H:i';
24 
28  public function getRecordQueryFilterObject(
29  $filter_value = "",
30  ?ilDclBaseFieldModel $sort_field = null
32 
33  global $DIC;
37  $date_from = (isset($filter_value['from']) && is_object($filter_value['from'])) ? $filter_value['from'] : null;
38  $date_from = new ilDateTime($date_from->get(IL_CAL_DATETIME, '', $DIC->user()->getTimeZone()), IL_CAL_DATETIME);
39  $date_to = (isset($filter_value['to']) && is_object($filter_value['to'])) ? $filter_value['to'] : null;
40  $date_to = new ilDateTime($date_to->get(IL_CAL_DATETIME, '', $DIC->user()->getTimeZone()), IL_CAL_DATETIME);
41 
42  $x = $this->db->quote($date_from, 'date');
43 
44  $join_str
45  = "INNER JOIN il_dcl_record_field AS filter_record_field_{$this->getId()} ON (filter_record_field_{$this->getId()}.record_id = record.id AND filter_record_field_{$this->getId()}.field_id = "
46  . $this->db->quote($this->getId(), 'integer') . ") ";
47  $join_str .= "INNER JOIN il_dcl_stloc{$this->getStorageLocation()}_value AS filter_stloc_{$this->getId()} ON (filter_stloc_{$this->getId()}.record_field_id = filter_record_field_{$this->getId()}.id ";
48  if ($date_from) {
49  $join_str .= "AND filter_stloc_{$this->getId()}.value >= " . $this->db->quote($date_from, 'date') . " ";
50  }
51  if ($date_to) {
52  $join_str .= "AND filter_stloc_{$this->getId()}.value <= " . $this->db->quote($date_to, 'date') . " ";
53  }
54  $join_str .= ") ";
55 
56  $sql_obj = new ilDclRecordQueryObject();
57  $sql_obj->setJoinStatement($join_str);
58 
59  return $sql_obj;
60  }
61 }
const IL_CAL_DATETIME
getRecordQueryFilterObject( $filter_value="", ?ilDclBaseFieldModel $sort_field=null)
Returns a query-object for building the record-loader-sql-query.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:26