ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilConfirmationGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 require_once("Services/Table/classes/class.ilTableGUI.php");
6 
16 {
17  private $hidden_item = array();
18  private $item = array();
19  private $use_images = false;
20  private $buttons = array();
21 
26  public function __construct()
27  {
28  }
29 
30  final public function setFormAction($a_form_action)
31  {
32  $this->form_action = $a_form_action;
33  }
34 
35  final public function getFormAction()
36  {
37  return $this->form_action;
38  }
39 
45  function setHeaderText($a_headertext)
46  {
47  $this->headertext = $a_headertext;
48  }
49 
55  function getHeaderText()
56  {
57  return $this->headertext;
58  }
59 
66  final public function addButton($a_txt, $a_cmd)
67  {
68  $this->buttons[] = array(
69  "txt" => $a_txt, "cmd" => $a_cmd);
70  }
71 
78  final public function setCancel($a_txt, $a_cmd)
79  {
80  $this->cancel_txt = $a_txt;
81  $this->cancel_cmd = $a_cmd;
82  }
83 
90  final public function setConfirm($a_txt, $a_cmd)
91  {
92  $this->confirm_txt = $a_txt;
93  $this->confirm_cmd = $a_cmd;
94  }
95 
104  public function addItem($a_post_var, $a_id, $a_text, $a_img = "",
105  $a_alt = "")
106  {
107  $this->item[] = array("var" => $a_post_var, "id" => $a_id,
108  "text" => $a_text, "img" => $a_img, "alt" => $a_alt);
109  if ($a_img != "")
110  {
111  $this->use_images = true;
112  }
113  }
114 
126  public function addHiddenItem($a_post_var, $a_value)
127  {
128  $this->hidden_item[] = array("var" => $a_post_var, "value" => $a_value);
129  }
130 
136  final public function getHTML()
137  {
138  global $lng;
139 
141 
142  include_once("./Services/Utilities/classes/class.ilConfirmationTableGUI.php");
143  $ctab = new ilConfirmationTableGUI($this->use_images);
144  $ctab->setData($this->item);
145 
146  // other buttons
147  foreach ($this->buttons as $b)
148  {
149  $ctab->addCommandButton($b["cmd"], $b["txt"]);
150  }
151  $ctab->addCommandButton($this->confirm_cmd, $this->confirm_txt);
152  $ctab->addCommandButton($this->cancel_cmd, $this->cancel_txt);
153  $ctab->setFormAction($this->getFormAction());
154  foreach ($this->hidden_item as $hidden_item)
155  {
156  $ctab->addHiddenInput($hidden_item["var"], $hidden_item["value"]);
157  }
158 
159  return $ctab->getHTML();
160  }
161 }
162 ?>