ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilCalendarRemoteAccessHandler Class Reference

Handles requests from external calendar applications More...

+ Collaboration diagram for ilCalendarRemoteAccessHandler:

Public Member Functions

 __construct ()
 Constructor. More...
 
 getTokenHandler ()
 
 parseRequest ()
 Fetch client id, the chosen calendar... More...
 
 handleRequest ()
 Handle Request. More...
 

Protected Member Functions

 initTokenHandler ()
 
 initIlias ()
 

Private Attributes

 $token_handler = null
 

Detailed Description

Handles requests from external calendar applications

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

Definition at line 34 of file class.ilCalendarRemoteAccessHandler.php.

Constructor & Destructor Documentation

◆ __construct()

ilCalendarRemoteAccessHandler::__construct ( )

Constructor.

Returns

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

43  {
44  }

Member Function Documentation

◆ getTokenHandler()

ilCalendarRemoteAccessHandler::getTokenHandler ( )

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

References $token_handler.

Referenced by handleRequest().

+ Here is the caller graph for this function:

◆ handleRequest()

ilCalendarRemoteAccessHandler::handleRequest ( )

Handle Request.

Returns

Definition at line 73 of file class.ilCalendarRemoteAccessHandler.php.

References $GLOBALS, ilCalendarCategories\_getInstance(), ilUtil\deliverData(), exit, ilCalendarExport\export(), getTokenHandler(), initIlias(), initTokenHandler(), ilCalendarCategories\MODE_REMOTE_ACCESS, ilCalendarCategories\MODE_REMOTE_SELECTED, and ilCalendarAuthenticationToken\SELECTION_CALENDAR.

74  {
75  $this->initIlias();
76  $this->initTokenHandler();
77 
78  if($this->getTokenHandler()->getIcal() and !$this->getTokenHandler()->isIcalExpired())
79  {
80  ilUtil::deliverData($this->getTokenHandler(),'calendar.ics','text/calendar','utf-8');
81  }
82 
83  include_once './Services/Calendar/classes/Export/class.ilCalendarExport.php';
84  include_once './Services/Calendar/classes/class.ilCalendarCategories.php';
85  if($this->getTokenHandler()->getSelectionType() == ilCalendarAuthenticationToken::SELECTION_CALENDAR)
86  {
87  #$export = new ilCalendarExport(array($this->getTokenHandler()->getCalendar()));
89  $cats->initialize(ilCalendarCategories::MODE_REMOTE_SELECTED, $this->getTokenHandler()->getCalendar());
90  $export = new ilCalendarExport($cats->getCategories(true));
91  }
92  else
93  {
96  $export = new ilCalendarExport($cats->getCategories(true));
97  }
98 
99  $export->export();
100 
101  $this->getTokenHandler()->setIcal($export->getExportString());
102  $this->getTokenHandler()->storeIcal();
103 
104  $GLOBALS['ilAuth']->logout();
105  ilUtil::deliverData($export->getExportString(),'calendar.ics','text/calendar','utf-8');
106  #echo $export->getExportString();
107  #echo nl2br($export->getExportString());
108 
109  #$fp = fopen('ilias.ics', 'w');
110  #fwrite($fp,$export->getExportString());
111  exit;
112  }
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
exit
Definition: login.php:54
$GLOBALS['ct_recipient']
Export calendar(s) to ical format
static _getInstance($a_usr_id=0)
get singleton instance
+ Here is the call graph for this function:

◆ initIlias()

ilCalendarRemoteAccessHandler::initIlias ( )
protected

Definition at line 123 of file class.ilCalendarRemoteAccessHandler.php.

References $_POST, $GLOBALS, ilAuthFactory\CONTEXT_CALENDAR_TOKEN, ilContext\CONTEXT_ICAL, ilContext\init(), ilInitialisation\initILIAS(), and ilAuthFactory\setContext().

Referenced by handleRequest().

124  {
125  include_once "Services/Context/classes/class.ilContext.php";
127 
128  include_once './Services/Authentication/classes/class.ilAuthFactory.php';
130 
131  $_POST['username'] = 'cal_auth_token';
132  $_POST['password'] = 'cal_auth_token';
133 
134  require_once("Services/Init/classes/class.ilInitialisation.php");
136 
137  $GLOBALS['lng']->loadLanguageModule('dateplaner');
138  }
$_POST['username']
Definition: cron.php:12
static initILIAS()
ilias initialisation
$GLOBALS['ct_recipient']
const CONTEXT_ICAL
static setContext($a_context)
set context
static init($a_type)
Init context by type.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initTokenHandler()

ilCalendarRemoteAccessHandler::initTokenHandler ( )
protected

Definition at line 114 of file class.ilCalendarRemoteAccessHandler.php.

References $_GET, and ilCalendarAuthenticationToken\lookupUser().

Referenced by handleRequest().

115  {
116  $this->token_handler = new ilCalendarAuthenticationToken(
118  $_GET['token']
119  );
120  return true;
121  }
$_GET["client_id"]
static lookupUser($a_token)
Lookup user by hash.
Handles calendar authentication tokens for external calendar subscriptions.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseRequest()

ilCalendarRemoteAccessHandler::parseRequest ( )

Fetch client id, the chosen calendar...

Returns

Definition at line 55 of file class.ilCalendarRemoteAccessHandler.php.

References $_COOKIE, $_GET, and $path_info_components.

56  {
57  if($_GET['client_id'])
58  {
59  $_COOKIE['ilClientId'] = $_GET['client_id'];
60 
61  }
62  else
63  {
64  $path_info_components = explode('/',$_SERVER['PATH_INFO']);
65  $_COOKIE['ilClientId'] = $path_info_components[1];
66  }
67  }
$_GET["client_id"]
$_COOKIE["ilClientId"]
Definition: cron.php:11
$path_info_components
Definition: webdav.php:20

Field Documentation

◆ $token_handler

ilCalendarRemoteAccessHandler::$token_handler = null
private

Definition at line 36 of file class.ilCalendarRemoteAccessHandler.php.

Referenced by getTokenHandler().


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