ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 43 of file class.ilLicenseGUI.php.

44 {
45 global $ilCtrl, $tpl, $lng;
46
47 $this->ctrl = $ilCtrl;
48 $this->tpl = $tpl;
49 $this->lng = $lng;
50 $this->lng->loadLanguageModule("license");
51 $this->parent_gui = $a_parent_gui;
52 $this->license = new ilLicense($this->parent_gui->object->getId());
53 }
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 117 of file class.ilLicenseGUI.php.

118 {
119 if (!$a_form) {
120 $a_form = $this->initLicenseForm();
121 }
122
123 $this->tpl->setContent($a_form->getHTML());
124 }

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 56 of file class.ilLicenseGUI.php.

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

References $ilErr.

◆ initLicenseForm()

ilLicenseGUI::initLicenseForm ( )
protected

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

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

References $form.

Referenced by editLicense(), and updateLicense().

+ Here is the caller graph for this function:

◆ updateLicense()

ilLicenseGUI::updateLicense ( )

Save the license form.

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

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

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

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilLicenseGUI::$ctrl
protected

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

◆ $license

ilLicenseGUI::$license
protected

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

◆ $lng

ilLicenseGUI::$lng
protected

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

Referenced by __construct().

◆ $tpl

ilLicenseGUI::$tpl
protected

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

Referenced by __construct().


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