ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilAdvSelectInputGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4
15{
16 protected $options = array();
17 protected $value;
18
25 function __construct($a_title = "", $a_postvar = "")
26 {
27 parent::__construct($a_title, $a_postvar);
28 $this->setType("advselect");
29 }
30
36 function addOption($a_value, $a_text, $a_html = "")
37 {
38 $this->options[$a_value] = array("value" => $a_value,
39 "txt" => $a_text, "html" => $a_html);
40 }
41
47 function getOptions()
48 {
49 return $this->options;
50 }
51
57 function setValue($a_value)
58 {
59 $this->value = $a_value;
60 }
61
67 function getValue()
68 {
69 return $this->value;
70 }
71
77 function setValueByArray($a_values)
78 {
79 $this->setValue($a_values[$this->getPostVar()]);
80 }
81
87 function checkInput()
88 {
89 global $lng;
90
91 $_POST[$this->getPostVar()] =
93 if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "")
94 {
95 $this->setAlert($lng->txt("msg_input_is_required"));
96
97 return false;
98 }
99 return true;
100 }
101
107 function insert(&$a_tpl)
108 {
109 include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
110 $selection = new ilAdvancedSelectionListGUI();
111 $selection->setFormSelectMode($this->getPostVar(), "", false,
112 "", "", "",
113 "", "", "", "");
114 $selection->setId($this->getPostVar());
115 $selection->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK);
116 $selection->setSelectedValue($this->getValue());
117 $selection->setUseImages(false);
119
120 foreach($this->getOptions() as $option)
121 {
122 $selection->addItem($option["txt"], $option["value"], "",
123 "", $option["value"], "", $option["html"]);
124 if ($this->getValue() == $option["value"])
125 {
126 $selection->setListTitle($option["txt"]);
127 }
128 }
129
130 $a_tpl->setCurrentBlock("prop_generic");
131 $a_tpl->setVariable("PROP_GENERIC", $selection->getHTML());
132 $a_tpl->parseCurrentBlock();
133 }
134
135}
This class represents an advanced selection list property in a property form.
checkInput()
Check input, strip slashes etc.
addOption($a_value, $a_text, $a_html="")
Add an Options.
setValueByArray($a_values)
Set value by array.
setValue($a_value)
Set Value.
__construct($a_title="", $a_postvar="")
Constructor.
insert(&$a_tpl)
Insert property html.
User interface class for advanced drop-down selection lists.
This class represents a property in a property form.
setType($a_type)
Set Type.
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST['username']
Definition: cron.php:12
global $lng
Definition: privfeed.php:40