ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilMiniCalendarGUI Class Reference
+ Collaboration diagram for ilMiniCalendarGUI:

Public Member Functions

 __construct (ilDate $seed, $a_par_obj)
 Constructor. More...
 
 setParentObject ($a_parentobject)
 Set Parent GUI object. More...
 
 getParentObject ()
 Get Parent GUI object. More...
 
 getHTML ()
 Get HTML for calendar. More...
 
 addMiniMonth ($a_tpl)
 Add mini version of monthly overview (Maybe extracted to another class, if used in pd calendar tab. More...
 

Data Fields

const PRESENTATION_CALENDAR = 1
 

Protected Attributes

 $seed
 
 $mode = null
 
 $user_settings = null
 
 $tpl = null
 
 $lng
 

Detailed Description

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilMiniCalendarGUI::__construct ( ilDate  $seed,
  $a_par_obj 
)

Constructor.

@access public

Parameters

return

Definition at line 50 of file class.ilMiniCalendarGUI.php.

51 {
52 global $DIC;
53
54 $ilUser = $DIC['ilUser'];
55 $lng = $DIC['lng'];
56
57 $this->user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId());
58 $this->lng = $lng;
59 $this->lng->loadLanguageModule('dateplaner');
60 $this->seed = $seed;
61 $this->setParentObject($a_par_obj);
62 }
static _getInstanceByUserId($a_user_id)
get singleton instance
setParentObject($a_parentobject)
Set Parent GUI object.
global $DIC
Definition: saml.php:7
$ilUser
Definition: imgupload.php:18

References $DIC, $ilUser, $lng, $seed, ilCalendarUserSettings\_getInstanceByUserId(), and setParentObject().

+ Here is the call graph for this function:

Member Function Documentation

◆ addMiniMonth()

ilMiniCalendarGUI::addMiniMonth (   $a_tpl)

Add mini version of monthly overview (Maybe extracted to another class, if used in pd calendar tab.

Definition at line 117 of file class.ilMiniCalendarGUI.php.

118 {
119 global $DIC;
120
121 $ilCtrl = $DIC['ilCtrl'];
122 $lng = $DIC['lng'];
123 $ilUser = $DIC['ilUser'];
124
125 // weekdays
126 include_once('Services/Calendar/classes/class.ilCalendarUtil.php');
127 $a_tpl->setCurrentBlock('month_header_col');
128 $a_tpl->setVariable('TXT_WEEKDAY', $lng->txt("cal_week_abbrev"));
129 $a_tpl->parseCurrentBlock();
130 for ($i = (int) $this->user_settings->getWeekStart();$i < (7 + (int) $this->user_settings->getWeekStart());$i++) {
131 $a_tpl->setCurrentBlock('month_header_col');
132 $a_tpl->setVariable('TXT_WEEKDAY', ilCalendarUtil::_numericDayToString($i, false));
133 $a_tpl->parseCurrentBlock();
134 }
135
136 include_once('Services/Calendar/classes/class.ilCalendarSchedule.php');
137 $this->scheduler = new ilCalendarSchedule($this->seed, ilCalendarSchedule::TYPE_MONTH);
138 $this->scheduler->calculate();
139
140 $counter = 0;
142 $this->seed->get(IL_CAL_FKT_DATE, 'm'),
143 $this->seed->get(IL_CAL_FKT_DATE, 'Y'),
144 $this->user_settings->getWeekStart()
145 )->get() as $date) {
146 $counter++;
147 //$this->showEvents($date);
148
149
150 $a_tpl->setCurrentBlock('month_col');
151
152 if (count($this->scheduler->getByDay($date, $ilUser->getTimeZone()))) {
153 $a_tpl->setVariable('DAY_CLASS', 'calminiapp');
154 #$a_tpl->setVariable('TD_CLASS','calminiapp');
155 }
156
157 include_once('./Services/Calendar/classes/class.ilCalendarUtil.php');
158 if (ilCalendarUtil::_isToday($date)) {
159 $a_tpl->setVariable('TD_CLASS', 'calminitoday');
160 }
161 #elseif(ilDateTime::_equals($date,$this->seed,IL_CAL_DAY))
162 #{
163 # $a_tpl->setVariable('TD_CLASS','calmininow');
164 #}
165 elseif (ilDateTime::_equals($date, $this->seed, IL_CAL_MONTH)) {
166 $a_tpl->setVariable('TD_CLASS', 'calministd');
167 } elseif (ilDateTime::_before($date, $this->seed, IL_CAL_MONTH)) {
168 $a_tpl->setVariable('TD_CLASS', 'calminiprev');
169 } else {
170 $a_tpl->setVariable('TD_CLASS', 'calmininext');
171 }
172
173 $day = $date->get(IL_CAL_FKT_DATE, 'j');
174 $month = $date->get(IL_CAL_FKT_DATE, 'n');
175
176 $month_day = $day;
177
178 $ilCtrl->clearParametersByClass('ilcalendardaygui');
179 $ilCtrl->setParameterByClass('ilcalendardaygui', 'seed', $date->get(IL_CAL_DATE));
180 $a_tpl->setVariable('OPEN_DAY_VIEW', $ilCtrl->getLinkTargetByClass('ilcalendardaygui', ''));
181 $ilCtrl->clearParametersByClass('ilcalendardaygui');
182
183 $a_tpl->setVariable('MONTH_DAY', $month_day);
184 $a_tpl->parseCurrentBlock();
185
186 if ($counter and !($counter % 7)) {
187 $a_tpl->setCurrentBlock('week');
188 $a_tpl->setVariable(
189 'WEEK',
190 $date->get(IL_CAL_FKT_DATE, 'W')
191 );
192 $a_tpl->parseCurrentBlock();
193
194 $a_tpl->setCurrentBlock('month_row');
195 $ilCtrl->clearParametersByClass('ilcalendarweekgui');
196 $ilCtrl->setParameterByClass('ilcalendarweekgui', 'seed', $date->get(IL_CAL_DATE));
197 $ilCtrl->clearParametersByClass('ilcalendarweekgui');
198 $a_tpl->setVariable('TD_CLASS', 'calminiweek');
199 $a_tpl->parseCurrentBlock();
200 }
201 }
202 $a_tpl->setCurrentBlock('mini_month');
203 //$a_tpl->setVariable('TXT_MONTH_OVERVIEW', $lng->txt("cal_month_overview"));
204 $a_tpl->setVariable(
205 'TXT_MONTH',
206 $lng->txt('month_' . $this->seed->get(IL_CAL_FKT_DATE, 'm') . '_long') .
207 ' ' . $this->seed->get(IL_CAL_FKT_DATE, 'Y')
208 );
209 $myseed = clone($this->seed);
210 $ilCtrl->setParameterByClass('ilcalendarmonthgui', 'seed', $myseed->get(IL_CAL_DATE));
211 $a_tpl->setVariable('OPEN_MONTH_VIEW', $ilCtrl->getLinkTargetByClass('ilcalendarmonthgui', ''));
212
213 $myseed->increment(ilDateTime::MONTH, -1);
214 $ilCtrl->setParameter($this->getParentObject(), 'seed', $myseed->get(IL_CAL_DATE));
215
216 //$a_tpl->setVariable('BL_TYPE', $this->getBlockType());
217 //$a_tpl->setVariable('BL_ID', $this->getBlockId());
218
219 $a_tpl->setVariable(
220 'PREV_MONTH',
221 $ilCtrl->getLinkTarget($this->getParentObject(), "")
222 );
223
224 $myseed->increment(ilDateTime::MONTH, 2);
225 $ilCtrl->setParameter($this->getParentObject(), 'seed', $myseed->get(IL_CAL_DATE));
226 $a_tpl->setVariable(
227 'NEXT_MONTH',
228 $ilCtrl->getLinkTarget($this->getParentObject(), "")
229 );
230
231 $ilCtrl->setParameter($this->getParentObject(), 'seed', "");
232 $a_tpl->parseCurrentBlock();
233 }
const IL_CAL_DATE
const IL_CAL_MONTH
const IL_CAL_FKT_DATE
Represents a list of calendar appointments (including recurring events) for a specific user in a give...
static _isToday($date)
check if a date is today
static _numericDayToString($a_day, $a_long=true)
get
static _buildMonthDayList($a_month, $a_year, $weekstart)
Build a month day list.
static _equals(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
Check if two date are equal.
static _before(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
getParentObject()
Get Parent GUI object.
$i
Definition: disco.tpl.php:19
global $ilCtrl
Definition: ilias.php:18

References $DIC, $i, $ilCtrl, $ilUser, $lng, ilDateTime\_before(), ilCalendarUtil\_buildMonthDayList(), ilDateTime\_equals(), ilCalendarUtil\_isToday(), ilCalendarUtil\_numericDayToString(), getParentObject(), IL_CAL_DATE, IL_CAL_FKT_DATE, IL_CAL_MONTH, ilDateTime\MONTH, and ilCalendarSchedule\TYPE_MONTH.

Referenced by getHTML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHTML()

ilMiniCalendarGUI::getHTML ( )

Get HTML for calendar.

Definition at line 87 of file class.ilMiniCalendarGUI.php.

88 {
89 global $DIC;
90
91 $lng = $DIC['lng'];
92
93 $ftpl = new ilTemplate(
94 "tpl.calendar_block_frame.html",
95 true,
96 true,
97 "Services/Calendar"
98 );
99
100 $tpl = new ilTemplate(
101 "tpl.calendar_block.html",
102 true,
103 true,
104 "Services/Calendar"
105 );
106 $this->addMiniMonth($tpl);
107
108 $ftpl->setVariable("BLOCK_TITLE", $lng->txt("calendar"));
109 $ftpl->setVariable("CONTENT", $tpl->get());
110 return $ftpl->get();
111 }
addMiniMonth($a_tpl)
Add mini version of monthly overview (Maybe extracted to another class, if used in pd calendar tab.
special template class to simplify handling of ITX/PEAR

References $DIC, $lng, $tpl, and addMiniMonth().

+ Here is the call graph for this function:

◆ getParentObject()

ilMiniCalendarGUI::getParentObject ( )

Get Parent GUI object.

Returns
object Parent GUI object

Definition at line 79 of file class.ilMiniCalendarGUI.php.

80 {
81 return $this->parentobject;
82 }

Referenced by addMiniMonth().

+ Here is the caller graph for this function:

◆ setParentObject()

ilMiniCalendarGUI::setParentObject (   $a_parentobject)

Set Parent GUI object.

Parameters
object$a_parentobjectParent GUI object

Definition at line 69 of file class.ilMiniCalendarGUI.php.

70 {
71 $this->parentobject = $a_parentobject;
72 }

Referenced by __construct().

+ Here is the caller graph for this function:

Field Documentation

◆ $lng

ilMiniCalendarGUI::$lng
protected

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

Referenced by __construct(), addMiniMonth(), and getHTML().

◆ $mode

ilMiniCalendarGUI::$mode = null
protected

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

◆ $seed

ilMiniCalendarGUI::$seed
protected

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

Referenced by __construct().

◆ $tpl

ilMiniCalendarGUI::$tpl = null
protected

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

Referenced by getHTML().

◆ $user_settings

ilMiniCalendarGUI::$user_settings = null
protected

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

◆ PRESENTATION_CALENDAR

const ilMiniCalendarGUI::PRESENTATION_CALENDAR = 1

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


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