blob: df341658dbcb88fff817c73f70de17267acfdbd8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
<?php
class DateSelectWidget extends SidebarWidget
{
protected $date = null;
protected $calendar_control = false;
public function __construct()
{
$this->template = 'sidebar/date-select-widget';
$this->date = new DateTime();
parent::__construct();
}
public function setCalendarControl(bool $calendar_control = false) : void
{
$this->calendar_control = $calendar_control;
}
public function setDate(DateTime $date) : void
{
$this->date = $date;
}
public function getDate() : ?DateTime
{
return $this->date;
}
public function getCalendarControlStatus() : bool
{
return $this->calendar_control;
}
public function render($variables = []) : string
{
$template = $GLOBALS['template_factory']->open($this->template);
$template->set_attributes($variables + $this->template_variables);
$template->set_attribute('title', _('Datum auswählen'));
$template->set_attribute('date', $this->date);
$template->set_attribute('calendar_control', $this->calendar_control);
if ($this->layout) {
$layout = $GLOBALS['template_factory']->open($this->layout);
$layout->layout_css_classes = $this->layout_css_classes;
$template->set_layout($layout);
}
return $template->render();
}
}
|