ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilAccountCodesGUI Class Reference

GUI class for account codes. More...

+ Collaboration diagram for ilAccountCodesGUI:

Public Member Functions

 __construct ($a_ref_id)
 Constructor. More...
 
 executeCommand ()
 
 listCodes ()
 
 initAddCodesForm ()
 
 addCodes ()
 
 createCodes ()
 
 deleteCodes ()
 
 deleteConfirmation ()
 
 resetCodesFilter ()
 
 applyCodesFilter ()
 
 exportCodes ()
 

Protected Attributes

 $ref_id
 

Detailed Description

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
Version
$Id$

@ilCtrl_Calls ilAccountCodesGUI:

Definition at line 13 of file class.ilAccountCodesGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilAccountCodesGUI::__construct (   $a_ref_id)

Constructor.

Parameters
int$a_ref_id

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

23 {
24 global $lng;
25
26 $this->ref_id = $a_ref_id;
27 $lng->loadLanguageModule("user");
28 }
global $lng
Definition: privfeed.php:17

References $lng.

Member Function Documentation

◆ addCodes()

ilAccountCodesGUI::addCodes ( )

Definition at line 113 of file class.ilAccountCodesGUI.php.

114 {
115 global $ilAccess, $ilErr, $tpl, $lng;
116
117 if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
118 $ilErr->raiseError($lng->txt("msg_no_perm_write"), $ilErr->MESSAGE);
119 }
120
121 $this->initAddCodesForm();
122 $tpl->setContent($this->form_gui->getHTML());
123 }
$tpl
Definition: ilias.php:10
global $ilErr
Definition: raiseError.php:16

References $ilErr, $lng, $tpl, and initAddCodesForm().

+ Here is the call graph for this function:

◆ applyCodesFilter()

ilAccountCodesGUI::applyCodesFilter ( )

Definition at line 210 of file class.ilAccountCodesGUI.php.

211 {
212 include_once("./Services/User/classes/class.ilAccountCodesTableGUI.php");
213 $utab = new ilAccountCodesTableGUI($this, "listCodes");
214 $utab->resetOffset();
215 $utab->writeFilterToSession();
216
217 $this->listCodes();
218 }
TableGUI class for account codes.

References listCodes().

+ Here is the call graph for this function:

◆ createCodes()

ilAccountCodesGUI::createCodes ( )

Definition at line 125 of file class.ilAccountCodesGUI.php.

126 {
127 global $ilAccess, $ilErr, $lng, $tpl, $ilCtrl;
128
129 if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
130 $ilErr->raiseError($lng->txt("msg_no_perm_write"), $ilErr->MESSAGE);
131 }
132
133 $this->initAddCodesForm();
134 if ($this->form_gui->checkInput()) {
135 $number = $this->form_gui->getInput('acc_codes_number');
136 switch ($this->form_gui->getInput('valid_type')) {
137 case 'valid_unlimited':
138 $valid = 0;
139 break;
140
141 case 'valid_static':
142 $valid = $this->form_gui->getItemByPostVar('valid_date')->getDate()->get(IL_CAL_DATE);
143 break;
144
145 case 'valid_dynamic':
146 $valid = $this->form_gui->getInput('valid_days');
147 break;
148 }
149
150 include_once './Services/User/classes/class.ilAccountCode.php';
151
152 $stamp = time();
153 for ($loop = 1; $loop <= $number; $loop++) {
155 }
156
157 ilUtil::sendSuccess($lng->txt('saved_successfully'), true);
158 $ilCtrl->redirect($this, "listCodes");
159 } else {
160 $this->form_gui->setValuesByPost();
161 $tpl->setContent($this->form_gui->getHtml());
162 }
163 }
const IL_CAL_DATE
static create($valid_until, $stamp)
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$valid
global $ilCtrl
Definition: ilias.php:18

References $ilCtrl, $ilErr, $lng, $tpl, $valid, ilAccountCode\create(), IL_CAL_DATE, initAddCodesForm(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ deleteCodes()

ilAccountCodesGUI::deleteCodes ( )

Definition at line 165 of file class.ilAccountCodesGUI.php.

166 {
167 global $lng, $ilCtrl;
168
169 include_once './Services/User/classes/class.ilAccountCode.php';
171
172 ilUtil::sendSuccess($lng->txt('info_deleted'), true);
173 $ilCtrl->redirect($this, "listCodes");
174 }
$_POST["username"]
static deleteCodes(array $ids)

References $_POST, $ilCtrl, $lng, ilAccountCode\deleteCodes(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ deleteConfirmation()

ilAccountCodesGUI::deleteConfirmation ( )

Definition at line 176 of file class.ilAccountCodesGUI.php.

177 {
178 global $ilErr, $lng, $ilCtrl, $tpl;
179
180 if (!isset($_POST["id"])) {
181 $ilErr->raiseError($lng->txt("no_checkbox"), $ilErr->MESSAGE);
182 }
183
184 include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
185 $gui = new ilConfirmationGUI();
186 $gui->setHeaderText($lng->txt("info_delete_sure"));
187 $gui->setCancel($lng->txt("cancel"), "listCodes");
188 $gui->setConfirm($lng->txt("confirm"), "deleteCodes");
189 $gui->setFormAction($ilCtrl->getFormAction($this, "deleteCodes"));
190
191 include_once './Services/User/classes/class.ilAccountCode.php';
193 foreach ($data as $code) {
194 $gui->addItem("id[]", $code["code_id"], $code["code"]);
195 }
196
197 $tpl->setContent($gui->getHTML());
198 }
static loadCodesByIds(array $ids)
Confirmation screen class.
$code
Definition: example_050.php:99

References $_POST, $code, $data, $ilCtrl, $ilErr, $lng, $tpl, and ilAccountCode\loadCodesByIds().

+ Here is the call graph for this function:

◆ executeCommand()

ilAccountCodesGUI::executeCommand ( )

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

31 {
32 global $ilCtrl;
33
34 $next_class = $ilCtrl->getNextClass($this);
35 $cmd = $ilCtrl->getCmd();
36
37 switch ($next_class) {
38 default:
39 if (!$cmd) {
40 $cmd = "listCodes";
41 }
42 $this->$cmd();
43 break;
44 }
45
46 return true;
47 }

References $ilCtrl.

◆ exportCodes()

ilAccountCodesGUI::exportCodes ( )

Definition at line 220 of file class.ilAccountCodesGUI.php.

221 {
222 global $ilAccess, $ilErr, $lng;
223
224 if (!$ilAccess->checkAccess('read', '', $this->ref_id)) {
225 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->MESSAGE);
226 }
227
228 include_once("./Services/User/classes/class.ilAccountCodesTableGUI.php");
229 $utab = new ilAccountCodesTableGUI($this, "listCodes");
230
231 include_once './Services/User/classes/class.ilAccountCode.php';
232 $codes = ilAccountCode::getCodesForExport($utab->filter["code"], $utab->filter["valid_until"], $utab->filter["generated"]);
233
234 if (sizeof($codes)) {
235 // #13497
236 ilUtil::deliverData(implode("\r\n", $codes), "ilias_account_codes_" . date("d-m-Y") . ".txt", "text/plain");
237 } else {
238 ilUtil::sendFailure($lng->txt("account_export_codes_no_data"));
239 $this->listCodes();
240 }
241 }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
static getCodesForExport($filter_code, $filter_valid_until, $filter_generated)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.

References $ilErr, $lng, date, ilUtil\deliverData(), ilAccountCode\getCodesForExport(), listCodes(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ initAddCodesForm()

ilAccountCodesGUI::initAddCodesForm ( )

Definition at line 68 of file class.ilAccountCodesGUI.php.

69 {
70 global $ilCtrl, $lng;
71
72 include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
73
74 $this->form_gui = new ilPropertyFormGUI();
75 $this->form_gui->setFormAction($ilCtrl->getFormAction($this, 'createCodes'));
76 $this->form_gui->setTitle($lng->txt('user_account_codes_edit_header'));
77
78 $count = new ilNumberInputGUI($lng->txt('user_account_codes_number'), 'acc_codes_number');
79 $count->setSize(4);
80 $count->setMaxLength(4);
81 $count->setMinValue(1);
82 $count->setMaxValue(1000);
83 $count->setRequired(true);
84 $this->form_gui->addItem($count);
85
86 $valid = new ilRadioGroupInputGUI($lng->txt('user_account_code_valid_until'), 'valid_type');
87 $valid->setRequired(true);
88
89 $unl = new ilRadioOption($lng->txt('user_account_code_valid_until_unlimited'), 'valid_unlimited');
90 $valid->addOption($unl);
91
92 $st = new ilRadioOption($lng->txt('user_account_code_valid_until_static'), 'valid_static');
93 $valid->addOption($st);
94
95 $dt = new ilDateTimeInputGUI($lng->txt('date'), 'valid_date');
96 $dt->setRequired(true);
97 $st->addSubItem($dt);
98
99 $dyn = new ilRadioOption($lng->txt('user_account_code_valid_until_dynamic'), 'valid_dynamic');
100 $valid->addOption($dyn);
101
102 $ds = new ilNumberInputGUI($lng->txt('days'), 'valid_days');
103 $ds->setSize(5);
104 $ds->setRequired(true);
105 $dyn->addSubItem($ds);
106
107 $this->form_gui->addItem($valid);
108
109 $this->form_gui->addCommandButton('createCodes', $lng->txt('create'));
110 $this->form_gui->addCommandButton('listCodes', $lng->txt('cancel'));
111 }
This class represents a date/time property in a property form.
This class represents a number property in a property form.
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.

References $ilCtrl, $lng, and $valid.

Referenced by addCodes(), and createCodes().

+ Here is the caller graph for this function:

◆ listCodes()

ilAccountCodesGUI::listCodes ( )

Definition at line 49 of file class.ilAccountCodesGUI.php.

50 {
51 global $ilAccess, $ilErr, $ilCtrl, $ilToolbar, $lng, $tpl;
52
53 if (!$ilAccess->checkAccess('read', '', $this->ref_id)) {
54 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->MESSAGE);
55 }
56
57 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
58 $button = ilLinkButton::getInstance();
59 $button->setCaption("user_account_codes_add");
60 $button->setUrl($ilCtrl->getLinkTarget($this, "addCodes"));
61 $ilToolbar->addButtonInstance($button);
62
63 include_once("./Services/User/classes/class.ilAccountCodesTableGUI.php");
64 $ctab = new ilAccountCodesTableGUI($this, "listCodes");
65 $tpl->setContent($ctab->getHTML());
66 }
static getInstance()
Factory.

References $ilCtrl, $ilErr, $lng, $tpl, and ilLinkButton\getInstance().

Referenced by applyCodesFilter(), exportCodes(), and resetCodesFilter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetCodesFilter()

ilAccountCodesGUI::resetCodesFilter ( )

Definition at line 200 of file class.ilAccountCodesGUI.php.

201 {
202 include_once("./Services/User/classes/class.ilAccountCodesTableGUI.php");
203 $utab = new ilAccountCodesTableGUI($this, "listCodes");
204 $utab->resetOffset();
205 $utab->resetFilter();
206
207 $this->listCodes();
208 }

References listCodes().

+ Here is the call graph for this function:

Field Documentation

◆ $ref_id

ilAccountCodesGUI::$ref_id
protected

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


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