ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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

 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...
 
 removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. 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

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

Additional Inherited Members

- 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.

Member Function Documentation

◆ __call()

ilCombinationInputGUI::__call (   $method,
  $param 
)

Call item methods.

Parameters
string$method
array$param

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

90 {
91 $result = array();
92 foreach($this->items as $id => $obj)
93 {
94 if(method_exists($obj, $method))
95 {
96 $result[$id] = call_user_func_array(array($obj, $method), $param);
97 }
98 }
99 return $result;
100 }
$result

References $result.

◆ addCombinationItem()

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

Add property item.

Parameters
string$id
object$item
string$label

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

48 {
49 $this->items[$id] = $item;
50 if($label)
51 {
52 $this->labels[$id] = $label;
53 }
54 }

◆ 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 255 of file class.ilCombinationInputGUI.php.

256 {
257 if(sizeof($this->items))
258 {
259 foreach($this->items as $id => $obj)
260 {
261 if(!$obj->checkInput())
262 {
263 return false;
264 }
265 }
266
267 if($this->comparison_mode)
268 {
269 $prev = NULL;
270 foreach($this->items as $id => $obj)
271 {
272 $value = $obj->getPostValueForComparison();
273 if($value != "")
274 {
275 if($prev !== NULL)
276 {
277 if($this->comparison_mode == self::COMPARISON_ASCENDING)
278 {
279 if($value < $prev)
280 {
281 return false;
282 }
283 }
284 else
285 {
286 if($value > $prev)
287 {
288 return false;
289 }
290 }
291 }
292 $prev = $value;
293 }
294 }
295 }
296 }
297
298 return $this->checkSubItemsInput();
299 }

References 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 62 of file class.ilCombinationInputGUI.php.

63 {
64 if(isset($this->items[$id]))
65 {
66 return $this->items[$id];
67 }
68 }

◆ getTableFilterHTML()

ilCombinationInputGUI::getTableFilterHTML ( )

Get HTML for table filter.

Implements ilTableFilterItem.

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

349 {
350 $html = $this->render();
351 return $html;
352 }
$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 219 of file class.ilCombinationInputGUI.php.

220 {
221 $result = array();
222 foreach($this->items as $id => $obj)
223 {
224 if(method_exists($obj, "getValue"))
225 {
226 $result[$id] = $obj->getValue();
227 }
228 // datetime
229 else if(method_exists($obj, "setDate"))
230 {
231 $result[$id] = $obj->getDate();
232 }
233 }
234 return $result;
235 }

References $result.

◆ insert()

ilCombinationInputGUI::insert ( $a_tpl)

Insert property html.

Returns
int Size

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

307 {
308 $html = $this->render();
309
310 $a_tpl->setCurrentBlock("prop_generic");
311 $a_tpl->setVariable("PROP_GENERIC", $html);
312 $a_tpl->parseCurrentBlock();
313 }

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 75 of file class.ilCombinationInputGUI.php.

76 {
77 if(isset($this->items[$id]))
78 {
79 unset($this->items[$id]);
80 }
81 }

◆ render()

ilCombinationInputGUI::render ( )

Render item.

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

319 {
320 global $lng;
321
322 $tpl = new ilTemplate("tpl.prop_combination.html", true, true, "Services/Form");
323
324 if(sizeof($this->items))
325 {
326 foreach($this->items as $id => $obj)
327 {
328 // label
329 if(isset($this->labels[$id]))
330 {
331 $tpl->setCurrentBlock("prop_combination_label");
332 $tpl->setVariable("LABEL", $this->labels[$id]);
333 $tpl->parseCurrentBlock();
334 }
335
336 $tpl->setCurrentBlock("prop_combination");
337 $tpl->setVariable("FIELD", $obj->render());
338 $tpl->parseCurrentBlock();
339 }
340 }
341
342 return $tpl->get();
343 }
global $tpl
Definition: ilias.php:8
special template class to simplify handling of ITX/PEAR
global $lng
Definition: privfeed.php:40

References $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 105 of file class.ilCombinationInputGUI.php.

106 {
107 $result = array();
108 foreach($this->items as $id => $obj)
109 {
110 $result[$id] = $obj->serializeData();
111 }
112 return serialize($result);
113 }

References $result.

◆ setComparisonMode()

ilCombinationInputGUI::setComparisonMode (   $mode)

Set mode for comparison (extended validation)

Parameters
int$mode
Returns
bool

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

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

◆ setValue()

ilCombinationInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

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

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

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 242 of file class.ilCombinationInputGUI.php.

243 {
244 foreach($this->items as $id => $obj)
245 {
246 $obj->setValueByArray($a_values);
247 }
248 }

◆ unserializeData()

ilCombinationInputGUI::unserializeData (   $a_data)

unserialize data

Reimplemented from ilFormPropertyGUI.

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

119 {
120 $data = unserialize($a_data);
121
122 if ($data)
123 {
124 foreach($this->items as $id => $obj)
125 {
126 $obj->unserializeData($data[$id]);
127 }
128 }
129 else
130 {
131 foreach($this->items as $id => $obj)
132 {
133 if(method_exists($obj, "setValue"))
134 {
135 $this->setValue(false);
136 }
137 }
138 }
139 }
$data

References $data, and setValue().

+ Here is the call graph for this function:

Field Documentation

◆ $comparison

ilCombinationInputGUI::$comparison
protected

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

◆ $items

ilCombinationInputGUI::$items = array()
protected

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

◆ $labels

ilCombinationInputGUI::$labels
protected

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

◆ COMPARISON_ASCENDING

◆ COMPARISON_DESCENDING

const ilCombinationInputGUI::COMPARISON_DESCENDING = 2

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


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