ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
class.ilADTFloatSearchBridgeSingle.php
Go to the documentation of this file.
1<?php
2
3require_once "Services/ADT/classes/Bridges/class.ilADTSearchBridgeSingle.php";
4
6{
7 protected function isValidADTDefinition(ilADTDefinition $a_adt_def)
8 {
9 return ($a_adt_def instanceof ilADTFloatDefinition);
10 }
11
12
13 // form
14
15 public function addToForm()
16 {
17 $def = $this->getADT()->getCopyOfDefinition();
18
19 $number = new ilNumberInputGUI($this->getTitle(), $this->getElementId());
20 $number->setSize(10);
21 $number->setDecimals($def->getDecimals());
22
23 $min = $def->getMin();
24 if($min !== null)
25 {
26 $number->setMinValue($min);
27 }
28
29 $max = $def->getMax();
30 if($max !== null)
31 {
32 $number->setMaxValue($max);
33
34 $length = strlen($max);
35 $number->setSize($length);
36 $number->setMaxLength($length);
37 }
38
39 $this->addToParentElement($number);
40 }
41
42 public function importFromPost(array $a_post = null)
43 {
44 $post = $this->extractPostValues($a_post);
45
46 if($post && $this->shouldBeImportedFromPost($post))
47 {
48 $item = $this->getForm()->getItemByPostVar($this->getElementId());
49 $item->setValue($post);
50
51 $this->getADT()->setNumber($post);
52 }
53 else
54 {
55 $this->getADT()->setNumber();
56 }
57 }
58
59
60 // db
61
62 public function getSQLCondition($a_element_id)
63 {
64 global $ilDB;
65
66 if(!$this->isNull() && $this->isValid())
67 {
68 return $a_element_id." = ".$ilDB->quote($this->getADT()->getNumber(), "float");
69 }
70 }
71
72 public function isInCondition(ilADTFloat $a_adt)
73 {
74 return $this->getADT()->equals($a_adt);
75 }
76}
77
78?>
ADT definition base class.
addToForm()
Add ADT-specific fields to form.
isValidADTDefinition(ilADTDefinition $a_adt_def)
Check if given ADT definition is valid.
importFromPost(array $a_post=null)
Import values from (search) form request POST data.
getSQLCondition($a_element_id)
Get SQL condition for current value(s)
extractPostValues(array $a_post=null)
Extract data from (post) values.
addToParentElement(ilFormPropertyGUI $a_field)
Add form field to parent element.
getElementId()
Get element id.
shouldBeImportedFromPost($a_post)
Check if incoming values should be imported at all.
This class represents a number property in a property form.
global $ilDB