ILIAS  release_8 Revision v8.24
ilADTIntegerSearchBridgeSingle Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilADTIntegerSearchBridgeSingle:
+ Collaboration diagram for ilADTIntegerSearchBridgeSingle:

Public Member Functions

 loadFilter ()
 Load filter value(s) into ADT. More...
 
 addToForm ()
 Add ADT-specific fields to form. More...
 
 importFromPost (array $a_post=null)
 
 getSQLCondition (string $a_element_id, int $mode=self::SQL_LIKE, array $quotedWords=[])
 Get SQL condition for current value(s) More...
 
 isInCondition (ilADT $a_adt)
 Compare directly against ADT. More...
 
 getSerializedValue ()
 Get current value(s) in serialized form (for easy persisting) More...
 
 setSerializedValue (string $a_value)
 Set current value(s) in serialized form (for easy persisting) More...
 
- Public Member Functions inherited from ilADTSearchBridgeSingle
 getADT ()
 Get ADT. More...
 
 isNull ()
 
 isValid ()
 
 validate ()
 Validate current data. More...
 
- Public Member Functions inherited from ilADTSearchBridge
 __construct (ilADTDefinition $a_adt_def)
 
 isNull ()
 
 setForm (ilPropertyFormGUI $a_form)
 
 getForm ()
 
 setElementId (string $a_value)
 
 getElementId ()
 
 setTitle (string $a_value)
 
 getTitle ()
 
 getSearchColumn ()
 
 setTableGUI (ilTable2GUI $a_table)
 
 getTableGUI ()
 Get table gui. More...
 
 loadFilter ()
 Load filter value(s) into ADT. More...
 
 addToForm ()
 Add ADT-specific fields to form. More...
 
 importFromPost (array $a_post=null)
 
 validate ()
 Validate current data. More...
 
 getSQLCondition (string $a_element_id, int $mode=self::SQL_LIKE, array $quotedWords=[])
 Get SQL condition for current value(s) More...
 
 isInCondition (ilADT $a_adt)
 Compare directly against ADT. More...
 
 getSerializedValue ()
 Get current value(s) in serialized form (for easy persisting) More...
 
 setSerializedValue (string $a_value)
 Set current value(s) in serialized form (for easy persisting) More...
 

Protected Member Functions

 isValidADTDefinition (ilADTDefinition $a_adt_def)
 
- Protected Member Functions inherited from ilADTSearchBridgeSingle
 setDefinition (ilADTDefinition $a_adt_def)
 
- Protected Member Functions inherited from ilADTSearchBridge
 isValidADTDefinition (ilADTDefinition $a_adt_def)
 
 setDefinition (ilADTDefinition $a_adt_def)
 
 writeFilter ($a_value=null)
 Write value(s) to filter store (in session) More...
 
 readFilter ()
 Load value(s) from filter store (in session) More...
 
 addToParentElement (ilFormPropertyGUI $a_field)
 Add form field to parent element. More...
 
 addToElementId (string $a_add)
 Add sub-element. More...
 
 shouldBeImportedFromPost ($a_post)
 Check if incoming values should be imported at all. More...
 
 extractPostValues (array $a_post=null)
 Extract data from (post) values. More...
 

Additional Inherited Members

- Data Fields inherited from ilADTSearchBridge
const SQL_STRICT = 1
 
const SQL_LIKE = 2
 
const SQL_LIKE_END = 3
 
const SQL_LIKE_START = 4
 
const DEFAULT_SEARCH_COLUMN = 'value'
 
- Protected Attributes inherited from ilADTSearchBridgeSingle
ilADT $adt
 
- Protected Attributes inherited from ilADTSearchBridge
ilPropertyFormGUI $form = null
 
ilTable2GUI $table_gui = null
 
array $table_filter_fields = []
 
string $id = ''
 
string $title = ''
 
string $info = ''
 
ilLanguage $lng
 
ilDBInterface $db
 
HttpServices $http
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Definition at line 22 of file class.ilADTIntegerSearchBridgeSingle.php.

Member Function Documentation

◆ addToForm()

ilADTIntegerSearchBridgeSingle::addToForm ( )

Add ADT-specific fields to form.

Reimplemented from ilADTSearchBridge.

Definition at line 41 of file class.ilADTIntegerSearchBridgeSingle.php.

41 : void
42 {
43 $def = $this->getADT()->getCopyOfDefinition();
44
45 $number = new ilNumberInputGUI($this->getTitle(), $this->getElementId());
46 $number->setSize(10);
47
48 $min = $def->getMin();
49 // do not set min value for search
50 if ($min !== null) {
51 //$number->setMinValue($min);
52 }
53 $max = $def->getMax();
54 // do not set min value for search
55 if ($max !== null) {
56 #$number->setMaxValue($max);
57 #$length = strlen((string) $max);
58 #$number->setSize($length);
59 #$number->setMaxLength($length);
60 }
61 $number->setValue((string) $this->getADT()->getNumber());
62 $this->addToParentElement($number);
63 }
addToParentElement(ilFormPropertyGUI $a_field)
Add form field to parent element.
This class represents a number property in a property form.

References ilADTSearchBridge\addToParentElement(), ilADTSearchBridgeSingle\getADT(), ilADTSearchBridge\getElementId(), and ilADTSearchBridge\getTitle().

+ Here is the call graph for this function:

◆ getSerializedValue()

ilADTIntegerSearchBridgeSingle::getSerializedValue ( )

Get current value(s) in serialized form (for easy persisting)

Reimplemented from ilADTSearchBridge.

Definition at line 99 of file class.ilADTIntegerSearchBridgeSingle.php.

99 : string
100 {
101 if (!$this->isNull() && $this->isValid()) {
102 return serialize(array($this->getADT()->getNumber()));
103 }
104 return '';
105 }

References ilADTSearchBridgeSingle\getADT(), ilADTSearchBridgeSingle\isNull(), and ilADTSearchBridgeSingle\isValid().

+ Here is the call graph for this function:

◆ getSQLCondition()

ilADTIntegerSearchBridgeSingle::getSQLCondition ( string  $a_element_id,
int  $mode = self::SQL_LIKE,
array  $quotedWords = [] 
)

Get SQL condition for current value(s)

Reimplemented from ilADTSearchBridge.

Definition at line 81 of file class.ilADTIntegerSearchBridgeSingle.php.

81 : string
82 {
83 if (!$this->isNull() && $this->isValid()) {
84 return $a_element_id . " = " . $this->db->quote($this->getADT()->getNumber(), "integer");
85 }
86 return '';
87 }

References ilADTSearchBridgeSingle\getADT(), ilADTSearchBridgeSingle\isNull(), and ilADTSearchBridgeSingle\isValid().

+ Here is the call graph for this function:

◆ importFromPost()

ilADTIntegerSearchBridgeSingle::importFromPost ( array  $a_post = null)
Todo:
make post required

Reimplemented from ilADTSearchBridge.

Definition at line 65 of file class.ilADTIntegerSearchBridgeSingle.php.

65 : bool
66 {
67 $post = $this->extractPostValues($a_post);
68
69 if ($post && $this->shouldBeImportedFromPost($post)) {
70 $item = $this->getForm()->getItemByPostVar($this->getElementId());
71 $item->setValue($post);
72 $this->getADT()->setNumber($post);
73 } else {
74 $this->getADT()->setNumber();
75 }
76 return true;
77 }
extractPostValues(array $a_post=null)
Extract data from (post) values.
shouldBeImportedFromPost($a_post)
Check if incoming values should be imported at all.
$post
Definition: ltitoken.php:49

References $post, ilADTSearchBridge\extractPostValues(), ilADTSearchBridgeSingle\getADT(), ilADTSearchBridge\getElementId(), ilADTSearchBridge\getForm(), and ilADTSearchBridge\shouldBeImportedFromPost().

+ Here is the call graph for this function:

◆ isInCondition()

ilADTIntegerSearchBridgeSingle::isInCondition ( ilADT  $a_adt)

Compare directly against ADT.

Reimplemented from ilADTSearchBridge.

Definition at line 89 of file class.ilADTIntegerSearchBridgeSingle.php.

89 : bool
90 {
91 if ($this->getADT()->getCopyOfDefinition()->isComparableTo($a_adt)) {
92 return $this->getADT()->equals($a_adt);
93 }
94 return false;
95 }

References ilADTSearchBridgeSingle\getADT().

+ Here is the call graph for this function:

◆ isValidADTDefinition()

ilADTIntegerSearchBridgeSingle::isValidADTDefinition ( ilADTDefinition  $a_adt_def)
protected

Reimplemented from ilADTSearchBridge.

Definition at line 24 of file class.ilADTIntegerSearchBridgeSingle.php.

24 : bool
25 {
26 return ($a_adt_def instanceof ilADTIntegerDefinition);
27 }

◆ loadFilter()

ilADTIntegerSearchBridgeSingle::loadFilter ( )

Load filter value(s) into ADT.

Reimplemented from ilADTSearchBridge.

Definition at line 31 of file class.ilADTIntegerSearchBridgeSingle.php.

31 : void
32 {
33 $value = $this->readFilter();
34 if ($value !== null) {
35 $this->getADT()->setNumber($value);
36 }
37 }
readFilter()
Load value(s) from filter store (in session)

References ilADTSearchBridgeSingle\getADT(), and ilADTSearchBridge\readFilter().

+ Here is the call graph for this function:

◆ setSerializedValue()

ilADTIntegerSearchBridgeSingle::setSerializedValue ( string  $a_value)

Set current value(s) in serialized form (for easy persisting)

Reimplemented from ilADTSearchBridge.

Definition at line 107 of file class.ilADTIntegerSearchBridgeSingle.php.

107 : void
108 {
109 $a_value = unserialize($a_value);
110 if (is_array($a_value)) {
111 $this->getADT()->setNumber($a_value[0]);
112 }
113 }

References ilADTSearchBridgeSingle\getADT().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: