ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilCombinationInputGUI Class Reference

This class represents a number property in a property form. More...

+ Inheritance diagram for ilCombinationInputGUI:
+ Collaboration diagram for ilCombinationInputGUI:

Public Member Functions

 __construct (string $a_title="", string $a_postvar="")
 
 addCombinationItem (string $id, ilFormPropertyGUI $item, $label="")
 
 getCombinationItem (string $id)
 
 removeCombinationItem (string $id)
 
 __call (string $method, array $param)
 
 serializeData ()
 
 unserializeData (string $a_data)
 
 setComparisonMode (int $mode)
 Set mode for comparison (extended validation) More...
 
 setValue (?array $a_value)
 
 getValue ()
 
 setValueByArray (array $a_values)
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 insert (ilTemplate $a_tpl)
 
 render ()
 
 getTableFilterHTML ()
 Get input item HTML to be inserted into table filters. More...
 
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem (ilFormPropertyGUI $a_item)
 
 getSubItems ()
 
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively More...
 
 checkSubItemsInput ()
 Check SubItems. More...
 
 getSubForm ()
 
 getItemByPostVar (string $a_post_var)
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct (string $a_title="", string $a_postvar="")
 
 executeCommand ()
 
 getType ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setPostVar (string $a_postvar)
 
 getPostVar ()
 
 getFieldId ()
 
 setInfo (string $a_info)
 
 getInfo ()
 
 setAlert (string $a_alert)
 
 getAlert ()
 
 setRequired (bool $a_required)
 
 getRequired ()
 
 setDisabled (bool $a_disabled)
 
 getDisabled ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm (ilPropertyFormGUI $a_parentform)
 
 getParentForm ()
 
 setParent (ilFormPropertyGUI $a_val)
 
 getParent ()
 
 getSubForm ()
 
 hideSubForm ()
 
 setHiddenTitle (string $a_val)
 
 getHiddenTitle ()
 
 getItemByPostVar (string $a_post_var)
 Get item by post var. More...
 
 serializeData ()
 
 unserializeData (string $a_data)
 
 setParentTable ($a_val)
 Set parent table. More...
 
 getParentTable ()
 Get parent table. More...
 
 writeToSession ()
 
 clearFromSession ()
 
 readFromSession ()
 
 getHiddenTag (string $a_post_var, string $a_value)
 
 setMulti (bool $a_multi, bool $a_sortable=false, bool $a_addremove=true)
 
 getMulti ()
 
 setMultiValues (array $a_values)
 
 getMultiValues ()
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback (string $a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 
 getTableFilterLabelFor ()
 Get label "for" attribute value for filter. More...
 
 getFormLabelFor ()
 Get label "for" attribute value for form. More...
 
 setRequestParam (string $key, $val)
 This writes the request (aka post) values. More...
 
- Public Member Functions inherited from ilTableFilterItem
 getTableFilterLabelFor ()
 Get label "for" attribute value. More...
 

Data Fields

const COMPARISON_NONE = 0
 
const COMPARISON_ASCENDING = 1
 
const COMPARISON_DESCENDING = 2
 

Protected Attributes

array $items = array()
 
array $labels = []
 
int $comparison_mode = self::COMPARISON_NONE
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
array $sub_items = array()
 
- Protected Attributes inherited from ilFormPropertyGUI
array $set_params = []
 
ilTable2GUI $parent_table = null
 
ilFormPropertyGUI $parent_gui = null
 
ilCtrl $ctrl
 
ilLanguage $lng
 
string $type = ""
 
string $title = ""
 
string $postvar = ""
 
string $info = ""
 
string $alert = ""
 
bool $required = false
 
ilPropertyFormGUI $parentform = null
 
string $hidden_title = ""
 
bool $multi = false
 
bool $multi_sortable = false
 
bool $multi_addremove = true
 
array $multi_values = []
 
RequestInterface $request
 
HTTP Services $http
 
Refinery Factory $refinery = null
 
bool $disabled = false
 
ilGlobalTemplateInterface $global_tpl = null
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters (string $a_text)
 Remove prohibited characters see #19159. More...
 
- Protected Member Functions inherited from ilFormPropertyGUI
 symbol ()
 
 setType (string $a_type)
 
 checkParentFormTable ()
 
 getSessionKey ()
 
 getMultiIconsHTML ()
 
 int ($key)
 
 intArray ($key)
 
 str ($key)
 
 raw ($key)
 
 strArray ($key)
 
 arrayArray ($key)
 
 isRequestParamArray (string $key)
 
 getRequestParam (string $key, Refinery\Transformation $t)
 

Detailed Description

This class represents a number property in a property form.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Deprecated:
12 This component will be removed with ILIAS 12

Definition at line 27 of file class.ilCombinationInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilCombinationInputGUI::__construct ( string  $a_title = "",
string  $a_postvar = "" 
)

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

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), and ILIAS\Repository\lng().

41  {
42  parent::__construct($a_title, $a_postvar);
43  global $DIC;
44  $this->lng = $DIC->language();
45  }
global $DIC
Definition: shib_login.php:26
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ __call()

ilCombinationInputGUI::__call ( string  $method,
array  $param 
)

Definition at line 73 of file class.ilCombinationInputGUI.php.

References $id.

76  : array {
77  $result = array();
78  foreach ($this->items as $id => $obj) {
79  if (method_exists($obj, $method)) {
80  $result[$id] = call_user_func_array(array($obj, $method), $param);
81  }
82  }
83  return $result;
84  }
$param
Definition: xapitoken.php:46
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ addCombinationItem()

ilCombinationInputGUI::addCombinationItem ( string  $id,
ilFormPropertyGUI  $item,
  $label = "" 
)

Definition at line 47 of file class.ilCombinationInputGUI.php.

References $id.

51  : void {
52  $this->items[$id] = $item;
53  if ($label) {
54  $this->labels[$id] = $label;
55  }
56  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ checkInput()

ilCombinationInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Definition at line 203 of file class.ilCombinationInputGUI.php.

References ilSubEnabledFormPropertyGUI\checkSubItemsInput(), and null.

203  : bool
204  {
205  if (sizeof($this->items)) {
206  foreach ($this->items as $obj) {
207  if (!$obj->checkInput()) {
208  return false;
209  }
210  }
211 
212  if ($this->comparison_mode !== self::COMPARISON_NONE) {
213  $prev = null;
214  foreach ($this->items as $obj) {
215  $value = $obj->getPostValueForComparison();
216  if ($value != "") {
217  if ($prev !== null) {
218  if ($this->comparison_mode == self::COMPARISON_ASCENDING) {
219  if ($value < $prev) {
220  return false;
221  }
222  } else {
223  if ($value > $prev) {
224  return false;
225  }
226  }
227  }
228  $prev = $value;
229  }
230  }
231  }
232  }
233 
234  return $this->checkSubItemsInput();
235  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ getCombinationItem()

ilCombinationInputGUI::getCombinationItem ( string  $id)

Definition at line 58 of file class.ilCombinationInputGUI.php.

References $id, and null.

59  {
60  if (isset($this->items[$id])) {
61  return $this->items[$id];
62  }
63  return null;
64  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ getTableFilterHTML()

ilCombinationInputGUI::getTableFilterHTML ( )

Get input item HTML to be inserted into table filters.

Implements ilTableFilterItem.

Definition at line 268 of file class.ilCombinationInputGUI.php.

References render().

268  : string
269  {
270  $html = $this->render();
271  return $html;
272  }
+ Here is the call graph for this function:

◆ getValue()

ilCombinationInputGUI::getValue ( )

Definition at line 174 of file class.ilCombinationInputGUI.php.

References $id.

174  : ?array
175  {
176  $result = array();
177  foreach ($this->items as $id => $obj) {
178  if (method_exists($obj, "getValue")) {
179  $result[$id] = $obj->getValue();
180  }
181  // datetime
182  elseif (method_exists($obj, "setDate")) {
183  $result[$id] = $obj->getDate();
184  }
185  // duration
186  elseif (method_exists($obj, 'getValueAsArray')) {
187  $result[$id] = $obj->getValueAsArray();
188  }
189  }
190  return $result;
191  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ insert()

ilCombinationInputGUI::insert ( ilTemplate  $a_tpl)

Definition at line 237 of file class.ilCombinationInputGUI.php.

References ilTemplate\parseCurrentBlock(), render(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

237  : void
238  {
239  $html = $this->render();
240 
241  $a_tpl->setCurrentBlock("prop_generic");
242  $a_tpl->setVariable("PROP_GENERIC", $html);
243  $a_tpl->parseCurrentBlock();
244  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
+ Here is the call graph for this function:

◆ removeCombinationItem()

ilCombinationInputGUI::removeCombinationItem ( string  $id)

Definition at line 66 of file class.ilCombinationInputGUI.php.

66  : void
67  {
68  if (isset($this->items[$id])) {
69  unset($this->items[$id]);
70  }
71  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ render()

ilCombinationInputGUI::render ( )

Definition at line 246 of file class.ilCombinationInputGUI.php.

References $id.

Referenced by getTableFilterHTML(), and insert().

246  : string
247  {
248  $tpl = new ilTemplate("tpl.prop_combination.html", true, true, "components/ILIAS/Form");
249 
250  if (sizeof($this->items)) {
251  foreach ($this->items as $id => $obj) {
252  // label
253  if (isset($this->labels[$id])) {
254  $tpl->setCurrentBlock("prop_combination_label");
255  $tpl->setVariable("LABEL", $this->labels[$id]);
256  $tpl->parseCurrentBlock();
257  }
258 
259  $tpl->setCurrentBlock("prop_combination");
260  $tpl->setVariable("FIELD", $obj->render());
261  $tpl->parseCurrentBlock();
262  }
263  }
264 
265  return $tpl->get();
266  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the caller graph for this function:

◆ serializeData()

ilCombinationInputGUI::serializeData ( )

Definition at line 86 of file class.ilCombinationInputGUI.php.

References $id.

86  : string
87  {
88  $result = array();
89  foreach ($this->items as $id => $obj) {
90  $result[$id] = $obj->serializeData();
91  }
92  return serialize($result);
93  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ setComparisonMode()

ilCombinationInputGUI::setComparisonMode ( int  $mode)

Set mode for comparison (extended validation)

Definition at line 115 of file class.ilCombinationInputGUI.php.

115  : bool
116  {
117  if (in_array($mode, array(self::COMPARISON_ASCENDING, self::COMPARISON_DESCENDING))) {
118  foreach ($this->items as $obj) {
119  if (!method_exists($obj, "getPostValueForComparison")) {
120  return false;
121  }
122  }
123  $this->comparison_mode = $mode;
124  return true;
125  }
126  return false;
127  }

◆ setValue()

ilCombinationInputGUI::setValue ( ?array  $a_value)

Definition at line 129 of file class.ilCombinationInputGUI.php.

References $id, and null.

Referenced by unserializeData().

129  : void
130  {
131  if (is_array($a_value)) {
132  foreach ($a_value as $id => $value) {
133  if (isset($this->items[$id])) {
134  if (method_exists($this->items[$id], "setValue")) {
135  // BT 35708: numeric inputs in table filters do not take floats as values
136  $value = is_float($value) ? (string) $value : $value;
137  $this->items[$id]->setValue($value);
138  }
139  // datetime
140  elseif (method_exists($this->items[$id], "setDate")) {
141  $this->items[$id]->setDate($value);
142  }
143  // duration
144  elseif (method_exists($this->items[$id], "setMonths")) {
145  $this->items[$id]->setMonths((int) ($value['MM'] ?? 0));
146  $this->items[$id]->setDays((int) ($value['dd'] ?? 0));
147  $this->items[$id]->setHours((int) ($value['hh'] ?? 0));
148  $this->items[$id]->setMinutes((int) ($value['mm'] ?? 0));
149  $this->items[$id]->setSeconds((int) ($value['ss'] ?? 0));
150  }
151  }
152  }
153  } elseif ($a_value === null) {
154  foreach ($this->items as $item) {
155  if (method_exists($item, "setValue")) {
156  $item->setValue(null);
157  }
158  // datetime
159  elseif (method_exists($item, "setDate")) {
160  $item->setDate();
161  }
162  // duration
163  elseif (method_exists($item, "setMonths")) {
164  $item->setMonths(0);
165  $item->setDays(0);
166  $item->setHours(0);
167  $item->setMinutes(0);
168  $item->setSeconds(0);
169  }
170  }
171  }
172  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the caller graph for this function:

◆ setValueByArray()

ilCombinationInputGUI::setValueByArray ( array  $a_values)

Definition at line 193 of file class.ilCombinationInputGUI.php.

193  : void
194  {
195  foreach ($this->items as $obj) {
196  $obj->setValueByArray($a_values);
197  }
198  }

◆ unserializeData()

ilCombinationInputGUI::unserializeData ( string  $a_data)

Definition at line 95 of file class.ilCombinationInputGUI.php.

References $data, $id, null, and setValue().

95  : void
96  {
97  $data = unserialize($a_data);
98 
99  if ($data) {
100  foreach ($this->items as $id => $obj) {
101  $obj->unserializeData($data[$id]);
102  }
103  } else {
104  foreach ($this->items as $id => $obj) {
105  if (method_exists($obj, "setValue")) {
106  $this->setValue(null);
107  }
108  }
109  }
110  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

Field Documentation

◆ $comparison_mode

int ilCombinationInputGUI::$comparison_mode = self::COMPARISON_NONE
protected

Definition at line 36 of file class.ilCombinationInputGUI.php.

◆ $items

array ilCombinationInputGUI::$items = array()
protected

Definition at line 33 of file class.ilCombinationInputGUI.php.

◆ $labels

array ilCombinationInputGUI::$labels = []
protected

Definition at line 34 of file class.ilCombinationInputGUI.php.

◆ COMPARISON_ASCENDING

const ilCombinationInputGUI::COMPARISON_ASCENDING = 1

◆ COMPARISON_DESCENDING

const ilCombinationInputGUI::COMPARISON_DESCENDING = 2

Definition at line 31 of file class.ilCombinationInputGUI.php.

◆ COMPARISON_NONE

const ilCombinationInputGUI::COMPARISON_NONE = 0

Definition at line 29 of file class.ilCombinationInputGUI.php.


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