24 include_once(
"./Services/Certificate/classes/class.ilCertificate.php");
102 include_once
"./Services/Certificate/classes/class.ilCertificate.php";
105 $this->lng = $DIC[
'lng'];
106 $this->tpl = $DIC[
'tpl'];
107 $this->ctrl = $DIC[
'ilCtrl'];
108 $this->
ilias = $DIC[
'ilias'];
109 $this->tree = $DIC[
'tree'];
110 $this->tree = $DIC[
'tree'];
111 $this->acccess = $DIC[
'ilAccess'];
112 $this->toolbar = $DIC[
'ilToolbar'];
114 $this->ref_id = (int)
$_GET[
'ref_id'];
116 $this->lng->loadLanguageModule(
'certificate');
124 $cmd = $this->ctrl->getCmd();
125 $next_class = $this->ctrl->getNextClass($this);
158 $this->
object->createPreview();
166 $this->
object->deliverExportFileXML();
174 $this->
object->deleteBackgroundImage();
184 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
186 $cgui->setFormAction($this->ctrl->getFormAction($this,
"certificateEditor"));
187 $cgui->setHeaderText($this->lng->txt(
"certificate_confirm_deletion_text"));
188 $cgui->setCancel($this->lng->txt(
"no"),
"certificateEditor");
189 $cgui->setConfirm($this->lng->txt(
"yes"),
"certificateDeleteConfirm");
191 $this->tpl->setContent($cgui->getHTML());
199 $this->
object->deleteCertificate();
200 $this->ctrl->redirect($this,
"certificateEditor");
224 $form_fields =
array(
235 $this->
object->getAdapter()->addFormFieldsFromPOST($form_fields);
244 $form_fields = $this->
object->getFormFieldsFromFO();
245 $form_fields[
"active"] = $this->
object->readActive();
246 $this->
object->getAdapter()->addFormFieldsFromObject($form_fields);
255 if(strcmp($this->ctrl->getCmd(),
"certificateSave") == 0)
263 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
265 $form->setPreventDoubleSubmission(
false);
266 $form->setFormAction($this->ctrl->getFormAction($this));
267 $form->setTitle($this->lng->txt(
"certificate_edit"));
268 $form->setMultipart(TRUE);
269 $form->setTableWidth(
"100%");
270 $form->setId(
"certificate");
274 $form->addItem($active);
276 $import =
new ilFileInputGUI($this->lng->txt(
"import"),
"certificate_import");
278 $import->setSuffixes(
array(
"zip"));
280 if (strlen($_FILES[
"certificate_import"][
"name"]))
282 if ($import->checkInput())
284 $result = $this->
object->importCertificate($_FILES[
"certificate_import"][
"tmp_name"], $_FILES[
"certificate_import"][
"name"]);
287 $import->setAlert($this->lng->txt(
"certificate_error_import"));
291 $this->ctrl->redirect($this,
"certificateEditor");
295 $form->addItem($import);
297 $pageformat =
new ilRadioGroupInputGUI($this->lng->txt(
"certificate_page_format"),
"pageformat");
298 $pageformats = $this->
object->getPageFormats();
299 $pageformat->
setValue($form_fields[
"pageformat"]);
300 foreach($pageformats as $format)
302 $option =
new ilRadioOption($format[
"name"], $format[
"value"]);
303 if(strcmp($format[
"value"],
"custom") == 0)
305 $pageheight =
new ilTextInputGUI($this->lng->txt(
"certificate_pageheight"),
"pageheight");
306 $pageheight->
setValue($form_fields[
"pageheight"]);
307 $pageheight->setSize(6);
308 $pageheight->setValidationRegexp(
'/^(([1-9]+|([1-9]+[0]*[\.,]{0,1}[\d]+))|(0[\.,](0*[1-9]+[\d]*)))(cm|mm|in|pt|pc|px|em)$/is');
309 $pageheight->setInfo($this->lng->txt(
"certificate_unit_description"));
310 $pageheight->setRequired(
true);
311 $option->addSubitem($pageheight);
313 $pagewidth =
new ilTextInputGUI($this->lng->txt(
"certificate_pagewidth"),
"pagewidth");
314 $pagewidth->
setValue($form_fields[
"pagewidth"]);
315 $pagewidth->setSize(6);
316 $pagewidth->setValidationRegexp(
'/^(([1-9]+|([1-9]+[0]*[\.,]{0,1}[\d]+))|(0[\.,](0*[1-9]+[\d]*)))(cm|mm|in|pt|pc|px|em)$/is');
317 $pagewidth->setInfo($this->lng->txt(
"certificate_unit_description"));
318 $pagewidth->setRequired(
true);
319 $option->addSubitem($pagewidth);
321 $pageformat->addOption($option);
323 $pageformat->setRequired(
true);
324 if (strcmp($this->ctrl->getCmd(),
"certificateSave") == 0) $pageformat->checkInput();
326 $form->addItem($pageformat);
328 $bgimage =
new ilImageFileInputGUI($this->lng->txt(
"certificate_background_image"),
"background");
330 $bgimage->setUseCache(
false);
334 if (strlen($_FILES[
"background"][
"tmp_name"]))
336 if ($bgimage->checkInput())
338 $result = $this->
object->uploadBackgroundImage($_FILES[
"background"][
"tmp_name"]);
341 $bgimage->setAlert($this->lng->txt(
"certificate_error_upload_bgimage"));
346 if (!$this->
object->hasBackgroundImage())
348 include_once
"./Services/Certificate/classes/class.ilObjCertificateSettingsAccess.php";
351 require_once(
'./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
358 require_once(
'./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
362 $form->addItem($bgimage);
364 $rect =
new ilCSSRectInputGUI($this->lng->txt(
"certificate_margin_body"),
"margin_body");
366 $rect->setUseUnits(TRUE);
367 $rect->setTop($form_fields[
"margin_body_top"]);
368 $rect->setBottom($form_fields[
"margin_body_bottom"]);
369 $rect->setLeft($form_fields[
"margin_body_left"]);
370 $rect->setRight($form_fields[
"margin_body_right"]);
371 $rect->setInfo($this->lng->txt(
"certificate_unit_description"));
372 if (strcmp($this->ctrl->getCmd(),
"certificateSave") == 0) $rect->checkInput();
373 $form->addItem($rect);
377 $certificate->setValue($form_fields[
"certificate_text"]);
383 $common_desc_tpl =
new ilTemplate(
"tpl.common_desc.html",
true,
true,
"Services/Certificate");
386 $common_desc_tpl->setCurrentBlock(
"cert_field");
387 $common_desc_tpl->setVariable(
"PH", $f[
"ph"]);
388 $common_desc_tpl->setVariable(
"PH_TXT", $f[
"name"]);
389 $common_desc_tpl->parseCurrentBlock();
391 $common_desc = $common_desc_tpl->get();
394 $certificate->setInfo($this->
object->getAdapter()->getCertificateVariablesDescription().$common_desc);
409 if (strcmp($this->ctrl->getCmd(),
"certificateSave") == 0)
$certificate->checkInput();
412 $this->
object->getAdapter()->addAdditionalFormElements($form, $form_fields);
414 if($this->acccess->checkAccess(
"write",
"",
$_GET[
"ref_id"]))
416 if ($this->
object->isComplete() || $this->
object->hasBackgroundImage())
418 $this->toolbar->setFormAction($this->ctrl->getFormAction($this));
420 require_once
'Services/UIComponent/Button/classes/class.ilSubmitButton.php';
422 $preview->setCaption(
'certificate_preview');
423 $preview->setCommand(
'certificatePreview');
424 $this->toolbar->addStickyItem(
$preview);
427 $export->setCaption(
'certificate_export');
428 $export->setCommand(
'certificateExportFO');
429 $this->toolbar->addButtonInstance($export);
432 $delete->setCaption(
'delete');
433 $delete->setCommand(
'certificateDelete');
434 $this->toolbar->addButtonInstance($delete);
436 $form->addCommandButton(
"certificateSave", $this->lng->txt(
"save"));
439 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
441 if (strcmp($this->ctrl->getCmd(),
"certificateSave") == 0)
443 if (
$_POST[
"background_delete"])
445 $this->
object->deleteBackgroundImage();
447 if ($form->checkInput())
451 $xslfo = $this->
object->processXHTML2FO($form_fields);
452 $this->
object->getAdapter()->saveFormFields($form_fields);
453 $this->
object->saveCertificate($xslfo);
454 $this->
object->writeActive($form_fields[
"active"]);
456 $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.
certificatePreview()
Creates a certificate preview.
executeCommand()
execute command
certificateEditor()
Shows the certificate editor for ILIAS tests.
__construct(ilCertificateAdapter $adapter)
ilCertificateGUI constructor
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)
Create styles array
The data for the language used.
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.
Create new PHPExcel object
obj_idprivate
This class represents a text area property in a property form.
Adapter class to provide certificate data for the certificate generator.
static setTokenMaxLifetimeInSeconds($token_max_lifetime_in_seconds)
certificateDelete()
Deletes the certificate and all its data.
setValue($a_value)
Set Value.
Confirmation screen class.