24include_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);
144 $this->
object->createPreview();
152 $this->
object->deliverExportFileXML();
160 $this->
object->deleteBackgroundImage();
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");
210 $form_fields = array(
222 $this->
object->getAdapter()->addFormFieldsFromPOST($form_fields);
231 $form_fields = $this->
object->getFormFieldsFromFO();
232 $form_fields[
"active"] = $this->
object->readActive();
233 $this->
object->getAdapter()->addFormFieldsFromObject($form_fields);
244 $form_fields = array();
245 if (strcmp($this->ctrl->getCmd(),
"certificateSave") == 0)
253 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
255 $form->setPreventDoubleSubmission(
false);
256 $form->setFormAction($this->ctrl->getFormAction($this));
257 $form->setTitle($this->lng->txt(
"certificate_edit"));
258 $form->setMultipart(TRUE);
259 $form->setTableWidth(
"100%");
260 $form->setId(
"certificate");
263 $active->setChecked($form_fields[
"active"]);
264 $form->addItem($active);
266 $import =
new ilFileInputGUI($this->lng->txt(
"import"),
"certificate_import");
267 $import->setRequired(FALSE);
268 $import->setSuffixes(array(
"zip"));
270 if (strlen($_FILES[
"certificate_import"][
"tmp_name"]))
272 if ($import->checkInput())
274 $result = $this->
object->importCertificate($_FILES[
"certificate_import"][
"tmp_name"], $_FILES[
"certificate_import"][
"name"]);
277 $import->setAlert($this->lng->txt(
"certificate_error_import"));
281 $this->ctrl->redirect($this,
"certificateEditor");
285 $form->addItem($import);
287 $pageformat =
new ilRadioGroupInputGUI($this->lng->txt(
"certificate_page_format"),
"pageformat");
288 $pageformats = $this->
object->getPageFormats();
289 $pageformat->setValue($form_fields[
"pageformat"]);
290 foreach($pageformats as $format)
292 $option =
new ilRadioOption($format[
"name"], $format[
"value"]);
293 if(strcmp($format[
"value"],
"custom") == 0)
295 $pageheight =
new ilTextInputGUI($this->lng->txt(
"certificate_pageheight"),
"pageheight");
296 $pageheight->setValue($form_fields[
"pageheight"]);
297 $pageheight->setSize(6);
298 $pageheight->setValidationRegexp(
"/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is");
299 $pageheight->setInfo($this->lng->txt(
"certificate_unit_description"));
300 $pageheight->setRequired(
true);
301 $option->addSubitem($pageheight);
303 $pagewidth =
new ilTextInputGUI($this->lng->txt(
"certificate_pagewidth"),
"pagewidth");
304 $pagewidth->setValue($form_fields[
"pagewidth"]);
305 $pagewidth->setSize(6);
306 $pagewidth->setValidationRegexp(
"/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is");
307 $pagewidth->setInfo($this->lng->txt(
"certificate_unit_description"));
308 $pagewidth->setRequired(
true);
309 $option->addSubitem($pagewidth);
311 $pageformat->addOption($option);
313 $pageformat->setRequired(
true);
314 if (strcmp($this->ctrl->getCmd(),
"certificateSave") == 0) $pageformat->checkInput();
316 $form->addItem($pageformat);
318 $bgimage =
new ilImageFileInputGUI($this->lng->txt(
"certificate_background_image"),
"background");
319 $bgimage->setRequired(FALSE);
320 $bgimage->setUseCache(
false);
324 if (strlen($_FILES[
"background"][
"tmp_name"]))
326 if ($bgimage->checkInput())
328 $result = $this->
object->uploadBackgroundImage($_FILES[
"background"][
"tmp_name"]);
331 $bgimage->setAlert($this->lng->txt(
"certificate_error_upload_bgimage"));
336 if (!$this->object->hasBackgroundImage())
338 include_once
"./Services/Certificate/classes/class.ilObjCertificateSettingsAccess.php";
346 $bgimage->setImage($this->object->getBackgroundImageThumbPathWeb());
348 $form->addItem($bgimage);
350 $padding_top =
new ilTextInputGUI($this->lng->txt(
"certificate_padding_top"),
"padding_top");
351 $padding_top->setRequired(TRUE);
352 $padding_top->setValue($form_fields[
"padding_top"]);
353 $padding_top->setSize(6);
354 $padding_top->setValidationRegexp(
"/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is");
355 $padding_top->setInfo($this->lng->txt(
"certificate_unit_description"));
356 if (strcmp($this->ctrl->getCmd(),
"certificateSave") == 0) $padding_top->checkInput();
357 $form->addItem($padding_top);
359 $rect =
new ilCSSRectInputGUI($this->lng->txt(
"certificate_margin_body"),
"margin_body");
360 $rect->setRequired(TRUE);
361 $rect->setUseUnits(TRUE);
362 $rect->setTop($form_fields[
"margin_body_top"]);
363 $rect->setBottom($form_fields[
"margin_body_bottom"]);
364 $rect->setLeft($form_fields[
"margin_body_left"]);
365 $rect->setRight($form_fields[
"margin_body_right"]);
366 $rect->setInfo($this->lng->txt(
"certificate_unit_description"));
367 if (strcmp($this->ctrl->getCmd(),
"certificateSave") == 0) $rect->checkInput();
368 $form->addItem($rect);
370 $certificate =
new ilTextAreaInputGUI($this->lng->txt(
"certificate_text"),
"certificate_text");
371 $certificate->removePlugin(
'ilimgupload');
372 $certificate->setValue($form_fields[
"certificate_text"]);
373 $certificate->setRequired(TRUE);
374 $certificate->setRows(20);
375 $certificate->setCols(80);
378 $common_desc_tpl =
new ilTemplate(
"tpl.common_desc.html",
true,
true,
"Services/Certificate");
381 $common_desc_tpl->setCurrentBlock(
"cert_field");
382 $common_desc_tpl->setVariable(
"PH", $f[
"ph"]);
383 $common_desc_tpl->setVariable(
"PH_TXT", $f[
"name"]);
384 $common_desc_tpl->parseCurrentBlock();
386 $common_desc = $common_desc_tpl->get();
389 $certificate->setInfo($this->object->getAdapter()->getCertificateVariablesDescription().$common_desc);
390 $certificate->setUseRte(TRUE,
'3.4.7');
403 $certificate->setRteTags($tags);
404 if (strcmp($this->ctrl->getCmd(),
"certificateSave") == 0) $certificate->checkInput();
405 $form->addItem($certificate);
407 $this->
object->getAdapter()->addAdditionalFormElements($form, $form_fields);
409 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"]))
411 if ($this->object->isComplete() || $this->object->hasBackgroundImage())
413 $form->addCommandButton(
"certificatePreview", $this->lng->txt(
"certificate_preview"));
414 $form->addCommandButton(
"certificateExportFO", $this->lng->txt(
"certificate_export"));
415 $form->addCommandButton(
"certificateDelete", $this->lng->txt(
"delete"));
417 $form->addCommandButton(
"certificateSave", $this->lng->txt(
"save"));
420 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
422 if (strcmp($this->ctrl->getCmd(),
"certificateSave") == 0)
424 if (
$_POST[
"background_delete"])
426 $this->
object->deleteBackgroundImage();
428 if ($form->checkInput())
432 $xslfo = $this->
object->processXHTML2FO($form_fields);
433 $this->
object->getAdapter()->saveFormFields($form_fields);
434 $this->
object->saveCertificate($xslfo);
435 $this->
object->writeActive($form_fields[
"active"]);
437 $this->ctrl->redirect($this,
"certificateEditor");
GUI class to create PDF certificates.
certificateExportFO()
Exports the certificate.
getFormFieldsFromFO()
Get the form values from the certificate xsl-fo.
certificateEditor()
Shows the certificate editor for ILIAS tests.
certificatePreview()
Creates a certificate preview.
certificateImport()
Import a certificate from a ZIP archive.
certificateDelete()
Deletes the certificate and all its data.
getCommand($cmd)
Retrieves the ilCtrl command.
certificateUpload()
Uploads the certificate.
certificateSave()
Saves the certificate.
certificateDeleteConfirm()
Deletes the certificate and all its data.
getFormFieldsFromPOST()
Get the form values from an HTTP POST.
certificateRemoveBackground()
Removes the background image of a certificate.
& executeCommand()
execute command
ilCertificateGUI($adapter)
ilCertificateGUI constructor
static getCustomCertificateFields()
Get custom certificate fields.
Confirmation screen class.
static hasBackgroundImage()
Returns wheather or not a default background image exists.
static getBackgroundImageThumbPathWeb()
Returns the web path of the background image thumbnail.
This class represents an option in a radio group.
special template class to simplify handling of ITX/PEAR
This class represents a text area property in a property form.
This class represents a text property in a property form.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
redirection script todo: (a better solution should control the processing via a xml file)