ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
class.ilDclDateFieldModel.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';
24 
28  public function getRecordQueryFilterObject(
29  $filter_value = "",
30  ?ilDclBaseFieldModel $sort_field = null
32 
33  $date_from = (isset($filter_value['from']) && is_object($filter_value['from'])) ? $filter_value['from'] : null;
34  $date_to = (isset($filter_value['to']) && is_object($filter_value['to'])) ? $filter_value['to'] : null;
35 
36  $join_str
37  = "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 = "
38  . $this->db->quote($this->getId(), 'integer') . ") ";
39  $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 ";
40  if ($date_from) {
41  $join_str .= "AND filter_stloc_{$this->getId()}.value >= " . $this->db->quote($date_from, 'date') . " ";
42  }
43  if ($date_to) {
44  $join_str .= "AND filter_stloc_{$this->getId()}.value <= " . $this->db->quote($date_to, 'date') . " ";
45  }
46  $join_str .= ") ";
47 
48  $sql_obj = new ilDclRecordQueryObject();
49  $sql_obj->setJoinStatement($join_str);
50 
51  return $sql_obj;
52  }
53 }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getRecordQueryFilterObject( $filter_value="", ?ilDclBaseFieldModel $sort_field=null)