ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
class.ilMailFormAttachmentPropertyGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
27 {
29  private array $items = [];
30 
31  public function __construct(private readonly string $buttonLabel, string $http_post_param_name)
32  {
33  parent::__construct('', $http_post_param_name);
34  $this->setTitle($this->lng->txt('attachments'));
35  }
36 
37  public function addItem(string $label): void
38  {
39  $this->items[] = $label;
40  }
41 
42  public function insert(ilTemplate $a_tpl): void
43  {
44  $tpl = new ilTemplate('tpl.mail_new_attachments.html', true, true, 'components/ILIAS/Mail');
45 
46  foreach ($this->items as $item) {
47  $tpl->setCurrentBlock('attachment_list_item');
48  $tpl->setVariable('ATTACHMENT_LABEL', $item);
49  $tpl->parseCurrentBlock();
50  }
51  $tpl->setVariable('ATTACHMENT_BUTTON_LABEL', $this->buttonLabel);
52 
53  $a_tpl->setCurrentBlock('prop_generic');
54  $a_tpl->setVariable('PROP_GENERIC', $tpl->get());
55  $a_tpl->parseCurrentBlock();
56  }
57 }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
__construct(private readonly string $buttonLabel, string $http_post_param_name)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:546
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
__construct(Container $dic, ilPlugin $plugin)