ILIAS  Release_4_4_x_branch Revision 61816
 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 
24 require_once('./Services/Form/classes/class.ilSubEnabledFormPropertyGUI.php');
35 {
36  protected $html;
37 
44  function __construct($a_title = "", $a_postvar = "")
45  {
46  parent::__construct($a_title, $a_postvar);
47  $this->setType("custom");
48  }
49 
55  function setHtml($a_html)
56  {
57  $this->html = $a_html;
58  }
59 
65  function getHtml()
66  {
67  return $this->html;
68  }
69 
75  function setValueByArray($a_values)
76  {
77  foreach($this->getSubItems() as $item)
78  {
79  $item->setValueByArray($a_values);
80  }
81  }
82 
87  function insert(&$a_tpl)
88  {
89  $a_tpl->setCurrentBlock("prop_custom");
90  $a_tpl->setVariable("CUSTOM_CONTENT", $this->getHtml());
91  $a_tpl->parseCurrentBlock();
92  }
93 
99  function checkInput()
100  {
101  global $lng;
102 
103  if($this->getPostVar())
104  {
105  $_POST[$this->getPostVar()] = ilUtil::stripSlashes($_POST[$this->getPostVar()]);
106  if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "")
107  {
108  $this->setAlert($lng->txt("msg_input_is_required"));
109  return false;
110  }
111  }
112  return $this->checkSubItemsInput();
113  }
114 }