ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
32 {
33  protected $html;
34 
41  function __construct($a_title = "", $a_postvar = "")
42  {
43  parent::__construct($a_title, $a_postvar);
44  $this->setType("custom");
45  }
46 
52  function setHtml($a_html)
53  {
54  $this->html = $a_html;
55  }
56 
62  function getHtml()
63  {
64  return $this->html;
65  }
66 
72  function setValueByArray($a_values)
73  {
74  foreach($this->getSubItems() as $item)
75  {
76  $item->setValueByArray($a_values);
77  }
78  }
79 
84  function insert(&$a_tpl)
85  {
86  $a_tpl->setCurrentBlock("prop_custom");
87  $a_tpl->setVariable("CUSTOM_CONTENT", $this->getHtml());
88  $a_tpl->parseCurrentBlock();
89  }
90 
96  function checkInput()
97  {
98  global $lng;
99 
100  $_POST[$this->getPostVar()] = ilUtil::stripSlashes($_POST[$this->getPostVar()]);
101  if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "")
102  {
103  $this->setAlert($lng->txt("msg_input_is_required"));
104  return false;
105  }
106  return $this->checkSubItemsInput();
107  }
108 }