ILIAS  release_8 Revision v8.24
ilADTDateTimeSearchBridgeSingle 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 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)
 
 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)
 
 shouldBeImportedFromPost ($a_post)
 @inheritDoc More...
 
- 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.ilADTDateTimeSearchBridgeSingle.php.

Member Function Documentation

◆ addToForm()

ilADTDateTimeSearchBridgeSingle::addToForm ( )

Add ADT-specific fields to form.

Reimplemented from ilADTSearchBridge.

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

41 : void
42 {
43 $adt_date = $this->getADT()->getDate();
44
45 $date = new ilDateTimeInputGUI($this->getTitle(), $this->getElementId());
46 $date->setShowTime(true);
47
48 $date->setDate($adt_date);
49
50 $this->addToParentElement($date);
51 }
addToParentElement(ilFormPropertyGUI $a_field)
Add form field to parent element.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References 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)

Reimplemented from ilADTSearchBridge.

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

103 : string
104 {
105 if (!$this->isNull() && $this->isValid()) {
106 return serialize(array($this->getADT()->getDate()->get(IL_CAL_DATETIME)));
107 }
108 return '';
109 }
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 ( string  $a_element_id,
int  $mode = self::SQL_LIKE,
array  $quotedWords = [] 
)

Get SQL condition for current value(s)

Reimplemented from ilADTSearchBridge.

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

86 : string
87 {
88 if (!$this->isNull() && $this->isValid()) {
89 return $a_element_id . " = " . $this->db->quote($this->getADT()->getDate()->get(IL_CAL_DATETIME), "timestamp");
90 }
91 return '';
92 }

References 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)
Todo:
make post required

Reimplemented from ilADTSearchBridge.

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

61 : bool
62 {
63 $post = $this->extractPostValues($a_post);
64
65 if ($post && $this->shouldBeImportedFromPost($post)) {
67
68 if ($this->getForm() instanceof ilPropertyFormGUI) {
69 $item = $this->getForm()->getItemByPostVar($this->getElementId());
70 $item->setDate($date);
71 } elseif (array_key_exists($this->getElementId(), $this->table_filter_fields)) {
72 $this->table_filter_fields[$this->getElementId()]->setDate($date);
73 $this->writeFilter($date->get(IL_CAL_DATETIME));
74 }
75
76 $this->getADT()->setDate($date);
77 } else {
78 $this->writeFilter();
79 $this->getADT()->setDate();
80 }
81 return true;
82 }
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, bool $a_add_time=false)
Try to parse incoming value to date object.
This class represents a property form user interface.
$post
Definition: ltitoken.php:49

References $post, 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.

Reimplemented from ilADTSearchBridge.

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

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

References ilADTSearchBridgeSingle\getADT().

+ Here is the call graph for this function:

◆ isValidADTDefinition()

ilADTDateTimeSearchBridgeSingle::isValidADTDefinition ( ilADTDefinition  $a_adt_def)
protected

Reimplemented from ilADTSearchBridge.

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

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

◆ loadFilter()

ilADTDateTimeSearchBridgeSingle::loadFilter ( )

Load filter value(s) into ADT.

Reimplemented from ilADTSearchBridge.

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

31 : void
32 {
33 $value = $this->readFilter();
34 if ($value !== null) {
35 $this->getADT()->setDate(new ilDateTime($value, IL_CAL_DATETIME));
36 }
37 }
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 ( string  $a_value)

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

Reimplemented from ilADTSearchBridge.

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

111 : void
112 {
113 $a_value = unserialize($a_value);
114 if (is_array($a_value)) {
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

@inheritDoc

Reimplemented from ilADTSearchBridge.

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

56 : bool
57 {
58 return ($a_post['lower'] ?? false) || ($a_post['upper'] ?? false);
59 }

Referenced by importFromPost().

+ Here is the caller graph for this function:

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