81 string $certificatePath,
104 $database =
$DIC->database();
107 if (
null === $logger) {
108 $logger = $logger =
$DIC->logger()->cert();
127 $DIC->filesystem()->web()
151 $certificateTemplate = $this->templateRepository->fetchCurrentlyUsedCertificate($this->objectId);
153 $command = $this->controller->getCmd();
156 $form->setPreventDoubleSubmission(
false);
157 $form->setFormAction($this->controller->getFormAction($certificateGUI));
158 $form->setTitle($this->language->txt(
"cert_form_sec_availability"));
159 $form->setMultipart(
true);
160 $form->setTableWidth(
"100%");
161 $form->setId(
"certificate");
164 $form->addItem($active);
166 $import =
new ilFileInputGUI($this->language->txt(
"import"),
"certificate_import");
167 $import->setRequired(
false);
168 $import->setSuffixes(array(
"zip"));
171 if (strlen($_FILES[
"certificate_import"][
"name"])) {
172 if ($import->checkInput()) {
173 $result = $this->importAction->import($_FILES[
"certificate_import"][
"tmp_name"], $_FILES[
"certificate_import"][
"name"]);
175 $import->setAlert($this->language->txt(
"certificate_error_import"));
177 $this->controller->redirect($certificateGUI,
"certificateEditor");
181 $form->addItem($import);
183 $formSection = new \ilFormSectionHeaderGUI();
184 $formSection->setTitle($this->language->txt(
"cert_form_sec_layout"));
185 $form->addItem($formSection);
187 $pageformat =
new ilRadioGroupInputGUI($this->language->txt(
"certificate_page_format"),
"pageformat");
188 $pageformats = $this->pageFormats->fetchPageFormats();
190 foreach ($pageformats as
$format) {
193 if (strcmp(
$format[
"value"],
"custom") == 0) {
194 $pageheight =
new ilTextInputGUI($this->language->txt(
"certificate_pageheight"),
"pageheight");
195 $pageheight->setSize(6);
196 $pageheight->setValidationRegexp(
'/^(([1-9]+|([1-9]+[0]*[\.,]{0,1}[\d]+))|(0[\.,](0*[1-9]+[\d]*)))(cm|mm|in|pt|pc|px|em)$/is');
197 $pageheight->setInfo($this->language->txt(
"certificate_unit_description"));
198 $pageheight->setRequired(
true);
199 $option->addSubitem($pageheight);
201 $pagewidth =
new ilTextInputGUI($this->language->txt(
"certificate_pagewidth"),
"pagewidth");
202 $pagewidth->setSize(6);
203 $pagewidth->setValidationRegexp(
'/^(([1-9]+|([1-9]+[0]*[\.,]{0,1}[\d]+))|(0[\.,](0*[1-9]+[\d]*)))(cm|mm|in|pt|pc|px|em)$/is');
204 $pagewidth->setInfo($this->language->txt(
"certificate_unit_description"));
205 $pagewidth->setRequired(
true);
206 $option->addSubitem($pagewidth);
209 $pageformat->addOption($option);
212 $pageformat->setRequired(
true);
214 if (strcmp($command,
"certificateSave") == 0) {
215 $pageformat->checkInput();
218 $form->addItem($pageformat);
220 $bgimage =
new ilImageFileInputGUI($this->language->txt(
"certificate_background_image"),
"background");
221 $bgimage->setRequired(
false);
222 $bgimage->setUseCache(
false);
224 $bgimage->setALlowDeletion(
true);
229 $bgimage->setImage($imagePath);
230 $bgimage->setALlowDeletion(
false);
237 if (!file_exists($thumbnailPath)) {
239 $bgimage->setALlowDeletion(
false);
242 $bgimage->setImage($imagePath);
245 $form->addItem($bgimage);
247 $thumbnailImage =
new ilImageFileInputGUI($this->language->txt(
'certificate_card_thumbnail_image'),
'certificate_card_thumbnail_image');
248 $thumbnailImage->setRequired(
false);
249 $thumbnailImage->setUseCache(
false);
250 $thumbnailImage->setSuffixes(array(
'svg'));
252 $allowThumbnailDeletion =
false;
254 $cardThumbnailImagePath = $certificateTemplate->getThumbnailImagePath();
255 if (
'' !== $cardThumbnailImagePath) {
256 $presentationThumbnailImagePath = CLIENT_WEB_DIR . $cardThumbnailImagePath;
258 $allowThumbnailDeletion =
true;
261 $thumbnailImage->setAllowDeletion($allowThumbnailDeletion);
263 $form->addItem($thumbnailImage);
265 $rect =
new ilCSSRectInputGUI($this->language->txt(
"certificate_margin_body"),
"margin_body");
266 $rect->setRequired(
true);
267 $rect->setUseUnits(
true);
268 $rect->setInfo($this->language->txt(
"certificate_unit_description"));
270 if (strcmp($command,
"certificateSave") == 0) {
274 $form->addItem($rect);
283 $placeholderHtmlDescription = $this->placeholderDescriptionObject->createPlaceholderHtmlDescription();
285 $placeholderDescriptionInHtml = $placeholderHtmlDescription;
306 if (strcmp($command,
"certificateSave") == 0) {
312 if ($certificateObject->
getAdapter()->hasAdditionalFormElements()) {
313 $formSection = new \ilFormSectionHeaderGUI();
314 $formSection->setTitle($this->language->txt(
"cert_form_sec_add_features"));
315 $form->addItem($formSection);
318 if ($this->access->checkAccess(
"write",
"",
$_GET[
"ref_id"])) {
319 if ($certificateTemplate->isCurrentlyActive()) {
320 $this->toolbar->setFormAction($this->controller->getFormAction($certificateGUI));
323 $preview->setCaption(
'certificate_preview');
324 $preview->setCommand(
'certificatePreview');
325 $this->toolbar->addStickyItem(
$preview);
328 $export->setCaption(
'certificate_export');
329 $export->setCommand(
'certificateExportFO');
330 $this->toolbar->addButtonInstance($export);
333 $delete->setCaption(
'delete');
334 $delete->setCommand(
'certificateDelete');
335 $this->toolbar->addButtonInstance($delete);
337 $form->addCommandButton(
"certificateSave", $this->language->txt(
"save"));
347 public function save(array $formFields)
357 return $this->formFieldParser->fetchDefaultFormFields($content);
An exception for terminatinating execution or to throw for unit testing.
GUI class to create PDF certificates.
getBackgroundImageThumbPath()
Returns the filesystem path of the background image thumbnail.
hasBackgroundImage()
Checks for the background image of the certificate.
getAdapter()
Gets the adapter.
This class provides processing control methods.
Component logger with individual log levels by component id.
static hasBackgroundImage()
Returns wheather or not a default background image exists.
static getBackgroundImageThumbPath()
Returns the filesystem path of the background image thumbnail.
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 signFile($path_to_file)
static setTokenMaxLifetimeInSeconds($token_max_lifetime_in_seconds)
if(@file_exists(dirname(__FILE__).'/lang/eng.php')) $certificate
if(isset($_POST['submit'])) $form