ILIAS  trunk Revision v11.0_alpha-1753-gb21ca8c4367
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
Confirmation.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
23 use Closure;
25 use ilLanguage;
26 
28 {
30  private readonly Closure $create;
31 
35  public function __construct(private readonly ilLanguage $language, ?Closure $create = null)
36  {
37  $this->create = $create ?? static fn() => new ilConfirmationGUI();
38  }
39 
43  public function render(string $link, string $command, string $cancel_command, string $message, array $items = []): string
44  {
45  $confirmation = ($this->create)();
46  $confirmation->setFormAction($link);
47  $confirmation->setConfirm($this->language->txt('confirm'), $command);
48  $confirmation->setCancel($this->language->txt('cancel'), $cancel_command);
49  $confirmation->setHeaderText($message);
50  foreach ($items as $value => $label) {
51  $value = is_int($value) ? (string) $value : $value;
52  $confirmation->addItem('ids[]', $value, $label);
53  }
54 
55  return $confirmation->getHTML();
56  }
57 }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
render(string $link, string $command, string $cancel_command, string $message, array $items=[])
__construct(private readonly ilLanguage $language, ?Closure $create=null)
$message
Definition: xapiexit.php:31
language()
description: > Example for rendring a language glyph.
Definition: language.php:41