ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilADTSearchBridge Class Reference

ADT search bridge base class. More...

+ Inheritance diagram for ilADTSearchBridge:
+ Collaboration diagram for ilADTSearchBridge:

Public Member Functions

 __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...
 
 addToFilterForm ()
 Add ADT-specific fields to filter. 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...
 

Data Fields

const SQL_STRICT = 1
 
const SQL_LIKE = 2
 
const SQL_LIKE_END = 3
 
const SQL_LIKE_START = 4
 
const DEFAULT_SEARCH_COLUMN = 'value'
 

Protected Member Functions

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

Protected Attributes

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

ADT search bridge base class.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 28 of file class.ilADTSearchBridge.php.

Constructor & Destructor Documentation

◆ __construct()

ilADTSearchBridge::__construct ( ilADTDefinition  $a_adt_def)

Reimplemented in ilADTLocationSearchBridgeSingle.

Definition at line 47 of file class.ilADTSearchBridge.php.

48 {
49 global $DIC;
50 $this->setDefinition($a_adt_def);
51
52 $this->lng = $DIC->language();
53 $this->db = $DIC->database();
54 $this->http = $DIC->http();
55 }
setDefinition(ilADTDefinition $a_adt_def)
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and setDefinition().

+ Here is the call graph for this function:

Member Function Documentation

◆ addToElementId()

ilADTSearchBridge::addToElementId ( string  $a_add)
protected

Add sub-element.

Parameters
string$a_add
Returns
string

Definition at line 185 of file class.ilADTSearchBridge.php.

185 : string
186 {
187 return $this->getElementId() . "[" . $a_add . "]";
188 }

References getElementId().

Referenced by ilADTDateSearchBridgeRange\addToForm(), ilADTDateTimeSearchBridgeRange\addToForm(), ilADTLocationSearchBridgeSingle\addToForm(), ilADTLocationSearchBridgeSingle\importFromPost(), and ilADTSearchBridgeRange\validate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addToFilterForm()

ilADTSearchBridge::addToFilterForm ( )

Add ADT-specific fields to filter.

This needs to be separated from other forms to avoid weird js interactions, but can probably be dropped when moving to KS (see #39225).

Reimplemented in ilADTLocalizedTextSearchBridgeSingle, and ilADTTextSearchBridgeSingle.

Definition at line 200 of file class.ilADTSearchBridge.php.

200 : void
201 {
202 $this->addToForm();
203 }
addToForm()
Add ADT-specific fields to form.

References addToForm().

+ Here is the call graph for this function:

◆ addToForm()

◆ addToParentElement()

ilADTSearchBridge::addToParentElement ( ilFormPropertyGUI  $a_field)
protected

Add form field to parent element.

Parameters
ilFormPropertyGUI$a_field

Definition at line 167 of file class.ilADTSearchBridge.php.

167 : void
168 {
169 if ($this->getForm() instanceof ilPropertyFormGUI) {
170 $this->getForm()->addItem($a_field);
171 } elseif (
172 $this->getTableGUI() instanceof ilTable2GUI &&
173 $a_field instanceof ilTableFilterItem
174 ) {
175 $this->table_filter_fields[$a_field->getFieldId()] = $a_field;
176 $this->getTableGUI()->addFilterItem($a_field);
177 }
178 }
This class represents a property form user interface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ilFormPropertyGUI\getFieldId(), getForm(), and getTableGUI().

Referenced by ilADTTextSearchBridgeSingle\addTextInputToForm(), ilADTDateSearchBridgeRange\addToForm(), ilADTDateSearchBridgeSingle\addToForm(), ilADTDateTimeSearchBridgeRange\addToForm(), ilADTDateTimeSearchBridgeSingle\addToForm(), ilADTEnumSearchBridgeMulti\addToForm(), ilADTEnumSearchBridgeSingle\addToForm(), ilADTExternalLinkSearchBridgeSingle\addToForm(), ilADTFloatSearchBridgeSingle\addToForm(), ilADTIntegerSearchBridgeSingle\addToForm(), ilADTInternalLinkSearchBridgeSingle\addToForm(), and ilADTLocationSearchBridgeSingle\addToForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ extractPostValues()

ilADTSearchBridge::extractPostValues ( ?array  $a_post = null)
protected

Extract data from (post) values.

Parameters
array$a_post
Returns
mixed

Definition at line 220 of file class.ilADTSearchBridge.php.

221 {
222 $element_id = $this->getElementId();
223 $multi = strpos($this->getElementId(), "[");
224
225 // get rid of this case
226 if ($a_post === null) {
227 $a_post = $this->http->request()->getParsedBody();
228 if ($multi !== false) {
229 $post = $a_post[substr($element_id, 0, $multi)][substr($element_id, $multi + 1, -1)] ?? null;
230 } else {
231 $post = $a_post[$element_id] ?? null;
232 }
233 } elseif ($multi !== false) {
234 $post = $a_post[substr($element_id, $multi + 1, -1)] ?? null;
235 } else {
236 $post = $a_post[$element_id] ?? null;
237 }
238 return $post;
239 }
$post
Definition: ltitoken.php:46

References $post, getElementId(), and ILIAS\FileDelivery\http().

Referenced by ilADTDateSearchBridgeRange\importFromPost(), ilADTDateSearchBridgeSingle\importFromPost(), ilADTDateTimeSearchBridgeRange\importFromPost(), ilADTDateTimeSearchBridgeSingle\importFromPost(), ilADTEnumSearchBridgeMulti\importFromPost(), ilADTEnumSearchBridgeSingle\importFromPost(), ilADTExternalLinkSearchBridgeSingle\importFromPost(), ilADTFloatSearchBridgeSingle\importFromPost(), ilADTIntegerSearchBridgeSingle\importFromPost(), ilADTInternalLinkSearchBridgeSingle\importFromPost(), ilADTLocalizedTextSearchBridgeSingle\importFromPost(), ilADTLocationSearchBridgeSingle\importFromPost(), and ilADTTextSearchBridgeSingle\importFromPost().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getElementId()

◆ getForm()

◆ getSearchColumn()

ilADTSearchBridge::getSearchColumn ( )

Reimplemented in ilADTEnumSearchBridgeMulti, and ilADTEnumSearchBridgeSingle.

Definition at line 93 of file class.ilADTSearchBridge.php.

93 : string
94 {
96 }

References DEFAULT_SEARCH_COLUMN.

◆ getSerializedValue()

◆ getSQLCondition()

◆ getTableGUI()

ilADTSearchBridge::getTableGUI ( )

Get table gui.

Definition at line 106 of file class.ilADTSearchBridge.php.

106 : ?ilTable2GUI
107 {
108 return $this->table_gui;
109 }

References $table_gui.

Referenced by addToParentElement().

+ Here is the caller graph for this function:

◆ getTitle()

◆ importFromPost()

◆ isInCondition()

ilADTSearchBridge::isInCondition ( ilADT  $a_adt)

◆ isNull()

ilADTSearchBridge::isNull ( )
abstract

◆ isValidADTDefinition()

◆ loadFilter()

◆ readFilter()

ilADTSearchBridge::readFilter ( )
protected

Load value(s) from filter store (in session)

Returns

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

141 {
142 if (!$this->table_gui instanceof ilTable2GUI) {
143 return null;
144 }
145 /*
146 * BT 35593: changes in ilFormPropertyGUI::clearFromSession make it necessary
147 * to have a flat array of all the filter inputs in the session.
148 */
149 $value = ilSession::get(
150 "form_" . $this->table_gui->getId() . "_" . $this->getElementId()
151 ) ?? '';
152 if ($value) {
153 return unserialize($value);
154 }
155 return '';
156 }
static get(string $a_var)

References ilSession\get().

Referenced by ilADTDateSearchBridgeRange\loadFilter(), ilADTDateSearchBridgeSingle\loadFilter(), ilADTDateTimeSearchBridgeRange\loadFilter(), ilADTDateTimeSearchBridgeSingle\loadFilter(), ilADTEnumSearchBridgeMulti\loadFilter(), ilADTEnumSearchBridgeSingle\loadFilter(), ilADTExternalLinkSearchBridgeSingle\loadFilter(), ilADTFloatSearchBridgeSingle\loadFilter(), ilADTIntegerSearchBridgeSingle\loadFilter(), ilADTInternalLinkSearchBridgeSingle\loadFilter(), ilADTLocalizedTextSearchBridgeSingle\loadFilter(), ilADTLocationSearchBridgeSingle\loadFilter(), and ilADTTextSearchBridgeSingle\loadFilter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDefinition()

ilADTSearchBridge::setDefinition ( ilADTDefinition  $a_adt_def)
abstractprotected

Reimplemented in ilADTSearchBridgeMulti, ilADTSearchBridgeRange, and ilADTSearchBridgeSingle.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setElementId()

ilADTSearchBridge::setElementId ( string  $a_value)

Definition at line 73 of file class.ilADTSearchBridge.php.

73 : void
74 {
75 $this->id = $a_value;
76 }

◆ setForm()

ilADTSearchBridge::setForm ( ilPropertyFormGUI  $a_form)

Definition at line 63 of file class.ilADTSearchBridge.php.

63 : void
64 {
65 $this->form = $a_form;
66 }
form( $class_path, string $cmd, string $submit_caption="")

References ILIAS\Repository\form().

+ Here is the call graph for this function:

◆ setSerializedValue()

◆ setTableGUI()

ilADTSearchBridge::setTableGUI ( ilTable2GUI  $a_table)

Definition at line 98 of file class.ilADTSearchBridge.php.

98 : void
99 {
100 $this->table_gui = $a_table;
101 }

◆ setTitle()

ilADTSearchBridge::setTitle ( string  $a_value)

Definition at line 83 of file class.ilADTSearchBridge.php.

83 : void
84 {
85 $this->title = trim($a_value);
86 }

◆ shouldBeImportedFromPost()

◆ validate()

ilADTSearchBridge::validate ( )
abstract

Validate current data.

Returns
bool

Reimplemented in ilADTSearchBridgeRange, and ilADTSearchBridgeSingle.

◆ writeFilter()

ilADTSearchBridge::writeFilter (   $a_value = null)
protected

Write value(s) to filter store (in session)

Parameters
?$a_value

Definition at line 115 of file class.ilADTSearchBridge.php.

115 : void
116 {
117 if (!$this->table_gui instanceof ilTable2GUI) {
118 return;
119 }
120 /*
121 * BT 35593: changes in ilFormPropertyGUI::clearFromSession make it necessary
122 * to have a flat array for all the filter inputs in the session.
123 */
124 if ($a_value !== null) {
126 "form_" . $this->table_gui->getId() . "_" . $this->getElementId(),
127 serialize($a_value)
128 );
129 } else {
131 "form_" . $this->table_gui->getId() . "_" . $this->getElementId()
132 );
133 }
134 }
static clear(string $a_var)
static set(string $a_var, $a_val)
Set a value.

References ilSession\clear(), and ilSession\set().

Referenced by ilADTDateSearchBridgeRange\importFromPost(), ilADTDateSearchBridgeSingle\importFromPost(), ilADTDateTimeSearchBridgeRange\importFromPost(), ilADTDateTimeSearchBridgeSingle\importFromPost(), ilADTEnumSearchBridgeMulti\importFromPost(), ilADTEnumSearchBridgeSingle\importFromPost(), ilADTExternalLinkSearchBridgeSingle\importFromPost(), ilADTInternalLinkSearchBridgeSingle\importFromPost(), ilADTLocalizedTextSearchBridgeSingle\importFromPost(), and ilADTTextSearchBridgeSingle\importFromPost().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilDBInterface ilADTSearchBridge::$db
protected

Definition at line 44 of file class.ilADTSearchBridge.php.

◆ $form

ilPropertyFormGUI ilADTSearchBridge::$form = null
protected

Definition at line 36 of file class.ilADTSearchBridge.php.

Referenced by getForm().

◆ $http

HttpServices ilADTSearchBridge::$http
protected

Definition at line 45 of file class.ilADTSearchBridge.php.

◆ $id

string ilADTSearchBridge::$id = ''
protected

Definition at line 39 of file class.ilADTSearchBridge.php.

Referenced by getElementId().

◆ $info

string ilADTSearchBridge::$info = ''
protected

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

◆ $lng

ilLanguage ilADTSearchBridge::$lng
protected

Definition at line 43 of file class.ilADTSearchBridge.php.

◆ $table_filter_fields

array ilADTSearchBridge::$table_filter_fields = []
protected

Definition at line 38 of file class.ilADTSearchBridge.php.

◆ $table_gui

ilTable2GUI ilADTSearchBridge::$table_gui = null
protected

Definition at line 37 of file class.ilADTSearchBridge.php.

Referenced by getTableGUI().

◆ $title

◆ DEFAULT_SEARCH_COLUMN

const ilADTSearchBridge::DEFAULT_SEARCH_COLUMN = 'value'

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

Referenced by getSearchColumn().

◆ SQL_LIKE

const ilADTSearchBridge::SQL_LIKE = 2

◆ SQL_LIKE_END

const ilADTSearchBridge::SQL_LIKE_END = 3

◆ SQL_LIKE_START

const ilADTSearchBridge::SQL_LIKE_START = 4

◆ SQL_STRICT

const ilADTSearchBridge::SQL_STRICT = 1

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