ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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)

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

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

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

References addToForm().

200  : void
201  {
202  $this->addToForm();
203  }
addToForm()
Add ADT-specific fields to form.
+ Here is the call graph for this function:

◆ addToForm()

ilADTSearchBridge::addToForm ( )
abstract

Add ADT-specific fields to form.

Referenced by addToElementId(), and addToFilterForm().

+ 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 ilADTTextSearchBridgeSingle\addTextInputToForm(), ilADTDateTimeSearchBridgeSingle\addToForm(), ilADTFloatSearchBridgeSingle\addToForm(), ilADTIntegerSearchBridgeSingle\addToForm(), ilADTDateSearchBridgeSingle\addToForm(), ilADTEnumSearchBridgeSingle\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  }
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 220 of file class.ilADTSearchBridge.php.

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

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

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  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static http()
Fetches the global http state from ILIAS.
$post
Definition: ltitoken.php:46
+ 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 ilADTTextSearchBridgeSingle\addTextInputToForm(), addToElementId(), ilADTDateSearchBridgeSingle\addToForm(), ilADTFloatSearchBridgeSingle\addToForm(), ilADTIntegerSearchBridgeSingle\addToForm(), ilADTDateTimeSearchBridgeSingle\addToForm(), ilADTEnumSearchBridgeSingle\addToForm(), ilADTDateTimeSearchBridgeRange\addToForm(), ilADTDateSearchBridgeRange\addToForm(), ilADTExternalLinkSearchBridgeSingle\addToForm(), ilADTInternalLinkSearchBridgeSingle\addToForm(), ilADTLocationSearchBridgeSingle\addToForm(), ilADTEnumSearchBridgeMulti\addToForm(), extractPostValues(), ilADTLocalizedTextSearchBridgeSingle\importFromPost(), ilADTDateSearchBridgeSingle\importFromPost(), ilADTExternalLinkSearchBridgeSingle\importFromPost(), ilADTDateTimeSearchBridgeSingle\importFromPost(), ilADTEnumSearchBridgeSingle\importFromPost(), ilADTFloatSearchBridgeSingle\importFromPost(), ilADTIntegerSearchBridgeSingle\importFromPost(), ilADTTextSearchBridgeSingle\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.

This is currently only used in ilAdvancedMDValues::queryForRecords, e.g. in the filter of mediapools. Other filter/search use cases use instead getSQLCondition.

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

References getSerializedValue(), and setSerializedValue().

273  : bool
274  {
275  return false;
276  }
+ 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(), loadFilter(), and null.

Referenced by ilADTDateSearchBridgeSingle\loadFilter(), ilADTDateTimeSearchBridgeSingle\loadFilter(), ilADTFloatSearchBridgeSingle\loadFilter(), ilADTIntegerSearchBridgeSingle\loadFilter(), ilADTLocalizedTextSearchBridgeSingle\loadFilter(), ilADTEnumSearchBridgeSingle\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)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ 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, string $submit_caption="")
+ 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(), null, and ilSession\set().

Referenced by ilADTLocalizedTextSearchBridgeSingle\importFromPost(), ilADTDateSearchBridgeSingle\importFromPost(), ilADTDateTimeSearchBridgeSingle\importFromPost(), ilADTExternalLinkSearchBridgeSingle\importFromPost(), ilADTEnumSearchBridgeSingle\importFromPost(), ilADTTextSearchBridgeSingle\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  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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: