ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
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 
4 include_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;
20  protected $disable_escaping;
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  {
38  return $this->checkSubItemsInput();
39  }
40 
46  function setType($a_type)
47  {
48  $this->type = $a_type;
49  }
50 
56  function getType()
57  {
58  return $this->type;
59  }
60 
66  function setTitle($a_title)
67  {
68  $this->title = $a_title;
69  }
70 
76  function getTitle()
77  {
78  return $this->title;
79  }
80 
86  function setInfo($a_info)
87  {
88  $this->info = $a_info;
89  }
90 
96  function getInfo()
97  {
98  return $this->info;
99  }
100 
106  function setValue($a_value)
107  {
108  if($this->getMulti() && is_array($a_value))
109  {
110  $this->setMultiValues($a_value);
111  $a_value = array_shift($a_value);
112  }
113  $this->value = $a_value;
114  }
115 
121  function getValue()
122  {
123  return $this->value;
124  }
125 
129  function render()
130  {
131  $tpl = new ilTemplate("tpl.non_editable_value.html", true, true, "Services/Form");
132  if ($this->getPostVar() != "")
133  {
134  $postvar = $this->getPostVar();
135  if($this->getMulti() && substr($postvar, -2) != "[]")
136  {
137  $postvar .= "[]";
138  }
139 
140  $tpl->setCurrentBlock("hidden");
141  $tpl->setVariable('NON_EDITABLE_ID', $postvar);
142  $tpl->setVariable("HVALUE", ilUtil::prepareFormOutput($this->getValue()));
143  $tpl->parseCurrentBlock();
144  }
145  $value = $this->getValue();
146  if(!$this->disable_escaping)
147  {
149  }
150  $tpl->setVariable("VALUE", $value);
151  $tpl->setVariable("ID", $this->getFieldId());
152  $tpl->parseCurrentBlock();
153 
154  if ($this->getMulti() && $postvar!= "" && !$this->getDisabled())
155  {
156  $tpl->setVariable("MULTI_ICONS", $this->getMultiIconsHTML());
157  }
158 
159 
160  return $tpl->get();
161  }
162 
167  function insert(&$a_tpl)
168  {
169  $a_tpl->setCurrentBlock("prop_generic");
170  $a_tpl->setVariable("PROP_GENERIC", $this->render());
171  $a_tpl->parseCurrentBlock();
172  }
173 
179  function setValueByArray($a_values)
180  {
181  if ($this->getPostVar() && isset($a_values[$this->getPostVar()]))
182  {
183  $this->setValue($a_values[$this->getPostVar()]);
184  }
185  foreach($this->getSubItems() as $item)
186  {
187  $item->setValueByArray($a_values);
188  }
189  }
190 
195  {
196  $html = $this->render();
197  return $html;
198  }
199 }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
Interface for property form input GUI classes that can be used in table filters.
$_POST['username']
Definition: cron.php:12
getTableFilterHTML()
Get HTML for table filter.
__construct($a_title="", $a_id="", $a_disable_escaping=false)
Constructor.
getPostVar()
Get Post Variable.
setInfo($a_info)
Set Information Text.
getMultiIconsHTML()
Get HTML for multiple value icons.
setMultiValues(array $a_values)
Set multi values.
getFieldId()
Get Post Variable.
special template class to simplify handling of ITX/PEAR
insert(&$a_tpl)
Insert property html.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
setValueByArray($a_values)
Set value by array.
Interface for multi values support.
This class represents a non editable value in a property form.
This class represents a property that may include a sub form.
getInfo()
Get Information Text.