24 include_once(
"./Services/Certificate/classes/class.ilCertificate.php");
94 include_once
"./Services/Certificate/classes/class.ilCertificate.php";
100 $this->tree =&
$tree;
101 $this->ref_id =
$_GET[
"ref_id"];
102 $this->lng->loadLanguageModule(
"certificate");
110 $cmd = $this->ctrl->getCmd();
111 $next_class = $this->ctrl->getNextClass($this);
136 $this->certificateEditor();
144 $this->
object->createPreview();
152 $this->
object->deliverExportFileXML();
160 $this->
object->deleteBackgroundImage();
161 $this->certificateEditor();
170 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
172 $cgui->setFormAction($this->ctrl->getFormAction($this,
"certificateEditor"));
173 $cgui->setHeaderText($this->lng->txt(
"certificate_confirm_deletion_text"));
174 $cgui->setCancel($this->lng->txt(
"no"),
"certificateEditor");
175 $cgui->setConfirm($this->lng->txt(
"yes"),
"certificateDeleteConfirm");
177 $this->tpl->setContent($cgui->getHTML());
185 $this->
object->deleteCertificate();
186 $this->ctrl->redirect($this,
"certificateEditor");
194 $this->certificateEditor();
202 $this->certificateEditor();
210 $form_fields = array(
221 $this->
object->getAdapter()->addFormFieldsFromPOST($form_fields);
230 $form_fields = $this->
object->getFormFieldsFromFO();
231 $form_fields[
"active"] = $this->
object->readActive();
232 $this->
object->getAdapter()->addFormFieldsFromObject($form_fields);
239 public function certificateEditor()
244 global $ilAccess, $ilToolbar;
246 $form_fields = array();
247 if (strcmp($this->ctrl->getCmd(),
"certificateSave") == 0)
255 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
257 $form->setPreventDoubleSubmission(
false);
258 $form->setFormAction($this->ctrl->getFormAction($this));
259 $form->setTitle($this->lng->txt(
"certificate_edit"));
260 $form->setMultipart(TRUE);
261 $form->setTableWidth(
"100%");
262 $form->setId(
"certificate");
266 $form->addItem($active);
268 $import =
new ilFileInputGUI($this->lng->txt(
"import"),
"certificate_import");
270 $import->setSuffixes(array(
"zip"));
272 if (strlen($_FILES[
"certificate_import"][
"name"]))
274 if ($import->checkInput())
276 $result = $this->
object->importCertificate($_FILES[
"certificate_import"][
"tmp_name"], $_FILES[
"certificate_import"][
"name"]);
279 $import->setAlert($this->lng->txt(
"certificate_error_import"));
283 $this->ctrl->redirect($this,
"certificateEditor");
287 $form->addItem($import);
289 $pageformat =
new ilRadioGroupInputGUI($this->lng->txt(
"certificate_page_format"),
"pageformat");
290 $pageformats = $this->
object->getPageFormats();
291 $pageformat->
setValue($form_fields[
"pageformat"]);
292 foreach($pageformats as $format)
294 $option =
new ilRadioOption($format[
"name"], $format[
"value"]);
295 if(strcmp($format[
"value"],
"custom") == 0)
297 $pageheight =
new ilTextInputGUI($this->lng->txt(
"certificate_pageheight"),
"pageheight");
298 $pageheight->
setValue($form_fields[
"pageheight"]);
299 $pageheight->setSize(6);
300 $pageheight->setValidationRegexp(
"/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is");
301 $pageheight->setInfo($this->lng->txt(
"certificate_unit_description"));
302 $pageheight->setRequired(
true);
303 $option->addSubitem($pageheight);
305 $pagewidth =
new ilTextInputGUI($this->lng->txt(
"certificate_pagewidth"),
"pagewidth");
306 $pagewidth->
setValue($form_fields[
"pagewidth"]);
307 $pagewidth->setSize(6);
308 $pagewidth->setValidationRegexp(
"/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is");
309 $pagewidth->setInfo($this->lng->txt(
"certificate_unit_description"));
310 $pagewidth->setRequired(
true);
311 $option->addSubitem($pagewidth);
313 $pageformat->addOption($option);
315 $pageformat->setRequired(
true);
316 if (strcmp($this->ctrl->getCmd(),
"certificateSave") == 0) $pageformat->checkInput();
318 $form->addItem($pageformat);
320 $bgimage =
new ilImageFileInputGUI($this->lng->txt(
"certificate_background_image"),
"background");
322 $bgimage->setUseCache(
false);
326 if (strlen($_FILES[
"background"][
"tmp_name"]))
328 if ($bgimage->checkInput())
330 $result = $this->
object->uploadBackgroundImage($_FILES[
"background"][
"tmp_name"]);
333 $bgimage->setAlert($this->lng->txt(
"certificate_error_upload_bgimage"));
338 if (!$this->object->hasBackgroundImage())
340 include_once
"./Services/Certificate/classes/class.ilObjCertificateSettingsAccess.php";
343 require_once(
'./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
350 require_once(
'./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
354 $form->addItem($bgimage);
356 $rect =
new ilCSSRectInputGUI($this->lng->txt(
"certificate_margin_body"),
"margin_body");
358 $rect->setUseUnits(TRUE);
359 $rect->setTop($form_fields[
"margin_body_top"]);
360 $rect->setBottom($form_fields[
"margin_body_bottom"]);
361 $rect->setLeft($form_fields[
"margin_body_left"]);
362 $rect->setRight($form_fields[
"margin_body_right"]);
363 $rect->setInfo($this->lng->txt(
"certificate_unit_description"));
364 if (strcmp($this->ctrl->getCmd(),
"certificateSave") == 0) $rect->checkInput();
365 $form->addItem($rect);
369 $certificate->setValue($form_fields[
"certificate_text"]);
375 $common_desc_tpl =
new ilTemplate(
"tpl.common_desc.html",
true,
true,
"Services/Certificate");
378 $common_desc_tpl->setCurrentBlock(
"cert_field");
379 $common_desc_tpl->setVariable(
"PH", $f[
"ph"]);
380 $common_desc_tpl->setVariable(
"PH_TXT", $f[
"name"]);
381 $common_desc_tpl->parseCurrentBlock();
383 $common_desc = $common_desc_tpl->get();
386 $certificate->setInfo($this->object->getAdapter()->getCertificateVariablesDescription().$common_desc);
401 if (strcmp($this->ctrl->getCmd(),
"certificateSave") == 0)
$certificate->checkInput();
404 $this->
object->getAdapter()->addAdditionalFormElements($form, $form_fields);
406 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"]))
408 if ($this->object->isComplete() || $this->
object->hasBackgroundImage())
410 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
412 require_once
'Services/UIComponent/Button/classes/class.ilSubmitButton.php';
414 $preview->setCaption(
'certificate_preview');
415 $preview->setCommand(
'certificatePreview');
416 $ilToolbar->addStickyItem(
$preview);
419 $export->setCaption(
'certificate_export');
420 $export->setCommand(
'certificateExportFO');
421 $ilToolbar->addButtonInstance($export);
424 $delete->setCaption(
'delete');
425 $delete->setCommand(
'certificateDelete');
426 $ilToolbar->addButtonInstance($delete);
428 $form->addCommandButton(
"certificateSave", $this->lng->txt(
"save"));
431 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
433 if (strcmp($this->ctrl->getCmd(),
"certificateSave") == 0)
435 if (
$_POST[
"background_delete"])
437 $this->
object->deleteBackgroundImage();
439 if ($form->checkInput())
443 $xslfo = $this->
object->processXHTML2FO($form_fields);
444 $this->
object->getAdapter()->saveFormFields($form_fields);
445 $this->
object->saveCertificate($xslfo);
446 $this->
object->writeActive($form_fields[
"active"]);
448 $this->ctrl->redirect($this,
"certificateEditor");
getCommand($cmd)
Retrieves the ilCtrl command.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
certificateSave()
Saves the certificate.
This class represents an option in a radio group.
ilCertificateGUI($adapter)
ilCertificateGUI constructor
certificatePreview()
Creates a certificate preview.
& executeCommand()
execute command
certificateDeleteConfirm()
Deletes the certificate and all its data.
if(@file_exists(dirname(__FILE__).'/lang/eng.php')) $certificate
getFormFieldsFromPOST()
Get the form values from an HTTP POST.
certificateExportFO()
Exports the certificate.
special template class to simplify handling of ITX/PEAR
certificateImport()
Import a certificate from a ZIP archive.
This class represents a text property in a property form.
certificateUpload()
Uploads the certificate.
GUI class to create PDF certificates.
redirection script todo: (a better solution should control the processing via a xml file) ...
static getBackgroundImageThumbPathWeb()
Returns the web path of the background image thumbnail.
getFormFieldsFromFO()
Get the form values from the certificate xsl-fo.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static getCustomCertificateFields()
Get custom certificate fields.
static signFile($path_to_file)
certificateRemoveBackground()
Removes the background image of a certificate.
static hasBackgroundImage()
Returns wheather or not a default background image exists.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
This class represents a text area property in a property form.
static setTokenMaxLifetimeInSeconds($token_max_lifetime_in_seconds)
certificateDelete()
Deletes the certificate and all its data.
setValue($a_value)
Set Value.
Confirmation screen class.