ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilCombinationInputGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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
 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 file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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

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

Constructor & Destructor Documentation

◆ __construct()

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

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

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

40  {
41  parent::__construct($a_title, $a_postvar);
42  global $DIC;
43  $this->lng = $DIC->language();
44  }
global $DIC
Definition: feed.php:28
__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 72 of file class.ilCombinationInputGUI.php.

References $id.

75  : array {
76  $result = array();
77  foreach ($this->items as $id => $obj) {
78  if (method_exists($obj, $method)) {
79  $result[$id] = call_user_func_array(array($obj, $method), $param);
80  }
81  }
82  return $result;
83  }
$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 46 of file class.ilCombinationInputGUI.php.

References $id.

50  : void {
51  $this->items[$id] = $item;
52  if ($label) {
53  $this->labels[$id] = $label;
54  }
55  }
$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 202 of file class.ilCombinationInputGUI.php.

References ilSubEnabledFormPropertyGUI\checkSubItemsInput().

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

◆ getCombinationItem()

ilCombinationInputGUI::getCombinationItem ( string  $id)

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

References $id.

58  {
59  if (isset($this->items[$id])) {
60  return $this->items[$id];
61  }
62  return null;
63  }
This class represents a property in a property form.
$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 267 of file class.ilCombinationInputGUI.php.

References render().

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

◆ getValue()

ilCombinationInputGUI::getValue ( )

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

References $id.

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

◆ insert()

ilCombinationInputGUI::insert ( ilTemplate  $a_tpl)

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

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

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

◆ removeCombinationItem()

ilCombinationInputGUI::removeCombinationItem ( string  $id)

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

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

◆ render()

ilCombinationInputGUI::render ( )

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

References $id, and $tpl.

Referenced by getTableFilterHTML(), and insert().

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

◆ serializeData()

ilCombinationInputGUI::serializeData ( )

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

References $id.

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

◆ setComparisonMode()

ilCombinationInputGUI::setComparisonMode ( int  $mode)

Set mode for comparison (extended validation)

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

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

◆ setValue()

ilCombinationInputGUI::setValue ( ?array  $a_value)

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

References $id.

Referenced by unserializeData().

128  : void
129  {
130  if (is_array($a_value)) {
131  foreach ($a_value as $id => $value) {
132  if (isset($this->items[$id])) {
133  if (method_exists($this->items[$id], "setValue")) {
134  // BT 35708: numeric inputs in table filters do not take floats as values
135  $value = is_float($value) ? (string) $value : $value;
136  $this->items[$id]->setValue($value);
137  }
138  // datetime
139  elseif (method_exists($this->items[$id], "setDate")) {
140  $this->items[$id]->setDate($value);
141  }
142  // duration
143  elseif (method_exists($this->items[$id], "setMonths")) {
144  $this->items[$id]->setMonths((int) ($value['MM'] ?? 0));
145  $this->items[$id]->setDays((int) ($value['dd'] ?? 0));
146  $this->items[$id]->setHours((int) ($value['hh'] ?? 0));
147  $this->items[$id]->setMinutes((int) ($value['mm'] ?? 0));
148  $this->items[$id]->setSeconds((int) ($value['ss'] ?? 0));
149  }
150  }
151  }
152  } elseif ($a_value === null) {
153  foreach ($this->items as $item) {
154  if (method_exists($item, "setValue")) {
155  $item->setValue(null);
156  }
157  // datetime
158  elseif (method_exists($item, "setDate")) {
159  $item->setDate();
160  }
161  // duration
162  elseif (method_exists($item, "setMonths")) {
163  $item->setMonths(0);
164  $item->setDays(0);
165  $item->setHours(0);
166  $item->setMinutes(0);
167  $item->setSeconds(0);
168  }
169  }
170  }
171  }
$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 192 of file class.ilCombinationInputGUI.php.

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

◆ unserializeData()

ilCombinationInputGUI::unserializeData ( string  $a_data)

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

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

94  : void
95  {
96  $data = unserialize($a_data);
97 
98  if ($data) {
99  foreach ($this->items as $id => $obj) {
100  $obj->unserializeData($data[$id]);
101  }
102  } else {
103  foreach ($this->items as $id => $obj) {
104  if (method_exists($obj, "setValue")) {
105  $this->setValue(null);
106  }
107  }
108  }
109  }
$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 35 of file class.ilCombinationInputGUI.php.

◆ $items

array ilCombinationInputGUI::$items = array()
protected

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

◆ $labels

array ilCombinationInputGUI::$labels = []
protected

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

◆ COMPARISON_ASCENDING

const ilCombinationInputGUI::COMPARISON_ASCENDING = 1

◆ COMPARISON_DESCENDING

const ilCombinationInputGUI::COMPARISON_DESCENDING = 2

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

◆ COMPARISON_NONE

const ilCombinationInputGUI::COMPARISON_NONE = 0

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


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