3 declare(strict_types=1);
45 protected \ILIAS\DI\UIServices
$ui;
47 public function __construct(
object $cmdClass,
ilDate $seed,
string $a_increment,
string $cmd =
'')
51 $this->
lng = $DIC->language();
53 $this->
ctrl = $DIC->ctrl();
55 $this->seed = clone
$seed;
56 $this->increment = $a_increment;
58 $this->
toolbar = $DIC->toolbar();
59 $this->
ui = $DIC->ui();
60 $this->
user = $DIC->user();
67 $tpl =
new ilTemplate(
"tpl.navigation_header.html",
true,
true,
"Services/Calendar");
70 $contains_today =
false;
72 $this->
ctrl->setParameterByClass(get_class($this->cmdClass),
'seed', $this->seed->get(
IL_CAL_DATE));
73 $b1 = $this->
ui->factory()->button()->standard(
74 $this->
lng->txt(
"previous"),
75 $this->
ctrl->getLinkTarget($this->cmdClass, $this->cmd)
81 switch ($this->increment) {
89 $contains_today =
true;
96 $this->user_settings->getWeekStart()
98 $start = current($weekday_list);
99 $end = end($weekday_list);
100 $tpl->setVariable(
"TXT_TITLE", $this->
lng->txt(
'week') .
' ' . $this->seed->get(
IL_CAL_FKT_DATE,
'W') .
105 $contains_today =
true;
116 $contains_today =
true;
121 $this->
ctrl->setParameterByClass(
122 get_class($this->cmdClass),
126 if ($contains_today) {
127 $b2 = $this->
ui->factory()->button()->standard(
128 $this->
lng->txt(
"today"),
129 $this->
ctrl->getLinkTarget($this->cmdClass, $this->cmd)
132 $b2 = $this->
ui->factory()->button()->standard(
133 $this->
lng->txt(
"today"),
134 $this->
ctrl->getLinkTarget($this->cmdClass, $this->cmd)
139 $this->
ctrl->setParameterByClass(get_class($this->cmdClass),
'seed', $this->seed->get(
IL_CAL_DATE));
140 $b3 = $this->
ui->factory()->button()->standard(
141 $this->
lng->txt(
"next"),
142 $this->
ctrl->getLinkTarget($this->cmdClass, $this->cmd)
144 $this->
ctrl->setParameterByClass(get_class($this->cmdClass),
'seed',
'');
145 $this->
toolbar->addStickyItem($this->
ui->factory()->viewControl()->section($b1, $b2, $b3));
146 $this->
toolbar->addSeparator();
153 switch ($this->increment) {
157 $this->seed->increment(
IL_CAL_DAY, (31 - $day) * -1);
161 $this->seed->increment($this->increment, $a_count);
get(int $a_format, string $a_format_str='', string $a_tz='')
get formatted date
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
static _buildWeekDayList(ilDate $a_day, int $a_weekstart)
build week day list public
static now()
Return current timestamp in Y-m-d H:i:s format.
static _getInstanceByUserId(int $a_user_id)
static _numericDayToString(int $a_day, bool $a_long=true)
static setUseRelativeDates(bool $a_status)
set use relative dates
static _within(ilDateTime $dt, ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
Check whether an date is within a date duration given by start and end.