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