ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilSimpleConfirmationGUI.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/Utilities/classes/class.ilConfirmationGUI.php");
25 
35 {
36  private $buttons = array();
37 
42  public function __construct()
43  {
44  }
45 
46  final public function setFormAction($a_form_action)
47  {
48  $this->form_action = $a_form_action;
49  }
50 
51  final public function getFormAction()
52  {
53  return $this->form_action;
54  }
55 
61  function setHeaderText($a_headertext)
62  {
63  $this->headertext = $a_headertext;
64  }
65 
71  function getHeaderText()
72  {
73  return $this->headertext;
74  }
75 
82  final public function addButton($a_txt, $a_cmd)
83  {
84  $this->buttons[] = array(
85  "txt" => $a_txt, "cmd" => $a_cmd);
86  }
87 
94  final public function setCancel($a_txt, $a_cmd)
95  {
96  $this->cancel_txt = $a_txt;
97  $this->cancel_cmd = $a_cmd;
98  }
99 
106  final public function setConfirm($a_txt, $a_cmd)
107  {
108  $this->confirm_txt = $a_txt;
109  $this->confirm_cmd = $a_cmd;
110  }
111 
117  public function getHTML()
118  {
119  global $lng;
120 
122 
123  $template = new ilTemplate("tpl.confirmation.simple.html", TRUE, TRUE, "Services/Utilities");
124 
125  if (strlen($this->confirm_cmd))
126  {
127  $template->setCurrentBlock('cmd');
128  $template->setVariable('CMD', $this->confirm_cmd);
129  $template->setVariable('TXT_CMD', $this->confirm_txt);
130  $template->parseCurrentBlock();
131  }
132 
133  if (strlen($this->cancel_cmd))
134  {
135  $template->setCurrentBlock('cmd');
136  $template->setVariable('CMD', $this->cancel_cmd);
137  $template->setVariable('TXT_CMD', $this->cancel_txt);
138  $template->parseCurrentBlock();
139  }
140 
141  // add buttons
142  foreach ($this->buttons as $b)
143  {
144  $template->setCurrentBlock('cmd');
145  $template->setVariable('CMD', $b['cmd']);
146  $template->setVariable('TXT_CMD', $b['txt']);
147  $template->parseCurrentBlock();
148  }
149 
150  $template->setVariable("FORMACTION", $this->getFormAction());
151  return $template->get();
152  }
153 }
154 ?>