ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilADTEnumSearchBridgeSingle Class Reference
+ Inheritance diagram for ilADTEnumSearchBridgeSingle:
+ Collaboration diagram for ilADTEnumSearchBridgeSingle:

Public Member Functions

 loadFilter ()
 
 getSearchColumn ()
 
 addToForm ()
 
 importFromPost (array $a_post=null)
 
 getSQLCondition ($a_element_id)
 
 isInCondition (ilADT $a_adt)
 
 getSerializedValue ()
 
 setSerializedValue ($a_value)
 
- Public Member Functions inherited from ilADTSearchBridgeSingle
 getADT ()
 Get ADT. More...
 
 isNull ()
 
 isValid ()
 
 validate ()
 
- Public Member Functions inherited from ilADTSearchBridge
 __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...
 
 getSearchColumn ()
 
 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...
 

Data Fields

const ENUM_SEARCH_COLUMN = 'value_index'
 
- Data Fields inherited from ilADTSearchBridge
const DEFAULT_SEARCH_COLUMN = 'value'
 

Protected Member Functions

 isValidADTDefinition (ilADTDefinition $a_adt_def)
 
- Protected Member Functions inherited from ilADTSearchBridgeSingle
 setDefinition (ilADTDefinition $a_adt_def)
 
- Protected Member Functions inherited from ilADTSearchBridge
 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...
 

Additional Inherited Members

- Protected Attributes inherited from ilADTSearchBridgeSingle
 $adt
 
- Protected Attributes inherited from ilADTSearchBridge
 $form
 
 $table_gui
 
 $table_filter_fields = []
 
 $id
 
 $title
 
 $info
 

Detailed Description

Definition at line 5 of file class.ilADTEnumSearchBridgeSingle.php.

Member Function Documentation

◆ addToForm()

ilADTEnumSearchBridgeSingle::addToForm ( )

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

References $DIC, $lng, ilADTSearchBridge\addToParentElement(), ilADTSearchBridgeSingle\getADT(), ilADTSearchBridge\getElementId(), and ilADTSearchBridge\getTitle().

33  {
34  global $DIC;
35 
36  $lng = $DIC['lng'];
37 
38  $def = $this->getADT()->getCopyOfDefinition();
39 
40  $options = $def->getOptions();
41  asort($options); // ?
42 
43  $lng->loadLanguageModule("search");
44  $options = array("" => $lng->txt("search_any")) + $options;
45 
46  $select = new ilSelectInputGUI($this->getTitle(), $this->getElementId());
47  $select->setOptions($options);
48 
49  $select->setValue($this->getADT()->getSelection());
50 
51  $this->addToParentElement($select);
52  }
$lng
global $DIC
Definition: goto.php:24
getElementId()
Get element id.
addToParentElement(ilFormPropertyGUI $a_field)
Add form field to parent element.
+ Here is the call graph for this function:

◆ getSearchColumn()

ilADTEnumSearchBridgeSingle::getSearchColumn ( )

Definition at line 25 of file class.ilADTEnumSearchBridgeSingle.php.

Referenced by getSQLCondition().

25  : string
26  {
27  return self::ENUM_SEARCH_COLUMN;
28  }
+ Here is the caller graph for this function:

◆ getSerializedValue()

ilADTEnumSearchBridgeSingle::getSerializedValue ( )

Definition at line 102 of file class.ilADTEnumSearchBridgeSingle.php.

References ilADTSearchBridgeSingle\getADT(), ilADTSearchBridgeSingle\isNull(), and ilADTSearchBridgeSingle\isValid().

103  {
104  if (!$this->isNull() && $this->isValid()) {
105  return serialize(array($this->getADT()->getSelection()));
106  }
107  }
+ Here is the call graph for this function:

◆ getSQLCondition()

ilADTEnumSearchBridgeSingle::getSQLCondition (   $a_element_id)

Definition at line 79 of file class.ilADTEnumSearchBridgeSingle.php.

References $DIC, $ilDB, ilADTSearchBridgeSingle\getADT(), getSearchColumn(), ilADTSearchBridgeSingle\isNull(), ilADTSearchBridgeSingle\isValid(), and ilDBConstants\T_TEXT.

80  {
81  global $DIC;
82 
83  $ilDB = $DIC['ilDB'];
84 
85  $search_column = $this->getSearchColumn();
86  if (!$this->isNull() && $this->isValid()) {
87  return $search_column . ' = ' . $ilDB->quote($this->getADT()->getSelection(), ilDBConstants::T_TEXT);
88  }
89  return '';
90  }
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the call graph for this function:

◆ importFromPost()

ilADTEnumSearchBridgeSingle::importFromPost ( array  $a_post = null)

Definition at line 54 of file class.ilADTEnumSearchBridgeSingle.php.

References ilADTSearchBridge\extractPostValues(), ilADTSearchBridgeSingle\getADT(), ilADTSearchBridge\getElementId(), ilADTSearchBridge\getForm(), ilADTSearchBridge\shouldBeImportedFromPost(), and ilADTSearchBridge\writeFilter().

55  {
56  $post = $this->extractPostValues($a_post);
57  if (
58  is_numeric($post) &&
59  $this->shouldBeImportedFromPost($post)
60  ) {
61  if ($this->getForm() instanceof ilPropertyFormGUI) {
62  $item = $this->getForm()->getItemByPostVar($this->getElementId());
63  $item->setValue($post);
64  } elseif (array_key_exists($this->getElementId(), $this->table_filter_fields)) {
65  $this->table_filter_fields[$this->getElementId()]->setValue($post);
66  $this->writeFilter($post);
67  }
68 
69  $this->getADT()->setSelection($post);
70  } else {
71  $this->writeFilter();
72  $this->getADT()->setSelection();
73  }
74  }
This class represents a property form user interface.
extractPostValues(array $a_post=null)
Extract data from (post) values.
shouldBeImportedFromPost($a_post)
Check if incoming values should be imported at all.
writeFilter($a_value=null)
Write value(s) to filter store (in session)
getElementId()
Get element id.
+ Here is the call graph for this function:

◆ isInCondition()

ilADTEnumSearchBridgeSingle::isInCondition ( ilADT  $a_adt)

Definition at line 92 of file class.ilADTEnumSearchBridgeSingle.php.

References ilADTSearchBridgeSingle\getADT().

93  {
94  assert($a_adt instanceof ilADTEnum);
95 
96  return $this->getADT()->equals($a_adt);
97  }
+ Here is the call graph for this function:

◆ isValidADTDefinition()

ilADTEnumSearchBridgeSingle::isValidADTDefinition ( ilADTDefinition  $a_adt_def)
protected

Definition at line 9 of file class.ilADTEnumSearchBridgeSingle.php.

10  {
11  return ($a_adt_def instanceof ilADTEnumDefinition);
12  }

◆ loadFilter()

ilADTEnumSearchBridgeSingle::loadFilter ( )

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

References ilADTSearchBridgeSingle\getADT(), and ilADTSearchBridge\readFilter().

18  {
19  $value = $this->readFilter();
20  if ($value !== null) {
21  $this->getADT()->setSelection($value);
22  }
23  }
readFilter()
Load value(s) from filter store (in session)
+ Here is the call graph for this function:

◆ setSerializedValue()

ilADTEnumSearchBridgeSingle::setSerializedValue (   $a_value)

Definition at line 109 of file class.ilADTEnumSearchBridgeSingle.php.

References ilADTSearchBridgeSingle\getADT().

110  {
111  $a_value = unserialize($a_value);
112  if (is_array($a_value)) {
113  $this->getADT()->setSelection($a_value[0]);
114  }
115  }
+ Here is the call graph for this function:

Field Documentation

◆ ENUM_SEARCH_COLUMN

const ilADTEnumSearchBridgeSingle::ENUM_SEARCH_COLUMN = 'value_index'

Definition at line 7 of file class.ilADTEnumSearchBridgeSingle.php.


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