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

Public Member Functions

 setSearchMode ($a_mode)
 
 getSearchColumn ()
 
 loadFilter ()
 
 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'
 
const SEARCH_MODE_ALL = 1
 
const SEARCH_MODE_ANY = 2
 
- Data Fields inherited from ilADTSearchBridge
const DEFAULT_SEARCH_COLUMN = 'value'
 

Protected Member Functions

 isValidADTDefinition (ilADTDefinition $a_adt_def)
 
 convertADTDefinitionToMulti (ilADTDefinition $a_adt_def)
 
- Protected Member Functions inherited from ilADTSearchBridgeMulti
 setDefinition (ilADTDefinition $a_adt_def)
 
 convertADTDefinitionToMulti (ilADTDefinition $a_adt_def)
 Convert definition to multi version. More...
 
- 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...
 

Protected Attributes

 $multi_source
 
 $search_mode
 
- 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.ilADTEnumSearchBridgeMulti.php.

Member Function Documentation

◆ addToForm()

ilADTEnumSearchBridgeMulti::addToForm ( )

Definition at line 57 of file class.ilADTEnumSearchBridgeMulti.php.

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

58  {
59  global $DIC;
60 
61  $lng = $DIC['lng'];
62 
63  $def = $this->getADT()->getCopyOfDefinition();
64 
65  $options = $def->getOptions();
66  asort($options); // ?
67 
68  $cbox = new ilCheckboxGroupInputGUI($this->getTitle(), $this->getElementId());
69  $cbox->setValue($this->getADT()->getSelections());
70 
71  foreach ($options as $value => $caption) {
72  $option = new ilCheckboxOption($caption, $value);
73  $cbox->addOption($option);
74  }
75 
76  $this->addToParentElement($cbox);
77  }
This class represents an option in a checkbox group.
$lng
global $DIC
Definition: goto.php:24
This class represents a property in a property form.
getElementId()
Get element id.
addToParentElement(ilFormPropertyGUI $a_field)
Add form field to parent element.
+ Here is the call graph for this function:

◆ convertADTDefinitionToMulti()

ilADTEnumSearchBridgeMulti::convertADTDefinitionToMulti ( ilADTDefinition  $a_adt_def)
protected

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

References ilADTFactory\getInstance(), and ilADTDefinition\getType().

33  {
34  if ($a_adt_def->getType() == "Enum") {
35  $this->multi_source = false;
36  $def = ilADTFactory::getInstance()->getDefinitionInstanceByType("MultiEnum");
37  $def->setNumeric($a_adt_def->isNumeric());
38  $def->setOptions($a_adt_def->getOptions());
39  return $def;
40  } else {
41  $this->multi_source = true;
42  return $a_adt_def;
43  }
44  }
static getInstance()
Get singleton.
getType()
Get type (from class/instance)
+ Here is the call graph for this function:

◆ getSearchColumn()

ilADTEnumSearchBridgeMulti::getSearchColumn ( )

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

Referenced by getSQLCondition().

20  : string
21  {
22  return self::ENUM_SEARCH_COLUMN;
23  }
+ Here is the caller graph for this function:

◆ getSerializedValue()

ilADTEnumSearchBridgeMulti::getSerializedValue ( )

Definition at line 144 of file class.ilADTEnumSearchBridgeMulti.php.

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

145  {
146  if (!$this->isNull() && $this->isValid()) {
147  return serialize($this->getADT()->getSelections());
148  }
149  }
+ Here is the call graph for this function:

◆ getSQLCondition()

ilADTEnumSearchBridgeMulti::getSQLCondition (   $a_element_id)

Definition at line 103 of file class.ilADTEnumSearchBridgeMulti.php.

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

Referenced by ilAdvancedMDFieldDefinitionSelect\findBySingleValue().

104  {
105  global $DIC;
106 
107  $ilDB = $DIC->database();
108 
109  if (!$this->isNull() && $this->isValid()) {
110  return $ilDB->in(
111  $this->getSearchColumn(),
112  $this->getADT()->getSelections(),
113  '',
115  );
116  }
117  }
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ importFromPost()

ilADTEnumSearchBridgeMulti::importFromPost ( array  $a_post = null)

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

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

80  {
81  $post = $this->extractPostValues($a_post);
82 
83  if ($post && $this->shouldBeImportedFromPost($post)) {
84  if ($this->getForm() instanceof ilPropertyFormGUI) {
85  $item = $this->getForm()->getItemByPostVar($this->getElementId());
86  $item->setValue($post);
87  } elseif (array_key_exists($this->getElementId(), $this->table_filter_fields)) {
88  $this->table_filter_fields[$this->getElementId()]->setValue($post);
89  $this->writeFilter($post);
90  }
91 
92  if (is_array($post)) {
93  $this->getADT()->setSelections($post);
94  }
95  } else {
96  $this->getADT()->setSelections();
97  }
98  }
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()

ilADTEnumSearchBridgeMulti::isInCondition ( ilADT  $a_adt)

Definition at line 119 of file class.ilADTEnumSearchBridgeMulti.php.

References ilADTSearchBridgeSingle\getADT().

120  {
121  assert($a_adt instanceof ilADTMultiEnum);
122 
123  $current = $this->getADT()->getSelections();
124  if (is_array($current) &&
125  sizeof($current)) {
126  // #16827 / #17087
127  if ($this->search_mode == self::SEARCH_MODE_ANY) {
128  foreach ((array) $a_adt->getSelections() as $value) {
129  if (in_array($value, $current)) {
130  return true;
131  }
132  }
133  } else {
134  // #18028
135  return !(bool) sizeof(array_diff($current, (array) $a_adt->getSelections()));
136  }
137  }
138  return false;
139  }
+ Here is the call graph for this function:

◆ isValidADTDefinition()

ilADTEnumSearchBridgeMulti::isValidADTDefinition ( ilADTDefinition  $a_adt_def)
protected

Definition at line 26 of file class.ilADTEnumSearchBridgeMulti.php.

27  {
28  return ($a_adt_def instanceof ilADTEnumDefinition ||
29  $a_adt_def instanceof ilADTMultiEnumDefinition);
30  }

◆ loadFilter()

ilADTEnumSearchBridgeMulti::loadFilter ( )

Definition at line 46 of file class.ilADTEnumSearchBridgeMulti.php.

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

47  {
48  $value = $this->readFilter();
49  if ($value !== null) {
50  $this->getADT()->setSelections($value);
51  }
52  }
readFilter()
Load value(s) from filter store (in session)
+ Here is the call graph for this function:

◆ setSearchMode()

ilADTEnumSearchBridgeMulti::setSearchMode (   $a_mode)

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

16  {
17  $this->search_mode = (int) $a_mode;
18  }

◆ setSerializedValue()

ilADTEnumSearchBridgeMulti::setSerializedValue (   $a_value)

Definition at line 151 of file class.ilADTEnumSearchBridgeMulti.php.

References ilADTSearchBridgeSingle\getADT().

152  {
153  $a_value = unserialize($a_value);
154  if (is_array($a_value)) {
155  $this->getADT()->setSelections($a_value);
156  }
157  }
+ Here is the call graph for this function:

Field Documentation

◆ $multi_source

ilADTEnumSearchBridgeMulti::$multi_source
protected

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

◆ $search_mode

ilADTEnumSearchBridgeMulti::$search_mode
protected

Definition at line 10 of file class.ilADTEnumSearchBridgeMulti.php.

◆ ENUM_SEARCH_COLUMN

const ilADTEnumSearchBridgeMulti::ENUM_SEARCH_COLUMN = 'value_index'

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

◆ SEARCH_MODE_ALL

const ilADTEnumSearchBridgeMulti::SEARCH_MODE_ALL = 1

Definition at line 12 of file class.ilADTEnumSearchBridgeMulti.php.

◆ SEARCH_MODE_ANY

const ilADTEnumSearchBridgeMulti::SEARCH_MODE_ANY = 2

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


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