19 include_once(
"./Services/Object/classes/class.ilObjectGUI.php");
63 public function __construct($a_data, $a_id = 0, $a_call_by_reference =
true, $a_prepare_output =
true)
68 $this->httpState = $DIC->http();
69 $this->upload = $DIC->upload();
71 $this->lng->loadLanguageModule(
"certificate");
72 $this->lng->loadLanguageModule(
"trac");
74 $this->access = $DIC[
'rbacsystem'];
75 $this->error = $DIC[
'ilErr'];
76 $this->hierarchical_access = $DIC[
'ilAccess'];
88 $next_class = $this->ctrl->getNextClass($this);
89 $cmd = $this->ctrl->getCmd();
93 if (!$this->hierarchical_access->checkAccess(
'read',
'', $this->object->getRefId())) {
94 $this->error->raiseError($this->lng->txt(
'no_permission'), $this->error->WARNING);
97 switch ($next_class) {
98 case 'ilpermissiongui':
99 $this->tabs_gui->setTabActive(
'perm_settings');
100 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
102 $this->ctrl->forwardCommand($perm_gui);
106 if (!$cmd || $cmd ==
'view') {
123 if ($this->access->checkAccess(
"visible,read", $this->object->getRefId())) {
124 $this->tabs_gui->addTarget(
126 $this->ctrl->getLinkTarget($this,
"settings"),
127 array(
"settings",
"view")
131 if ($this->access->checkAccess(
'edit_permission', $this->object->getRefId())) {
132 $this->tabs_gui->addTarget(
134 $this->ctrl->getLinkTargetByClass(
'ilpermissiongui',
"perm"),
147 $this->tabs_gui->setTabActive(
'settings');
148 $form_settings =
new ilSetting(
"certificate");
150 include_once(
'Services/Form/classes/class.ilPropertyFormGUI.php');
152 $form->setFormAction($this->ctrl->getFormAction($this));
153 $form->setTitle($this->lng->txt(
'certificate_settings'));
156 $active->
setChecked($form_settings->get(
"active"));
157 $form->addItem($active);
160 $info->
setValue($this->lng->txt(
"certificate_usage"));
161 $form->addItem($info);
163 $bgimage =
new ilImageFileInputGUI($this->lng->txt(
"certificate_background_image"),
"background");
166 if (strcmp($this->ctrl->getCmd(),
"save") == 0) {
167 if (
$_POST[
"background_delete"]) {
168 $this->
object->deleteBackgroundImage();
173 $this->upload->hasUploads() &&
174 $this->httpState->request()->getMethod() ===
'POST' &&
175 $bgimage->checkInput()
177 if (!$this->upload->hasBeenProcessed()) {
178 $this->upload->process();
181 if (is_array($this->upload->getResults()) && $this->upload->getResults() !== []) {
182 $results = $this->upload->getResults();
185 $result = $this->
object->uploadBackgroundImage($file->getPath());
187 $bgimage->setAlert($this->lng->txt(
'certificate_error_upload_bgimage'));
193 if (strlen($this->object->hasBackgroundImage())) {
194 require_once(
'./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
198 $bgimage->setInfo($this->lng->txt(
"default_background_info"));
199 $form->addItem($bgimage);
201 $defaultformats = array(
202 "a4" => $this->lng->txt(
"certificate_a4"),
203 "a4landscape" => $this->lng->txt(
"certificate_a4_landscape"),
204 "a5" => $this->lng->txt(
"certificate_a5"),
205 "a5landscape" => $this->lng->txt(
"certificate_a5_landscape"),
206 "letter" => $this->lng->txt(
"certificate_letter"),
207 "letterlandscape" => $this->lng->txt(
"certificate_letter_landscape")
209 $format->setOptions($defaultformats);
210 $format->setValue($form_settings->get(
"pageformat"));
211 $format->setInfo($this->lng->txt(
"certificate_page_format_info"));
214 if ($this->hierarchical_access->checkAccess(
'write',
'', $this->object->getRefId())) {
215 $form->addCommandButton(
'save', $this->lng->txt(
'save'));
226 $persistentCertificateMode =
new ilRadioGroupInputGUI($this->lng->txt(
'persistent_certificate_mode'),
'persistent_certificate_mode');
229 $cronJobMode =
new ilRadioOption($this->lng->txt(
'persistent_certificate_mode_cron'),
'persistent_certificate_mode_cron');
230 $cronJobMode->
setInfo($this->lng->txt(
'persistent_certificate_mode_cron_info'));
232 $instantMode =
new ilRadioOption($this->lng->txt(
'persistent_certificate_mode_instant'),
'persistent_certificate_mode_instant');
233 $instantMode->
setInfo($this->lng->txt(
'persistent_certificate_mode_instant_info'));
235 $persistentCertificateMode->addOption($cronJobMode);
236 $persistentCertificateMode->addOption($instantMode);
238 $persistentCertificateMode->setValue($form_settings->get(
'persistent_certificate_mode',
'persistent_certificate_mode_cron'));
240 $form->addItem($persistentCertificateMode);
242 $this->tpl->setContent($form->getHTML());
247 $form_settings =
new ilSetting(
"certificate");
249 $mode =
$_POST[
"persistent_certificate_mode"];
250 $previousMode = $form_settings->get(
'persistent_certificate_mode',
'persistent_certificate_mode_cron');
251 if ($mode !== $previousMode && $mode ===
'persistent_certificate_mode_instant') {
257 $form_settings->set(
"pageformat",
$_POST[
"pageformat"]);
258 $form_settings->set(
"active",
$_POST[
"active"]);
259 $form_settings->set(
"persistent_certificate_mode", $mode);
261 ilUtil::sendSuccess($this->lng->txt(
"settings_saved"));
This class represents an option in a radio group.
setValue($a_value)
Set Value.
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.
Class ilObjectGUI Basic methods of all Output classes.
static signFile($path_to_file)
This class represents a non editable value in a property form.
__construct(Container $dic, ilPlugin $plugin)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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.