ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCalendarPresentationGUI Class Reference
+ Collaboration diagram for ilCalendarPresentationGUI:

Public Member Functions

 __construct ()
 Constructor.
 executeCommand ()
 Execute command.
 getNextClass ()
 get next class
 readLastClass ()
 Read last class from history.
 setCmdClass ($a_class)
 show ()
 Show.
 initSeed ()
 init the seed date for presentations (month view, minicalendar)

Protected Member Functions

 forwardToClass ($a_class)
 forward to class
 loadHistory ()
 forward to last presentation class
 showSideBlocks ()
 show side blocks
 prepareOutput ()
 get tabs
 synchroniseExternalCalendars ()
 Sync external calendars.

Protected Attributes

 $ctrl
 $lng
 $tpl
 $tabs_gui

Detailed Description

Constructor & Destructor Documentation

ilCalendarPresentationGUI::__construct ( )

Constructor.

public

Parameters

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

References $ilCtrl, $ilUser, $lng, $tpl, ilCalendarUserSettings\_getInstance(), ilCalendarCategories\_getInstance(), ilCalendarUserSettings\CAL_SELECTION_MEMBERSHIP, ilCalendarCategories\MODE_PERSONAL_DESKTOP_ITEMS, and ilCalendarCategories\MODE_PERSONAL_DESKTOP_MEMBERSHIP.

{
global $ilCtrl,$lng,$tpl,$ilTabs,$ilUser;
$this->ctrl = $ilCtrl;
$this->lng = $lng;
$this->lng->loadLanguageModule('dateplaner');
$this->tpl = $tpl;
$this->tabs_gui = $ilTabs;
include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
$cats = ilCalendarCategories::_getInstance($ilUser->getId());
include_once './Services/Calendar/classes/class.ilCalendarUserSettings.php';
{
}
else
{
}
}

+ Here is the call graph for this function:

Member Function Documentation

ilCalendarPresentationGUI::executeCommand ( )

Execute command.

public

Parameters

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

References $_GET, $_REQUEST, $_SESSION, $cmd, $ilSetting, $ilUser, $tpl, ilCalendarSettings\_getInstance(), forwardToClass(), getNextClass(), initSeed(), prepareOutput(), readLastClass(), ilUtil\redirect(), ilUtil\sendFailure(), setCmdClass(), showSideBlocks(), and synchroniseExternalCalendars().

{
global $ilUser, $ilSetting,$tpl, $ilHelp;
include_once('./Services/Calendar/classes/class.ilCalendarSettings.php');
{
ilUtil::sendFailure($this->lng->txt('permission_denied'),true);
ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
}
$this->initSeed();
$this->prepareOutput();
$next_class = $this->getNextClass();
switch($next_class)
{
case 'ilcalendarinboxgui':
$this->tabs_gui->activateTab('cal_upcoming_events_header');
$this->forwardToClass('ilcalendarinboxgui');
break;
case 'ilconsultationhoursgui':
$this->tabs_gui->activateTab('app_consultation_hours');
$this->tabs_gui->clearTargets();
// No side blocks
$this->tabs_gui->setBackTarget(
$this->lng->txt('cal_back_to_cal'),
$this->ctrl->getLinkTargetByClass($this->readLastClass())
);
include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHoursGUI.php';
$gui = new ilConsultationHoursGUI();
$this->ctrl->forwardCommand($gui);
return true;
case 'ilcalendarmonthgui':
$this->tabs_gui->activateTab('app_month');
$this->forwardToClass('ilcalendarmonthgui');
break;
case 'ilcalendarweekgui':
$this->tabs_gui->activateTab('app_week');
$this->forwardToClass('ilcalendarweekgui');
break;
case 'ilcalendardaygui':
$this->tabs_gui->activateTab('app_day');
$this->forwardToClass('ilcalendardaygui');
break;
case 'ilcalendarusersettingsgui':
$this->ctrl->setReturn($this,'');
$this->tabs_gui->activateTab('settings');
$this->setCmdClass('ilcalendarusersettingsgui');
include_once('./Services/Calendar/classes/class.ilCalendarUserSettingsGUI.php');
$user_settings = new ilCalendarUserSettingsGUI();
$this->ctrl->forwardCommand($user_settings);
// No side blocks
return true;
case 'ilcalendarappointmentgui':
$this->ctrl->setReturn($this,'');
$this->tabs_gui->activateTab($_SESSION['cal_last_tab']);
include_once('./Services/Calendar/classes/class.ilCalendarAppointmentGUI.php');
$app = new ilCalendarAppointmentGUI($this->seed, $this->seed,(int) $_GET['app_id']);
$this->ctrl->forwardCommand($app);
break;
case 'ilcalendarsubscriptiongui':
$this->ctrl->setReturn($this,'');
$this->tabs_gui->activateTab($_SESSION['cal_last_tab']);
include_once './Services/Calendar/classes/class.ilCalendarSubscriptionGUI.php';
$sub = new ilCalendarSubscriptionGUI((int) $_REQUEST['cal_id']);
$this->ctrl->forwardCommand($sub);
break;
case 'ilcalendarcategorygui':
$this->ctrl->setReturn($this,'');
include_once('Services/Calendar/classes/class.ilCalendarCategoryGUI.php');
$category = new ilCalendarCategoryGUI($ilUser->getId(),$this->seed);
if($this->ctrl->forwardCommand($category))
{
$this->tabs_gui->activateTab("cal_manage");
// no side blocks
return;
}
else
{
$this->tabs_gui->activateTab($_SESSION['cal_last_tab']);
break;
}
default:
$cmd = $this->ctrl->getCmd("show");
$this->$cmd();
break;
}
$this->showSideBlocks();
return true;
}

+ Here is the call graph for this function:

ilCalendarPresentationGUI::forwardToClass (   $a_class)
protected

forward to class

protected

Definition at line 246 of file class.ilCalendarPresentationGUI.php.

References $_SESSION, $ilUser, and setCmdClass().

Referenced by executeCommand(), and loadHistory().

{
global $ilUser;
switch($a_class)
{
case 'ilcalendarmonthgui':
$ilUser->writePref('cal_last_class',$a_class);
$_SESSION['cal_last_tab'] = 'app_month';
$this->setCmdClass('ilcalendarmonthgui');
include_once('./Services/Calendar/classes/class.ilCalendarMonthGUI.php');
$month_gui = new ilCalendarMonthGUI($this->seed);
$this->ctrl->forwardCommand($month_gui);
break;
case 'ilcalendarweekgui':
$ilUser->writePref('cal_last_class',$a_class);
$_SESSION['cal_last_tab'] = 'app_week';
$this->setCmdClass('ilcalendarweekgui');
include_once('./Services/Calendar/classes/class.ilCalendarWeekGUI.php');
$week_gui = new ilCalendarWeekGUI($this->seed);
$this->ctrl->forwardCommand($week_gui);
break;
case 'ilcalendardaygui':
$ilUser->writePref('cal_last_class',$a_class);
$_SESSION['cal_last_tab'] = 'app_day';
$this->setCmdClass('ilcalendardaygui');
include_once('./Services/Calendar/classes/class.ilCalendarDayGUI.php');
$day_gui = new ilCalendarDayGUI($this->seed);
$this->ctrl->forwardCommand($day_gui);
break;
case 'ilcalendarinboxgui':
$ilUser->writePref('cal_last_class',$a_class);
$_SESSION['cal_last_tab'] = 'cal_upcoming_events_header';
$this->setCmdClass('ilcalendarinboxgui');
include_once('./Services/Calendar/classes/class.ilCalendarInboxGUI.php');
$inbox_gui = new ilCalendarinboxGUI($this->seed);
$this->ctrl->forwardCommand($inbox_gui);
break;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarPresentationGUI::getNextClass ( )

get next class

public

Definition at line 203 of file class.ilCalendarPresentationGUI.php.

References $ilUser, and readLastClass().

Referenced by executeCommand().

{
global $ilUser;
if(strlen($next_class = $this->ctrl->getNextClass()))
{
return $next_class;
}
if($this->ctrl->getCmdClass() == strtolower(get_class($this)) or $this->ctrl->getCmdClass() == '')
{
return $this->readLastClass();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarPresentationGUI::initSeed ( )

init the seed date for presentations (month view, minicalendar)

public

Definition at line 378 of file class.ilCalendarPresentationGUI.php.

References $_GET, $_REQUEST, and IL_CAL_DATE.

Referenced by executeCommand().

{
include_once('Services/Calendar/classes/class.ilDate.php');
$this->seed = $_REQUEST['seed'] ? new ilDate($_REQUEST['seed'],IL_CAL_DATE) : new ilDate(date('Y-m-d',time()),IL_CAL_DATE);
$_GET['seed'] = $this->seed->get(IL_CAL_DATE,'');
$this->ctrl->saveParameter($this,array('seed'));
}

+ Here is the caller graph for this function:

ilCalendarPresentationGUI::loadHistory ( )
protected

forward to last presentation class

protected

Parameters
@return

Definition at line 298 of file class.ilCalendarPresentationGUI.php.

References $ilUser, and forwardToClass().

{
global $ilUser;
$this->ctrl->setCmd('');
$history = $ilUser->getPref('cal_last_class') ? $ilUser->getPref('cal_last_class') : 'ilcalendarmonthgui';
$this->forwardToClass($history);
}

+ Here is the call graph for this function:

ilCalendarPresentationGUI::prepareOutput ( )
protected

get tabs

public

Definition at line 351 of file class.ilCalendarPresentationGUI.php.

References ilCalendarSettings\_getInstance().

Referenced by executeCommand().

{
global $rbacsystem, $ilHelp;
$ilHelp->setScreenIdComponent("cal");
$this->tabs_gui->addTarget('cal_upcoming_events_header',$this->ctrl->getLinkTargetByClass('ilCalendarInboxGUI',''));
if(
$rbacsystem->checkAccess('add_consultation_hours', ilCalendarSettings::_getInstance()->getCalendarSettingsId()) and
ilCalendarSettings::_getInstance()->areConsultationHoursEnabled()
)
{
$this->tabs_gui->addTarget('app_consultation_hours',$this->ctrl->getLinkTargetByClass('ilConsultationHoursGUI',''));
}
$this->tabs_gui->addTarget('app_day',$this->ctrl->getLinkTargetByClass('ilCalendarDayGUI',''));
$this->tabs_gui->addTarget('app_week',$this->ctrl->getLinkTargetByClass('ilCalendarWeekGUI',''));
$this->tabs_gui->addTarget('app_month',$this->ctrl->getLinkTargetByClass('ilCalendarMonthGUI',''));
$this->tabs_gui->addTarget('cal_manage',$this->ctrl->getLinkTargetByClass('ilCalendarCategoryGUI','manage'));
$this->tabs_gui->addTarget('settings',$this->ctrl->getLinkTargetByClass('ilCalendarUserSettingsGUI',''));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarPresentationGUI::readLastClass ( )

Read last class from history.

Returns

Definition at line 221 of file class.ilCalendarPresentationGUI.php.

References $ilUser.

Referenced by executeCommand(), and getNextClass().

{
global $ilUser;
return $ilUser->getPref('cal_last_class') ? $ilUser->getPref('cal_last_class') : 'ilcalendarinboxgui';
}

+ Here is the caller graph for this function:

ilCalendarPresentationGUI::setCmdClass (   $a_class)

Definition at line 229 of file class.ilCalendarPresentationGUI.php.

Referenced by executeCommand(), and forwardToClass().

{
// If cmd class == 'ilcalendarpresentationgui' the cmd class is set to the the new forwarded class
// otherwise e.g ilcalendarmonthgui tries to forward (back) to ilcalendargui.
if($this->ctrl->getCmdClass() == strtolower(get_class($this)))
{
$this->ctrl->setCmdClass(strtolower($a_class));
}
return true;
}

+ Here is the caller graph for this function:

ilCalendarPresentationGUI::show ( )

Show.

public

Parameters

Definition at line 340 of file class.ilCalendarPresentationGUI.php.

References ilUtil\getStyleSheetLocation().

{
$this->tpl->addCss(ilUtil::getStyleSheetLocation('filesystem','delos.css','Services/Calendar'));
}

+ Here is the call graph for this function:

ilCalendarPresentationGUI::showSideBlocks ( )
protected

show side blocks

protected

Parameters
@return

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

References $ilCtrl, $ilUser, and $tpl.

Referenced by executeCommand().

{
global $ilUser, $ilCtrl;
$tpl = new ilTemplate('tpl.cal_side_block.html',true,true,'Services/Calendar');
include_once('./Services/Calendar/classes/class.ilMiniCalendarGUI.php');
$mini = new ilMiniCalendarGUI($this->seed, $this);
// $mini->setPresentationMode(ilMiniCalendarGUI::PRESENTATION_CALENDAR);
$tpl->setVariable('MINICAL',$mini->getHTML());
include_once('./Services/Calendar/classes/class.ilCalendarCategoryGUI.php');
$cat = new ilCalendarCategoryGUI($ilUser->getId(),$this->seed);
$tpl->setVariable('CATEGORIES', $ilCtrl->getHTML($cat));
$this->tpl->setLeftContent($tpl->get());
}

+ Here is the caller graph for this function:

ilCalendarPresentationGUI::synchroniseExternalCalendars ( )
protected

Sync external calendars.

Definition at line 389 of file class.ilCalendarPresentationGUI.php.

References $ilUser, ilDateTime\_before(), ilCalendarCategories\_getInstance(), ilCalendarSettings\_getInstance(), IL_CAL_HOUR, IL_CAL_UNIX, and ilCalendarRemoteReader\setUser().

Referenced by executeCommand().

{
global $ilUser;
if(!ilCalendarSettings::_getInstance()->isWebCalSyncEnabled())
{
return false;
}
// @todo make this thread safe
$limit = new ilDateTime(time(),IL_CAL_UNIX);
$limit->increment(IL_CAL_HOUR, -1 * ilCalendarSettings::_getInstance()->getWebCalSyncHours());
$cats = ilCalendarCategories::_getInstance($ilUser->getId());
foreach($cats->getCategoriesInfo() as $cat_id => $info)
{
if($info['remote'])
{
// Check for execution
$category = new ilCalendarCategory($cat_id);
if(ilDateTime::_before($category->getRemoteSyncLastExecution(), $limit))
{
// update in any case to avoid multiple updates of invalid calendar sources.
$category->setRemoteSyncLastExecution(new ilDateTime(time(),IL_CAL_UNIX));
$category->update();
include_once './Services/Calendar/classes/class.ilCalendarRemoteReader.php';
$remote = new ilCalendarRemoteReader($category->getRemoteUrl());
$remote->setUser($category->getRemoteUser());
$remote->setPass($category->getRemotePass());
$remote->read();
$remote->import($category);
break;
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilCalendarPresentationGUI::$ctrl
protected

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

ilCalendarPresentationGUI::$lng
protected

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

Referenced by __construct().

ilCalendarPresentationGUI::$tabs_gui
protected

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

ilCalendarPresentationGUI::$tpl
protected

Definition at line 42 of file class.ilCalendarPresentationGUI.php.

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


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