ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilConfirmationGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 setFormAction (string $a_form_action)
 
 getFormAction ()
 
 setHeaderText (string $a_headertext)
 
 getHeaderText ()
 
 setFormName (string $a_name)
 
 addButton (string $a_txt, string $a_cmd)
 
 setCancel (string $a_txt, string $a_cmd, string $a_id='')
 
 setConfirm (string $a_txt, string $a_cmd, string $a_id='')
 
 addItem (string $a_post_var, string $a_id, string $a_text, string $a_img='', string $a_alt='')
 
 addHiddenItem (string $a_post_var, string $a_value)
 
 getHTML ()
 

Protected Attributes

ilLanguage $lng
 
string $form_action = ''
 
string $headertext = ''
 
string $cancel_txt = ''
 
string $cancel_cmd = ''
 
string $cancel_id = ''
 
string $confirm_txt = ''
 
string $confirm_cmd = ''
 
string $confirm_id = ''
 

Private Attributes

array $hidden_item = []
 
array $item = []
 
array $buttons = []
 
bool $use_images = false
 
string $form_name = ''
 
ilGlobalTemplateInterface $main_tpl
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Confirmation screen class.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de
Deprecated:
with ILIAS 12

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

Member Function Documentation

◆ addButton()

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

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

81 : void
82 {
83 $this->buttons[] = [
84 'txt' => $a_txt,
85 'cmd' => $a_cmd
86 ];
87 }

◆ addHiddenItem()

ilConfirmationGUI::addHiddenItem ( string  $a_post_var,
string  $a_value 
)

◆ addItem()

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

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

115 : void {
116 $this->item[] = [
117 'var' => $a_post_var,
118 'id' => $a_id,
119 'text' => $a_text,
120 'img' => $a_img,
121 'alt' => $a_alt
122 ];
123
124 if ($a_img !== '') {
125 $this->use_images = true;
126 }
127 }

◆ getFormAction()

ilConfirmationGUI::getFormAction ( )
final

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

61 : string
62 {
63 return $this->form_action;
64 }

References $form_action.

◆ getHeaderText()

ilConfirmationGUI::getHeaderText ( )

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

71 : string
72 {
73 return $this->headertext;
74 }

References $headertext.

◆ getHTML()

ilConfirmationGUI::getHTML ( )
final

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

139 : string
140 {
141 if ($this->headertext === '') {
142 throw new RuntimeException('Please provide a header text before rendering the confirmation dialogue');
143 }
144
145 if ($this->form_action === '') {
146 throw new RuntimeException('Please provide a form action before rendering the confirmation dialogue');
147 }
148
149 if ($this->confirm_txt === '' || $this->confirm_cmd === '') {
150 throw new RuntimeException('Please provide a confirmation button label and command before rendering the confirmation dialogue');
151 }
152
153 if ($this->cancel_txt === '' || $this->cancel_cmd === '') {
154 throw new RuntimeException('Please provide a cancel button label and command before rendering the confirmation dialogue');
155 }
156
157 $this->main_tpl->setOnScreenMessage('question', $this->getHeaderText());
158
159 // delete/handle items
160 if (count($this->item) > 0) {
161 $ctab = new ilConfirmationTableGUI($this->use_images);
162 $ctab->setData($this->item);
163
164 foreach ($this->buttons as $b) {
165 $ctab->addCommandButton($b["cmd"], $b["txt"]);
166 }
167 $ctab->addCommandButton($this->confirm_cmd, $this->confirm_txt);
168 $ctab->addCommandButton($this->cancel_cmd, $this->cancel_txt);
169 $ctab->setFormAction($this->getFormAction());
170 foreach ($this->hidden_item as $hidden_item) {
171 $ctab->addHiddenInput($hidden_item["var"], $hidden_item["value"]);
172 }
173
174 if ($this->form_name !== '') {
175 $ctab->setFormName($this->form_name);
176 }
177
178 return $ctab->getHTML();
179 }
180
181 // simple version, just ask for confirmation
182 $tb = new ilToolbarGUI();
183 $tb->setPreventDoubleSubmission(true);
184 $tb->setFormAction($this->getFormAction());
185 if ($this->hidden_item) {
186 foreach ($this->hidden_item as $hidden_item) {
187 $hiddenInput = new ilHiddenInputGUI($hidden_item['var']);
188 $hiddenInput->setValue($hidden_item['value']);
189 $tb->addInputItem($hiddenInput);
190 }
191 }
192 $confirm = ilSubmitButton::getInstance();
193 $confirm->setCommand($this->confirm_cmd);
194 $confirm->setCaption($this->confirm_txt, false);
195 $confirm->setId($this->confirm_id);
196
197 $cancel = ilSubmitButton::getInstance();
198 $cancel->setCommand($this->cancel_cmd);
199 $cancel->setCaption($this->cancel_txt, false);
200
201 if ($this->cancel_id !== '') {
202 $cancel->setId($this->cancel_id);
203 }
204
205 $tb->addStickyItem($confirm);
206 $tb->addStickyItem($cancel);
207
208 return $tb->getHTML();
209 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a hidden form property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References Vendor\Package\$b, and ilSubmitButton\getInstance().

+ Here is the call graph for this function:

◆ setCancel()

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

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

93 : void {
94 $this->cancel_txt = $a_txt;
95 $this->cancel_cmd = $a_cmd;
96 $this->cancel_id = $a_id;
97 }

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

+ Here is the caller graph for this function:

◆ setConfirm()

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

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

103 : void {
104 $this->confirm_txt = $a_txt;
105 $this->confirm_cmd = $a_cmd;
106 $this->confirm_id = $a_id;
107 }

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

+ Here is the caller graph for this function:

◆ setFormAction()

ilConfirmationGUI::setFormAction ( string  $a_form_action)
final

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

56 : void
57 {
58 $this->form_action = $a_form_action;
59 }

Referenced by ilTestPassDeletionConfirmationGUI\__construct().

+ Here is the caller graph for this function:

◆ setFormName()

ilConfirmationGUI::setFormName ( string  $a_name)

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

76 : void
77 {
78 $this->form_name = $a_name;
79 }

◆ setHeaderText()

ilConfirmationGUI::setHeaderText ( string  $a_headertext)

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

66 : void
67 {
68 $this->headertext = $a_headertext;
69 }

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

+ Here is the caller graph for this function:

Field Documentation

◆ $buttons

array ilConfirmationGUI::$buttons = []
private

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

◆ $cancel_cmd

string ilConfirmationGUI::$cancel_cmd = ''
protected

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

◆ $cancel_id

string ilConfirmationGUI::$cancel_id = ''
protected

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

◆ $cancel_txt

string ilConfirmationGUI::$cancel_txt = ''
protected

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

◆ $confirm_cmd

string ilConfirmationGUI::$confirm_cmd = ''
protected

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

◆ $confirm_id

string ilConfirmationGUI::$confirm_id = ''
protected

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

◆ $confirm_txt

string ilConfirmationGUI::$confirm_txt = ''
protected

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

◆ $form_action

string ilConfirmationGUI::$form_action = ''
protected

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

Referenced by getFormAction().

◆ $form_name

string ilConfirmationGUI::$form_name = ''
private

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

◆ $headertext

string ilConfirmationGUI::$headertext = ''
protected

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

Referenced by getHeaderText().

◆ $hidden_item

array ilConfirmationGUI::$hidden_item = []
private

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

◆ $item

array ilConfirmationGUI::$item = []
private

◆ $lng

◆ $main_tpl

ilGlobalTemplateInterface ilConfirmationGUI::$main_tpl
private

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

◆ $use_images

bool ilConfirmationGUI::$use_images = false
private

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


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