19 declare(strict_types=1);
32 protected \ILIAS\FileUpload\FileUpload
$upload;
40 $this->httpState = $DIC->http();
41 $this->
upload = $DIC->upload();
43 $this->
lng->loadLanguageModule(
'certificate');
44 $this->
lng->loadLanguageModule(
'trac');
49 $next_class = $this->
ctrl->getNextClass($this);
50 $cmd = $this->
ctrl->getCmd();
54 if (!$this->rbac_system->checkAccess(
'read', $this->object->getRefId())) {
55 $this->error->raiseError($this->
lng->txt(
'no_permission'), $this->error->WARNING);
58 switch (strtolower($next_class)) {
59 case strtolower(ilPermissionGUI::class):
60 $this->tabs_gui->setTabActive(
'perm_settings');
62 $this->
ctrl->forwardCommand($perm_gui);
66 if (!$cmd || $cmd ===
'view') {
77 if ($this->rbac_system->checkAccess(
'visible,read', $this->object->getRefId())) {
78 $this->tabs_gui->addTarget(
80 $this->
ctrl->getLinkTarget($this,
'settings'),
85 if ($this->rbac_system->checkAccess(
'edit_permission', $this->object->getRefId())) {
86 $this->tabs_gui->addTarget(
88 $this->
ctrl->getLinkTargetByClass(ilPermissionGUI::class,
'perm'),
90 strtolower(ilPermissionGUI::class)
97 $this->tabs_gui->setTabActive(
'settings');
98 $form_settings =
new ilSetting(
'certificate');
101 $form->setFormAction($this->
ctrl->getFormAction($this));
102 $form->setTitle($this->
lng->txt(
'certificate_settings'));
105 $active->
setChecked((
bool) $form_settings->get(
'active',
'0'));
106 $form->addItem($active);
109 $info->
setValue($this->
lng->txt(
'certificate_usage'));
110 $form->addItem($info);
115 if (strcmp($this->
ctrl->getCmd(),
'save') === 0) {
116 $backgroundDelete = $this->httpState->wrapper()->post()->has(
'background_delete') && $this->httpState->wrapper()->post()->retrieve(
120 if ($backgroundDelete) {
121 $this->
object->deleteBackgroundImage();
126 $this->
upload->hasUploads() &&
127 $this->httpState->request()->getMethod() ===
'POST' &&
128 $bgimage->checkInput()
130 if (!$this->
upload->hasBeenProcessed()) {
134 if (is_array($this->
upload->getResults()) && $this->
upload->getResults() !== []) {
138 $result = $this->
object->uploadBackgroundImage($file);
139 if ($result ===
false) {
140 $bgimage->setAlert($this->
lng->txt(
'certificate_error_upload_bgimage'));
146 if ($this->
object->hasBackgroundImage()) {
150 $bgimage->setInfo($this->
lng->txt(
'default_background_info'));
151 $form->addItem($bgimage);
154 'a4' => $this->
lng->txt(
'certificate_a4'),
155 'a4landscape' => $this->
lng->txt(
'certificate_a4_landscape'),
156 'a5' => $this->
lng->txt(
'certificate_a5'),
157 'a5landscape' => $this->
lng->txt(
'certificate_a5_landscape'),
158 'letter' => $this->
lng->txt(
'certificate_letter'),
159 'letterlandscape' => $this->
lng->txt(
'certificate_letter_landscape')
161 $format->setOptions($defaultformats);
162 $format->setValue($form_settings->get(
"pageformat",
''));
163 $format->setInfo($this->
lng->txt(
"certificate_page_format_info"));
166 if ($this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
167 $form->addCommandButton(
'save', $this->
lng->txt(
'save'));
179 $this->
lng->txt(
'persistent_certificate_mode'),
180 'persistent_certificate_mode' 185 $this->
lng->txt(
'persistent_certificate_mode_cron'),
186 'persistent_certificate_mode_cron' 188 $cronJobMode->
setInfo($this->
lng->txt(
'persistent_certificate_mode_cron_info'));
191 $this->
lng->txt(
'persistent_certificate_mode_instant'),
192 'persistent_certificate_mode_instant' 194 $instantMode->
setInfo($this->
lng->txt(
'persistent_certificate_mode_instant_info'));
196 $persistentCertificateMode->addOption($cronJobMode);
197 $persistentCertificateMode->addOption($instantMode);
199 $persistentCertificateMode->setValue($form_settings->get(
200 'persistent_certificate_mode',
201 'persistent_certificate_mode_cron' 204 $form->addItem($persistentCertificateMode);
206 $this->tpl->setContent($form->getHTML());
211 $form_settings =
new ilSetting(
"certificate");
213 $mode = $this->httpState->wrapper()->post()->retrieve(
214 'persistent_certificate_mode',
215 $this->
refinery->kindlyTo()->string()
217 $previousMode = $form_settings->get(
'persistent_certificate_mode',
'persistent_certificate_mode_cron');
218 if ($mode !== $previousMode && $mode ===
'persistent_certificate_mode_instant') {
226 $this->httpState->wrapper()->post()->retrieve(
'pageformat', $this->
refinery->kindlyTo()->string())
230 (
string) ($this->httpState->wrapper()->post()->has(
'active') && $this->httpState->wrapper()->post()->retrieve(
235 $form_settings->set(
'persistent_certificate_mode', $mode);
237 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'));
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS HTTP GlobalHttpState $httpState
prepareOutput(bool $show_sub_objects=true)
static setTokenMaxLifetimeInSeconds(int $token_max_lifetime_in_seconds)
static _enabledLearningProgress()
ILIAS FileUpload FileUpload $upload
Class ilObjectGUI Basic methods of all Output classes.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
static signFile(string $path_to_file)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
__construct($data, int $id=0, bool $call_by_reference=true, bool $prepare_output=true)