ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilConfirmationGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2005 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/Table/classes/class.ilTableGUI.php");
25 
35 {
36  private $hidden_item = array();
37  private $item = array();
38  private $use_images = false;
39  private $buttons = array();
40 
45  public function __construct()
46  {
47  }
48 
49  final public function setFormAction($a_form_action)
50  {
51  $this->form_action = $a_form_action;
52  }
53 
54  final public function getFormAction()
55  {
56  return $this->form_action;
57  }
58 
64  function setHeaderText($a_headertext)
65  {
66  $this->headertext = $a_headertext;
67  }
68 
74  function getHeaderText()
75  {
76  return $this->headertext;
77  }
78 
85  final public function addButton($a_txt, $a_cmd)
86  {
87  $this->buttons[] = array(
88  "txt" => $a_txt, "cmd" => $a_cmd);
89  }
90 
97  final public function setCancel($a_txt, $a_cmd)
98  {
99  $this->cancel_txt = $a_txt;
100  $this->cancel_cmd = $a_cmd;
101  }
102 
109  final public function setConfirm($a_txt, $a_cmd)
110  {
111  $this->confirm_txt = $a_txt;
112  $this->confirm_cmd = $a_cmd;
113  }
114 
123  public function addItem($a_post_var, $a_id, $a_text, $a_img = "",
124  $a_alt = "")
125  {
126  $this->item[] = array("var" => $a_post_var, "id" => $a_id,
127  "text" => $a_text, "img" => $a_img, "alt" => $a_alt);
128  if ($a_img != "")
129  {
130  $this->use_images = true;
131  }
132  }
133 
145  public function addHiddenItem($a_post_var, $a_value)
146  {
147  $this->hidden_item[] = array("var" => $a_post_var, "value" => $a_value);
148  }
149 
155  final public function getHTML()
156  {
157  global $lng;
158 
160 
161  include_once("./Services/Utilities/classes/class.ilConfirmationTableGUI.php");
162  $ctab = new ilConfirmationTableGUI($this->use_images);
163  $ctab->setData($this->item);
164 
165  // other buttons
166  foreach ($this->buttons as $b)
167  {
168  $ctab->addCommandButton($b["cmd"], $b["txt"]);
169  }
170  $ctab->addCommandButton($this->confirm_cmd, $this->confirm_txt);
171  $ctab->addCommandButton($this->cancel_cmd, $this->cancel_txt);
172  $ctab->setFormAction($this->getFormAction());
173  foreach ($this->hidden_item as $hidden_item)
174  {
175  $ctab->addHiddenInput($hidden_item["var"], $hidden_item["value"]);
176  }
177 
178  return $ctab->getHTML();
179  }
180 }
181 ?>