ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCalendarMonthGUI Class Reference
+ Collaboration diagram for ilCalendarMonthGUI:

Public Member Functions

 __construct (ilDate $seed_date)
 Constructor.
 executeCommand ()
 Execute command.
 show ()
 fill data section

Protected Member Functions

 showEvents (ilDate $date)
 Show events.

Protected Attributes

 $num_appointments = 1
 $seed = null
 $user_settings = null
 $lng
 $ctrl
 $tabs_gui
 $tpl
 $timezone = 'UTC'

Detailed Description

Constructor & Destructor Documentation

ilCalendarMonthGUI::__construct ( ilDate  $seed_date)

Constructor.

public

Parameters

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

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

{
global $ilCtrl, $lng, $ilUser,$ilTabs,$tpl;
$this->seed = $seed_date;
$this->tpl = $tpl;
$this->lng = $lng;
$this->ctrl = $ilCtrl;
$this->tabs_gui = $ilTabs;
$this->tabs_gui->setSubTabActive('app_month');
$this->user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId());
$this->app_colors = new ilCalendarAppointmentColors($ilUser->getId());
$this->timezone = $ilUser->getTimeZone();
}

+ Here is the call graph for this function:

Member Function Documentation

ilCalendarMonthGUI::executeCommand ( )

Execute command.

public

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

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

{
global $ilCtrl,$tpl;
$this->ctrl->saveParameter($this,'seed');
$next_class = $ilCtrl->getNextClass();
switch($next_class)
{
case 'ilcalendarappointmentgui':
$this->ctrl->setReturn($this,'');
$this->tabs_gui->setSubTabActive($_SESSION['cal_last_tab']);
include_once('./Services/Calendar/classes/class.ilCalendarAppointmentGUI.php');
// initial date for new calendar appointments
$idate = new ilDate($_REQUEST['idate'], IL_CAL_DATE);
$app = new ilCalendarAppointmentGUI($this->seed,$idate,(int) $_GET['app_id']);
$this->ctrl->forwardCommand($app);
break;
default:
$time = microtime(true);
$cmd = $this->ctrl->getCmd("show");
$this->$cmd();
$tpl->setContent($this->tpl->get());
#echo "Zeit: ".(microtime(true) - $time);
break;
}
return true;
}
ilCalendarMonthGUI::show ( )

fill data section

public

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

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

{
global $tpl, $ilUser;
$this->tpl = new ilTemplate('tpl.month_view.html',true,true,'Services/Calendar');
include_once('./Services/YUI/classes/class.ilYuiUtil.php');
$navigation = new ilCalendarHeaderNavigationGUI($this,$this->seed,ilDateTime::MONTH);
$this->tpl->setVariable('NAVIGATION',$navigation->getHTML());
for($i = (int) $this->user_settings->getWeekStart();$i < (7 + (int) $this->user_settings->getWeekStart());$i++)
{
$this->tpl->setCurrentBlock('month_header_col');
$this->tpl->setVariable('TXT_WEEKDAY',ilCalendarUtil::_numericDayToString($i,true));
$this->tpl->parseCurrentBlock();
}
if(isset($_GET["bkid"]))
{
$user_id = $_GET["bkid"];
$disable_empty = true;
$no_add = true;
}
else
{
$user_id = $ilUser->getId();
$disable_empty = false;
$no_add = false;
}
include_once('Services/Calendar/classes/class.ilCalendarSchedule.php');
$this->scheduler = new ilCalendarSchedule($this->seed,ilCalendarSchedule::TYPE_MONTH,$user_id,$disable_empty);
$this->scheduler->addSubitemCalendars(true);
$this->scheduler->calculate();
include_once('Services/Calendar/classes/class.ilCalendarSettings.php');
$counter = 0;
foreach(ilCalendarUtil::_buildMonthDayList($this->seed->get(IL_CAL_FKT_DATE,'m'),
$this->seed->get(IL_CAL_FKT_DATE,'Y'),
$this->user_settings->getWeekStart())->get() as $date)
{
$counter++;
$has_events = (bool)$this->showEvents($date);
if(!$no_add)
{
if ($settings->getEnableGroupMilestones())
{
$this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
$this->ctrl->setParameterByClass('ilcalendarappointmentgui','seed',$this->seed->get(IL_CAL_DATE));
$this->ctrl->setParameterByClass('ilcalendarappointmentgui','idate',$date->get(IL_CAL_DATE));
$this->tpl->setCurrentBlock("new_ms");
$this->tpl->setVariable('H_NEW_MS_SRC',ilUtil::getImagePath('ms_add.gif'));
$this->tpl->setVariable('H_NEW_MS_ALT',$this->lng->txt('cal_new_ms'));
$this->tpl->setVariable('NEW_MS_LINK',$this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui','addMilestone'));
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("new_app");
#$this->tpl->setVariable('NEW_SRC',ilUtil::getImagePath('new.gif','calendar'));
$this->tpl->setVariable('NEW_SRC',ilUtil::getImagePath('date_add.gif'));
$this->tpl->setVariable('NEW_ALT',$this->lng->txt('cal_new_app'));
$this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
$this->ctrl->setParameterByClass('ilcalendarappointmentgui','idate',$date->get(IL_CAL_DATE));
$this->ctrl->setParameterByClass('ilcalendarappointmentgui','seed',$this->seed->get(IL_CAL_DATE));
$this->tpl->setVariable('ADD_LINK',$this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui','add'));
$this->tpl->parseCurrentBlock();
}
$day = $date->get(IL_CAL_FKT_DATE,'j');
$month = $date->get(IL_CAL_FKT_DATE,'n');
if($day == 1)
{
$month_day = '1 '.ilCalendarUtil::_numericMonthToString($month,false);
}
else
{
$month_day = $day;
}
if(!$disable_empty || $has_events)
{
$this->tpl->setCurrentBlock('month_day_link');
$this->ctrl->clearParametersByClass('ilcalendardaygui');
$this->ctrl->setParameterByClass('ilcalendardaygui','seed',$date->get(IL_CAL_DATE));
$this->tpl->setVariable('OPEN_DAY_VIEW',$this->ctrl->getLinkTargetByClass('ilcalendardaygui',''));
$this->ctrl->clearParametersByClass('ilcalendardaygui');
}
else
{
$this->tpl->setCurrentBlock('month_day_no_link');
}
$this->tpl->setVariable('MONTH_DAY',$month_day);
$this->tpl->parseCurrentBlock();
$this->tpl->setCurrentBlock('month_col');
include_once('./Services/Calendar/classes/class.ilCalendarUtil.php');
{
$this->tpl->setVariable('TD_CLASS','caltoday');
}
#elseif(ilDateTime::_equals($date,$this->seed,IL_CAL_DAY))
#{
# $this->tpl->setVariable('TD_CLASS','calnow');
#}
elseif(ilDateTime::_equals($date,$this->seed,IL_CAL_MONTH))
{
$this->tpl->setVariable('TD_CLASS','calstd');
}
elseif(ilDateTime::_before($date,$this->seed,IL_CAL_MONTH))
{
$this->tpl->setVariable('TD_CLASS','calprev');
}
else
{
$this->tpl->setVariable('TD_CLASS','calnext');
}
$this->tpl->parseCurrentBlock();
if($counter and !($counter % 7))
{
$this->tpl->setCurrentBlock('month_row');
$this->tpl->parseCurrentBlock();
}
}
}

+ Here is the call graph for this function:

ilCalendarMonthGUI::showEvents ( ilDate  $date)
protected

Show events.

protected

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

References $title, ilCalendarAppointmentPanelGUI\_getInstance(), ilCalendarUtil\calculateFontColor(), ilUtil\getImagePath(), IL_CAL_FKT_DATE, ilCalendarSettings\TIME_FORMAT_12, ilCalendarSettings\TIME_FORMAT_24, and ilCalendarCategory\TYPE_CH.

Referenced by show().

{
global $tree, $ilUser;
$count = 0;
foreach($this->scheduler->getByDay($date,$this->timezone) as $item)
{
// booking
$booking_subtitle = false;
if($item['category_type'] == ilCalendarCategory::TYPE_CH)
{
include_once 'Services/Booking/classes/class.ilBookingEntry.php';
$entry = new ilBookingEntry($item['event']->getContextId());
if($entry)
{
$booking_subtitle = ' '.$item['event']->getTitle();
if($entry->isOwner())
{
$max = (int)$entry->getNumberOfBookings();
$current = (int)$entry->getCurrentNumberOfBookings($item['event']->getEntryId());
if($max > 1)
{
$booking_subtitle .= ' ('.$current.'/'.$max.')';
}
else if($current == $max)
{
$booking_subtitle .= ' ('.$this->lng->txt('cal_booked_out').')';
}
else
{
$booking_subtitle .= ' ('.$this->lng->txt('cal_book_free').')';
}
}
else if($entry->hasBooked($item['event']->getEntryId()))
{
$booking_subtitle .= ' ('.$this->lng->txt('cal_date_booked').')';
}
}
}
$this->tpl->setCurrentBlock('panel_code');
$this->tpl->setVariable('NUM',$this->num_appointments);
$this->tpl->parseCurrentBlock();
// milestone icon
if ($item['event']->isMilestone())
{
$this->tpl->setCurrentBlock('fullday_ms_icon');
$this->tpl->setVariable('ALT_FD_MS', $this->lng->txt("cal_milestone"));
$this->tpl->setVariable('SRC_FD_MS', ilUtil::getImagePath("icon_ms_s.gif"));
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock('il_event');
include_once('./Services/Calendar/classes/class.ilCalendarAppointmentPanelGUI.php');
$this->tpl->setVariable('PANEL_DATA',ilCalendarAppointmentPanelGUI::_getInstance($this->seed)->getHTML($item));
$this->tpl->setVariable('PANEL_NUM',$this->num_appointments);
$this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
$this->ctrl->setParameterByClass('ilcalendarappointmentgui','app_id',$item['event']->getEntryId());
$this->tpl->setVariable('EVENT_EDIT_LINK',$this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui','edit'));
$this->tpl->setVariable('EVENT_NUM',$item['event']->getEntryId());
$compl = ($item['event']->isMilestone() && $item['event']->getCompletion() > 0)
? " (".$item['event']->getCompletion()."%)"
: "";
if($item['event']->isFullDay())
{
$title = $item['event']->getPresentationTitle().$compl;
}
else
{
switch($this->user_settings->getTimeFormat())
{
$title = $item['event']->getStart()->get(IL_CAL_FKT_DATE,'H:i',$this->timezone);
break;
$title = $item['event']->getStart()->get(IL_CAL_FKT_DATE,'h:ia',$this->timezone);
break;
}
if(!$booking_subtitle)
{
$title .= (' '.$item['event']->getPresentationTitle());
}
else
{
$title .= $booking_subtitle;
}
}
$this->tpl->setVariable('EVENT_TITLE',$title);
$color = $this->app_colors->getColorByAppointment($item['event']->getEntryId());
$this->tpl->setVariable('EVENT_BGCOLOR',$color);
$this->tpl->setVariable('EVENT_FONTCOLOR',ilCalendarUtil::calculateFontColor($color));
$this->tpl->parseCurrentBlock();
$this->num_appointments++;
$count++;
}
return $count;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilCalendarMonthGUI::$ctrl
protected

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

ilCalendarMonthGUI::$lng
protected

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

Referenced by __construct().

ilCalendarMonthGUI::$num_appointments = 1
protected

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

ilCalendarMonthGUI::$seed = null
protected

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

ilCalendarMonthGUI::$tabs_gui
protected

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

ilCalendarMonthGUI::$timezone = 'UTC'
protected

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

ilCalendarMonthGUI::$tpl
protected

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

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

ilCalendarMonthGUI::$user_settings = null
protected

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


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