ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilDclNumberFieldModel.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
28 $filter_value = "",
29 ?ilDclBaseFieldModel $sort_field = null
31 global $DIC;
32 $ilDB = $DIC['ilDB'];
33
34 if (is_array($filter_value)) {
35 $from = (isset($filter_value['from'])) ? (int) $filter_value['from'] : null;
36 $to = (isset($filter_value['to'])) ? (int) $filter_value['to'] : null;
37 }
38
39 $join_str
40 = "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 = "
41 . $ilDB->quote($this->getId(), 'integer') . ") ";
42 $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";
43 if (isset($from)) {
44 $join_str .= " AND filter_stloc_{$this->getId()}.value >= " . $ilDB->quote($from, 'integer');
45 }
46 if (isset($to)) {
47 $join_str .= " AND filter_stloc_{$this->getId()}.value <= " . $ilDB->quote($to, 'integer');
48 }
49 $join_str .= ") ";
50
51 $sql_obj = new ilDclRecordQueryObject();
52 $sql_obj->setJoinStatement($join_str);
53
54 return $sql_obj;
55 }
56
57 public function hasNumericSorting(): bool
58 {
59 return true;
60 }
61
65 public function checkValidity($value, ?int $record_id): bool
66 {
67 if (!is_numeric($value) && $value !== null) {
69 }
70 return parent::checkValidity((int) $value, $record_id);
71 }
72}
getRecordQueryFilterObject( $filter_value="", ?ilDclBaseFieldModel $sort_field=null)
Returns a query-object for building the record-loader-sql-query.
checkValidity($value, ?int $record_id)
hasNumericSorting()
Set to true, when the sorting should be handled numerical.
global $DIC
Definition: shib_login.php:26