ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilLicenseGUI Class Reference
+ Collaboration diagram for ilLicenseGUI:

Public Member Functions

 __construct (ilObjectGUI $a_parent_gui)
 ilLicenseGUI constructor. More...
 
 executeCommand ()
 
 updateLicense ()
 Save the license form. More...
 

Protected Member Functions

 initLicenseForm ()
 
 editLicense (ilPropertyFormGUI $a_form=null)
 

Protected Attributes

 $license
 
 $ctrl
 
 $tpl
 
 $lng
 

Detailed Description

Definition at line 16 of file class.ilLicenseGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilLicenseGUI::__construct ( ilObjectGUI  $a_parent_gui)

ilLicenseGUI constructor.

Parameters
\ilObjectGUI$a_parent_gui

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

42 {
43 global $ilCtrl, $tpl, $lng;
44
45 $this->ctrl = $ilCtrl;
46 $this->tpl = $tpl;
47 $this->lng = $lng;
48 $this->lng->loadLanguageModule("license");
49 $this->parent_gui = $a_parent_gui;
50 $this->license = new ilLicense($this->parent_gui->object->getId());
51 }
global $ilCtrl
Definition: ilias.php:18

References $ilCtrl, $lng, and $tpl.

Member Function Documentation

◆ editLicense()

ilLicenseGUI::editLicense ( ilPropertyFormGUI  $a_form = null)
protected
Parameters
\ilPropertyFormGUI | null$a_form

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

113 {
114 if (!$a_form) {
115 $a_form = $this->initLicenseForm();
116 }
117
118 $this->tpl->setContent($a_form->getHTML());
119 }

References initLicenseForm().

Referenced by updateLicense().

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

◆ executeCommand()

ilLicenseGUI::executeCommand ( )

Definition at line 54 of file class.ilLicenseGUI.php.

54 {
55 global $rbacsystem, $ilErr;
56
57 // access to all functions in this class are only allowed if edit_permission is granted
58 if (!$rbacsystem->checkAccess("edit_permission", $this->parent_gui->object->getRefId())) {
59 $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
60 }
61
62 $cmd = $this->ctrl->getCmd("editLicense");
63 $this->$cmd();
64
65 return true;
66 }
global $ilErr
Definition: raiseError.php:16
$cmd
Definition: sahs_server.php:35

References $cmd, and $ilErr.

◆ initLicenseForm()

ilLicenseGUI::initLicenseForm ( )
protected

Definition at line 69 of file class.ilLicenseGUI.php.

69 {
70 include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
71 $form = new ilPropertyFormGUI();
72 $form->setFormAction($this->ctrl->getFormAction($this, "updateLicense"));
73 $form->setTitle($this->lng->txt('edit_license'));
74
75 $exist = new ilNumberInputGUI($this->lng->txt("existing_licenses"), "licenses");
76 $exist->setInfo($this->lng->txt("zero_licenses_explanation"));
77 $exist->setMaxLength(10);
78 $exist->setSize(10);
79 $exist->setValue($this->license->getLicenses());
80 $form->addItem($exist);
81
82 $info_used = new ilNonEditableValueGUI($this->lng->txt("used_licenses"));
83 $info_used->setInfo($this->lng->txt("used_licenses_explanation"));
84 $info_used->setValue($this->license->getAccesses());
85 $form->addItem($info_used);
86
87 $remaining_licenses = ($this->license->getLicenses() == "0") ? $this->lng->txt("arbitrary") : $this->license->getRemainingLicenses();
88
89 $info_remain = new ilNonEditableValueGUI($this->lng->txt("remaining_licenses"));
90 $info_remain->setInfo($this->lng->txt("remaining_licenses_explanation"));
91 $info_remain->setValue($remaining_licenses);
92 $form->addItem($info_remain);
93
94 $info_potential = new ilNonEditableValueGUI($this->lng->txt("potential_accesses"));
95 $info_potential->setInfo($this->lng->txt("potential_accesses_explanation"));
96 $info_potential->setValue($this->license->getPotentialAccesses());
97 $form->addItem($info_potential);
98
99 $comm = new ilTextAreaInputGUI($this->lng->txt("comment"), "remarks");
100 $comm->setRows(5);
101 $comm->setValue($this->license->getRemarks());
102 $form->addItem($comm);
103
104 $form->addCommandButton('updateLicense', $this->lng->txt('save'));
105
106 return $form;
107 }
This class represents a non editable value 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 text area property in a property form.

Referenced by editLicense(), and updateLicense().

+ Here is the caller graph for this function:

◆ updateLicense()

ilLicenseGUI::updateLicense ( )

Save the license form.

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

125 {
126 $form = $this->initLicenseForm();
127 if ($form->checkInput()) {
128 $this->license->setLicenses($form->getInput("licenses"));
129 $this->license->setRemarks($form->getInput("remarks"));
130 $this->license->update();
131
132 ilUtil::sendSuccess($this->lng->txt('license_updated'), true);
133 $this->ctrl->redirect($this, "editLicense");
134 }
135
136 $form->setValuesByPost();
137 $this->editLicense($form);
138 }
editLicense(ilPropertyFormGUI $a_form=null)
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

References editLicense(), initLicenseForm(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilLicenseGUI::$ctrl
protected

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

◆ $license

ilLicenseGUI::$license
protected

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

◆ $lng

ilLicenseGUI::$lng
protected

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

Referenced by __construct().

◆ $tpl

ilLicenseGUI::$tpl
protected

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

Referenced by __construct().


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