ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.SlotGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
24 
28 class SlotGUI
29 {
30  protected int $color_nr;
31  protected $from;
32  protected string $to;
33  protected int $from_ts;
34  protected int $to_ts;
35  protected string $title;
36  protected int $available;
37  protected string $link;
38 
39  public function __construct(
40  string $link,
41  string $from,
42  string $to,
43  int $from_ts,
44  int $to_ts,
45  string $title,
46  int $available,
47  int $color_nr
48  ) {
49  $this->from = $from;
50  $this->to = $to;
51  $this->from_ts = $from_ts;
52  $this->to_ts = $to_ts;
53  $this->title = $title;
54  $this->available = $available;
55  $this->link = $link;
56  $this->color_nr = $color_nr;
57  }
58 
59  public function render(): string
60  {
61  global $DIC;
62  $ui = $DIC->ui();
63  $tpl = new \ilTemplate("tpl.slot.html", true, true, "components/ILIAS/BookingManager/BookingProcess");
64 
65  $modal = $ui->factory()->modal()->roundtrip("", $ui->factory()->legacy()->content(""));
66  $url = $this->link . '&replaceSignal=' . $modal->getReplaceSignal()->getId();
67  $modal = $modal->withAsyncRenderUrl($url);
68  $button = $ui->factory()->button()->shy($this->title, "#")
69  ->withOnClick($modal->getShowSignal());
70 
71  $tpl->setVariable("OBJECT_LINK", $ui->renderer()->render([$button, $modal]));
72  $tpl->setVariable("TIME", $this->from . "-" . $this->to);
73  $tpl->setVariable("COLOR_NR", $this->color_nr);
74  $tpl->setVariable("AVAILABILITY", "(" . $this->available . ") ");
75 
76  return $tpl->get();
77  }
78 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$url
Definition: shib_logout.php:68
global $DIC
Definition: shib_login.php:26
__construct(string $link, string $from, string $to, int $from_ts, int $to_ts, string $title, int $available, int $color_nr)
link(string $caption, string $href, bool $new_viewport=false)
to(\GdImage $image, ?int $quality=null)
Currently this is the only way to make a FileStream from a GD image resource.