ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilCustomInputGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2007 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 require_once('./Services/Form/classes/class.ilSubEnabledFormPropertyGUI.php');
35 {
39  protected $lng;
40 
41  protected $html;
42 
49  public function __construct($a_title = "", $a_postvar = "")
50  {
51  global $DIC;
52 
53  $this->lng = $DIC->language();
54  parent::__construct($a_title, $a_postvar);
55  $this->setType("custom");
56  }
57 
63  public function setHtml($a_html)
64  {
65  $this->html = $a_html;
66  }
67 
73  public function getHtml()
74  {
75  return $this->html;
76  }
77 
83  public function setValueByArray($a_values)
84  {
85  foreach ($this->getSubItems() as $item) {
86  $item->setValueByArray($a_values);
87  }
88  }
89 
94  public function insert($a_tpl)
95  {
96  $a_tpl->setCurrentBlock("prop_custom");
97  $a_tpl->setVariable("CUSTOM_CONTENT", $this->getHtml());
98  $a_tpl->parseCurrentBlock();
99  }
100 
106  public function checkInput()
107  {
108  $lng = $this->lng;
109 
110  if ($this->getPostVar()) {
111  $_POST[$this->getPostVar()] = ilUtil::stripSlashes($_POST[$this->getPostVar()]);
112  if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "") {
113  $this->setAlert($lng->txt("msg_input_is_required"));
114  return false;
115  }
116  }
117  return $this->checkSubItemsInput();
118  }
119 }
insert($a_tpl)
Insert property html.
__construct($a_title="", $a_postvar="")
Constructor.
setHtml($a_html)
Set Html.
checkInput()
Check input, strip slashes etc.
global $DIC
Definition: saml.php:7
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
setType($a_type)
Set Type.
setValueByArray($a_values)
Set value by array.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
This class represents a custom property in a property form.
This class represents a property that may include a sub form.
html()
$_POST["username"]