ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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)
 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...
 
 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...
 

Protected Attributes

 $form
 
 $table_gui
 
 $table_filter_fields = []
 
 $id
 
 $title
 
 $info
 

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
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilADTSearchBridge::__construct ( ilADTDefinition  $a_adt_def)

Constructor.

Parameters
ilADT$a_adt_def
Returns
self

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

References isNull(), isValidADTDefinition(), and setDefinition().

29  {
30  $this->setDefinition($a_adt_def);
31  }
setDefinition(ilADTDefinition $a_adt_def)
Set ADT definition.
+ Here is the call graph for this function:

Member Function Documentation

◆ addToElementId()

ilADTSearchBridge::addToElementId (   $a_add)
protected

Add sub-element.

Parameters
string$a_add
Returns
string

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

References addToForm(), and getElementId().

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

216  {
217  return $this->getElementId() . "[" . $a_add . "]";
218  }
getElementId()
Get element id.
+ 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 195 of file class.ilADTSearchBridge.php.

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

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

196  {
197  if ($this->getForm() instanceof ilPropertyFormGUI) {
198  $this->getForm()->addItem($a_field);
199  } elseif ($this->getTableGUI() instanceof ilTable2GUI) {
200  $this->table_filter_fields[$a_field->getFieldId()] = $a_field;
201  $this->getTableGUI()->addFilterItem($a_field);
202 
203  // :TODO:
204  // $a_field->readFromSession();
205  // $this->getTableGUI()->filter[$this->getElementId()] = $a_field->getValue();
206  }
207  }
This class represents a property form user interface.
Class ilTable2GUI.
getFieldId()
Get Post Variable.
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 247 of file class.ilADTSearchBridge.php.

References $_POST, $post, array, getElementId(), getSQLCondition(), importFromPost(), and validate().

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

248  {
249  $element_id = $this->getElementId();
250  $multi = strpos($this->getElementId(), "[");
251 
252  if (!$a_post) {
253  $a_post = $_POST;
254  if ($multi !== false) {
255  $post = $a_post[substr($element_id, 0, $multi)][substr($element_id, $multi+1, -1)];
256  } else {
257  $post = $a_post[$element_id];
258  }
259  } else {
260  if ($multi !== false) {
261  $post = $a_post[substr($element_id, $multi+1, -1)];
262  } else {
263  $post = $a_post[$element_id];
264  }
265  }
266 
267  return $post;
268  }
$post
Definition: post.php:34
getElementId()
Get element id.
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getElementId()

◆ getForm()

◆ getSerializedValue()

ilADTSearchBridge::getSerializedValue ( )
abstract

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

Returns
string

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

+ Here is the caller graph for this function:

◆ getSQLCondition()

ilADTSearchBridge::getSQLCondition (   $a_element_id)
abstract

Get SQL condition for current value(s)

Parameters
string$a_element_id
Returns
string

Referenced by extractPostValues(), ilAdvancedMDFieldDefinitionInternalLink\searchObjects(), ilAdvancedMDFieldDefinitionText\searchObjects(), ilAdvancedMDFieldDefinition\searchObjects(), and ilAdvancedMDFieldDefinition\searchSubObjects().

+ Here is the caller graph for this function:

◆ getTableGUI()

ilADTSearchBridge::getTableGUI ( )

Get table gui.

Returns
ilTable2GUI

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

References $table_gui.

Referenced by addToParentElement().

143  {
144  return $this->table_gui;
145  }
+ Here is the caller graph for this function:

◆ getTitle()

◆ importFromPost()

ilADTSearchBridge::importFromPost ( array  $a_post = null)
abstract

Import values from (search) form request POST data.

Returns
bool

Referenced by extractPostValues().

+ Here is the caller graph for this function:

◆ isInCondition()

ilADTSearchBridge::isInCondition ( ilADT  $a_adt)

Compare directly against ADT.

Parameters
ilADT$a_adt
Returns
boolean

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

References getSerializedValue(), and setSerializedValue().

304  {
305  return false;
306  }
+ Here is the call graph for this function:

◆ isNull()

ilADTSearchBridge::isNull ( )
abstract

Is null ?

Returns
bool

Referenced by __construct().

+ Here is the caller graph for this function:

◆ isValidADTDefinition()

ilADTSearchBridge::isValidADTDefinition ( ilADTDefinition  $a_adt_def)
abstractprotected

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

Referenced by __construct(), ilADTSearchBridgeMulti\setDefinition(), ilADTSearchBridgeSingle\setDefinition(), and ilADTSearchBridgeRange\setDefinition().

+ Here is the caller graph for this function:

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

Parameters
string$a_element_id

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

References $_SESSION, getElementId(), and loadFilter().

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

170  {
171  if (!$this->table_gui instanceof ilTable2GUI) {
172  return;
173  }
174  $value = $_SESSION["form_" . $this->table_gui->getId()][$this->getElementId()];
175  if ($value) {
176  return unserialize($value);
177  }
178  }
$_SESSION["AccountId"]
Class ilTable2GUI.
getElementId()
Get element id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDefinition()

ilADTSearchBridge::setDefinition ( ilADTDefinition  $a_adt_def)
abstractprotected

Set ADT definition.

Parameters
ilADTDefinition$a_adt_def

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setElementId()

ilADTSearchBridge::setElementId (   $a_value)

Set element id (aka form field)

Parameters
string$a_value

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

References string.

88  {
89  $this->id = (string) $a_value;
90  }
Add rich text string

◆ setForm()

ilADTSearchBridge::setForm ( ilPropertyFormGUI  $a_form)

Set form.

Parameters
ilPropertyFormGUI$a_form

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

68  {
69  $this->form = $a_form;
70  }

◆ setSerializedValue()

ilADTSearchBridge::setSerializedValue (   $a_value)
abstract

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

Parameters
string

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

+ Here is the caller graph for this function:

◆ setTableGUI()

ilADTSearchBridge::setTableGUI ( ilTable2GUI  $a_table)

Set table gui (for filter mode)

Parameters
ilTable2GUI$a_table

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

133  {
134  $this->table_gui = $a_table;
135  }

◆ setTitle()

ilADTSearchBridge::setTitle (   $a_value)

Set title (aka form field caption)

Parameters
string$a_value

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

108  {
109  $this->title = trim($a_value);
110  }

◆ shouldBeImportedFromPost()

ilADTSearchBridge::shouldBeImportedFromPost (   $a_post)
protected

Check if incoming values should be imported at all.

Parameters
mixed$a_post
Returns
bool

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

Referenced by ilADTTextSearchBridgeSingle\importFromPost(), ilADTEnumSearchBridgeSingle\importFromPost(), ilADTIntegerSearchBridgeSingle\importFromPost(), ilADTFloatSearchBridgeSingle\importFromPost(), ilADTExternalLinkSearchBridgeSingle\importFromPost(), and ilADTEnumSearchBridgeMulti\importFromPost().

237  {
238  return true;
239  }
+ Here is the caller graph for this function:

◆ 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
mixed$a_value

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

References $_SESSION, and getElementId().

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

153  {
154  if (!$this->table_gui instanceof ilTable2GUI) {
155  return;
156  }
157  if ($a_value !== null) {
158  $_SESSION["form_" . $this->table_gui->getId()][$this->getElementId()] = serialize($a_value);
159  } else {
160  unset($_SESSION["form_" . $this->table_gui->getId()][$this->getElementId()]);
161  }
162  }
$_SESSION["AccountId"]
Class ilTable2GUI.
getElementId()
Get element id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $form

ilADTSearchBridge::$form
protected

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

Referenced by getForm().

◆ $id

ilADTSearchBridge::$id
protected

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

Referenced by getElementId().

◆ $info

ilADTSearchBridge::$info
protected

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

◆ $table_filter_fields

ilADTSearchBridge::$table_filter_fields = []
protected

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

◆ $table_gui

ilADTSearchBridge::$table_gui
protected

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

Referenced by getTableGUI().

◆ $title

ilADTSearchBridge::$title
protected

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