ILIAS  trunk Revision v13.0_alpha-52-g21c366bbdd4
class.SlotGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use ILIAS\UI\Factory as UIFactory;
25use ilTemplate;
26
28{
29 protected UIFactory $ui_factory;
31
32 public function __construct(
33 protected string $link,
34 protected string $from,
35 protected string $to,
36 protected int $from_ts,
37 protected int $to_ts,
38 protected string $title,
39 protected int $available,
40 protected int $color_nr
41 ) {
42
43 global $DIC;
44 $this->ui_factory = $DIC->ui()->factory();
45 $this->ui_renderer = $DIC->ui()->renderer();
46 }
47
48 public function render(): string
49 {
50 $tpl = new ilTemplate('tpl.slot.html', true, true, 'components/ILIAS/BookingManager/BookingProcess');
51
52 $modal = $this->ui_factory->modal()->roundtrip('', $this->ui_factory->legacy()->content(''));
53 $url = "{$this->link}&replaceSignal={$modal->getReplaceSignal()->getId()}";
54 $modal = $modal->withAsyncRenderUrl($url);
55 $button = $this->ui_factory->button()->shy($this->title, '#')->withOnClick($modal->getShowSignal());
56
57 $tpl->setVariable('OBJECT_LINK', $this->ui_renderer->render([$button, $modal]));
58 $tpl->setVariable('TIME', ($this->to_ts - $this->from_ts) !== 86400 ? "{$this->from}-{$this->to}" : '');
59 $tpl->setVariable('COLOR_NR', $this->color_nr);
60 $tpl->setVariable('AVAILABILITY', "({$this->available}) ");
61
62 return $tpl->get();
63 }
64}
__construct(protected string $link, protected string $from, protected string $to, protected int $from_ts, protected int $to_ts, protected string $title, protected int $available, protected int $color_nr)
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
special template class to simplify handling of ITX/PEAR
setVariable(string $variable, $value='')
Sets the given variable to the given value.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
An entity that renders components to a string output.
Definition: Renderer.php:31
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
readonly ilGlobalTemplateInterface $tpl
global $DIC
Definition: shib_login.php:26