ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
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

Constructor & Destructor Documentation

◆ __construct()

ilCalendarMonthGUI::__construct ( ilDate  $seed_date)

Constructor.

public

Parameters

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

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

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
+ 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.

public

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

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

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  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$_GET["client_id"]
$cmd
Definition: sahs_server.php:35
global $ilCtrl
Definition: ilias.php:18
Class for single dates.
const IL_CAL_DATE
Administrate calendar appointments.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7

◆ getHTML()

ilCalendarMonthGUI::getHTML ( )

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

References show().

Referenced by showEvents().

303  {
304  $this->show();
305  return $this->tpl->get();
306  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ show()

ilCalendarMonthGUI::show ( )

fill data section

public

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

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

Referenced by getHTML().

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');
199  $settings = ilCalendarSettings::_getInstance();
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  if ($settings->getEnableGroupMilestones())
212  {
213  $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
214  $this->ctrl->setParameterByClass('ilcalendarappointmentgui','seed',$this->seed->get(IL_CAL_DATE));
215  $this->ctrl->setParameterByClass('ilcalendarappointmentgui','idate',$date->get(IL_CAL_DATE));
216  $this->tpl->setCurrentBlock("new_ms");
217  $this->tpl->setVariable('H_NEW_MS_SRC',ilUtil::getImagePath('ms_add.png'));
218  $this->tpl->setVariable('H_NEW_MS_ALT',$this->lng->txt('cal_new_ms'));
219  $this->tpl->setVariable('NEW_MS_LINK',$this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui','addMilestone'));
220  $this->tpl->parseCurrentBlock();
221  }
222 
223  $this->tpl->setCurrentBlock("new_app");
224  #$this->tpl->setVariable('NEW_SRC',ilUtil::getImagePath('new.png','calendar'));
225  $this->tpl->setVariable('NEW_SRC',ilUtil::getImagePath('date_add.png'));
226  $this->tpl->setVariable('NEW_ALT',$this->lng->txt('cal_new_app'));
227  $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
228  $this->ctrl->setParameterByClass('ilcalendarappointmentgui','idate',$date->get(IL_CAL_DATE));
229  $this->ctrl->setParameterByClass('ilcalendarappointmentgui','seed',$this->seed->get(IL_CAL_DATE));
230  $this->tpl->setVariable('ADD_LINK',$this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui','add'));
231  $this->tpl->parseCurrentBlock();
232  }
233 
234 
235  $day = $date->get(IL_CAL_FKT_DATE,'j');
236  $month = $date->get(IL_CAL_FKT_DATE,'n');
237 
238  if($day == 1)
239  {
240  $month_day = '1 '.ilCalendarUtil::_numericMonthToString($month,false);
241  }
242  else
243  {
244  $month_day = $day;
245  }
246 
247  if(!$is_portfolio_embedded &&
248  (!$disable_empty || $has_events))
249  {
250  $this->tpl->setCurrentBlock('month_day_link');
251  $this->ctrl->clearParametersByClass('ilcalendardaygui');
252  $this->ctrl->setParameterByClass('ilcalendardaygui','seed',$date->get(IL_CAL_DATE));
253  $this->tpl->setVariable('OPEN_DAY_VIEW',$this->ctrl->getLinkTargetByClass('ilcalendardaygui',''));
254  $this->ctrl->clearParametersByClass('ilcalendardaygui');
255  }
256  else
257  {
258  $this->tpl->setCurrentBlock('month_day_no_link');
259  }
260 
261  $this->tpl->setVariable('MONTH_DAY',$month_day);
262 
263  $this->tpl->parseCurrentBlock();
264 
265 
266  $this->tpl->setCurrentBlock('month_col');
267 
268  include_once('./Services/Calendar/classes/class.ilCalendarUtil.php');
269  if(ilCalendarUtil::_isToday($date))
270  {
271  $this->tpl->setVariable('TD_CLASS','caltoday');
272  }
273  #elseif(ilDateTime::_equals($date,$this->seed,IL_CAL_DAY))
274  #{
275  # $this->tpl->setVariable('TD_CLASS','calnow');
276  #}
277  elseif(ilDateTime::_equals($date,$this->seed,IL_CAL_MONTH))
278  {
279  $this->tpl->setVariable('TD_CLASS','calstd');
280  }
281  elseif(ilDateTime::_before($date,$this->seed,IL_CAL_MONTH))
282  {
283  $this->tpl->setVariable('TD_CLASS','calprev');
284  }
285  else
286  {
287  $this->tpl->setVariable('TD_CLASS','calnext');
288  }
289 
290  $this->tpl->parseCurrentBlock();
291 
292 
293  if($counter and !($counter % 7))
294  {
295  $this->tpl->setCurrentBlock('month_row');
296  $this->tpl->parseCurrentBlock();
297  }
298  }
299  }
static _buildMonthDayList($a_month, $a_year, $weekstart)
Build a month day list.
showEvents(ilDate $date)
Show events.
static _getInstance()
get singleton instance
static _numericDayToString($a_day, $a_long=true)
get
$_GET["client_id"]
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.
const IL_CAL_MONTH
static _equals(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
Check if two date are equal.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
special template class to simplify handling of ITX/PEAR
const IL_CAL_FKT_DATE
static _getInstance($a_usr_id=0)
get singleton instance
static initPanel($a_resize=false)
Init yui panel.
const IL_CAL_DATE
global $ilUser
Definition: imgupload.php:15
static initDragDrop()
Init YUI Drag and Drop.
static _isToday($date)
check if a date is today
Represents a list of calendar appointments (including recurring events) for a specific user in a give...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showEvents()

ilCalendarMonthGUI::showEvents ( ilDate  $date)
protected

Show events.

protected

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

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().

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