ILIAS  release_8 Revision v8.24
class.ilDclNumberFieldModel.php
Go to the documentation of this file.
1<?php
2
20{
26 $filter_value = "",
27 ?ilDclBaseFieldModel $sort_field = null
29 global $DIC;
30 $ilDB = $DIC['ilDB'];
31
32 if (is_array($filter_value)) {
33 $from = (isset($filter_value['from'])) ? (int) $filter_value['from'] : null;
34 $to = (isset($filter_value['to'])) ? (int) $filter_value['to'] : null;
35 }
36
37 $join_str
38 = "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 = "
39 . $ilDB->quote($this->getId(), 'integer') . ") ";
40 $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";
41 if (!is_null($from)) {
42 $join_str .= " AND filter_stloc_{$this->getId()}.value >= " . $ilDB->quote($from, 'integer');
43 }
44 if (!is_null($to)) {
45 $join_str .= " AND filter_stloc_{$this->getId()}.value <= " . $ilDB->quote($to, 'integer');
46 }
47 $join_str .= ") ";
48
49 $sql_obj = new ilDclRecordQueryObject();
50 $sql_obj->setJoinStatement($join_str);
51
52 return $sql_obj;
53 }
54
55 public function hasNumericSorting(): bool
56 {
57 return true;
58 }
59
63 public function checkValidity($value, ?int $record_id = null): bool
64 {
65 $valid = parent::checkValidity($value, $record_id);
66
67 if (!is_numeric($value) && $value != '') {
69 }
70
71 return $valid;
72 }
73}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getRecordQueryFilterObject( $filter_value="", ?ilDclBaseFieldModel $sort_field=null)
Returns a query-object for building the record-loader-sql-query.
checkValidity($value, ?int $record_id=null)
hasNumericSorting()
Set to true, when the sorting should be handled numerical.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$valid
global $DIC
Definition: feed.php:28