ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilADTEnumSearchBridgeMulti Class Reference
+ Inheritance diagram for ilADTEnumSearchBridgeMulti:
+ Collaboration diagram for ilADTEnumSearchBridgeMulti:

Public Member Functions

 setSearchMode ($a_mode)
 
 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...
 
 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 SEARCH_MODE_ALL = 1
 
const SEARCH_MODE_ANY = 2
 

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 49 of file class.ilADTEnumSearchBridgeMulti.php.

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

50  {
51  global $lng;
52 
53  $def = $this->getADT()->getCopyOfDefinition();
54 
55  $options = $def->getOptions();
56  asort($options); // ?
57 
58  $cbox = new ilCheckboxGroupInputGUI($this->getTitle(), $this->getElementId());
59  $cbox->setValue($this->getADT()->getSelections());
60 
61  foreach ($options as $value => $caption) {
62  $option = new ilCheckboxOption($caption, $value);
63  $cbox->addOption($option);
64  }
65 
66  $this->addToParentElement($cbox);
67  }
This class represents an option in a checkbox group.
This class represents a property in a property form.
global $lng
Definition: privfeed.php:17
$def
Definition: croninfo.php:21
getElementId()
Get element id.
addToParentElement(ilFormPropertyGUI $a_field)
Add form field to parent element.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
+ Here is the call graph for this function:

◆ convertADTDefinitionToMulti()

ilADTEnumSearchBridgeMulti::convertADTDefinitionToMulti ( ilADTDefinition  $a_adt_def)
protected

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

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

25  {
26  if ($a_adt_def->getType() == "Enum") {
27  $this->multi_source = false;
28  $def = ilADTFactory::getInstance()->getDefinitionInstanceByType("MultiEnum");
29  $def->setNumeric($a_adt_def->isNumeric());
30  $def->setOptions($a_adt_def->getOptions());
31  return $def;
32  } else {
33  $this->multi_source = true;
34  return $a_adt_def;
35  }
36  }
static getInstance()
Get singleton.
$def
Definition: croninfo.php:21
getType()
Get type (from class/instance)
+ Here is the call graph for this function:

◆ getSerializedValue()

ilADTEnumSearchBridgeMulti::getSerializedValue ( )

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

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

150  {
151  if (!$this->isNull() && $this->isValid()) {
152  return serialize($this->getADT()->getSelections());
153  }
154  }
+ Here is the call graph for this function:

◆ getSQLCondition()

ilADTEnumSearchBridgeMulti::getSQLCondition (   $a_element_id)

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

References $ilDB, $type, array, ilADTSearchBridgeSingle\getADT(), ilADTSearchBridgeSingle\isNull(), ilADTSearchBridgeSingle\isValid(), and ilADTMultiEnumDBBridge\SEPARATOR.

Referenced by ilAdvancedMDFieldDefinitionSelectMulti\findBySingleValue().

94  {
95  global $ilDB;
96 
97  if (!$this->isNull() && $this->isValid()) {
98  $type = ($this->getADT() instanceof ilADTMultiEnumText)
99  ? "text"
100  : "integer";
101 
102  if ($this->multi_source) {
103  include_once "Services/ADT/classes/Types/MultiEnum/class.ilADTMultiEnumDBBridge.php";
104 
105  // #16827 / #17087
106  $mode_concat = ($this->search_mode == self::SEARCH_MODE_ANY)
107  ? " OR "
108  : " AND ";
109 
110  $parts = array();
111  foreach ($this->getADT()->getSelections() as $item) {
112  $item = "%" . ilADTMultiEnumDBBridge::SEPARATOR .
113  $item .
115  $parts[] = $ilDB->like($a_element_id, "text", $item, false);
116  }
117  return "(" . implode($mode_concat, $parts) . ")";
118  }
119 
120  return $ilDB->in($a_element_id, $this->getADT()->getSelections(), "", $type);
121  }
122  }
$type
Create styles array
The data for the language used.
global $ilDB
PHPExcel root directory.
Definition: Database.php:30
+ 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 69 of file class.ilADTEnumSearchBridgeMulti.php.

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

70  {
71  $post = $this->extractPostValues($a_post);
72 
73  if ($post && $this->shouldBeImportedFromPost($post)) {
74  if ($this->getForm() instanceof ilPropertyFormGUI) {
75  $item = $this->getForm()->getItemByPostVar($this->getElementId());
76  $item->setValue($post);
77  } elseif (array_key_exists($this->getElementId(), $this->table_filter_fields)) {
78  $this->table_filter_fields[$this->getElementId()]->setValue($post);
79  $this->writeFilter($post);
80  }
81 
82  if (is_array($post)) {
83  $this->getADT()->setSelections($post);
84  }
85  } else {
86  $this->getADT()->setSelections();
87  }
88  }
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.
$post
Definition: post.php:34
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 124 of file class.ilADTEnumSearchBridgeMulti.php.

References $current, array, and ilADTSearchBridgeSingle\getADT().

125  {
126  assert($a_adt instanceof ilADTMultiEnum);
127 
128  $current = $this->getADT()->getSelections();
129  if (is_array($current) &&
130  sizeof($current)) {
131  // #16827 / #17087
132  if ($this->search_mode == self::SEARCH_MODE_ANY) {
133  foreach ((array) $a_adt->getSelections() as $value) {
134  if (in_array($value, $current)) {
135  return true;
136  }
137  }
138  } else {
139  // #18028
140  return !(bool) sizeof(array_diff($current, (array) $a_adt->getSelections()));
141  }
142  }
143  return false;
144  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ isValidADTDefinition()

ilADTEnumSearchBridgeMulti::isValidADTDefinition ( ilADTDefinition  $a_adt_def)
protected

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

19  {
20  return ($a_adt_def instanceof ilADTEnumDefinition ||
21  $a_adt_def instanceof ilADTMultiEnumDefinition);
22  }

◆ loadFilter()

ilADTEnumSearchBridgeMulti::loadFilter ( )

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

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

39  {
40  $value = $this->readFilter();
41  if ($value !== null) {
42  $this->getADT()->setSelections($value);
43  }
44  }
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 13 of file class.ilADTEnumSearchBridgeMulti.php.

14  {
15  $this->search_mode = (int) $a_mode;
16  }

◆ setSerializedValue()

ilADTEnumSearchBridgeMulti::setSerializedValue (   $a_value)

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

References ilADTSearchBridgeSingle\getADT().

157  {
158  $a_value = unserialize($a_value);
159  if (is_array($a_value)) {
160  $this->getADT()->setSelections($a_value);
161  }
162  }
+ Here is the call graph for this function:

Field Documentation

◆ $multi_source

ilADTEnumSearchBridgeMulti::$multi_source
protected

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

◆ $search_mode

ilADTEnumSearchBridgeMulti::$search_mode
protected

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

◆ SEARCH_MODE_ALL

const ilADTEnumSearchBridgeMulti::SEARCH_MODE_ALL = 1

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

◆ SEARCH_MODE_ANY

const ilADTEnumSearchBridgeMulti::SEARCH_MODE_ANY = 2

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


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