ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilADTDateTimeSearchBridgeSingle Class Reference
+ Inheritance diagram for ilADTDateTimeSearchBridgeSingle:
+ Collaboration diagram for ilADTDateTimeSearchBridgeSingle:

Public Member Functions

 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 (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...
 
- 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 ($a_post)
 Check if incoming values should be imported at all. More...
 
- 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...
 

Additional Inherited Members

- 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.ilADTDateTimeSearchBridgeSingle.php.

Member Function Documentation

◆ addToForm()

ilADTDateTimeSearchBridgeSingle::addToForm ( )

Add ADT-specific fields to form.

Reimplemented from ilADTSearchBridge.

Definition at line 27 of file class.ilADTDateTimeSearchBridgeSingle.php.

28 {
29 global $lng;
30
31 $adt_date = $this->getADT()->getDate();
32
33 $date = new ilDateTimeInputGUI($this->getTitle(), $this->getElementId());
34 $date->setShowTime(true);
35
36 $date->setDate($adt_date);
37
38 $this->addToParentElement($date);
39 }
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:17

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

+ Here is the call graph for this function:

◆ getSerializedValue()

ilADTDateTimeSearchBridgeSingle::getSerializedValue ( )

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

Returns
string

Reimplemented from ilADTSearchBridge.

Definition at line 102 of file class.ilADTDateTimeSearchBridgeSingle.php.

103 {
104 if(!$this->isNull() && $this->isValid())
105 {
106 return serialize(array($this->getADT()->getDate()->get(IL_CAL_DATETIME)));
107 }
108 }
const IL_CAL_DATETIME

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

+ Here is the call graph for this function:

◆ getSQLCondition()

ilADTDateTimeSearchBridgeSingle::getSQLCondition (   $a_element_id)

Get SQL condition for current value(s)

Parameters
string$a_element_id
Returns
string

Reimplemented from ilADTSearchBridge.

Definition at line 82 of file class.ilADTDateTimeSearchBridgeSingle.php.

83 {
84 global $ilDB;
85
86 if(!$this->isNull() && $this->isValid())
87 {
88 return $a_element_id." = ".$ilDB->quote($this->getADT()->getDate()->get(IL_CAL_DATETIME), "timestamp");
89 }
90 }
global $ilDB

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

+ Here is the call graph for this function:

◆ importFromPost()

ilADTDateTimeSearchBridgeSingle::importFromPost ( array  $a_post = null)

Import values from (search) form request POST data.

Returns
bool

Reimplemented from ilADTSearchBridge.

Definition at line 50 of file class.ilADTDateTimeSearchBridgeSingle.php.

51 {
52 $post = $this->extractPostValues($a_post);
53
54 if($post && $this->shouldBeImportedFromPost($post))
55 {
56 include_once "Services/Calendar/classes/class.ilCalendarUtil.php";
57 $date = ilCalendarUtil::parseIncomingDate($post, 1);
58
59 if($this->getForm() instanceof ilPropertyFormGUI)
60 {
61 $item = $this->getForm()->getItemByPostVar($this->getElementId());
62 $item->setDate($date);
63 }
64 else if(array_key_exists($this->getElementId(), $this->table_filter_fields))
65 {
66 $this->table_filter_fields[$this->getElementId()]->setDate($date);
67 $this->writeFilter($date->get(IL_CAL_DATETIME));
68 }
69
70 $this->getADT()->setDate($date);
71 }
72 else
73 {
74 $this->writeFilter();
75 $this->getADT()->setDate();
76 }
77 }
shouldBeImportedFromPost($a_post)
Check if incoming values should be imported at all.
extractPostValues(array $a_post=null)
Extract data from (post) values.
writeFilter($a_value=null)
Write value(s) to filter store (in session)
static parseIncomingDate($a_value, $a_add_time=null)
Try to parse incoming value to date object.
This class represents a property form user interface.

References ilADTSearchBridge\extractPostValues(), ilADTSearchBridgeSingle\getADT(), ilADTSearchBridge\getElementId(), ilADTSearchBridge\getForm(), IL_CAL_DATETIME, ilCalendarUtil\parseIncomingDate(), shouldBeImportedFromPost(), and ilADTSearchBridge\writeFilter().

+ Here is the call graph for this function:

◆ isInCondition()

ilADTDateTimeSearchBridgeSingle::isInCondition ( ilADT  $a_adt)

Compare directly against ADT.

Parameters
ilADT$a_adt
Returns
boolean

Reimplemented from ilADTSearchBridge.

Definition at line 92 of file class.ilADTDateTimeSearchBridgeSingle.php.

93 {
94 assert($a_adt instanceof ilADTDateTime);
95
96 return $this->getADT()->equals($a_adt);
97 }

References ilADTSearchBridgeSingle\getADT().

+ Here is the call graph for this function:

◆ isValidADTDefinition()

ilADTDateTimeSearchBridgeSingle::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 7 of file class.ilADTDateTimeSearchBridgeSingle.php.

8 {
9 return ($a_adt_def instanceof ilADTDateTimeDefinition);
10 }

◆ loadFilter()

ilADTDateTimeSearchBridgeSingle::loadFilter ( )

Load filter value(s) into ADT.

Reimplemented from ilADTSearchBridge.

Definition at line 15 of file class.ilADTDateTimeSearchBridgeSingle.php.

16 {
17 $value = $this->readFilter();
18 if($value !== null)
19 {
20 $this->getADT()->setDate(new ilDateTime($value, IL_CAL_DATETIME));
21 }
22 }
readFilter()
Load value(s) from filter store (in session)
@classDescription Date and time handling

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

+ Here is the call graph for this function:

◆ setSerializedValue()

ilADTDateTimeSearchBridgeSingle::setSerializedValue (   $a_value)

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

Parameters
string

Reimplemented from ilADTSearchBridge.

Definition at line 110 of file class.ilADTDateTimeSearchBridgeSingle.php.

111 {
112 $a_value = unserialize($a_value);
113 if(is_array($a_value))
114 {
115 $this->getADT()->setDate(new ilDateTime($a_value[0], IL_CAL_DATETIME));
116 }
117 }

References ilADTSearchBridgeSingle\getADT(), and IL_CAL_DATETIME.

+ Here is the call graph for this function:

◆ shouldBeImportedFromPost()

ilADTDateTimeSearchBridgeSingle::shouldBeImportedFromPost (   $a_post)
protected

Check if incoming values should be imported at all.

Parameters
mixed$a_post
Returns
bool

Reimplemented from ilADTSearchBridge.

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

42 {
43 if(!(bool)$this->text_input)
44 {
45 return (bool)$a_post["tgl"];
46 }
47 return parent::shouldBeImportedFromPost($a_post);
48 }

Referenced by importFromPost().

+ Here is the caller graph for this function:

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