23 include_once(
"./Services/Object/classes/class.ilObjectGUI.php");
61 public function __construct($a_data, $a_id = 0, $a_call_by_reference =
true, $a_prepare_output =
true)
65 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
67 $this->lng->loadLanguageModule(
"certificate");
68 $this->lng->loadLanguageModule(
"trac");
70 $this->access = $DIC[
'rbacsystem'];
71 $this->error = $DIC[
'ilErr'];
72 $this->hierarchical_access = $DIC[
'ilAccess'];
83 $next_class = $this->ctrl->getNextClass($this);
84 $cmd = $this->ctrl->getCmd();
88 if (!$this->hierarchical_access->checkAccess(
'read',
'', $this->object->getRefId())) {
89 $this->error->raiseError($this->lng->txt(
'no_permission'), $this->error->WARNING);
92 switch ($next_class) {
93 case 'ilpermissiongui':
94 $this->tabs_gui->setTabActive(
'perm_settings');
95 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
97 $this->ctrl->forwardCommand($perm_gui);
101 if (!$cmd || $cmd ==
'view') {
116 if ($this->access->checkAccess(
"visible,read", $this->object->getRefId())) {
117 $this->tabs_gui->addTarget(
119 $this->ctrl->getLinkTarget($this,
"settings"),
120 array(
"settings",
"view")
124 if ($this->access->checkAccess(
'edit_permission', $this->object->getRefId())) {
125 $this->tabs_gui->addTarget(
127 $this->ctrl->getLinkTargetByClass(
'ilpermissiongui',
"perm"),
139 $this->tabs_gui->setTabActive(
'settings');
140 $form_settings =
new ilSetting(
"certificate");
142 include_once(
'Services/Form/classes/class.ilPropertyFormGUI.php');
144 $form->setFormAction($this->ctrl->getFormAction($this));
145 $form->setTitle($this->lng->txt(
'certificate_settings'));
148 $active->
setChecked($form_settings->get(
"active"));
149 $form->addItem($active);
152 $info->setValue($this->lng->txt(
"certificate_usage"));
155 $bgimage =
new ilImageFileInputGUI($this->lng->txt(
"certificate_background_image"),
"background");
159 if (strlen($_FILES[
"background"][
"tmp_name"])) {
160 if ($bgimage->checkInput()) {
161 $result = $this->
object->uploadBackgroundImage($_FILES[
"background"][
"tmp_name"]);
163 $bgimage->setAlert($this->lng->txt(
"certificate_error_upload_bgimage"));
168 if (strlen($this->object->hasBackgroundImage())) {
169 require_once(
'./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
173 $bgimage->setInfo($this->lng->txt(
"default_background_info"));
174 $form->addItem($bgimage);
176 $defaultformats = array(
177 "a4" => $this->lng->txt(
"certificate_a4"),
178 "a4landscape" => $this->lng->txt(
"certificate_a4_landscape"),
179 "a5" => $this->lng->txt(
"certificate_a5"),
180 "a5landscape" => $this->lng->txt(
"certificate_a5_landscape"),
181 "letter" => $this->lng->txt(
"certificate_letter"),
182 "letterlandscape" => $this->lng->txt(
"certificate_letter_landscape")
184 $format->setOptions($defaultformats);
185 $format->setValue($form_settings->get(
"pageformat"));
186 $format->setInfo($this->lng->txt(
"certificate_page_format_info"));
190 if ($this->hierarchical_access->checkAccess(
'write',
'', $this->object->getRefId())) {
191 $form->addCommandButton(
'save', $this->lng->txt(
'save'));
202 $persistentCertificateMode =
new ilRadioGroupInputGUI($this->lng->txt(
'persistent_certificate_mode'),
'persistent_certificate_mode');
205 $cronJobMode =
new ilRadioOption($this->lng->txt(
'persistent_certificate_mode_cron'),
'persistent_certificate_mode_cron');
206 $cronJobMode->
setInfo($this->lng->txt(
'persistent_certificate_mode_cron_info'));
208 $instantMode =
new ilRadioOption($this->lng->txt(
'persistent_certificate_mode_instant'),
'persistent_certificate_mode_instant');
209 $instantMode->
setInfo($this->lng->txt(
'persistent_certificate_mode_instant_info'));
211 $persistentCertificateMode->addOption($cronJobMode);
212 $persistentCertificateMode->addOption($instantMode);
214 $persistentCertificateMode->setValue($form_settings->get(
'persistent_certificate_mode',
'persistent_certificate_mode_cron'));
216 $form->addItem($persistentCertificateMode);
219 $this->tpl->setContent(
$form->getHTML());
221 if (strcmp($this->ctrl->getCmd(),
"save") == 0) {
222 if (
$_POST[
"background_delete"]) {
223 $this->
object->deleteBackgroundImage();
230 $form_settings =
new ilSetting(
"certificate");
232 $mode =
$_POST[
"persistent_certificate_mode"];
233 $previousMode = $form_settings->get(
'persistent_certificate_mode',
'persistent_certificate_mode_cron');
234 if ($mode !== $previousMode && $mode ===
'persistent_certificate_mode_instant') {
240 $form_settings->set(
"pageformat",
$_POST[
"pageformat"]);
241 $form_settings->set(
"active",
$_POST[
"active"]);
242 $form_settings->set(
"persistent_certificate_mode", $mode);
244 ilUtil::sendSuccess($this->lng->txt(
"settings_saved"));
This class represents an option in a radio group.
setInfo($a_info)
Set Info.
prepareOutput($a_show_subobjects=true)
prepare output
static _enabledLearningProgress()
check wether learing progress is enabled or not
executeCommand()
Execute command.
if(isset($_POST['submit'])) $form
Class ilObjectGUI Basic methods of all Output classes.
static signFile($path_to_file)
This class represents a non editable value in a property form.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static setTokenMaxLifetimeInSeconds($token_max_lifetime_in_seconds)
__construct($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Contructor.