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