ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilNonEditableValueGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once 'Services/Form/interfaces/interface.ilMultiValuesItem.php';
5
14{
15 protected $type;
16 protected $value;
17 protected $title;
18 protected $info;
19 protected $section_icon;
21
27 function __construct($a_title = "", $a_id = "", $a_disable_escaping = false)
28 {
29 parent::__construct($a_title, $a_id);
30 $this->setTitle($a_title);
31 $this->setType("non_editable_value");
32 $this->disable_escaping = (bool)$a_disable_escaping;
33 }
34
35 function checkInput()
36 {
37 if(!is_array($_POST[$this->getPostVar()]))
38 {
40 }
41 return $this->checkSubItemsInput();
42 }
43
49 function setType($a_type)
50 {
51 $this->type = $a_type;
52 }
53
59 function getType()
60 {
61 return $this->type;
62 }
63
69 function setTitle($a_title)
70 {
71 $this->title = $a_title;
72 }
73
79 function getTitle()
80 {
81 return $this->title;
82 }
83
89 function setInfo($a_info)
90 {
91 $this->info = $a_info;
92 }
93
99 function getInfo()
100 {
101 return $this->info;
102 }
103
109 function setValue($a_value)
110 {
111 if($this->getMulti() && is_array($a_value))
112 {
113 $this->setMultiValues($a_value);
114 $a_value = array_shift($a_value);
115 }
116 $this->value = $a_value;
117 }
118
124 function getValue()
125 {
126 return $this->value;
127 }
128
132 function render()
133 {
134 $tpl = new ilTemplate("tpl.non_editable_value.html", true, true, "Services/Form");
135 if ($this->getPostVar() != "")
136 {
137 $postvar = $this->getPostVar();
138 if($this->getMulti() && substr($postvar, -2) != "[]")
139 {
140 $postvar .= "[]";
141 }
142
143 $tpl->setCurrentBlock("hidden");
144 $tpl->setVariable('NON_EDITABLE_ID', $postvar);
145 $tpl->setVariable('MULTI_HIDDEN_ID', $this->getFieldId());
146 $tpl->setVariable("HVALUE", ilUtil::prepareFormOutput($this->getValue()));
147 $tpl->parseCurrentBlock();
148 }
149 $value = $this->getValue();
150 if(!$this->disable_escaping)
151 {
153 }
154 $tpl->setVariable("VALUE", $value);
155 $tpl->setVariable("ID", $this->getFieldId());
156 $tpl->parseCurrentBlock();
157
158 if ($this->getMulti() && $postvar!= "" && !$this->getDisabled())
159 {
160 $tpl->setVariable("MULTI_ICONS", $this->getMultiIconsHTML());
161 }
162
163
164 return $tpl->get();
165 }
166
171 function insert(&$a_tpl)
172 {
173 $a_tpl->setCurrentBlock("prop_generic");
174 $a_tpl->setVariable("PROP_GENERIC", $this->render());
175 $a_tpl->parseCurrentBlock();
176 }
177
183 function setValueByArray($a_values)
184 {
185 if ($this->getPostVar() && isset($a_values[$this->getPostVar()]))
186 {
187 $this->setValue($a_values[$this->getPostVar()]);
188 }
189 foreach($this->getSubItems() as $item)
190 {
191 $item->setValueByArray($a_values);
192 }
193 }
194
199 {
200 $html = $this->render();
201 return $html;
202 }
203}
global $tpl
Definition: ilias.php:8
getMultiIconsHTML()
Get HTML for multiple value icons.
getPostVar()
Get Post Variable.
setMultiValues(array $a_values)
Set multi values.
getFieldId()
Get Post Variable.
This class represents a non editable value in a property form.
setValueByArray($a_values)
Set value by array.
checkInput()
Check input, strip slashes etc.
insert(&$a_tpl)
Insert property html.
__construct($a_title="", $a_id="", $a_disable_escaping=false)
Constructor.
setInfo($a_info)
Set Information Text.
getInfo()
Get Information Text.
getTableFilterHTML()
Get HTML for table filter.
This class represents a property that may include a sub form.
special template class to simplify handling of ITX/PEAR
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
$_POST['username']
Definition: cron.php:12
$html
Definition: example_001.php:87
Interface for multi values support.
Interface for property form input GUI classes that can be used in table filters.