92                 include_once 
"./Services/Certificate/classes/class.ilCertificate.php";
 
   99                 $this->ref_id = 
$_GET[
"ref_id"];
 
  100                 $this->lng->loadLanguageModule(
"certificate");
 
  108                 $cmd = $this->ctrl->getCmd();
 
  109                 $next_class = $this->ctrl->getNextClass($this);
 
  142                 $this->
object->createPreview();
 
  150                 $this->
object->deliverExportFileXML();
 
  158                 $this->
object->deleteBackgroundImage();
 
  167                 include_once(
"Services/Utilities/classes/class.ilSimpleConfirmationGUI.php");
 
  171                 $c_gui->setFormAction($this->ctrl->getFormAction($this, 
"certificateEditor"));
 
  172                 $c_gui->setHeaderText($this->lng->txt(
"certificate_confirm_deletion_text"));
 
  173                 $c_gui->setConfirm($this->lng->txt(
"yes"), 
"certificateDeleteConfirm");
 
  174                 $c_gui->setCancel($this->lng->txt(
"no"), 
"certificateEditor");
 
  175                 $this->tpl->setContent($c_gui->getHTML());
 
  183                 $this->
object->deleteCertificate();
 
  184                 $this->ctrl->redirect($this, 
"certificateEditor");
 
  208                 $form_fields = array(
 
  219                 $this->
object->getAdapter()->addFormFieldsFromPOST($form_fields);
 
  228                 $form_fields = $this->
object->getFormFieldsFromFO();
 
  229                 $this->
object->getAdapter()->addFormFieldsFromObject($form_fields);
 
  240                 $form_fields = array();
 
  241                 if (strcmp($this->ctrl->getCmd(), 
"certificateSave") == 0)
 
  249                 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
  251                 $form->setFormAction($this->ctrl->getFormAction($this));
 
  252                 $form->setTitle($this->lng->txt(
"certificate_edit"));
 
  253                 $form->setMultipart(TRUE);
 
  254                 $form->setTableWidth(
"100%");
 
  255                 $form->setId(
"certificate");
 
  257                 $import = 
new ilFileInputGUI($this->lng->txt(
"import"), 
"certificate_import");
 
  259                 $import->setSuffixes(array(
"zip"));
 
  261                 if (strlen($_FILES[
"certificate_import"][
"tmp_name"]))
 
  263                         if ($import->checkInput())
 
  265                                 $result = $this->
object->importCertificate($_FILES[
"certificate_import"][
"tmp_name"], $_FILES[
"certificate_import"][
"name"]);
 
  268                                         $import->setAlert($this->lng->txt(
"certificate_error_import"));
 
  272                                         $this->ctrl->redirect($this, 
"certificateEditor");
 
  276                 $form->addItem($import);
 
  278                 $pageformat = 
new ilSelectInputGUI($this->lng->txt(
"certificate_page_format"), 
"pageformat");
 
  279                 $pageformats = $this->
object->getPageFormats();
 
  280                 $pageformat->
setValue($form_fields[
"pageformat"]);
 
  282                 foreach ($pageformats as $format)
 
  284                         $options[$format[
"value"]] = $format[
"name"];
 
  286                 $pageformat->setRequired(TRUE);
 
  287                 $pageformat->setOptions($options);
 
  288                 if (strcmp($this->ctrl->getCmd(), 
"certificateSave") == 0) $pageformat->checkInput();
 
  290                 if (strcmp($form_fields[
"pageformat"], 
"custom") == 0)
 
  292                         $pageheight = 
new ilTextInputGUI($this->lng->txt(
"certificate_pageheight"), 
"pageheight");
 
  293                         $pageheight->
setValue($form_fields[
"pageheight"]);
 
  294                         $pageheight->setSize(6);
 
  295                         $pageheight->setValidationRegexp(
"/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is");
 
  296                         $pageheight->setInfo($this->lng->txt(
"certificate_unit_description"));
 
  297                         if (strcmp($this->ctrl->getCmd(), 
"certificateSave") == 0) $pageheight->checkInput();
 
  298                         $pageformat->addSubitem($pageheight);
 
  300                         $pagewidth = 
new ilTextInputGUI($this->lng->txt(
"certificate_pagewidth"), 
"pagewidth");
 
  301                         $pagewidth->
setValue($form_fields[
"pagewidth"]);
 
  302                         $pagewidth->setSize(6);
 
  303                         $pagewidth->setValidationRegexp(
"/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is");
 
  304                         $pagewidth->setInfo($this->lng->txt(
"certificate_unit_description"));
 
  305                         if (strcmp($this->ctrl->getCmd(), 
"certificateSave") == 0) $pagewidth->checkInput();
 
  306                         $pageformat->addSubitem($pagewidth);
 
  308                 $form->addItem($pageformat);
 
  310                 $bgimage = 
new ilImageFileInputGUI($this->lng->txt(
"certificate_background_image"), 
"background");
 
  312                 $bgimage->setUseCache(
false);
 
  316                         if (strlen($_FILES[
"background"][
"tmp_name"]))
 
  318                                 if ($bgimage->checkInput())
 
  320                                         $result = $this->
object->uploadBackgroundImage($_FILES[
"background"][
"tmp_name"]);
 
  323                                                 $bgimage->setAlert($this->lng->txt(
"certificate_error_upload_bgimage"));
 
  328                 if (!$this->object->hasBackgroundImage())
 
  330                         include_once 
"./Services/Certificate/classes/class.ilObjCertificateSettingsAccess.php";
 
  338                         $bgimage->setImage($this->object->getBackgroundImageThumbPathWeb());
 
  340                 $form->addItem($bgimage);
 
  342                 $padding_top = 
new ilTextInputGUI($this->lng->txt(
"certificate_padding_top"), 
"padding_top");
 
  344                 $padding_top->setValue($form_fields[
"padding_top"]);
 
  345                 $padding_top->setSize(6);
 
  346                 $padding_top->setValidationRegexp(
"/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is");
 
  347                 $padding_top->setInfo($this->lng->txt(
"certificate_unit_description"));
 
  348                 if (strcmp($this->ctrl->getCmd(), 
"certificateSave") == 0) $padding_top->checkInput();
 
  349                 $form->addItem($padding_top);
 
  351                 $rect = 
new ilCSSRectInputGUI($this->lng->txt(
"certificate_margin_body"), 
"margin_body");
 
  353                 $rect->setUseUnits(TRUE);
 
  354                 $rect->setTop($form_fields[
"margin_body_top"]);
 
  355                 $rect->setBottom($form_fields[
"margin_body_bottom"]);
 
  356                 $rect->setLeft($form_fields[
"margin_body_left"]);
 
  357                 $rect->setRight($form_fields[
"margin_body_right"]);
 
  358                 $rect->setInfo($this->lng->txt(
"certificate_unit_description"));
 
  359                 if (strcmp($this->ctrl->getCmd(), 
"certificateSave") == 0) $rect->checkInput();
 
  360                 $form->addItem($rect);
 
  362                 $certificate = 
new ilTextAreaInputGUI($this->lng->txt(
"certificate_text"), 
"certificate_text");
 
  363                 $certificate->
setValue($form_fields[
"certificate_text"]);
 
  364                 $certificate->setRequired(TRUE);
 
  365                 $certificate->setRows(20);
 
  366                 $certificate->setCols(80);
 
  367                 $certificate->setInfo($this->object->getAdapter()->getCertificateVariablesDescription());
 
  368                 $certificate->setUseRte(TRUE);
 
  381                 $certificate->setRteTags($tags);
 
  382                 if (strcmp($this->ctrl->getCmd(), 
"certificateSave") == 0) $certificate->checkInput();
 
  383                 $form->addItem($certificate);
 
  385                 $this->
object->getAdapter()->addAdditionalFormElements($form, $form_fields);
 
  387                 if ($ilAccess->checkAccess(
"write", 
"", 
$_GET[
"ref_id"]))
 
  389                         if ($this->object->isComplete() || $this->
object->hasBackgroundImage())
 
  391                                 $form->addCommandButton(
"certificatePreview", $this->lng->txt(
"certificate_preview"));
 
  392                                 $form->addCommandButton(
"certificateExportFO", $this->lng->txt(
"certificate_export"));
 
  393                                 $form->addCommandButton(
"certificateDelete", $this->lng->txt(
"delete"));
 
  395                         $form->addCommandButton(
"certificateSave", $this->lng->txt(
"save"));
 
  398                 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
 
  400                 if (strcmp($this->ctrl->getCmd(), 
"certificateSave") == 0)
 
  402                         if (
$_POST[
"background_delete"])
 
  404                                 $this->
object->deleteBackgroundImage();
 
  406                         if ($form->checkInput())
 
  410                                         $xslfo = $this->
object->processXHTML2FO($form_fields);
 
  411                                         $this->
object->getAdapter()->saveFormFields($form_fields);
 
  412                                         $this->
object->saveCertificate($xslfo);
 
  414                                         $this->ctrl->redirect($this, 
"certificateEditor");