ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilCalendarHeaderNavigationGUI Class Reference
+ Collaboration diagram for ilCalendarHeaderNavigationGUI:

Public Member Functions

 __construct (object $cmdClass, ilDate $seed, string $a_increment, string $cmd='')
 
 getHTML ()
 

Protected Member Functions

 incrementDate (int $a_count)
 

Protected Attributes

object $cmdClass
 
string $cmd
 
ilDate $seed
 
string $increment = ''
 
string $html
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilCtrlInterface $ctrl
 
ilToolbarGUI $toolbar
 
ilObjUser $user
 
ilCalendarUserSettings $user_settings
 
ILIAS DI UIServices $ui
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCalendarHeaderNavigationGUI::__construct ( object  $cmdClass,
ilDate  $seed,
string  $a_increment,
string  $cmd = '' 
)

Definition at line 47 of file class.ilCalendarHeaderNavigationGUI.php.

References $cmd, $cmdClass, $DIC, $seed, ilCalendarUserSettings\_getInstanceByUserId(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\toolbar(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

48  {
49  global $DIC;
50 
51  $this->lng = $DIC->language();
52 
53  $this->ctrl = $DIC->ctrl();
54  $this->cmdClass = $cmdClass;
55  $this->seed = clone $seed;
56  $this->increment = $a_increment;
57  $this->cmd = $cmd;
58  $this->toolbar = $DIC->toolbar();
59  $this->ui = $DIC->ui();
60  $this->user = $DIC->user();
61  $this->user_settings = ilCalendarUserSettings::_getInstanceByUserId($this->user->getId());
62  }
static _getInstanceByUserId(int $a_user_id)
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ getHTML()

ilCalendarHeaderNavigationGUI::getHTML ( )

Definition at line 64 of file class.ilCalendarHeaderNavigationGUI.php.

References ilCalendarUtil\_buildWeekDayList(), ilCalendarUtil\_numericDayToString(), ilDateTime\_within(), ILIAS\Repository\ctrl(), ilDateTime\DAY, ilDatePresentation\formatDate(), ilDateTime\get(), IL_CAL_DATE, IL_CAL_DATETIME, IL_CAL_FKT_DATE, IL_CAL_UNIX, incrementDate(), ILIAS\Repository\lng(), ilDateTime\MONTH, ilUtil\now(), ilDatePresentation\setUseRelativeDates(), ILIAS\Repository\toolbar(), ILIAS\Repository\ui(), ILIAS\Repository\user(), ilDateTime\WEEK, and ILIAS\UI\Implementation\Component\Button\withEngagedState().

64  : string
65  {
66  $today = new ilDateTime(time(), IL_CAL_UNIX, $this->user->getTimeZone());
67  $tpl = new ilTemplate("tpl.navigation_header.html", true, true, "Services/Calendar");
68 
69  // previous button
70  $contains_today = false;
71  $this->incrementDate(-1);
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)
76  );
77 
78  // today button
79  $this->incrementDate(1);
81  switch ($this->increment) {
82  case ilDateTime::DAY:
83  $tpl->setVariable(
84  "TXT_TITLE",
85  ilCalendarUtil::_numericDayToString((int) $this->seed->get(IL_CAL_FKT_DATE, 'w')) .
86  ", " . ilDatePresentation::formatDate($this->seed)
87  );
88  if (date("Y-m-d") === $this->seed->get(IL_CAL_FKT_DATE, 'Y-m-d')) {
89  $contains_today = true;
90  }
91  break;
92 
93  case ilDateTime::WEEK:
94  $weekday_list = ilCalendarUtil::_buildWeekDayList(
95  $this->seed,
96  $this->user_settings->getWeekStart()
97  )->get();
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') .
101  ", " . ilDatePresentation::formatDate($start) . " - " .
103  $il_date_now = new ilDateTime(ilUtil::now(), IL_CAL_DATETIME);
104  if (ilDate::_within($il_date_now, $start, $end)) {
105  $contains_today = true;
106  }
107  break;
108 
109  case ilDateTime::MONTH:
110  $tpl->setVariable(
111  "TXT_TITLE",
112  $this->lng->txt('month_' . $this->seed->get(IL_CAL_FKT_DATE, 'm') . '_long') .
113  ' ' . $this->seed->get(IL_CAL_FKT_DATE, 'Y')
114  );
115  if ($this->seed->get(IL_CAL_FKT_DATE, 'Y-m') == date("Y-m")) {
116  $contains_today = true;
117  }
118  break;
119  }
121  $this->ctrl->setParameterByClass(
122  get_class($this->cmdClass),
123  'seed',
124  $today->get(IL_CAL_DATE)
125  );
126  if ($contains_today) {
127  $b2 = $this->ui->factory()->button()->standard(
128  $this->lng->txt("today"),
129  $this->ctrl->getLinkTarget($this->cmdClass, $this->cmd)
130  )->withEngagedState(true);
131  } else {
132  $b2 = $this->ui->factory()->button()->standard(
133  $this->lng->txt("today"),
134  $this->ctrl->getLinkTarget($this->cmdClass, $this->cmd)
135  );
136  }
137  // next button
138  $this->incrementDate(1);
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)
143  );
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();
147 
148  return $tpl->get();
149  }
get(int $a_format, string $a_format_str='', string $a_tz='')
get formatted date
const IL_CAL_DATETIME
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
const IL_CAL_UNIX
static now()
Return current timestamp in Y-m-d H:i:s format.
const IL_CAL_FKT_DATE
static _numericDayToString(int $a_day, bool $a_long=true)
const IL_CAL_DATE
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.
+ Here is the call graph for this function:

◆ incrementDate()

ilCalendarHeaderNavigationGUI::incrementDate ( int  $a_count)
protected

Definition at line 151 of file class.ilCalendarHeaderNavigationGUI.php.

References IL_CAL_DAY, IL_CAL_FKT_DATE, and ilDateTime\MONTH.

Referenced by getHTML().

151  : void
152  {
153  switch ($this->increment) {
154  case ilDateTime::MONTH:
155  $day = $this->seed->get(IL_CAL_FKT_DATE, 'j');
156  if ($day > 28) {
157  $this->seed->increment(IL_CAL_DAY, (31 - $day) * -1);
158  }
159  // no break
160  default:
161  $this->seed->increment($this->increment, $a_count);
162  break;
163  }
164  }
const IL_CAL_DAY
const IL_CAL_FKT_DATE
+ Here is the caller graph for this function:

Field Documentation

◆ $cmd

string ilCalendarHeaderNavigationGUI::$cmd
protected

Definition at line 33 of file class.ilCalendarHeaderNavigationGUI.php.

Referenced by __construct().

◆ $cmdClass

object ilCalendarHeaderNavigationGUI::$cmdClass
protected

Definition at line 32 of file class.ilCalendarHeaderNavigationGUI.php.

Referenced by __construct().

◆ $ctrl

ilCtrlInterface ilCalendarHeaderNavigationGUI::$ctrl
protected

Definition at line 41 of file class.ilCalendarHeaderNavigationGUI.php.

◆ $html

string ilCalendarHeaderNavigationGUI::$html
protected

Definition at line 37 of file class.ilCalendarHeaderNavigationGUI.php.

◆ $increment

string ilCalendarHeaderNavigationGUI::$increment = ''
protected

Definition at line 35 of file class.ilCalendarHeaderNavigationGUI.php.

◆ $lng

ilLanguage ilCalendarHeaderNavigationGUI::$lng
protected

Definition at line 39 of file class.ilCalendarHeaderNavigationGUI.php.

◆ $seed

ilDate ilCalendarHeaderNavigationGUI::$seed
protected

Definition at line 34 of file class.ilCalendarHeaderNavigationGUI.php.

Referenced by __construct().

◆ $toolbar

ilToolbarGUI ilCalendarHeaderNavigationGUI::$toolbar
protected

Definition at line 42 of file class.ilCalendarHeaderNavigationGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilCalendarHeaderNavigationGUI::$tpl
protected

Definition at line 40 of file class.ilCalendarHeaderNavigationGUI.php.

◆ $ui

ILIAS DI UIServices ilCalendarHeaderNavigationGUI::$ui
protected

Definition at line 45 of file class.ilCalendarHeaderNavigationGUI.php.

◆ $user

ilObjUser ilCalendarHeaderNavigationGUI::$user
protected

Definition at line 43 of file class.ilCalendarHeaderNavigationGUI.php.

◆ $user_settings

ilCalendarUserSettings ilCalendarHeaderNavigationGUI::$user_settings
protected

Definition at line 44 of file class.ilCalendarHeaderNavigationGUI.php.


The documentation for this class was generated from the following file: