ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilLicenseGUI Class Reference
+ Collaboration diagram for ilLicenseGUI:

Public Member Functions

 ilLicenseGUI (&$a_parent_gui)
 Constructor @access public. More...
 
executeCommand ()
 Execute a command (main entry point) @access public. More...
 
 editLicense (ilPropertyFormGUI $a_form=null)
 Show the license form @access public. More...
 
 updateLicense ()
 Save the license form @access public. More...
 

Protected Member Functions

 initLicenseForm ()
 

Detailed Description

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

Member Function Documentation

◆ editLicense()

ilLicenseGUI::editLicense ( ilPropertyFormGUI  $a_form = null)

Show the license form @access public.

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

103 {
104 if(!$a_form)
105 {
106 $a_form = $this->initLicenseForm();
107 }
108
109 $this->tpl->setContent($a_form->getHTML());
110 }

References initLicenseForm().

Referenced by updateLicense().

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

◆ executeCommand()

& ilLicenseGUI::executeCommand ( )

Execute a command (main entry point) @access public.

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

40 {
41 global $rbacsystem, $ilErr;
42
43 // access to all functions in this class are only allowed if edit_permission is granted
44 if (!$rbacsystem->checkAccess("edit_permission",$this->parent_gui->object->getRefId()))
45 {
46 $ilErr->raiseError($this->lng->txt("permission_denied"),$ilErr->MESSAGE);
47 }
48
49 $cmd = $this->ctrl->getCmd("editLicense");
50 $this->$cmd();
51
52 return true;
53 }
$cmd
Definition: sahs_server.php:35

References $cmd, and $ilErr.

◆ ilLicenseGUI()

ilLicenseGUI::ilLicenseGUI ( $a_parent_gui)

Constructor @access public.

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

24 {
25 global $ilCtrl, $tpl, $lng;
26
27 $this->ctrl =& $ilCtrl;
28 $this->tpl =& $tpl;
29 $this->lng =& $lng;
30 $this->lng->loadLanguageModule("license");
31 $this->parent_gui =& $a_parent_gui;
32 $this->license =& new ilLicense($this->parent_gui->object->getId());
33 }
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40

References $ilCtrl, $lng, and $tpl.

◆ initLicenseForm()

ilLicenseGUI::initLicenseForm ( )
protected

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

56 {
57 include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
58 $form = new ilPropertyFormGUI();
59 $form->setFormAction($this->ctrl->getFormAction($this, "updateLicense"));
60 $form->setTitle($this->lng->txt('edit_license'));
61
62 $exist = new ilNumberInputGUI($this->lng->txt("existing_licenses"), "licenses");
63 $exist->setInfo($this->lng->txt("zero_licenses_explanation"));
64 $exist->setMaxLength(10);
65 $exist->setSize(10);
66 $exist->setValue($this->license->getLicenses());
67 $form->addItem($exist);
68
69 $info_used = new ilNonEditableValueGUI($this->lng->txt("used_licenses"));
70 $info_used->setInfo($this->lng->txt("used_licenses_explanation"));
71 $info_used->setValue($this->license->getAccesses());
72 $form->addItem($info_used);
73
74 $remaining_licenses = ($this->license->getLicenses() == "0")
75 ? $this->lng->txt("arbitrary")
76 : $this->license->getRemainingLicenses();
77
78 $info_remain = new ilNonEditableValueGUI($this->lng->txt("remaining_licenses"));
79 $info_remain->setInfo($this->lng->txt("remaining_licenses_explanation"));
80 $info_remain->setValue($remaining_licenses);
81 $form->addItem($info_remain);
82
83 $info_potential = new ilNonEditableValueGUI($this->lng->txt("potential_accesses"));
84 $info_potential->setInfo($this->lng->txt("potential_accesses_explanation"));
85 $info_potential->setValue($this->license->getPotentialAccesses());
86 $form->addItem($info_potential);
87
88 $comm = new ilTextAreaInputGUI($this->lng->txt("comment"), "remarks");
89 $comm->setRows(5);
90 $comm->setValue($this->license->getRemarks());
91 $form->addItem($comm);
92
93 $form->addCommandButton('updateLicense', $this->lng->txt('save'));
94
95 return $form;
96 }
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 @access public.

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

117 {
118 $form = $this->initLicenseForm();
119 if($form->checkInput())
120 {
121 $this->license->setLicenses($form->getInput("licenses"));
122 $this->license->setRemarks($form->getInput("remarks"));
123 $this->license->update();
124
125 ilUtil::sendSuccess($this->lng->txt('license_updated'), true);
126 $this->ctrl->redirect($this,"editLicense");
127 }
128
129 $form->setValuesByPost();
130 $this->editLicense($form);
131 }
editLicense(ilPropertyFormGUI $a_form=null)
Show the license form @access public.
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:

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