This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
More...
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 GUI class for account codes
- Author
- Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Definition at line 23 of file class.ilAccountCodesGUI.php.
◆ __construct()
| ilAccountCodesGUI::__construct |
( |
int |
$a_ref_id | ) |
|
Definition at line 31 of file class.ilAccountCodesGUI.php.
32 {
34 $this->main_tpl =
$DIC->ui()->mainTemplate();
35
37
38 $this->ref_id = $a_ref_id;
39 $lng->loadLanguageModule(
"user");
40 $this->request = new \ILIAS\User\StandardGUIRequest(
43 );
44 }
References $DIC, and $lng.
◆ addCodes()
| ilAccountCodesGUI::addCodes |
( |
| ) |
|
Definition at line 135 of file class.ilAccountCodesGUI.php.
135 : void
136 {
138
139 $ilAccess =
$DIC[
'ilAccess'];
143
144 if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
146 }
147
149 $tpl->setContent($this->form_gui->getHTML());
150 }
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
References $DIC, $ilErr, $lng, $tpl, and initAddCodesForm().
◆ applyCodesFilter()
| ilAccountCodesGUI::applyCodesFilter |
( |
| ) |
|
Definition at line 249 of file class.ilAccountCodesGUI.php.
249 : void
250 {
252 $utab->resetOffset();
253 $utab->writeFilterToSession();
254
256 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
References listCodes().
◆ createCodes()
| ilAccountCodesGUI::createCodes |
( |
| ) |
|
Definition at line 152 of file class.ilAccountCodesGUI.php.
152 : void
153 {
155
156 $ilAccess =
$DIC[
'ilAccess'];
160 $ilCtrl =
$DIC[
'ilCtrl'];
161
163
164 if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
166 }
167
169 if ($this->form_gui->checkInput()) {
170 $number = $this->form_gui->getInput('acc_codes_number');
171 switch ($this->form_gui->getInput('valid_type')) {
172 case 'valid_unlimited':
174 break;
175
176 case 'valid_static':
177 $valid = $this->form_gui->getItemByPostVar(
'valid_date')->getDate()->get(
IL_CAL_DATE);
178 break;
179
180 case 'valid_dynamic':
181 $valid = $this->form_gui->getInput(
'valid_days');
182 break;
183 }
184
185 $stamp = time();
186 for ($loop = 1; $loop <= $number; $loop++) {
188 }
189
190 $this->main_tpl->setOnScreenMessage(
'success',
$lng->txt(
'saved_successfully'),
true);
191 $ilCtrl->redirect($this, "listCodes");
192 } else {
193 $this->form_gui->setValuesByPost();
194 $tpl->setContent($this->form_gui->getHTML());
195 }
196 }
static create(string $valid_until, int $stamp)
References $DIC, $ilErr, $lng, $tpl, $valid, ilAccountCode\create(), IL_CAL_DATE, and initAddCodesForm().
◆ deleteCodes()
| ilAccountCodesGUI::deleteCodes |
( |
| ) |
|
Definition at line 198 of file class.ilAccountCodesGUI.php.
198 : void
199 {
201
203 $ilCtrl =
$DIC[
'ilCtrl'];
204
205 $ids = $this->request->getIds();
207
208 $this->main_tpl->setOnScreenMessage(
'success',
$lng->txt(
'info_deleted'),
true);
209 $ilCtrl->redirect($this, "listCodes");
210 }
static deleteCodes(array $ids)
References $DIC, $lng, and ilAccountCode\deleteCodes().
◆ deleteConfirmation()
| ilAccountCodesGUI::deleteConfirmation |
( |
| ) |
|
Definition at line 212 of file class.ilAccountCodesGUI.php.
212 : void
213 {
215
217 $ilCtrl =
$DIC[
'ilCtrl'];
219
220 $ids = $this->request->getIds();
221 if (count($ids) == 0) {
222 $this->main_tpl->setOnScreenMessage(
'failure',
$lng->txt(
"no_checkbox"),
true);
224 }
225
227 $gui->setHeaderText(
$lng->txt(
"info_delete_sure"));
228 $gui->setCancel(
$lng->txt(
"cancel"),
"listCodes");
229 $gui->setConfirm(
$lng->txt(
"confirm"),
"deleteCodes");
230 $gui->setFormAction($ilCtrl->getFormAction($this, "deleteCodes"));
231
233 foreach (
$data as $code) {
234 $gui->addItem("id[]", $code["code_id"], $code["code"]);
235 }
236
237 $tpl->setContent($gui->getHTML());
238 }
static loadCodesByIds(array $ids)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
References $data, $DIC, $lng, $tpl, listCodes(), and ilAccountCode\loadCodesByIds().
◆ executeCommand()
| ilAccountCodesGUI::executeCommand |
( |
| ) |
|
Definition at line 46 of file class.ilAccountCodesGUI.php.
46 : void
47 {
49
50 $ilCtrl =
$DIC[
'ilCtrl'];
51
52 $next_class = $ilCtrl->getNextClass($this);
53 $cmd = $ilCtrl->getCmd();
54
55 switch ($next_class) {
56 default:
57 if (!$cmd) {
58 $cmd = "listCodes";
59 }
60 $this->$cmd();
61 break;
62 }
63 }
References $DIC.
◆ exportCodes()
| ilAccountCodesGUI::exportCodes |
( |
| ) |
|
Definition at line 258 of file class.ilAccountCodesGUI.php.
258 : void
259 {
261
262 $ilAccess =
$DIC[
'ilAccess'];
265
266 if (!$ilAccess->checkAccess('read', '', $this->ref_id)) {
268 }
269
272
273 if (count($codes)) {
274
275 ilUtil::deliverData(implode(
"\r\n", $codes),
"ilias_account_codes_" . date(
"d-m-Y") .
".txt",
"text/plain");
276 } else {
277 $this->main_tpl->setOnScreenMessage(
'failure',
$lng->txt(
"account_export_codes_no_data"));
279 }
280 }
static getCodesForExport(string $filter_code, string $filter_valid_until, string $filter_generated)
static deliverData(string $a_data, string $a_filename, string $mime="application/octet-stream")
References $DIC, $ilErr, $lng, ilUtil\deliverData(), ilAccountCode\getCodesForExport(), and listCodes().
◆ initAddCodesForm()
| ilAccountCodesGUI::initAddCodesForm |
( |
| ) |
|
Definition at line 89 of file class.ilAccountCodesGUI.php.
89 : void
90 {
92
93 $ilCtrl =
$DIC[
'ilCtrl'];
95
97 $this->form_gui->setFormAction($ilCtrl->getFormAction($this, 'createCodes'));
98 $this->form_gui->setTitle(
$lng->txt(
'user_account_codes_edit_header'));
99
101 $count->setSize(4);
102 $count->setMaxLength(4);
103 $count->setMinValue(1);
104 $count->setMaxValue(1000);
105 $count->setRequired(true);
106 $this->form_gui->addItem($count);
107
109 $valid->setRequired(
true);
110
111 $unl =
new ilRadioOption(
$lng->txt(
'user_account_code_valid_until_unlimited'),
'valid_unlimited');
113
114 $st =
new ilRadioOption(
$lng->txt(
'user_account_code_valid_until_static'),
'valid_static');
116
118 $dt->setRequired(true);
119 $st->addSubItem($dt);
120
121 $dyn =
new ilRadioOption(
$lng->txt(
'user_account_code_valid_until_dynamic'),
'valid_dynamic');
123
125 $ds->setSize(5);
126 $ds->setRequired(true);
127 $dyn->addSubItem($ds);
128
129 $this->form_gui->addItem(
$valid);
130
131 $this->form_gui->addCommandButton(
'createCodes',
$lng->txt(
'create'));
132 $this->form_gui->addCommandButton(
'listCodes',
$lng->txt(
'cancel'));
133 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
References $DIC, $lng, and $valid.
Referenced by addCodes(), and createCodes().
◆ listCodes()
| ilAccountCodesGUI::listCodes |
( |
| ) |
|
Definition at line 65 of file class.ilAccountCodesGUI.php.
65 : void
66 {
68
69 $ilAccess =
$DIC[
'ilAccess'];
71 $ilCtrl =
$DIC[
'ilCtrl'];
72 $ilToolbar =
$DIC[
'ilToolbar'];
75
76 if (!$ilAccess->checkAccess('read', '', $this->ref_id)) {
78 }
79
81 $button->setCaption("user_account_codes_add");
82 $button->setUrl($ilCtrl->getLinkTarget($this, "addCodes"));
83 $ilToolbar->addButtonInstance($button);
84
86 $tpl->setContent($ctab->getHTML());
87 }
References $DIC, $ilErr, $lng, $tpl, and ilLinkButton\getInstance().
Referenced by applyCodesFilter(), deleteConfirmation(), exportCodes(), and resetCodesFilter().
◆ resetCodesFilter()
| ilAccountCodesGUI::resetCodesFilter |
( |
| ) |
|
◆ $filter
| array ilAccountCodesGUI::$filter |
|
protected |
◆ $form_gui
◆ $main_tpl
◆ $ref_id
| int ilAccountCodesGUI::$ref_id |
|
protected |
◆ $request
| ILIAS User StandardGUIRequest ilAccountCodesGUI::$request |
|
protected |
The documentation for this class was generated from the following file: