ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilDclDatetimeFieldModel.php
Go to the documentation of this file.
1 <?php
2 
10 {
17  public function getRecordQueryFilterObject($filter_value = "", ilDclBaseFieldModel $sort_field = null)
18  {
19  global $DIC;
20  $ilDB = $DIC['ilDB'];
21 
22  $date_from = (isset($filter_value['from']) && is_object($filter_value['from'])) ? $filter_value['from'] : null;
23  $date_to = (isset($filter_value['to']) && is_object($filter_value['to'])) ? $filter_value['to'] : null;
24 
25  $join_str = "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 = "
26  . $ilDB->quote($this->getId(), 'integer') . ") ";
27  $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 ";
28  if ($date_from) {
29  $join_str .= "AND filter_stloc_{$this->getId()}.value >= " . $ilDB->quote($date_from, 'date') . " ";
30  }
31  if ($date_to) {
32  $join_str .= "AND filter_stloc_{$this->getId()}.value <= " . $ilDB->quote($date_to, 'date') . " ";
33  }
34  $join_str .= ") ";
35 
36  $sql_obj = new ilDclRecordQueryObject();
37  $sql_obj->setJoinStatement($join_str);
38 
39  return $sql_obj;
40  }
41 
42 
43  public function checkValidity($value, $record_id = null)
44  {
45  if ($value == null) {
46  return true;
47  }
48 
49  if ($this->isUnique()) {
51  $datestring = $value . ' 00:00:00';
52  foreach ($table->getRecords() as $record) {
53  if ($record->getRecordFieldValue($this->getId()) == $datestring && ($record->getId() != $record_id || $record_id == 0)) {
55  }
56  }
57  }
58  }
59 }
Class ilDclBaseFieldModel.
Class ilDclRecordQueryObject.
global $DIC
Definition: saml.php:7
Class ilDclBaseFieldModel.
static getTableCache($table_id=0)
getRecordQueryFilterObject($filter_value="", ilDclBaseFieldModel $sort_field=null)
Returns a query-object for building the record-loader-sql-query.
checkValidity($value, $record_id=null)
global $ilDB
Class ilDclBooleanFieldModel.
if(empty($password)) $table
Definition: pwgen.php:24