ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilADTSearchBridge 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 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...
 
 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

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

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

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

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)
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.
+ 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.

References addToForm(), and getElementId().

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

185  : string
186  {
187  return $this->getElementId() . "[" . $a_add . "]";
188  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addToForm()

ilADTSearchBridge::addToForm ( )
abstract

Add ADT-specific fields to form.

Referenced by addToElementId().

+ Here is the caller graph for this function:

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

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

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

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 file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getTableGUI()
Get table gui.
+ 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 210 of file class.ilADTSearchBridge.php.

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

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

211  {
212  $element_id = $this->getElementId();
213  $multi = strpos($this->getElementId(), "[");
214 
215  // get rid of this case
216  if ($a_post === null) {
217  $a_post = $this->http->request()->getParsedBody();
218  if ($multi !== false) {
219  $post = $a_post[substr($element_id, 0, $multi)][substr($element_id, $multi + 1, -1)] ?? null;
220  } else {
221  $post = $a_post[$element_id] ?? null;
222  }
223  } elseif ($multi !== false) {
224  $post = $a_post[substr($element_id, $multi + 1, -1)] ?? null;
225  } else {
226  $post = $a_post[$element_id] ?? null;
227  }
228  return $post;
229  }
static http()
Fetches the global http state from ILIAS.
$post
Definition: ltitoken.php:49
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getElementId()

ilADTSearchBridge::getElementId ( )

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

References $id.

Referenced by addToElementId(), ilADTFloatSearchBridgeSingle\addToForm(), ilADTEnumSearchBridgeSingle\addToForm(), ilADTDateSearchBridgeSingle\addToForm(), ilADTLocalizedTextSearchBridgeSingle\addToForm(), ilADTIntegerSearchBridgeSingle\addToForm(), ilADTDateTimeSearchBridgeSingle\addToForm(), ilADTTextSearchBridgeSingle\addToForm(), ilADTDateSearchBridgeRange\addToForm(), ilADTDateTimeSearchBridgeRange\addToForm(), ilADTExternalLinkSearchBridgeSingle\addToForm(), ilADTInternalLinkSearchBridgeSingle\addToForm(), ilADTLocationSearchBridgeSingle\addToForm(), ilADTEnumSearchBridgeMulti\addToForm(), extractPostValues(), ilADTFloatSearchBridgeSingle\importFromPost(), ilADTEnumSearchBridgeSingle\importFromPost(), ilADTLocalizedTextSearchBridgeSingle\importFromPost(), ilADTTextSearchBridgeSingle\importFromPost(), ilADTDateSearchBridgeSingle\importFromPost(), ilADTExternalLinkSearchBridgeSingle\importFromPost(), ilADTDateTimeSearchBridgeSingle\importFromPost(), ilADTIntegerSearchBridgeSingle\importFromPost(), ilADTInternalLinkSearchBridgeSingle\importFromPost(), ilADTEnumSearchBridgeMulti\importFromPost(), ilADTLocationSearchBridgeSingle\importFromPost(), ilADTDateSearchBridgeRange\importFromPost(), ilADTDateTimeSearchBridgeRange\importFromPost(), readFilter(), ilADTSearchBridgeSingle\validate(), and writeFilter().

78  : string
79  {
80  return $this->id;
81  }
+ Here is the caller graph for this function:

◆ getForm()

◆ getSearchColumn()

ilADTSearchBridge::getSearchColumn ( )

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

93  : string
94  {
95  return self::DEFAULT_SEARCH_COLUMN;
96  }

◆ getSerializedValue()

ilADTSearchBridge::getSerializedValue ( )
abstract

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

Referenced by ilAdvancedMDFieldDefinition\getSearchValueSerialized(), and isInCondition().

+ Here is the caller graph for this function:

◆ getSQLCondition()

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

◆ getTableGUI()

ilADTSearchBridge::getTableGUI ( )

Get table gui.

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

References $table_gui.

Referenced by addToParentElement().

106  : ?ilTable2GUI
107  {
108  return $this->table_gui;
109  }
+ Here is the caller graph for this function:

◆ getTitle()

◆ importFromPost()

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

Referenced by extractPostValues().

+ Here is the caller graph for this function:

◆ isInCondition()

ilADTSearchBridge::isInCondition ( ilADT  $a_adt)

Compare directly against ADT.

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

References getSerializedValue(), and setSerializedValue().

259  : bool
260  {
261  return false;
262  }
+ Here is the call graph for this function:

◆ isNull()

ilADTSearchBridge::isNull ( )
abstract

Referenced by __construct().

+ Here is the caller graph for this function:

◆ isValidADTDefinition()

ilADTSearchBridge::isValidADTDefinition ( ilADTDefinition  $a_adt_def)
abstractprotected

◆ loadFilter()

ilADTSearchBridge::loadFilter ( )
abstract

Load filter value(s) into ADT.

Referenced by readFilter().

+ Here is the caller graph for this function:

◆ readFilter()

ilADTSearchBridge::readFilter ( )
protected

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

Returns

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

References ilSession\get(), getElementId(), and loadFilter().

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

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)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDefinition()

ilADTSearchBridge::setDefinition ( ilADTDefinition  $a_adt_def)
abstractprotected

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.

References ILIAS\Repository\form().

63  : void
64  {
65  $this->form = $a_form;
66  }
form( $class_path, string $cmd)
+ Here is the call graph for this function:

◆ setSerializedValue()

ilADTSearchBridge::setSerializedValue ( string  $a_value)
abstract

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

Referenced by isInCondition(), and ilAdvancedMDFieldDefinition\setSearchValueSerialized().

+ Here is the caller graph for this function:

◆ 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()

ilADTSearchBridge::shouldBeImportedFromPost (   $a_post)
protected

◆ validate()

ilADTSearchBridge::validate ( )
abstract

Validate current data.

Returns
bool

Referenced by extractPostValues().

+ Here is the caller graph for this function:

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

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

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

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

◆ SQL_LIKE

const ilADTSearchBridge::SQL_LIKE = 2

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

◆ SQL_LIKE_END

const ilADTSearchBridge::SQL_LIKE_END = 3

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

◆ SQL_LIKE_START

const ilADTSearchBridge::SQL_LIKE_START = 4

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

◆ SQL_STRICT

const ilADTSearchBridge::SQL_STRICT = 1

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


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