ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilCalendarHeaderNavigationGUI Class Reference
+ Collaboration diagram for ilCalendarHeaderNavigationGUI:

Public Member Functions

 __construct ($cmdClass, ilDate $seed, $a_increment, $cmd='')
 Constructor. More...
 
 getHTML ()
 getHTML More...
 

Protected Member Functions

 incrementDate ($a_count)
 

Protected Attributes

 $cmdClass = null
 
 $cmd = null
 
 $seed = null
 
 $increment = ''
 
 $html
 
 $lng
 
 $tpl
 

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

@access public

Parameters
objectilDate seed for navigation @parame string type MONTH WEEK DAY

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

62 {
63 global $DIC;
64
65 $this->lng = $DIC->language();
66
67 $this->ctrl = $DIC->ctrl();
68 $this->cmdClass = $cmdClass;
69 $this->seed = clone $seed;
70 $this->increment = $a_increment;
71 $this->cmd = $cmd;
72 $this->toolbar = $DIC->toolbar();
73 $this->ui = $DIC->ui();
74 $this->user = $DIC->user();
75
76 $this->user_settings = ilCalendarUserSettings::_getInstanceByUserId($this->user->getId());
77 }
user()
Definition: user.php:4
static _getInstanceByUserId($a_user_id)
get singleton instance
global $DIC
Definition: saml.php:7

References $cmd, $cmdClass, $DIC, $seed, ilCalendarUserSettings\_getInstanceByUserId(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ getHTML()

ilCalendarHeaderNavigationGUI::getHTML ( )

getHTML

@access public

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

86 {
88 $ui = $this->ui;
89 $toolbar = $this->toolbar;
90
91 $tpl = new ilTemplate("tpl.navigation_header.html", true, true, "Services/Calendar");
92
93 // previous button
94 $this->incrementDate(-1);
95 $this->ctrl->setParameterByClass(get_class($this->cmdClass), 'seed', $this->seed->get(IL_CAL_DATE));
96 $b1 = $ui->factory()->button()->standard($lng->txt("previous"), $this->ctrl->getLinkTarget($this->cmdClass, $this->cmd));
97
98 // today button
99 $contains_today = false;
100 $this->incrementDate(1);
102 switch ($this->increment) {
103 case ilDateTime::DAY:
104 $tpl->setVariable("TXT_TITLE", ilCalendarUtil::_numericDayToString($this->seed->get(IL_CAL_FKT_DATE, 'w')) .
105 ", " . ilDatePresentation::formatDate($this->seed));
106 if (date("Y-m-d") === $this->seed->get(IL_CAL_FKT_DATE, 'Y-m-d')) {
107 $contains_today = true;
108 }
109 break;
110
111 case ilDateTime::WEEK:
112 $weekday_list = ilCalendarUtil::_buildWeekDayList($this->seed, $this->user_settings->getWeekStart())->get();
113 $start = current($weekday_list);
114 $end = end($weekday_list);
115 $tpl->setVariable("TXT_TITLE", $this->lng->txt('week') . ' ' . $this->seed->get(IL_CAL_FKT_DATE, 'W') .
116 ", " . ilDatePresentation::formatDate($start) . " - " .
118 $il_date_now = new ilDateTime(ilUtil::now(), IL_CAL_DATETIME);
119 if (ilDate::_within($il_date_now, $start, $end)) {
120 $contains_today = true;
121 }
122 break;
123
125 $tpl->setVariable("TXT_TITLE", $this->lng->txt('month_' . $this->seed->get(IL_CAL_FKT_DATE, 'm') . '_long') .
126 ' ' . $this->seed->get(IL_CAL_FKT_DATE, 'Y'));
127 if ($this->seed->get(IL_CAL_FKT_DATE, 'Y-m') == date("Y-m")) {
128 $contains_today = true;
129 }
130 break;
131 }
133 $this->ctrl->setParameterByClass(get_class($this->cmdClass), 'seed', '');
134 if ($contains_today) {
135 $b2 = $ui->factory()->button()->standard($lng->txt("today"), $this->ctrl->getLinkTarget($this->cmdClass, $this->cmd))->withUnavailableAction();
136 } else {
137 $b2 = $ui->factory()->button()->standard($lng->txt("today"), $this->ctrl->getLinkTarget($this->cmdClass, $this->cmd));
138 }
139
140 // next button
141 $this->incrementDate(1);
142 $this->ctrl->setParameterByClass(get_class($this->cmdClass), 'seed', $this->seed->get(IL_CAL_DATE));
143 $b3 = $ui->factory()->button()->standard($lng->txt("next"), $this->ctrl->getLinkTarget($this->cmdClass, $this->cmd));
144 $this->ctrl->setParameterByClass(get_class($this->cmdClass), 'seed', '');
145
146 //$toolbar->addComponent($ui->factory()->viewControl()->section($b1,$b2,$b3));
147 $toolbar->addStickyItem($ui->factory()->viewControl()->section($b1, $b2, $b3));
148 $toolbar->addSeparator();
149
150 return $tpl->get();
151 }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
const IL_CAL_DATE
const IL_CAL_DATETIME
const IL_CAL_FKT_DATE
static _numericDayToString($a_day, $a_long=true)
get
static _buildWeekDayList($a_day, $a_weekstart)
build week day list
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date @access public.
static setUseRelativeDates($a_status)
set use relative dates
@classDescription Date and time handling
static _within(ilDateTime $dt, ilDateTime $start, ilDateTime $end, $a_compare_field='', $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.
$end
Definition: saml1-acs.php:18

References $end, $lng, $tpl, ilCalendarUtil\_buildWeekDayList(), ilCalendarUtil\_numericDayToString(), ilDateTime\_within(), date, ilDateTime\DAY, ilDatePresentation\formatDate(), IL_CAL_DATE, IL_CAL_DATETIME, IL_CAL_FKT_DATE, incrementDate(), ilDateTime\MONTH, ilUtil\now(), ilDatePresentation\setUseRelativeDates(), and ilDateTime\WEEK.

+ Here is the call graph for this function:

◆ incrementDate()

ilCalendarHeaderNavigationGUI::incrementDate (   $a_count)
protected

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

154 {
155 switch ($this->increment) {
157
158 $day = $this->seed->get(IL_CAL_FKT_DATE, 'j');
159 if ($day > 28) {
160 $this->seed->increment(IL_CAL_DAY, (31 - $day) * -1);
161 }
162 // no break
163 default:
164 $this->seed->increment($this->increment, $a_count);
165 break;
166 }
167 }
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

ilCalendarHeaderNavigationGUI::$cmd = null
protected

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

Referenced by __construct().

◆ $cmdClass

ilCalendarHeaderNavigationGUI::$cmdClass = null
protected

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

Referenced by __construct().

◆ $html

ilCalendarHeaderNavigationGUI::$html
protected

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

◆ $increment

ilCalendarHeaderNavigationGUI::$increment = ''
protected

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

◆ $lng

ilCalendarHeaderNavigationGUI::$lng
protected

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

Referenced by getHTML().

◆ $seed

ilCalendarHeaderNavigationGUI::$seed = null
protected

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

Referenced by __construct().

◆ $tpl

ilCalendarHeaderNavigationGUI::$tpl
protected

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

Referenced by getHTML().


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