ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 public 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 public function checkInput()
36 {
37 if (!is_array($_POST[$this->getPostVar()])) {
39 }
40 return $this->checkSubItemsInput();
41 }
42
48 public function setType($a_type)
49 {
50 $this->type = $a_type;
51 }
52
58 public function getType()
59 {
60 return $this->type;
61 }
62
68 public function setTitle($a_title)
69 {
70 $this->title = $a_title;
71 }
72
78 public function getTitle()
79 {
80 return $this->title;
81 }
82
88 public function setInfo($a_info)
89 {
90 $this->info = $a_info;
91 }
92
98 public function getInfo()
99 {
100 return $this->info;
101 }
102
108 public function setValue($a_value)
109 {
110 if ($this->getMulti() && is_array($a_value)) {
111 $this->setMultiValues($a_value);
112 $a_value = array_shift($a_value);
113 }
114 $this->value = $a_value;
115 }
116
122 public function getValue()
123 {
124 return $this->value;
125 }
126
130 public function render()
131 {
132 $tpl = new ilTemplate("tpl.non_editable_value.html", true, true, "Services/Form");
133 if ($this->getPostVar() != "") {
134 $postvar = $this->getPostVar();
135 if ($this->getMulti() && substr($postvar, -2) != "[]") {
136 $postvar .= "[]";
137 }
138
139 $tpl->setCurrentBlock("hidden");
140 $tpl->setVariable('NON_EDITABLE_ID', $postvar);
141 $tpl->setVariable('MULTI_HIDDEN_ID', $this->getFieldId());
142 $tpl->setVariable("HVALUE", ilUtil::prepareFormOutput($this->getValue()));
143 $tpl->parseCurrentBlock();
144 }
145 $value = $this->getValue();
146 if (!$this->disable_escaping) {
148 }
149 $tpl->setVariable("VALUE", $value);
150 $tpl->setVariable("ID", $this->getFieldId());
151 $tpl->parseCurrentBlock();
152
153 if ($this->getMulti() && $postvar!= "" && !$this->getDisabled()) {
154 $tpl->setVariable("MULTI_ICONS", $this->getMultiIconsHTML());
155 }
156
157
158 return $tpl->get();
159 }
160
165 public function insert($a_tpl)
166 {
167 $a_tpl->setCurrentBlock("prop_generic");
168 $a_tpl->setVariable("PROP_GENERIC", $this->render());
169 $a_tpl->parseCurrentBlock();
170 }
171
177 public function setValueByArray($a_values)
178 {
179 if ($this->getPostVar() && isset($a_values[$this->getPostVar()])) {
180 $this->setValue($a_values[$this->getPostVar()]);
181 }
182 foreach ($this->getSubItems() as $item) {
183 $item->setValueByArray($a_values);
184 }
185 }
186
190 public function getTableFilterHTML()
191 {
192 $html = $this->render();
193 return $html;
194 }
195}
$tpl
Definition: ilias.php:10
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
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.
insert($a_tpl)
Insert property html.
checkInput()
Check input, strip slashes etc.
__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
$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.
$a_type
Definition: workflow.php:92