ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 41 of file class.ilCalendarHeaderNavigationGUI.php.

42 {
43 global $DIC;
44
45 $this->lng = $DIC->language();
46
47 $this->ctrl = $DIC->ctrl();
48 $this->cmdClass = $cmdClass;
49 $this->seed = clone $seed;
50 $this->increment = $a_increment;
51 $this->cmd = $cmd;
52 $this->toolbar = $DIC->toolbar();
53 $this->ui = $DIC->ui();
54 $this->user = $DIC->user();
55 $this->user_settings = ilCalendarUserSettings::_getInstanceByUserId($this->user->getId());
56 }
static _getInstanceByUserId(int $a_user_id)
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ getHTML()

ilCalendarHeaderNavigationGUI::getHTML ( )

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

58 : string
59 {
60 $today = new ilDateTime(time(), IL_CAL_UNIX, $this->user->getTimeZone());
61 $tpl = new ilTemplate("tpl.navigation_header.html", true, true, "components/ILIAS/Calendar");
62
63 // previous button
64 $contains_today = false;
65 $this->incrementDate(-1);
66 $this->ctrl->setParameterByClass(get_class($this->cmdClass), 'seed', $this->seed->get(IL_CAL_DATE));
67 $b1 = $this->ui->factory()->button()->standard(
68 $this->lng->txt("previous"),
69 $this->ctrl->getLinkTarget($this->cmdClass, $this->cmd)
70 );
71
72 // today button
73 $this->incrementDate(1);
75 switch ($this->increment) {
76 case ilDateTime::DAY:
78 "TXT_TITLE",
79 ilCalendarUtil::_numericDayToString((int) $this->seed->get(IL_CAL_FKT_DATE, 'w')) .
80 ", " . ilDatePresentation::formatDate($this->seed)
81 );
82 if (date("Y-m-d") === $this->seed->get(IL_CAL_FKT_DATE, 'Y-m-d')) {
83 $contains_today = true;
84 }
85 break;
86
89 $this->seed,
90 $this->user_settings->getWeekStart()
91 )->get();
92 $start = current($weekday_list);
93 $end = end($weekday_list);
94 $tpl->setVariable("TXT_TITLE", $this->lng->txt('week') . ' ' . $this->seed->get(IL_CAL_FKT_DATE, 'W') .
95 ", " . ilDatePresentation::formatDate($start) . " - " .
97 $il_date_now = new ilDateTime(ilUtil::now(), IL_CAL_DATETIME);
98 if (ilDate::_within($il_date_now, $start, $end)) {
99 $contains_today = true;
100 }
101 break;
102
105 "TXT_TITLE",
106 $this->lng->txt('month_' . $this->seed->get(IL_CAL_FKT_DATE, 'm') . '_long') .
107 ' ' . $this->seed->get(IL_CAL_FKT_DATE, 'Y')
108 );
109 if ($this->seed->get(IL_CAL_FKT_DATE, 'Y-m') == date("Y-m")) {
110 $contains_today = true;
111 }
112 break;
113 }
115 $this->ctrl->setParameterByClass(
116 get_class($this->cmdClass),
117 'seed',
118 $today->get(IL_CAL_DATE)
119 );
120 if ($contains_today) {
121 $b2 = $this->ui->factory()->button()->standard(
122 $this->lng->txt("today"),
123 $this->ctrl->getLinkTarget($this->cmdClass, $this->cmd)
124 )->withEngagedState(true);
125 } else {
126 $b2 = $this->ui->factory()->button()->standard(
127 $this->lng->txt("today"),
128 $this->ctrl->getLinkTarget($this->cmdClass, $this->cmd)
129 );
130 }
131 // next button
132 $this->incrementDate(1);
133 $this->ctrl->setParameterByClass(get_class($this->cmdClass), 'seed', $this->seed->get(IL_CAL_DATE));
134 $b3 = $this->ui->factory()->button()->standard(
135 $this->lng->txt("next"),
136 $this->ctrl->getLinkTarget($this->cmdClass, $this->cmd)
137 );
138 $this->ctrl->setParameterByClass(get_class($this->cmdClass), 'seed', '');
139 $this->toolbar->addStickyItem($this->ui->factory()->viewControl()->section($b1, $b2, $b3));
140 $this->toolbar->addSeparator();
141
142 return $tpl->get();
143 }
const IL_CAL_DATE
const IL_CAL_UNIX
const IL_CAL_DATETIME
const IL_CAL_FKT_DATE
static _numericDayToString(int $a_day, bool $a_long=true, ?ilLanguage $lng=null)
static _buildWeekDayList(ilDate $a_day, int $a_weekstart)
build week day list @access public
static setUseRelativeDates(bool $a_status)
set use relative dates
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@classDescription Date and time handling
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.
special template class to simplify handling of ITX/PEAR
static now()
Return current timestamp in Y-m-d H:i:s format.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.

References $tpl, ilCalendarUtil\_buildWeekDayList(), ilCalendarUtil\_numericDayToString(), ilDateTime\_within(), ILIAS\Repository\ctrl(), ilDateTime\DAY, ilDatePresentation\formatDate(), ILIAS\UICore\GlobalTemplate\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\UICore\GlobalTemplate\setVariable(), ILIAS\Repository\toolbar(), ILIAS\Repository\ui(), ILIAS\Repository\user(), and ilDateTime\WEEK.

+ Here is the call graph for this function:

◆ incrementDate()

ilCalendarHeaderNavigationGUI::incrementDate ( int  $a_count)
protected

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

145 : void
146 {
147 switch ($this->increment) {
149 $day = $this->seed->get(IL_CAL_FKT_DATE, 'j');
150 if ($day > 28) {
151 $this->seed->increment(IL_CAL_DAY, (31 - $day) * -1);
152 }
153 // no break
154 default:
155 $this->seed->increment($this->increment, $a_count);
156 break;
157 }
158 }
const IL_CAL_DAY

References IL_CAL_DAY, IL_CAL_FKT_DATE, and ilDateTime\MONTH.

Referenced by getHTML().

+ Here is the caller graph for this function:

Field Documentation

◆ $cmd

string ilCalendarHeaderNavigationGUI::$cmd
protected

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

Referenced by __construct().

◆ $cmdClass

object ilCalendarHeaderNavigationGUI::$cmdClass
protected

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

Referenced by __construct().

◆ $ctrl

ilCtrlInterface ilCalendarHeaderNavigationGUI::$ctrl
protected

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

◆ $html

string ilCalendarHeaderNavigationGUI::$html
protected

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

◆ $increment

string ilCalendarHeaderNavigationGUI::$increment = ''
protected

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

◆ $lng

ilLanguage ilCalendarHeaderNavigationGUI::$lng
protected

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

◆ $seed

ilDate ilCalendarHeaderNavigationGUI::$seed
protected

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

Referenced by __construct().

◆ $toolbar

ilToolbarGUI ilCalendarHeaderNavigationGUI::$toolbar
protected

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

◆ $tpl

ilGlobalTemplateInterface ilCalendarHeaderNavigationGUI::$tpl
protected

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

Referenced by getHTML().

◆ $ui

ILIAS DI UIServices ilCalendarHeaderNavigationGUI::$ui
protected

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

◆ $user

ilObjUser ilCalendarHeaderNavigationGUI::$user
protected

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

◆ $user_settings

ilCalendarUserSettings ilCalendarHeaderNavigationGUI::$user_settings
protected

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


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