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

Public Member Functions

 loadFilter ()
 
 addToForm ()
 
 importFromPost (array $a_post=null)
 
 getSQLCondition ($a_element_id, $a_mode=self::SQL_LIKE, $a_value=null)
 
 isInCondition (ilADT $a_adt)
 
 getSerializedValue ()
 
 setSerializedValue ($a_value)
 
- Public Member Functions inherited from ilADTTextSearchBridgeSingle
 loadFilter ()
 
 addToForm ()
 
 importFromPost (array $a_post=null)
 
 getSQLCondition ($a_element_id, $a_mode=self::SQL_LIKE, $a_value=null)
 
 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...
 

Protected Member Functions

 isValidADTDefinition (ilADTDefinition $a_adt_def)
 
- Protected Member Functions inherited from ilADTTextSearchBridgeSingle
 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

- Data Fields inherited from ilADTTextSearchBridgeSingle
const SQL_STRICT = 1
 
const SQL_LIKE = 2
 
const SQL_LIKE_END = 3
 
const SQL_LIKE_START = 4
 
- Data Fields inherited from ilADTSearchBridge
const DEFAULT_SEARCH_COLUMN = 'value'
 
- Protected Attributes inherited from ilADTSearchBridgeSingle
 $adt
 
- Protected Attributes inherited from ilADTSearchBridge
 $form
 
 $table_gui
 
 $table_filter_fields = []
 
 $id
 
 $title
 
 $info
 

Detailed Description

Member Function Documentation

◆ addToForm()

ilADTLocalizedTextSearchBridgeSingle::addToForm ( )

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

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

26  {
27  $text = new ilTextInputGUI($this->getTitle(), $this->getElementId());
28  $text->setSize(20);
29  $text->setMaxLength(512);
30  $text->setSubmitFormOnEnter(true);
31 
32  $text->setValue($this->getADT()->getText());
33 
34  $this->addToParentElement($text);
35  }
getElementId()
Get element id.
addToParentElement(ilFormPropertyGUI $a_field)
Add form field to parent element.
+ Here is the call graph for this function:

◆ getSerializedValue()

ilADTLocalizedTextSearchBridgeSingle::getSerializedValue ( )

Definition at line 126 of file class.ilADTLocalizedTextSearchBridgeSingle.php.

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

127  {
128  if (!$this->isNull() && $this->isValid()) {
129  return serialize(array($this->getADT()->getText()));
130  }
131  }
+ Here is the call graph for this function:

◆ getSQLCondition()

ilADTLocalizedTextSearchBridgeSingle::getSQLCondition (   $a_element_id,
  $a_mode = self::SQL_LIKE,
  $a_value = null 
)

Definition at line 59 of file class.ilADTLocalizedTextSearchBridgeSingle.php.

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

60  {
61  global $DIC;
62 
63  $ilDB = $DIC['ilDB'];
64 
65  if (!$a_value) {
66  if ($this->isNull() || !$this->isValid()) {
67  return;
68  }
69  $a_value = $this->getADT()->getText();
70  }
71 
72  switch ($a_mode) {
73  case self::SQL_STRICT:
74  if (!is_array($a_value)) {
75  return $a_element_id . " = " . $ilDB->quote($a_value, "text");
76  } else {
77  return $ilDB->in($a_element_id, $a_value, "", "text");
78  }
79  break;
80 
81  case self::SQL_LIKE:
82  if (!is_array($a_value)) {
83  return $ilDB->like($a_element_id, "text", "%" . $a_value . "%");
84  } else {
85  $tmp = array();
86  foreach ($a_value as $word) {
87  if ($word) {
88  $tmp[] = $ilDB->like($a_element_id, "text", "%" . $word . "%");
89  }
90  }
91  if (sizeof($tmp)) {
92  return "(" . implode(" OR ", $tmp) . ")";
93  }
94  }
95  break;
96 
97  case self::SQL_LIKE_END:
98  if (!is_array($a_value)) {
99  return $ilDB->like($a_element_id, "text", $a_value . "%");
100  }
101  break;
102 
103  case self::SQL_LIKE_START:
104  if (!is_array($a_value)) {
105  return $ilDB->like($a_element_id, "text", "%" . $a_value);
106  }
107  break;
108  }
109  }
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the call graph for this function:

◆ importFromPost()

ilADTLocalizedTextSearchBridgeSingle::importFromPost ( array  $a_post = null)

Definition at line 37 of file class.ilADTLocalizedTextSearchBridgeSingle.php.

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

38  {
39  $post = $this->extractPostValues($a_post);
40 
41  if ($post && $this->shouldBeImportedFromPost($post)) {
42  if ($this->getForm() instanceof ilPropertyFormGUI) {
43  $item = $this->getForm()->getItemByPostVar($this->getElementId());
44  $item->setValue($post);
45  } elseif (array_key_exists($this->getElementId(), $this->table_filter_fields)) {
46  $this->table_filter_fields[$this->getElementId()]->setValue($post);
47  $this->writeFilter($post);
48  }
49  $this->getADT()->setText($post);
50  } else {
51  $this->writeFilter();
52  $this->getADT()->setText();
53  }
54  }
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()

ilADTLocalizedTextSearchBridgeSingle::isInCondition ( ilADT  $a_adt)

Definition at line 111 of file class.ilADTLocalizedTextSearchBridgeSingle.php.

References $txt, and ilADTSearchBridgeSingle\getADT().

112  {
113  if ($this->getADT()->getCopyOfDefinition()->isComparableTo($a_adt)) {
114  foreach ($a_adt->getTranslations() as $language => $txt) {
115  if (strcasecmp($txt, $this->getADT()->getText()) === 0) {
116  return true;
117  }
118  }
119  }
120  return false;
121  }
$txt
Definition: error.php:13
+ Here is the call graph for this function:

◆ isValidADTDefinition()

ilADTLocalizedTextSearchBridgeSingle::isValidADTDefinition ( ilADTDefinition  $a_adt_def)
protected

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

8  {
9  return ($a_adt_def instanceof ilADTLocalizedTextDefinition);
10  }

◆ loadFilter()

ilADTLocalizedTextSearchBridgeSingle::loadFilter ( )

Definition at line 14 of file class.ilADTLocalizedTextSearchBridgeSingle.php.

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

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

◆ setSerializedValue()

ilADTLocalizedTextSearchBridgeSingle::setSerializedValue (   $a_value)

Definition at line 133 of file class.ilADTLocalizedTextSearchBridgeSingle.php.

References ilADTSearchBridgeSingle\getADT().

134  {
135  $a_value = unserialize($a_value);
136  if (is_array($a_value)) {
137  $this->getADT()->setText($a_value[0]);
138  }
139  }
+ Here is the call graph for this function:

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