ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilAccountCodesGUI Class Reference

GUI class for account codes. More...

+ Collaboration diagram for ilAccountCodesGUI:

Public Member Functions

 __construct ($a_ref_id)
 Constructor.
 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$

ilAccountCodesGUI:

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

Constructor & Destructor Documentation

ilAccountCodesGUI::__construct (   $a_ref_id)

Constructor.

Parameters
int$a_ref_id

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

References $lng.

{
global $lng;
$this->ref_id = $a_ref_id;
$lng->loadLanguageModule("user");
}

Member Function Documentation

ilAccountCodesGUI::addCodes ( )

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

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

{
global $ilAccess, $ilErr, $tpl, $lng;
if(!$ilAccess->checkAccess('write', '', $this->ref_id))
{
$ilErr->raiseError($lng->txt("msg_no_perm_write"), $ilErr->MESSAGE);
}
$this->initAddCodesForm();
$tpl->setContent($this->form_gui->getHTML());
}

+ Here is the call graph for this function:

ilAccountCodesGUI::applyCodesFilter ( )

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

References listCodes().

{
include_once("./Services/User/classes/class.ilAccountCodesTableGUI.php");
$utab = new ilAccountCodesTableGUI($this, "listCodes");
$utab->resetOffset();
$utab->writeFilterToSession();
$this->listCodes();
}

+ Here is the call graph for this function:

ilAccountCodesGUI::createCodes ( )

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

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

{
global $ilAccess, $ilErr, $lng, $tpl, $ilCtrl;
if(!$ilAccess->checkAccess('write', '', $this->ref_id))
{
$ilErr->raiseError($lng->txt("msg_no_perm_write"), $ilErr->MESSAGE);
}
$this->initAddCodesForm();
if($this->form_gui->checkInput())
{
$number = $this->form_gui->getInput('acc_codes_number');
switch($this->form_gui->getInput('valid_type'))
{
case 'valid_unlimited':
$valid = 0;
break;
case 'valid_static':
$valid = $this->form_gui->getInput('valid_date');
$valid = $valid['date'];
break;
case 'valid_dynamic':
$valid = $this->form_gui->getInput('valid_days');
break;
}
include_once './Services/User/classes/class.ilAccountCode.php';
$stamp = time();
for($loop = 1; $loop <= $number; $loop++)
{
}
ilUtil::sendSuccess($lng->txt('saved_successfully'), true);
$ilCtrl->redirect($this, "listCodes");
}
else
{
$this->form_gui->setValuesByPost();
$tpl->setContent($this->form_gui->getHtml());
}
}

+ Here is the call graph for this function:

ilAccountCodesGUI::deleteCodes ( )

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

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

{
global $lng, $ilCtrl;
include_once './Services/User/classes/class.ilAccountCode.php';
ilUtil::sendSuccess($lng->txt('info_deleted'), true);
$ilCtrl->redirect($this, "listCodes");
}

+ Here is the call graph for this function:

ilAccountCodesGUI::deleteConfirmation ( )

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

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

{
global $ilErr, $lng, $ilCtrl, $tpl;
if(!isset($_POST["id"]))
{
$ilErr->raiseError($lng->txt("no_checkbox"), $ilErr->MESSAGE);
}
include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
$gui = new ilConfirmationGUI();
$gui->setHeaderText($lng->txt("info_delete_sure"));
$gui->setCancel($lng->txt("cancel"), "listCodes");
$gui->setConfirm($lng->txt("confirm"), "deleteCodes");
$gui->setFormAction($ilCtrl->getFormAction($this, "deleteCodes"));
include_once './Services/User/classes/class.ilAccountCode.php';
foreach($data as $code)
{
$gui->addItem("id[]", $code["code_id"], $code["code"]);
}
$tpl->setContent($gui->getHTML());
}

+ Here is the call graph for this function:

ilAccountCodesGUI::executeCommand ( )

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

References $cmd, and $ilCtrl.

{
global $ilCtrl;
$next_class = $ilCtrl->getNextClass($this);
$cmd = $ilCtrl->getCmd();
switch($next_class)
{
default:
if(!$cmd)
{
$cmd = "listCodes";
}
$this->$cmd();
break;
}
return true;
}
ilAccountCodesGUI::exportCodes ( )

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

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

{
global $ilAccess, $ilErr, $lng;
if(!$ilAccess->checkAccess('read', '', $this->ref_id))
{
$ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->MESSAGE);
}
include_once("./Services/User/classes/class.ilAccountCodesTableGUI.php");
$utab = new ilAccountCodesTableGUI($this, "listCodes");
include_once './Services/User/classes/class.ilAccountCode.php';
$codes = ilAccountCode::getCodesForExport($utab->filter["code"], $utab->filter["valid_until"], $utab->filter["generated"]);
if(sizeof($codes))
{
// #13497
ilUtil::deliverData(implode("\r\n", $codes), "ilias_account_codes_".date("d-m-Y").".txt","text/plain");
}
else
{
ilUtil::sendFailure($lng->txt("account_export_codes_no_data"));
$this->listCodes();
}
}

+ Here is the call graph for this function:

ilAccountCodesGUI::initAddCodesForm ( )

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

References $ilCtrl, $lng, $valid, ilFormPropertyGUI\setRequired(), and ilNumberInputGUI\setSize().

Referenced by addCodes(), and createCodes().

{
global $ilCtrl, $lng;
include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
$this->form_gui = new ilPropertyFormGUI();
$this->form_gui->setFormAction($ilCtrl->getFormAction($this, 'createCodes'));
$this->form_gui->setTitle($lng->txt('user_account_codes_edit_header'));
$count = new ilNumberInputGUI($lng->txt('user_account_codes_number'), 'acc_codes_number');
$count->setSize(4);
$count->setMaxLength(4);
$count->setMinValue(1);
$count->setMaxValue(1000);
$count->setRequired(true);
$this->form_gui->addItem($count);
$valid = new ilRadioGroupInputGUI($lng->txt('user_account_code_valid_until'), 'valid_type');
$valid->setRequired(true);
$unl = new ilRadioOption($lng->txt('user_account_code_valid_until_unlimited'), 'valid_unlimited');
$valid->addOption($unl);
$st = new ilRadioOption($lng->txt('user_account_code_valid_until_static'), 'valid_static');
$valid->addOption($st);
$dt = new ilDateTimeInputGUI($lng->txt('date'), 'valid_date');
$dt->setRequired(true);
$st->addSubItem($dt);
$dyn = new ilRadioOption($lng->txt('user_account_code_valid_until_dynamic'), 'valid_dynamic');
$valid->addOption($dyn);
$ds = new ilNumberInputGUI($lng->txt('days'), 'valid_days');
$ds->setSize(5);
$ds->setRequired(true);
$dyn->addSubItem($ds);
$this->form_gui->addItem($valid);
$this->form_gui->addCommandButton('createCodes', $lng->txt('create'));
$this->form_gui->addCommandButton('listCodes', $lng->txt('cancel'));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAccountCodesGUI::listCodes ( )

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

References $ilCtrl, $ilErr, $lng, and $tpl.

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

{
global $ilAccess, $ilErr, $ilCtrl, $ilToolbar, $lng, $tpl;
if(!$ilAccess->checkAccess('read','',$this->ref_id))
{
$ilErr->raiseError($lng->txt("msg_no_perm_read"),$ilErr->MESSAGE);
}
$ilToolbar->addButton($lng->txt("user_account_codes_add"),
$ilCtrl->getLinkTarget($this, "addCodes"));
include_once("./Services/User/classes/class.ilAccountCodesTableGUI.php");
$ctab = new ilAccountCodesTableGUI($this, "listCodes");
$tpl->setContent($ctab->getHTML());
}

+ Here is the caller graph for this function:

ilAccountCodesGUI::resetCodesFilter ( )

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

References listCodes().

{
include_once("./Services/User/classes/class.ilAccountCodesTableGUI.php");
$utab = new ilAccountCodesTableGUI($this, "listCodes");
$utab->resetOffset();
$utab->resetFilter();
$this->listCodes();
}

+ Here is the call graph for this function:

Field Documentation

ilAccountCodesGUI::$ref_id
protected

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


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