ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilConfirmationGUI Class Reference

Confirmation screen class. More...

+ Inheritance diagram for ilConfirmationGUI:
+ Collaboration diagram for ilConfirmationGUI:

Public Member Functions

 __construct ()
 Constructor. More...
 
 setFormAction ($a_form_action)
 
 getFormAction ()
 
 setHeaderText ($a_headertext)
 Set Set header text. More...
 
 getHeaderText ()
 Get Set header text. More...
 
 addButton ($a_txt, $a_cmd)
 Set cancel button command and text. More...
 
 setCancel ($a_txt, $a_cmd, $a_id="")
 Set cancel button command and text. More...
 
 setConfirm ($a_txt, $a_cmd, $a_id="")
 Set confirmation button command and text. More...
 
 addItem ( $a_post_var, $a_id, $a_text, $a_img="", $a_alt="")
 Add row item. More...
 
 addHiddenItem ($a_post_var, $a_value)
 Add hidden item. More...
 
 getHTML ()
 Get confirmation screen HTML. More...
 
 setFormName ($a_name)
 Set form name. More...
 

Protected Attributes

 $lng
 

Private Attributes

 $hidden_item = array()
 
 $item = array()
 
 $use_images = false
 
 $buttons = array()
 
 $form_name
 

Detailed Description

Confirmation screen class.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 15 of file class.ilConfirmationGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilConfirmationGUI::__construct ( )

Constructor.

Definition at line 32 of file class.ilConfirmationGUI.php.

References $DIC.

33  {
34  global $DIC;
35 
36  $this->lng = $DIC->language();
37  }
global $DIC
Definition: saml.php:7

Member Function Documentation

◆ addButton()

ilConfirmationGUI::addButton (   $a_txt,
  $a_cmd 
)
final

Set cancel button command and text.

Parameters
stringcancel text
stringcancel command

Definition at line 75 of file class.ilConfirmationGUI.php.

76  {
77  $this->buttons[] = array(
78  "txt" => $a_txt, "cmd" => $a_cmd);
79  }

◆ addHiddenItem()

ilConfirmationGUI::addHiddenItem (   $a_post_var,
  $a_value 
)

◆ addItem()

ilConfirmationGUI::addItem (   $a_post_var,
  $a_id,
  $a_text,
  $a_img = "",
  $a_alt = "" 
)

Add row item.

Parameters
stringname of post variable used for id (e.g. "id[]")
mixedid value
stringitem text
stringitem image path

Definition at line 115 of file class.ilConfirmationGUI.php.

121  {
122  $this->item[] = array("var" => $a_post_var, "id" => $a_id,
123  "text" => $a_text, "img" => $a_img, "alt" => $a_alt);
124  if ($a_img != "") {
125  $this->use_images = true;
126  }
127  }

◆ getFormAction()

ilConfirmationGUI::getFormAction ( )
final

Definition at line 44 of file class.ilConfirmationGUI.php.

Referenced by getHTML().

45  {
46  return $this->form_action;
47  }
+ Here is the caller graph for this function:

◆ getHeaderText()

ilConfirmationGUI::getHeaderText ( )

Get Set header text.

Returns
string Set header text

Definition at line 64 of file class.ilConfirmationGUI.php.

Referenced by getHTML().

65  {
66  return $this->headertext;
67  }
+ Here is the caller graph for this function:

◆ getHTML()

ilConfirmationGUI::getHTML ( )
final

Get confirmation screen HTML.

Returns
string HTML code.

Definition at line 145 of file class.ilConfirmationGUI.php.

References $hidden_item, $lng, getFormAction(), getHeaderText(), ilSubmitButton\getInstance(), and ilUtil\sendQuestion().

146  {
147  $lng = $this->lng;
148 
150 
151  include_once("./Services/Utilities/classes/class.ilConfirmationTableGUI.php");
152 
153  // delete/handle items
154  if (count($this->item) > 0) {
155  $ctab = new ilConfirmationTableGUI($this->use_images);
156  $ctab->setData($this->item);
157 
158  // other buttons
159  foreach ($this->buttons as $b) {
160  $ctab->addCommandButton($b["cmd"], $b["txt"]);
161  }
162  $ctab->addCommandButton($this->confirm_cmd, $this->confirm_txt);
163  $ctab->addCommandButton($this->cancel_cmd, $this->cancel_txt);
164  $ctab->setFormAction($this->getFormAction());
165  foreach ($this->hidden_item as $hidden_item) {
166  $ctab->addHiddenInput($hidden_item["var"], $hidden_item["value"]);
167  }
168 
169  if ($this->form_name) {
170  $ctab->setFormName($this->form_name);
171  }
172 
173  return $ctab->getHTML();
174  } else { // simple version, just ask for confirmation
175  $tb = new ilToolbarGUI();
176  $tb->setPreventDoubleSubmission(true);
177  $tb->setFormAction($this->getFormAction());
178  if ($this->hidden_item) {
179  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
180  foreach ($this->hidden_item as $hidden_item) {
181  $hiddenInput = new ilHiddenInputGUI($hidden_item['var']);
182  $hiddenInput->setValue($hidden_item['value']);
183  $tb->addInputItem($hiddenInput);
184  }
185  }
186  require_once 'Services/UIComponent/Button/classes/class.ilSubmitButton.php';
187  $confirm = ilSubmitButton::getInstance();
188  $confirm->setCommand($this->confirm_cmd);
189  $confirm->setCaption($this->confirm_txt, false);
190  $confirm->setId($this->confirm_id);
191 
192  $cancel = ilSubmitButton::getInstance();
193  $cancel->setCommand($this->cancel_cmd);
194  $cancel->setCaption($this->cancel_txt, false);
195  $cancel->setId($this->cancel_id);
196 
197  $tb->addStickyItem($confirm);
198  $tb->addStickyItem($cancel);
199 
200  return $tb->getHTML();
201  }
202  }
getHeaderText()
Get Set header text.
This class represents a hidden form property in a property form.
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
+ Here is the call graph for this function:

◆ setCancel()

ilConfirmationGUI::setCancel (   $a_txt,
  $a_cmd,
  $a_id = "" 
)
final

Set cancel button command and text.

Parameters
stringcancel text
stringcancel command

Definition at line 87 of file class.ilConfirmationGUI.php.

Referenced by ilTestPassDeletionConfirmationGUI\build(), and ilTestAnswerOptionalQuestionsConfirmationGUI\build().

88  {
89  $this->cancel_txt = $a_txt;
90  $this->cancel_cmd = $a_cmd;
91  $this->cancel_id = $a_id;
92  }
+ Here is the caller graph for this function:

◆ setConfirm()

ilConfirmationGUI::setConfirm (   $a_txt,
  $a_cmd,
  $a_id = "" 
)
final

Set confirmation button command and text.

Parameters
stringconfirmation button text
stringconfirmation button command

Definition at line 100 of file class.ilConfirmationGUI.php.

Referenced by ilTestPassDeletionConfirmationGUI\build(), and ilTestAnswerOptionalQuestionsConfirmationGUI\build().

101  {
102  $this->confirm_txt = $a_txt;
103  $this->confirm_cmd = $a_cmd;
104  $this->confirm_id = $a_id;
105  }
+ Here is the caller graph for this function:

◆ setFormAction()

ilConfirmationGUI::setFormAction (   $a_form_action)
final

Definition at line 39 of file class.ilConfirmationGUI.php.

Referenced by ilTestPassDeletionConfirmationGUI\__construct(), ilCalendarAppointmentGUI\cancelBooking(), ilCalendarAppointmentGUI\confirmRegister(), and ilCalendarAppointmentGUI\confirmUnregister().

40  {
41  $this->form_action = $a_form_action;
42  }
+ Here is the caller graph for this function:

◆ setFormName()

ilConfirmationGUI::setFormName (   $a_name)

Set form name.

Parameters
string$a_name

Definition at line 209 of file class.ilConfirmationGUI.php.

210  {
211  $this->form_name = $a_name;
212  }

◆ setHeaderText()

ilConfirmationGUI::setHeaderText (   $a_headertext)

Set Set header text.

Parameters
string$a_headertextSet header text

Definition at line 54 of file class.ilConfirmationGUI.php.

Referenced by ilTestPassDeletionConfirmationGUI\build(), ilTestAnswerOptionalQuestionsConfirmationGUI\build(), and ilTestSettingsChangeConfirmationGUI\build().

55  {
56  $this->headertext = $a_headertext;
57  }
+ Here is the caller graph for this function:

Field Documentation

◆ $buttons

ilConfirmationGUI::$buttons = array()
private

Definition at line 25 of file class.ilConfirmationGUI.php.

◆ $form_name

ilConfirmationGUI::$form_name
private

Definition at line 26 of file class.ilConfirmationGUI.php.

◆ $hidden_item

ilConfirmationGUI::$hidden_item = array()
private

Definition at line 22 of file class.ilConfirmationGUI.php.

Referenced by getHTML().

◆ $item

ilConfirmationGUI::$item = array()
private

◆ $lng

ilConfirmationGUI::$lng
protected

Definition at line 20 of file class.ilConfirmationGUI.php.

Referenced by getHTML().

◆ $use_images

ilConfirmationGUI::$use_images = false
private

Definition at line 24 of file class.ilConfirmationGUI.php.


The documentation for this class was generated from the following file: