23 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)
69 $this->lng->loadLanguageModule(
"certificate");
70 $this->lng->loadLanguageModule(
"trac");
72 $this->access = $DIC[
'rbacsystem'];
73 $this->error = $DIC[
'ilErr'];
74 $this->hierarchical_access = $DIC[
'ilAccess'];
86 $next_class = $this->ctrl->getNextClass($this);
87 $cmd = $this->ctrl->getCmd();
91 if (!$this->hierarchical_access->checkAccess(
'read',
'', $this->object->getRefId())) {
92 $this->error->raiseError($this->lng->txt(
'no_permission'), $this->error->WARNING);
95 switch ($next_class) {
96 case 'ilpermissiongui':
97 $this->tabs_gui->setTabActive(
'perm_settings');
98 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
100 $this->ctrl->forwardCommand($perm_gui);
104 if (!$cmd || $cmd ==
'view') {
121 if ($this->access->checkAccess(
"visible,read", $this->object->getRefId())) {
122 $this->tabs_gui->addTarget(
124 $this->ctrl->getLinkTarget($this,
"settings"),
125 array(
"settings",
"view")
129 if ($this->access->checkAccess(
'edit_permission', $this->object->getRefId())) {
130 $this->tabs_gui->addTarget(
132 $this->ctrl->getLinkTargetByClass(
'ilpermissiongui',
"perm"),
145 $this->tabs_gui->setTabActive(
'settings');
146 $form_settings =
new ilSetting(
"certificate");
148 include_once(
'Services/Form/classes/class.ilPropertyFormGUI.php');
150 $form->setFormAction($this->ctrl->getFormAction($this));
151 $form->setTitle($this->lng->txt(
'certificate_settings'));
154 $active->
setChecked($form_settings->get(
"active"));
155 $form->addItem($active);
158 $info->
setValue($this->lng->txt(
"certificate_usage"));
159 $form->addItem($info);
161 $bgimage =
new ilImageFileInputGUI($this->lng->txt(
"certificate_background_image"),
"background");
165 if (strlen($_FILES[
"background"][
"tmp_name"])) {
166 if ($bgimage->checkInput()) {
167 $result = $this->
object->uploadBackgroundImage($_FILES[
"background"][
"tmp_name"]);
169 $bgimage->setAlert($this->lng->txt(
"certificate_error_upload_bgimage"));
174 if (strlen($this->object->hasBackgroundImage())) {
175 require_once(
'./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
179 $bgimage->setInfo($this->lng->txt(
"default_background_info"));
180 $form->addItem($bgimage);
182 $defaultformats = array(
183 "a4" => $this->lng->txt(
"certificate_a4"),
184 "a4landscape" => $this->lng->txt(
"certificate_a4_landscape"),
185 "a5" => $this->lng->txt(
"certificate_a5"),
186 "a5landscape" => $this->lng->txt(
"certificate_a5_landscape"),
187 "letter" => $this->lng->txt(
"certificate_letter"),
188 "letterlandscape" => $this->lng->txt(
"certificate_letter_landscape")
190 $format->setOptions($defaultformats);
191 $format->setValue($form_settings->get(
"pageformat"));
192 $format->setInfo($this->lng->txt(
"certificate_page_format_info"));
195 if ($this->hierarchical_access->checkAccess(
'write',
'', $this->object->getRefId())) {
196 $form->addCommandButton(
'save', $this->lng->txt(
'save'));
207 $persistentCertificateMode =
new ilRadioGroupInputGUI($this->lng->txt(
'persistent_certificate_mode'),
'persistent_certificate_mode');
210 $cronJobMode =
new ilRadioOption($this->lng->txt(
'persistent_certificate_mode_cron'),
'persistent_certificate_mode_cron');
211 $cronJobMode->
setInfo($this->lng->txt(
'persistent_certificate_mode_cron_info'));
213 $instantMode =
new ilRadioOption($this->lng->txt(
'persistent_certificate_mode_instant'),
'persistent_certificate_mode_instant');
214 $instantMode->
setInfo($this->lng->txt(
'persistent_certificate_mode_instant_info'));
216 $persistentCertificateMode->addOption($cronJobMode);
217 $persistentCertificateMode->addOption($instantMode);
219 $persistentCertificateMode->setValue($form_settings->get(
'persistent_certificate_mode',
'persistent_certificate_mode_cron'));
221 $form->addItem($persistentCertificateMode);
223 $this->tpl->setContent($form->getHTML());
225 if (strcmp($this->ctrl->getCmd(),
"save") == 0) {
226 if (
$_POST[
"background_delete"]) {
227 $this->
object->deleteBackgroundImage();
234 $form_settings =
new ilSetting(
"certificate");
236 $mode =
$_POST[
"persistent_certificate_mode"];
237 $previousMode = $form_settings->get(
'persistent_certificate_mode',
'persistent_certificate_mode_cron');
238 if ($mode !== $previousMode && $mode ===
'persistent_certificate_mode_instant') {
244 $form_settings->set(
"pageformat",
$_POST[
"pageformat"]);
245 $form_settings->set(
"active",
$_POST[
"active"]);
246 $form_settings->set(
"persistent_certificate_mode", $mode);
248 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)
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.