ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilDclDatetimeFieldModel.php
Go to the documentation of this file.
1<?php
2
10{
11
19 public function getRecordQueryFilterObject($filter_value = "", ilDclBaseFieldModel $sort_field = null)
20 {
21 global $DIC;
22 $ilDB = $DIC['ilDB'];
23
24 $date_from = (isset($filter_value['from']) && is_object($filter_value['from'])) ? $filter_value['from'] : null;
25 $date_to = (isset($filter_value['to']) && is_object($filter_value['to'])) ? $filter_value['to'] : null;
26
27 $join_str
28 = "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 = "
29 . $ilDB->quote($this->getId(), 'integer') . ") ";
30 $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 ";
31 if ($date_from) {
32 $join_str .= "AND filter_stloc_{$this->getId()}.value >= " . $ilDB->quote($date_from, 'date') . " ";
33 }
34 if ($date_to) {
35 $join_str .= "AND filter_stloc_{$this->getId()}.value <= " . $ilDB->quote($date_to, 'date') . " ";
36 }
37 $join_str .= ") ";
38
39 $sql_obj = new ilDclRecordQueryObject();
40 $sql_obj->setJoinStatement($join_str);
41
42 return $sql_obj;
43 }
44
45
46 public function checkValidity($value, $record_id = null)
47 {
48 if ($value == null) {
49 return true;
50 }
51
52 if ($this->isUnique()) {
53 $table = ilDclCache::getTableCache($this->getTableId());
54 $datestring = $value . ' 00:00:00';
55 foreach ($table->getRecords() as $record) {
56 if ($record->getRecordFieldValue($this->getId()) == $datestring && ($record->getId() != $record_id || $record_id == 0)) {
58 }
59 }
60 }
61 }
62}
An exception for terminatinating execution or to throw for unit testing.
Class ilDclBaseFieldModel.
static getTableCache($table_id=0)
Class ilDclBooleanFieldModel.
getRecordQueryFilterObject($filter_value="", ilDclBaseFieldModel $sort_field=null)
Returns a query-object for building the record-loader-sql-query.
checkValidity($value, $record_id=null)
Check if input is valid.
Class ilDclBaseFieldModel.
Class ilDclRecordQueryObject.
global $DIC
Definition: goto.php:24
global $ilDB