ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilDclBooleanFieldModel.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 $where_additions = "";
32
33 $join_str
34 = "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 = "
35 . $this->db->quote($this->getId(), 'integer') . ")";
36 if ($filter_value == "checked") {
37 $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";
38 $join_str .= " AND filter_stloc_{$this->getId()}.value = " . $this->db->quote(1, 'integer');
39 } else {
40 $join_str .= "LEFT 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 $where_additions = " AND (filter_stloc_{$this->getId()}.value <> " . $this->db->quote(1, 'integer')
42 . " OR filter_stloc_{$this->getId()}.value is NULL)";
43 }
44 $join_str .= " ) ";
45
46 $sql_obj = new ilDclRecordQueryObject();
47 $sql_obj->setJoinStatement($join_str);
48 if ($where_additions) {
49 $sql_obj->setWhereStatement($where_additions);
50 }
51
52 return $sql_obj;
53 }
54
55
59 public function checkValidityFromForm(ilPropertyFormGUI &$form, ?int $record_id): void
60 {
61 $value = $form->getInput('field_' . $this->getId());
62
63 //value from the form comes as string
64 if (!is_numeric($value) && $value != '') {
66 }
67
68 //field is of type boolean (see ilDcldatatype::INPUTFORMAT_BOOLEAN)
69 parent::checkValidity((int) $value, $record_id);
70 }
71}
getRecordQueryFilterObject( $filter_value="", ?ilDclBaseFieldModel $sort_field=null)
Returns a query-object for building the record-loader-sql-query.
checkValidityFromForm(ilPropertyFormGUI &$form, ?int $record_id)
This class represents a property form user interface.
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...