ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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:40

References $lng.

Member Function Documentation

◆ addCodes()

ilAccountCodesGUI::addCodes ( )

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

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

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

+ Here is the call graph for this function:

◆ applyCodesFilter()

ilAccountCodesGUI::applyCodesFilter ( )

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

224 {
225 include_once("./Services/User/classes/class.ilAccountCodesTableGUI.php");
226 $utab = new ilAccountCodesTableGUI($this, "listCodes");
227 $utab->resetOffset();
228 $utab->writeFilterToSession();
229
230 $this->listCodes();
231 }
TableGUI class for account codes.

References listCodes().

+ Here is the call graph for this function:

◆ createCodes()

ilAccountCodesGUI::createCodes ( )

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

130 {
131 global $ilAccess, $ilErr, $lng, $tpl, $ilCtrl;
132
133 if(!$ilAccess->checkAccess('write', '', $this->ref_id))
134 {
135 $ilErr->raiseError($lng->txt("msg_no_perm_write"), $ilErr->MESSAGE);
136 }
137
138 $this->initAddCodesForm();
139 if($this->form_gui->checkInput())
140 {
141 $number = $this->form_gui->getInput('acc_codes_number');
142 switch($this->form_gui->getInput('valid_type'))
143 {
144 case 'valid_unlimited':
145 $valid = 0;
146 break;
147
148 case 'valid_static':
149 $valid = $this->form_gui->getInput('valid_date');
150 $valid = $valid['date'];
151 break;
152
153 case 'valid_dynamic':
154 $valid = $this->form_gui->getInput('valid_days');
155 break;
156 }
157
158 include_once './Services/User/classes/class.ilAccountCode.php';
159
160 $stamp = time();
161 for($loop = 1; $loop <= $number; $loop++)
162 {
164 }
165
166 ilUtil::sendSuccess($lng->txt('saved_successfully'), true);
167 $ilCtrl->redirect($this, "listCodes");
168 }
169 else
170 {
171 $this->form_gui->setValuesByPost();
172 $tpl->setContent($this->form_gui->getHtml());
173 }
174 }
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(), initAddCodesForm(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ deleteCodes()

ilAccountCodesGUI::deleteCodes ( )

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

177 {
178 global $lng, $ilCtrl;
179
180 include_once './Services/User/classes/class.ilAccountCode.php';
182
183 ilUtil::sendSuccess($lng->txt('info_deleted'), true);
184 $ilCtrl->redirect($this, "listCodes");
185 }
static deleteCodes(array $ids)
$_POST['username']
Definition: cron.php:12

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

+ Here is the call graph for this function:

◆ deleteConfirmation()

ilAccountCodesGUI::deleteConfirmation ( )

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

188 {
189 global $ilErr, $lng, $ilCtrl, $tpl;
190
191 if(!isset($_POST["id"]))
192 {
193 $ilErr->raiseError($lng->txt("no_checkbox"), $ilErr->MESSAGE);
194 }
195
196 include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
197 $gui = new ilConfirmationGUI();
198 $gui->setHeaderText($lng->txt("info_delete_sure"));
199 $gui->setCancel($lng->txt("cancel"), "listCodes");
200 $gui->setConfirm($lng->txt("confirm"), "deleteCodes");
201 $gui->setFormAction($ilCtrl->getFormAction($this, "deleteCodes"));
202
203 include_once './Services/User/classes/class.ilAccountCode.php';
205 foreach($data as $code)
206 {
207 $gui->addItem("id[]", $code["code_id"], $code["code"]);
208 }
209
210 $tpl->setContent($gui->getHTML());
211 }
static loadCodesByIds(array $ids)
Confirmation screen class.
$data
$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 {
39 default:
40 if(!$cmd)
41 {
42 $cmd = "listCodes";
43 }
44 $this->$cmd();
45 break;
46 }
47
48 return true;
49 }
$cmd
Definition: sahs_server.php:35

References $cmd, and $ilCtrl.

◆ exportCodes()

ilAccountCodesGUI::exportCodes ( )

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

234 {
235 global $ilAccess, $ilErr, $lng;
236
237 if(!$ilAccess->checkAccess('read', '', $this->ref_id))
238 {
239 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->MESSAGE);
240 }
241
242 include_once("./Services/User/classes/class.ilAccountCodesTableGUI.php");
243 $utab = new ilAccountCodesTableGUI($this, "listCodes");
244
245 include_once './Services/User/classes/class.ilAccountCode.php';
246 $codes = ilAccountCode::getCodesForExport($utab->filter["code"], $utab->filter["valid_until"], $utab->filter["generated"]);
247
248 if(sizeof($codes))
249 {
250 // #13497
251 ilUtil::deliverData(implode("\r\n", $codes), "ilias_account_codes_".date("d-m-Y").".txt","text/plain");
252 }
253 else
254 {
255 ilUtil::sendFailure($lng->txt("account_export_codes_no_data"));
256 $this->listCodes();
257 }
258 }
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, ilUtil\deliverData(), ilAccountCode\getCodesForExport(), listCodes(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ initAddCodesForm()

ilAccountCodesGUI::initAddCodesForm ( )

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

72 {
73 global $ilCtrl, $lng;
74
75 include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
76
77 $this->form_gui = new ilPropertyFormGUI();
78 $this->form_gui->setFormAction($ilCtrl->getFormAction($this, 'createCodes'));
79 $this->form_gui->setTitle($lng->txt('user_account_codes_edit_header'));
80
81 $count = new ilNumberInputGUI($lng->txt('user_account_codes_number'), 'acc_codes_number');
82 $count->setSize(4);
83 $count->setMaxLength(4);
84 $count->setMinValue(1);
85 $count->setMaxValue(1000);
86 $count->setRequired(true);
87 $this->form_gui->addItem($count);
88
89 $valid = new ilRadioGroupInputGUI($lng->txt('user_account_code_valid_until'), 'valid_type');
90 $valid->setRequired(true);
91
92 $unl = new ilRadioOption($lng->txt('user_account_code_valid_until_unlimited'), 'valid_unlimited');
93 $valid->addOption($unl);
94
95 $st = new ilRadioOption($lng->txt('user_account_code_valid_until_static'), 'valid_static');
96 $valid->addOption($st);
97
98 $dt = new ilDateTimeInputGUI($lng->txt('date'), 'valid_date');
99 $dt->setRequired(true);
100 $st->addSubItem($dt);
101
102 $dyn = new ilRadioOption($lng->txt('user_account_code_valid_until_dynamic'), 'valid_dynamic');
103 $valid->addOption($dyn);
104
105 $ds = new ilNumberInputGUI($lng->txt('days'), 'valid_days');
106 $ds->setSize(5);
107 $ds->setRequired(true);
108 $dyn->addSubItem($ds);
109
110 $this->form_gui->addItem($valid);
111
112 $this->form_gui->addCommandButton('createCodes', $lng->txt('create'));
113 $this->form_gui->addCommandButton('listCodes', $lng->txt('cancel'));
114 }
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 51 of file class.ilAccountCodesGUI.php.

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

214 {
215 include_once("./Services/User/classes/class.ilAccountCodesTableGUI.php");
216 $utab = new ilAccountCodesTableGUI($this, "listCodes");
217 $utab->resetOffset();
218 $utab->resetFilter();
219
220 $this->listCodes();
221 }

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: