ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilMailFormAttachmentPropertyGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
24 private array $items = [];
25
26 public function __construct(private readonly string $button_label, string $http_post_param_name)
27 {
28 parent::__construct('', $http_post_param_name);
29 $this->setTitle($this->lng->txt('attachments'));
30 }
31
32 public function addItem(string $label): void
33 {
34 $this->items[] = $label;
35 }
36
37 public function insert(ilTemplate $a_tpl): void
38 {
39 $tpl = new ilTemplate('tpl.mail_new_attachments.html', true, true, 'components/ILIAS/Mail');
40
41 foreach ($this->items as $item) {
42 $tpl->setCurrentBlock('attachment_list_item');
43 $tpl->setVariable('ATTACHMENT_LABEL', $item);
44 $tpl->parseCurrentBlock();
45 }
46 $tpl->setVariable('ATTACHMENT_BUTTON_LABEL', $this->button_label);
47
48 $a_tpl->setCurrentBlock('prop_generic');
49 $a_tpl->setVariable('PROP_GENERIC', $tpl->get());
50 $a_tpl->parseCurrentBlock();
51 }
52}
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
This class represents a property in a property form.
__construct(private readonly string $button_label, string $http_post_param_name)
special template class to simplify handling of ITX/PEAR
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc