ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilSubEnabledFormPropertyGUI.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 include_once("./Services/Form/classes/class.ilFormPropertyGUI.php");
25 
34 {
35  protected $sub_items = array();
36 
42  function addSubItem($a_item)
43  {
44  $this->sub_items[] = $a_item;
45  }
46 
52  function getSubItems()
53  {
54  return $this->sub_items;
55  }
56 
62  final function checkSubItemsInput()
63  {
64  $ok = true;
65  foreach($this->getSubItems() as $item)
66  {
67  $item_ok = $item->checkInput();
68  if(!$item_ok)
69  {
70  $ok = false;
71  }
72  }
73  return $ok;
74  }
75 
80  final function getSubForm()
81  {
82  // subitems
83  $pf = null;
84  if (count($this->getSubItems()) > 0)
85  {
86  $pf = new ilPropertyFormGUI();
87  $pf->setMode("subform");
88  $pf->setItems($this->getSubItems());
89  }
90 
91  return $pf;
92  }
93 
99  function getItemByPostVar($a_post_var)
100  {
101  if ($this->getPostVar() == $a_post_var)
102  {
103  return $this;
104  }
105 
106  foreach($this->getSubItems() as $item)
107  {
108  if ($item->getType() != "section_header")
109  {
110  $ret = $item->getItemByPostVar($a_post_var);
111  if (is_object($ret))
112  {
113  return $ret;
114  }
115  }
116  }
117 
118  return false;
119  }
120 
121 }