ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 ($a_title="", $a_postvar="")
 Constructor. More...
 
 addCombinationItem ($id, $item, $label="")
 Add property item. More...
 
 getCombinationItem ($id)
 Get property item. More...
 
 removeCombinationItem ($id)
 Remove property item. More...
 
 __call ($method, $param)
 Call item methods. More...
 
 serializeData ()
 serialize data More...
 
 unserializeData ($a_data)
 unserialize data More...
 
 setComparisonMode ($mode)
 Set mode for comparison (extended validation) More...
 
 setValue ($a_value)
 Set Value. More...
 
 getValue ()
 Get Value. More...
 
 setValueByArray ($a_values)
 Set value by array. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 insert ($a_tpl)
 Insert property html. More...
 
 render ()
 Render item. More...
 
 getTableFilterHTML ()
 Get HTML for table filter. More...
 
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem ($a_item)
 Add Subitem. More...
 
 getSubItems ()
 Get Subitems. More...
 
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively More...
 
 checkSubItemsInput ()
 Check SubItems. More...
 
 getSubForm ()
 Get sub form html. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 getType ()
 Get Type. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setPostVar ($a_postvar)
 Set Post Variable. More...
 
 getPostVar ()
 Get Post Variable. More...
 
 getFieldId ()
 Get Post Variable. More...
 
 setInfo ($a_info)
 Set Information Text. More...
 
 getInfo ()
 Get Information Text. More...
 
 setAlert ($a_alert)
 Set Alert Text. More...
 
 getAlert ()
 Get Alert Text. More...
 
 setRequired ($a_required)
 Set Required. More...
 
 getRequired ()
 Get Required. More...
 
 setDisabled ($a_disabled)
 Set Disabled. More...
 
 getDisabled ()
 Get Disabled. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm ($a_parentform)
 Set Parent Form. More...
 
 getParentForm ()
 Get Parent Form. More...
 
 setParent ($a_val)
 Set Parent GUI object. More...
 
 getParent ()
 Get Parent GUI object. More...
 
 getSubForm ()
 Get sub form html. More...
 
 hideSubForm ()
 Sub form hidden on init? More...
 
 setHiddenTitle ($a_val)
 Set hidden title (for screenreaders) More...
 
 getHiddenTitle ()
 Get hidden title. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
 serializeData ()
 serialize data More...
 
 unserializeData ($a_data)
 unserialize data More...
 
 writeToSession ()
 Write to session. More...
 
 clearFromSession ()
 Clear session value. More...
 
 readFromSession ()
 Read from session. More...
 
 getHiddenTag ($a_post_var, $a_value)
 Get hidden tag (used for disabled properties) More...
 
 setMulti ($a_multi, $a_sortable=false, $a_addremove=true)
 Set Multi. More...
 
 getMulti ()
 Get Multi. More...
 
 setMultiValues (array $a_values)
 Set multi values. More...
 
 getMultiValues ()
 Get multi values. More...
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback ($a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 
 getTableFilterHTML ()
 Get input item HTML to be inserted into table filters. More...
 

Data Fields

const COMPARISON_ASCENDING = 1
 
const COMPARISON_DESCENDING = 2
 

Protected Attributes

 $lng
 
 $items = array()
 
 $labels
 
 $comparison
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
 $sub_items = array()
 
- Protected Attributes inherited from ilFormPropertyGUI
 $ctrl
 
 $lng
 
 $type
 
 $title
 
 $postvar
 
 $info
 
 $alert
 
 $required = false
 
 $parentgui
 
 $parentform
 
 $hidden_title = ""
 
 $multi = false
 
 $multi_sortable = false
 
 $multi_addremove = true
 
 $multi_values
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 
- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type. More...
 
 getMultiIconsHTML ()
 Get HTML for multiple value icons. More...
 

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
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Reimplemented from ilFormPropertyGUI.

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

43 {
44 parent::__construct($a_title, $a_postvar);
45 global $DIC;
46
47 $this->lng = $DIC->language();
48 }
global $DIC
Definition: saml.php:7

References $DIC.

Member Function Documentation

◆ __call()

ilCombinationInputGUI::__call (   $method,
  $param 
)

Call item methods.

Parameters
string$method
array$param

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

104 {
105 $result = array();
106 foreach ($this->items as $id => $obj) {
107 if (method_exists($obj, $method)) {
108 $result[$id] = call_user_func_array(array($obj, $method), $param);
109 }
110 }
111 return $result;
112 }
$result
if(!array_key_exists('StateId', $_REQUEST)) $id

References $id, and $result.

◆ addCombinationItem()

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

Add property item.

Parameters
string$id
object$item
string$label

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

65 {
66 $this->items[$id] = $item;
67 if ($label) {
68 $this->labels[$id] = $label;
69 }
70 }

References $id.

◆ checkInput()

ilCombinationInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

Reimplemented from ilFormPropertyGUI.

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

243 {
244 if (sizeof($this->items)) {
245 foreach ($this->items as $id => $obj) {
246 if (!$obj->checkInput()) {
247 return false;
248 }
249 }
250
251 if ($this->comparison_mode) {
252 $prev = null;
253 foreach ($this->items as $id => $obj) {
254 $value = $obj->getPostValueForComparison();
255 if ($value != "") {
256 if ($prev !== null) {
257 if ($this->comparison_mode == self::COMPARISON_ASCENDING) {
258 if ($value < $prev) {
259 return false;
260 }
261 } else {
262 if ($value > $prev) {
263 return false;
264 }
265 }
266 }
267 $prev = $value;
268 }
269 }
270 }
271 }
272
273 return $this->checkSubItemsInput();
274 }

References $id, and ilSubEnabledFormPropertyGUI\checkSubItemsInput().

+ Here is the call graph for this function:

◆ getCombinationItem()

ilCombinationInputGUI::getCombinationItem (   $id)

Get property item.

Parameters
string$id
Returns
object

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

79 {
80 if (isset($this->items[$id])) {
81 return $this->items[$id];
82 }
83 }

References $id.

◆ getTableFilterHTML()

ilCombinationInputGUI::getTableFilterHTML ( )

Get HTML for table filter.

Implements ilTableFilterItem.

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

321 {
322 $html = $this->render();
323 return $html;
324 }
$html
Definition: example_001.php:87

References $html, and render().

+ Here is the call graph for this function:

◆ getValue()

ilCombinationInputGUI::getValue ( )

Get Value.

Returns
string Value

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

211 {
212 $result = array();
213 foreach ($this->items as $id => $obj) {
214 if (method_exists($obj, "getValue")) {
215 $result[$id] = $obj->getValue();
216 }
217 // datetime
218 elseif (method_exists($obj, "setDate")) {
219 $result[$id] = $obj->getDate();
220 }
221 }
222 return $result;
223 }

References $id, and $result.

◆ insert()

ilCombinationInputGUI::insert (   $a_tpl)

Insert property html.

Returns
int Size

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

282 {
283 $html = $this->render();
284
285 $a_tpl->setCurrentBlock("prop_generic");
286 $a_tpl->setVariable("PROP_GENERIC", $html);
287 $a_tpl->parseCurrentBlock();
288 }

References $html, and render().

+ Here is the call graph for this function:

◆ removeCombinationItem()

ilCombinationInputGUI::removeCombinationItem (   $id)

Remove property item.

Parameters
string$id

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

91 {
92 if (isset($this->items[$id])) {
93 unset($this->items[$id]);
94 }
95 }

References $id.

◆ render()

ilCombinationInputGUI::render ( )

Render item.

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

294 {
296
297 $tpl = new ilTemplate("tpl.prop_combination.html", true, true, "Services/Form");
298
299 if (sizeof($this->items)) {
300 foreach ($this->items as $id => $obj) {
301 // label
302 if (isset($this->labels[$id])) {
303 $tpl->setCurrentBlock("prop_combination_label");
304 $tpl->setVariable("LABEL", $this->labels[$id]);
305 $tpl->parseCurrentBlock();
306 }
307
308 $tpl->setCurrentBlock("prop_combination");
309 $tpl->setVariable("FIELD", $obj->render());
310 $tpl->parseCurrentBlock();
311 }
312 }
313
314 return $tpl->get();
315 }
$tpl
Definition: ilias.php:10
special template class to simplify handling of ITX/PEAR

References $id, $lng, and $tpl.

Referenced by getTableFilterHTML(), and insert().

+ Here is the caller graph for this function:

◆ serializeData()

ilCombinationInputGUI::serializeData ( )

serialize data

Reimplemented from ilFormPropertyGUI.

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

118 {
119 $result = array();
120 foreach ($this->items as $id => $obj) {
121 $result[$id] = $obj->serializeData();
122 }
123 return serialize($result);
124 }

References $id, and $result.

◆ setComparisonMode()

ilCombinationInputGUI::setComparisonMode (   $mode)

Set mode for comparison (extended validation)

Parameters
int$mode
Returns
bool

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

153 {
154 if (in_array($mode, array(self::COMPARISON_ASCENDING, self::COMPARISON_DESCENDING))) {
155 foreach ($this->items as $obj) {
156 if (!method_exists($obj, "getPostValueForComparison")) {
157 return false;
158 }
159 }
160 $this->comparison_mode = $mode;
161 return true;
162 }
163 }

◆ setValue()

ilCombinationInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

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

171 {
172 if (is_array($a_value)) {
173 foreach ($a_value as $id => $value) {
174 if (isset($this->items[$id])) {
175 if (method_exists($this->items[$id], "setValue")) {
176 $this->items[$id]->setValue($value);
177 }
178 // datetime
179 elseif (method_exists($this->items[$id], "setDate")) {
180 $this->items[$id]->setDate($value);
181 }
182 }
183 }
184 } elseif ($a_value === null) {
185 foreach ($this->items as $item) {
186 if (method_exists($item, "setValue")) {
187 $item->setValue(null);
188 }
189 // datetime
190 elseif (method_exists($item, "setDate")) {
191 $item->setDate();
192 }
193 // duration
194 elseif (method_exists($item, "setMonths")) {
195 $item->setMonths(0);
196 $item->setDays(0);
197 $item->setHours(0);
198 $item->setMinutes(0);
199 $item->setSeconds(0);
200 }
201 }
202 }
203 }

References $id.

Referenced by unserializeData().

+ Here is the caller graph for this function:

◆ setValueByArray()

ilCombinationInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

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

231 {
232 foreach ($this->items as $id => $obj) {
233 $obj->setValueByArray($a_values);
234 }
235 }

References $id.

◆ unserializeData()

ilCombinationInputGUI::unserializeData (   $a_data)

unserialize data

Reimplemented from ilFormPropertyGUI.

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

130 {
131 $data = unserialize($a_data);
132
133 if ($data) {
134 foreach ($this->items as $id => $obj) {
135 $obj->unserializeData($data[$id]);
136 }
137 } else {
138 foreach ($this->items as $id => $obj) {
139 if (method_exists($obj, "setValue")) {
140 $this->setValue(false);
141 }
142 }
143 }
144 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $comparison

ilCombinationInputGUI::$comparison
protected

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

◆ $items

ilCombinationInputGUI::$items = array()
protected

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

◆ $labels

ilCombinationInputGUI::$labels
protected

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

◆ $lng

ilCombinationInputGUI::$lng
protected

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

Referenced by render().

◆ COMPARISON_ASCENDING

const ilCombinationInputGUI::COMPARISON_ASCENDING = 1

◆ COMPARISON_DESCENDING

const ilCombinationInputGUI::COMPARISON_DESCENDING = 2

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


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