ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilCalendarMonthGUI Class Reference
+ Collaboration diagram for ilCalendarMonthGUI:

Public Member Functions

 __construct (ilDate $seed_date)
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 addScheduleFilter (ilCalendarScheduleFilter $a_filter)
 Add schedule filter. More...
 
 show ()
 fill data section More...
 
 getHTML ()
 

Protected Member Functions

 showEvents (ilDate $date)
 Show events. More...
 

Protected Attributes

 $num_appointments = 1
 
 $schedule_filters = array()
 
 $seed = null
 
 $user_settings = null
 
 $lng
 
 $ctrl
 
 $tabs_gui
 
 $tpl
 
 $timezone = 'UTC'
 

Detailed Description

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

@ilCtrl_Calls ilCalendarMonthGUI: ilCalendarAppointmentGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilCalendarMonthGUI::__construct ( ilDate  $seed_date)

Constructor.

@access public

Parameters

Definition at line 63 of file class.ilCalendarMonthGUI.php.

64 {
65 global $ilCtrl, $lng, $ilUser,$ilTabs,$tpl;
66
67 $this->seed = $seed_date;
68
69 $this->tpl = $tpl;
70 $this->lng = $lng;
71 $this->ctrl = $ilCtrl;
72 $this->tabs_gui = $ilTabs;
73 $this->tabs_gui->setSubTabActive('app_month');
74
75 $this->user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId());
76 $this->app_colors = new ilCalendarAppointmentColors($ilUser->getId());
77
78 $this->timezone = $ilUser->getTimeZone();
79 }
static _getInstanceByUserId($a_user_id)
get singleton instance
global $ilCtrl
Definition: ilias.php:18
global $ilUser
Definition: imgupload.php:15

References $ilCtrl, $ilUser, $lng, $tpl, and ilCalendarUserSettings\_getInstanceByUserId().

+ Here is the call graph for this function:

Member Function Documentation

◆ addScheduleFilter()

ilCalendarMonthGUI::addScheduleFilter ( ilCalendarScheduleFilter  $a_filter)

Add schedule filter.

Parameters
ilCalendarScheduleFilter$a_filter

Definition at line 126 of file class.ilCalendarMonthGUI.php.

127 {
128 $this->schedule_filters[] = $a_filter;
129 }

◆ executeCommand()

ilCalendarMonthGUI::executeCommand ( )

Execute command.

@access public

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

88 {
89 global $ilCtrl,$tpl;
90
91 $this->ctrl->saveParameter($this,'seed');
92
93 $next_class = $ilCtrl->getNextClass();
94 switch($next_class)
95 {
96 case 'ilcalendarappointmentgui':
97 $this->ctrl->setReturn($this,'');
98 $this->tabs_gui->setSubTabActive($_SESSION['cal_last_tab']);
99
100 include_once('./Services/Calendar/classes/class.ilCalendarAppointmentGUI.php');
101
102 // initial date for new calendar appointments
103 $idate = new ilDate($_REQUEST['idate'], IL_CAL_DATE);
104
105 $app = new ilCalendarAppointmentGUI($this->seed,$idate,(int) $_GET['app_id']);
106 $this->ctrl->forwardCommand($app);
107 break;
108
109 default:
110 $time = microtime(true);
111 $cmd = $this->ctrl->getCmd("show");
112 $this->$cmd();
113 $tpl->setContent($this->tpl->get());
114
115 #echo "Zeit: ".(microtime(true) - $time);
116 break;
117 }
118 return true;
119 }
$_GET["client_id"]
$_SESSION["AccountId"]
const IL_CAL_DATE
Administrate calendar appointments.
Class for single dates.
$cmd
Definition: sahs_server.php:35
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7

References $_GET, $_REQUEST, $_SESSION, $cmd, $ilCtrl, $tpl, and IL_CAL_DATE.

◆ getHTML()

ilCalendarMonthGUI::getHTML ( )

Definition at line 311 of file class.ilCalendarMonthGUI.php.

312 {
313 $this->show();
314 return $this->tpl->get();
315 }

References show().

Referenced by showEvents().

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

◆ show()

ilCalendarMonthGUI::show ( )

fill data section

@access public

Definition at line 137 of file class.ilCalendarMonthGUI.php.

138 {
139 global $tpl, $ilUser;
140
141 $this->tpl = new ilTemplate('tpl.month_view.html',true,true,'Services/Calendar');
142
143 include_once('./Services/YUI/classes/class.ilYuiUtil.php');
146
147 $navigation = new ilCalendarHeaderNavigationGUI($this,$this->seed,ilDateTime::MONTH);
148 $this->tpl->setVariable('NAVIGATION',$navigation->getHTML());
149
150 for($i = (int) $this->user_settings->getWeekStart();$i < (7 + (int) $this->user_settings->getWeekStart());$i++)
151 {
152 $this->tpl->setCurrentBlock('month_header_col');
153 $this->tpl->setVariable('TXT_WEEKDAY',ilCalendarUtil::_numericDayToString($i,true));
154 $this->tpl->parseCurrentBlock();
155 }
156
157 if(isset($_GET["bkid"]))
158 {
159 $user_id = $_GET["bkid"];
160 $disable_empty = true;
161 $no_add = true;
162 }
163 else
164 {
165 if($ilUser->getId() == ANONYMOUS_USER_ID)
166 {
167 $user_id = $ilUser->getId();
168 $disable_empty = false;
169 $no_add = true;
170 }
171 else
172 {
173 $user_id = $ilUser->getId();
174 $disable_empty = false;
175 $no_add = false;
176 }
177 }
178
179 $is_portfolio_embedded = false;
181 {
182 $no_add = true;
183 $is_portfolio_embedded = true;
184 }
185
186 include_once('Services/Calendar/classes/class.ilCalendarSchedule.php');
187 $this->scheduler = new ilCalendarSchedule($this->seed,ilCalendarSchedule::TYPE_MONTH,$user_id);
188 $this->scheduler->addSubitemCalendars(true);
189 if(sizeof($this->schedule_filters))
190 {
191 foreach($this->schedule_filters as $filter)
192 {
193 $this->scheduler->addFilter($filter);
194 }
195 }
196 $this->scheduler->calculate();
197
198 include_once('Services/Calendar/classes/class.ilCalendarSettings.php');
200
201 $counter = 0;
202 foreach(ilCalendarUtil::_buildMonthDayList($this->seed->get(IL_CAL_FKT_DATE,'m'),
203 $this->seed->get(IL_CAL_FKT_DATE,'Y'),
204 $this->user_settings->getWeekStart())->get() as $date)
205 {
206 $counter++;
207 $has_events = (bool)$this->showEvents($date);
208
209 if(!$no_add)
210 {
211 include_once "Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php";
212
213 $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
214 $this->ctrl->setParameterByClass('ilcalendarappointmentgui','idate',$date->get(IL_CAL_DATE));
215 $this->ctrl->setParameterByClass('ilcalendarappointmentgui','seed',$this->seed->get(IL_CAL_DATE));
216 $new_app_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui','add');
217
218 if ($settings->getEnableGroupMilestones())
219 {
220 $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
221 $this->ctrl->setParameterByClass('ilcalendarappointmentgui','seed',$this->seed->get(IL_CAL_DATE));
222 $this->ctrl->setParameterByClass('ilcalendarappointmentgui','idate',$date->get(IL_CAL_DATE));
223 $new_ms_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui','addMilestone');
224
225 $this->tpl->setCurrentBlock("new_ms");
226 $this->tpl->setVariable('DD_ID', $date->get(IL_CAL_UNIX));
227 $this->tpl->setVariable('DD_TRIGGER', ilGlyphGUI::get(ilGlyphGUI::ADD));
228 $this->tpl->setVariable('URL_DD_NEW_APP', $new_app_url);
229 $this->tpl->setVariable('TXT_DD_NEW_APP', $this->lng->txt('cal_new_app'));
230 $this->tpl->setVariable('URL_DD_NEW_MS', $new_ms_url);
231 $this->tpl->setVariable('TXT_DD_NEW_MS', $this->lng->txt('cal_new_ms'));
232 $this->tpl->parseCurrentBlock();
233 }
234 else
235 {
236 $this->tpl->setCurrentBlock("new_app");
237 $this->tpl->setVariable('ADD_LINK', $new_app_url);
238 $this->tpl->setVariable('NEW_SRC', ilGlyphGUI::get(ilGlyphGUI::ADD, $this->lng->txt('cal_new_app')));
239 $this->tpl->parseCurrentBlock();
240 }
241 }
242
243
244 $day = $date->get(IL_CAL_FKT_DATE,'j');
245 $month = $date->get(IL_CAL_FKT_DATE,'n');
246
247 if($day == 1)
248 {
249 $month_day = '1 '.ilCalendarUtil::_numericMonthToString($month,false);
250 }
251 else
252 {
253 $month_day = $day;
254 }
255
256 if(!$is_portfolio_embedded &&
257 (!$disable_empty || $has_events))
258 {
259 $this->tpl->setCurrentBlock('month_day_link');
260 $this->ctrl->clearParametersByClass('ilcalendardaygui');
261 $this->ctrl->setParameterByClass('ilcalendardaygui','seed',$date->get(IL_CAL_DATE));
262 $this->tpl->setVariable('OPEN_DAY_VIEW',$this->ctrl->getLinkTargetByClass('ilcalendardaygui',''));
263 $this->ctrl->clearParametersByClass('ilcalendardaygui');
264 }
265 else
266 {
267 $this->tpl->setCurrentBlock('month_day_no_link');
268 }
269
270 $this->tpl->setVariable('MONTH_DAY',$month_day);
271
272 $this->tpl->parseCurrentBlock();
273
274
275 $this->tpl->setCurrentBlock('month_col');
276
277 include_once('./Services/Calendar/classes/class.ilCalendarUtil.php');
278 if(ilCalendarUtil::_isToday($date))
279 {
280 $this->tpl->setVariable('TD_CLASS','caltoday');
281 }
282 #elseif(ilDateTime::_equals($date,$this->seed,IL_CAL_DAY))
283 #{
284 # $this->tpl->setVariable('TD_CLASS','calnow');
285 #}
286 elseif(ilDateTime::_equals($date,$this->seed,IL_CAL_MONTH))
287 {
288 $this->tpl->setVariable('TD_CLASS','calstd');
289 }
290 elseif(ilDateTime::_before($date,$this->seed,IL_CAL_MONTH))
291 {
292 $this->tpl->setVariable('TD_CLASS','calprev');
293 }
294 else
295 {
296 $this->tpl->setVariable('TD_CLASS','calnext');
297 }
298
299 $this->tpl->parseCurrentBlock();
300
301
302 if($counter and !($counter % 7))
303 {
304 $this->tpl->setCurrentBlock('month_row');
305 $this->tpl->parseCurrentBlock();
306 }
307 }
308 }
const IL_CAL_UNIX
const IL_CAL_MONTH
const IL_CAL_FKT_DATE
static _getInstance($a_usr_id=0)
get singleton instance
showEvents(ilDate $date)
Show events.
Represents a list of calendar appointments (including recurring events) for a specific user in a give...
static _getInstance()
get singleton instance
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.
static get($a_glyph, $a_text="")
Get glyph html.
special template class to simplify handling of ITX/PEAR
static initDragDrop()
Init YUI Drag and Drop.
static initPanel($a_resize=false)
Init yui panel.

References $_GET, $ilUser, $tpl, ilDateTime\_before(), ilCalendarUtil\_buildMonthDayList(), ilDateTime\_equals(), ilCalendarCategories\_getInstance(), ilCalendarSettings\_getInstance(), ilCalendarUtil\_isToday(), ilCalendarUtil\_numericDayToString(), ilGlyphGUI\ADD, ilGlyphGUI\get(), IL_CAL_DATE, IL_CAL_FKT_DATE, IL_CAL_MONTH, IL_CAL_UNIX, ilYuiUtil\initDragDrop(), ilYuiUtil\initPanel(), ilCalendarCategories\MODE_PORTFOLIO_CONSULTATION, ilDateTime\MONTH, showEvents(), and ilCalendarSchedule\TYPE_MONTH.

Referenced by getHTML().

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

◆ showEvents()

ilCalendarMonthGUI::showEvents ( ilDate  $date)
protected

Show events.

@access protected

Definition at line 323 of file class.ilCalendarMonthGUI.php.

324 {
325 global $tree, $ilUser;
326
327 $count = 0;
328
329
330 foreach($this->scheduler->getByDay($date,$this->timezone) as $item)
331 {
332 $this->tpl->setCurrentBlock('panel_code');
333 $this->tpl->setVariable('NUM',$this->num_appointments);
334 $this->tpl->parseCurrentBlock();
335
336 // milestone icon
337 if ($item['event']->isMilestone())
338 {
339 $this->tpl->setCurrentBlock('fullday_ms_icon');
340 $this->tpl->setVariable('ALT_FD_MS', $this->lng->txt("cal_milestone"));
341 $this->tpl->setVariable('SRC_FD_MS', ilUtil::getImagePath("icon_ms.svg"));
342 $this->tpl->parseCurrentBlock();
343 }
344
345 $this->tpl->setCurrentBlock('il_event');
346
347 include_once('./Services/Calendar/classes/class.ilCalendarAppointmentPanelGUI.php');
348 $this->tpl->setVariable('PANEL_DATA',ilCalendarAppointmentPanelGUI::_getInstance($this->seed)->getHTML($item));
349 $this->tpl->setVariable('PANEL_NUM',$this->num_appointments);
350
351 $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
352 $this->ctrl->setParameterByClass('ilcalendarappointmentgui','app_id',$item['event']->getEntryId());
353 $this->tpl->setVariable('EVENT_EDIT_LINK',$this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui','edit'));
354 $this->tpl->setVariable('EVENT_NUM',$item['event']->getEntryId());
355
356 $compl = ($item['event']->isMilestone() && $item['event']->getCompletion() > 0)
357 ? " (".$item['event']->getCompletion()."%)"
358 : "";
359
360 if($item['event']->isFullDay())
361 {
362 $title = $item['event']->getPresentationTitle().$compl;
363 }
364 else
365 {
366 switch($this->user_settings->getTimeFormat())
367 {
369 $title = $item['event']->getStart()->get(IL_CAL_FKT_DATE,'H:i',$this->timezone);
370 break;
371
373 $title = $item['event']->getStart()->get(IL_CAL_FKT_DATE,'h:ia',$this->timezone);
374 break;
375 }
376
377 $title .= (' '.$item['event']->getPresentationTitle());
378 }
379 $this->tpl->setVariable('EVENT_TITLE',$title);
380 $color = $this->app_colors->getColorByAppointment($item['event']->getEntryId());
381 $this->tpl->setVariable('EVENT_BGCOLOR',$color);
382 $this->tpl->setVariable('EVENT_ADD_STYLES',$item['event']->getPresentationStyle());
383 $this->tpl->setVariable('EVENT_FONTCOLOR',ilCalendarUtil::calculateFontColor($color));
384
385 $this->tpl->parseCurrentBlock();
386
387 $this->num_appointments++;
388 $count++;
389 }
390 return $count;
391 }
static _getInstance(ilDate $seed)
get singleton instance
static calculateFontColor($a_html_color_code)
Calculate best font color from html hex color code.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)

References $ilUser, ilCalendarAppointmentPanelGUI\_getInstance(), ilCalendarUtil\calculateFontColor(), getHTML(), ilUtil\getImagePath(), IL_CAL_FKT_DATE, ilCalendarSettings\TIME_FORMAT_12, and ilCalendarSettings\TIME_FORMAT_24.

Referenced by show().

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

Field Documentation

◆ $ctrl

ilCalendarMonthGUI::$ctrl
protected

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

◆ $lng

ilCalendarMonthGUI::$lng
protected

Definition at line 49 of file class.ilCalendarMonthGUI.php.

Referenced by __construct().

◆ $num_appointments

ilCalendarMonthGUI::$num_appointments = 1
protected

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

◆ $schedule_filters

ilCalendarMonthGUI::$schedule_filters = array()
protected

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

◆ $seed

ilCalendarMonthGUI::$seed = null
protected

Definition at line 46 of file class.ilCalendarMonthGUI.php.

◆ $tabs_gui

ilCalendarMonthGUI::$tabs_gui
protected

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

◆ $timezone

ilCalendarMonthGUI::$timezone = 'UTC'
protected

Definition at line 54 of file class.ilCalendarMonthGUI.php.

◆ $tpl

ilCalendarMonthGUI::$tpl
protected

Definition at line 52 of file class.ilCalendarMonthGUI.php.

Referenced by __construct(), executeCommand(), and show().

◆ $user_settings

ilCalendarMonthGUI::$user_settings = null
protected

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


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