ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilADTDateSearchBridgeSingle Class Reference
+ Inheritance diagram for ilADTDateSearchBridgeSingle:
+ Collaboration diagram for ilADTDateSearchBridgeSingle:

Public Member Functions

 setTextInputMode ($a_value)
 
 loadFilter ()
 Load filter value(s) into ADT. More...
 
 addToForm ()
 Add ADT-specific fields to form. More...
 
 importFromPost (array $a_post=null)
 Import values from (search) form request POST data. More...
 
 getSQLCondition ($a_element_id)
 Get SQL condition for current value(s) More...
 
 isInCondition (ilADTDate $a_adt)
 
 getSerializedValue ()
 Get current value(s) in serialized form (for easy persisting) More...
 
 setSerializedValue ($a_value)
 Set current value(s) in serialized form (for easy persisting) More...
 
- Public Member Functions inherited from ilADTSearchBridgeSingle
 getADT ()
 Get ADT. More...
 
 isNull ()
 Is null ? More...
 
 isValid ()
 
 validate ()
 Validate current data. More...
 
- Public Member Functions inherited from ilADTSearchBridge
 __construct (ilADTDefinition $a_adt_def)
 Constructor. More...
 
 isNull ()
 Is null ? More...
 
 setForm (ilPropertyFormGUI $a_form)
 Set form. More...
 
 getForm ()
 Get form. More...
 
 setElementId ($a_value)
 Set element id (aka form field) More...
 
 getElementId ()
 Get element id. More...
 
 setTitle ($a_value)
 Set title (aka form field caption) More...
 
 getTitle ()
 Get title. More...
 
 setTableGUI (ilTable2GUI $a_table)
 Set table gui (for filter mode) More...
 
 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)
 Import values from (search) form request POST data. More...
 
 validate ()
 Validate current data. More...
 
 getSQLCondition ($a_element_id)
 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 ($a_value)
 Set current value(s) in serialized form (for easy persisting) More...
 

Protected Member Functions

 isValidADTDefinition (ilADTDefinition $a_adt_def)
 Check if given ADT definition is valid. More...
 
 shouldBeImportedFromPost (array $a_post)
 
- Protected Member Functions inherited from ilADTSearchBridgeSingle
 setDefinition (ilADTDefinition $a_adt_def)
 Set ADT definition. More...
 
- Protected Member Functions inherited from ilADTSearchBridge
 isValidADTDefinition (ilADTDefinition $a_adt_def)
 Check if given ADT definition is valid. More...
 
 setDefinition (ilADTDefinition $a_adt_def)
 Set ADT definition. More...
 
 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 ($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...
 

Protected Attributes

 $text_input
 
- Protected Attributes inherited from ilADTSearchBridgeSingle
 $adt
 
- Protected Attributes inherited from ilADTSearchBridge
 $form
 
 $table_gui
 
 $table_filter_fields
 
 $id
 
 $title
 
 $info
 

Detailed Description

Definition at line 5 of file class.ilADTDateSearchBridgeSingle.php.

Member Function Documentation

◆ addToForm()

ilADTDateSearchBridgeSingle::addToForm ( )

Add ADT-specific fields to form.

Reimplemented from ilADTSearchBridge.

Definition at line 34 of file class.ilADTDateSearchBridgeSingle.php.

35 {
36 global $lng;
37
38 $adt_date = $this->getADT()->getDate();
39
40 $date = new ilDateTimeInputGUI($this->getTitle(), $this->getElementId());
41 $date->setShowTime(false);
42
43 if(!(bool)$this->text_input)
44 {
45 $checked = !(!$adt_date || $adt_date->isNull());
46 $date->enableDateActivation($lng->txt("enabled"), $this->addToElementId("tgl"), $checked);
47 }
48 else
49 {
50 $date->setMode(ilDateTimeInputGUI::MODE_INPUT);
51 }
52
53 $date->setDate($adt_date);
54
55 $this->addToParentElement($date);
56 }
addToElementId($a_add)
Add sub-element.
addToParentElement(ilFormPropertyGUI $a_field)
Add form field to parent element.
getElementId()
Get element id.
This class represents a date/time property in a property form.
global $lng
Definition: privfeed.php:40

References $lng, ilADTSearchBridge\addToElementId(), ilADTSearchBridge\addToParentElement(), ilADTSearchBridgeSingle\getADT(), ilADTSearchBridge\getElementId(), ilADTSearchBridge\getTitle(), and ilDateTimeInputGUI\MODE_INPUT.

+ Here is the call graph for this function:

◆ getSerializedValue()

ilADTDateSearchBridgeSingle::getSerializedValue ( )

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

Returns
string

Reimplemented from ilADTSearchBridge.

Definition at line 132 of file class.ilADTDateSearchBridgeSingle.php.

133 {
134 if(!$this->isNull() && $this->isValid())
135 {
136 return serialize(array($this->getADT()->getDate()->get(IL_CAL_DATE)));
137 }
138 }
const IL_CAL_DATE

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

+ Here is the call graph for this function:

◆ getSQLCondition()

ilADTDateSearchBridgeSingle::getSQLCondition (   $a_element_id)

Get SQL condition for current value(s)

Parameters
string$a_element_id
Returns
string

Reimplemented from ilADTSearchBridge.

Definition at line 114 of file class.ilADTDateSearchBridgeSingle.php.

115 {
116 global $ilDB;
117
118 if(!$this->isNull() && $this->isValid())
119 {
120 return $a_element_id." = ".$ilDB->quote($this->getADT()->getDate()->get(IL_CAL_DATE), "date");
121 }
122 }
global $ilDB

References $ilDB, ilADTSearchBridgeSingle\getADT(), IL_CAL_DATE, ilADTSearchBridgeSingle\isNull(), and ilADTSearchBridgeSingle\isValid().

+ Here is the call graph for this function:

◆ importFromPost()

ilADTDateSearchBridgeSingle::importFromPost ( array  $a_post = null)

Import values from (search) form request POST data.

Returns
bool

Reimplemented from ilADTSearchBridge.

Definition at line 67 of file class.ilADTDateSearchBridgeSingle.php.

68 {
69 $post = $this->extractPostValues($a_post);
70
71 if($post && $this->shouldBeImportedFromPost($post))
72 {
73 include_once "Services/ADT/classes/class.ilADTDateSearchUtil.php";
74
75 if((bool)$this->text_input)
76 {
78 }
79 else
80 {
82 }
83
84 // :TODO: all dates are imported as valid
85
86 if($date)
87 {
88 $date = new ilDate($date, IL_CAL_UNIX);
89 }
90
91 if($this->getForm() instanceof ilPropertyFormGUI)
92 {
93 $item = $this->getForm()->getItemByPostVar($this->getElementId());
94 $item->setDate($date);
95 }
96 else if(array_key_exists($this->getElementId(), $this->table_filter_fields))
97 {
98 $this->table_filter_fields[$this->getElementId()]->setDate($date);
99 $this->writeFilter($date->get(IL_CAL_DATE));
100 }
101
102 $this->getADT()->setDate($date);
103 }
104 else
105 {
106 $this->writeFilter();
107 $this->getADT()->setDate();
108 }
109 }
const IL_CAL_UNIX
static handleTextInputPost($a_mode, $a_post)
Import text input post data.
static handleSelectInputPost($a_mode, $a_post)
Import select post data.
extractPostValues(array $a_post=null)
Extract data from (post) values.
writeFilter($a_value=null)
Write value(s) to filter store (in session)
Class for single dates.
This class represents a property form user interface.

References ilADTSearchBridge\extractPostValues(), ilADTSearchBridgeSingle\getADT(), ilADTSearchBridge\getElementId(), ilADTSearchBridge\getForm(), ilADTDateSearchUtil\handleSelectInputPost(), ilADTDateSearchUtil\handleTextInputPost(), IL_CAL_DATE, IL_CAL_UNIX, ilADTDateSearchUtil\MODE_DATE, shouldBeImportedFromPost(), and ilADTSearchBridge\writeFilter().

+ Here is the call graph for this function:

◆ isInCondition()

ilADTDateSearchBridgeSingle::isInCondition ( ilADTDate  $a_adt)

Definition at line 124 of file class.ilADTDateSearchBridgeSingle.php.

125 {
126 return $this->getADT()->equals($a_adt);
127 }

References ilADTSearchBridgeSingle\getADT().

+ Here is the call graph for this function:

◆ isValidADTDefinition()

ilADTDateSearchBridgeSingle::isValidADTDefinition ( ilADTDefinition  $a_adt_def)
protected

Check if given ADT definition is valid.

:TODO: This could be avoided with type-specifc constructors :TODO: bridge base class?

Parameters
ilADTDefinition$a_adt_def

Reimplemented from ilADTSearchBridge.

Definition at line 9 of file class.ilADTDateSearchBridgeSingle.php.

10 {
11 return ($a_adt_def instanceof ilADTDateDefinition);
12 }

◆ loadFilter()

ilADTDateSearchBridgeSingle::loadFilter ( )

Load filter value(s) into ADT.

Reimplemented from ilADTSearchBridge.

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

23 {
24 $value = $this->readFilter();
25 if($value !== null)
26 {
27 // $this->getADT()->setDate(new ilDate($value, IL_CAL_DATE));
28 }
29 }
readFilter()
Load value(s) from filter store (in session)

References ilADTSearchBridge\readFilter().

+ Here is the call graph for this function:

◆ setSerializedValue()

ilADTDateSearchBridgeSingle::setSerializedValue (   $a_value)

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

Parameters
string

Reimplemented from ilADTSearchBridge.

Definition at line 140 of file class.ilADTDateSearchBridgeSingle.php.

141 {
142 $a_value = unserialize($a_value);
143 if(is_array($a_value))
144 {
145 $this->getADT()->setDate(new ilDate($a_value[0], IL_CAL_DATE));
146 }
147 }

References ilADTSearchBridgeSingle\getADT(), and IL_CAL_DATE.

+ Here is the call graph for this function:

◆ setTextInputMode()

ilADTDateSearchBridgeSingle::setTextInputMode (   $a_value)

Definition at line 14 of file class.ilADTDateSearchBridgeSingle.php.

15 {
16 $this->text_input = (bool)$a_value;
17 }

◆ shouldBeImportedFromPost()

ilADTDateSearchBridgeSingle::shouldBeImportedFromPost ( array  $a_post)
protected

Definition at line 58 of file class.ilADTDateSearchBridgeSingle.php.

59 {
60 if(!(bool)$this->text_input)
61 {
62 return (bool)$a_post["tgl"];
63 }
64 return parent::shouldBeImportedFromPost($post);
65 }

Referenced by importFromPost().

+ Here is the caller graph for this function:

Field Documentation

◆ $text_input

ilADTDateSearchBridgeSingle::$text_input
protected

Definition at line 7 of file class.ilADTDateSearchBridgeSingle.php.


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