ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 224 of file class.ilADTSearchBridge.php.

References addToForm(), and getElementId().

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

225  {
226  return $this->getElementId()."[".$a_add."]";
227  }
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 201 of file class.ilADTSearchBridge.php.

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

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

202  {
203  if($this->getForm() instanceof ilPropertyFormGUI)
204  {
205  $this->getForm()->addItem($a_field);
206  }
207  else if($this->getTableGUI() instanceof ilTable2GUI)
208  {
209  $this->table_filter_fields[$a_field->getFieldId()] = $a_field;
210  $this->getTableGUI()->addFilterItem($a_field);
211 
212  // :TODO:
213  // $a_field->readFromSession();
214  // $this->getTableGUI()->filter[$this->getElementId()] = $a_field->getValue();
215  }
216  }
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 256 of file class.ilADTSearchBridge.php.

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

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

257  {
258  $element_id = $this->getElementId();
259  $multi = strpos($this->getElementId(), "[");
260 
261  if(!$a_post)
262  {
263  $a_post = $_POST;
264  if($multi !== false)
265  {
266  $post = $a_post[substr($element_id, 0, $multi)][substr($element_id, $multi+1, -1)];
267  }
268  else
269  {
270  $post = $a_post[$element_id];
271  }
272  }
273  else
274  {
275  if($multi !== false)
276  {
277  $post = $a_post[substr($element_id, $multi+1, -1)];
278  }
279  else
280  {
281  $post = $a_post[$element_id];
282  }
283  }
284 
285  return $post;
286  }
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(), 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 321 of file class.ilADTSearchBridge.php.

References getSerializedValue(), and setSerializedValue().

322  {
323  return false;
324  }
+ 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 173 of file class.ilADTSearchBridge.php.

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

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

174  {
175  if(!$this->table_gui instanceof ilTable2GUI)
176  {
177  return;
178  }
179  $value = $_SESSION["form_".$this->table_gui->getId()][$this->getElementId()];
180  if($value)
181  {
182  return unserialize($value);
183  }
184  }
$_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
The name of the decorator.

◆ 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 245 of file class.ilADTSearchBridge.php.

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

246  {
247  return true;
248  }
+ 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  {
156  return;
157  }
158  if($a_value !== null)
159  {
160  $_SESSION["form_".$this->table_gui->getId()][$this->getElementId()] = serialize($a_value);
161  }
162  else
163  {
164  unset($_SESSION["form_".$this->table_gui->getId()][$this->getElementId()]);
165  }
166  }
$_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

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

Referenced by getTitle().


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