ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilCalendarSubscriptionGUI Class Reference

Show calendar subscription info. More...

+ Collaboration diagram for ilCalendarSubscriptionGUI:

Public Member Functions

 __construct ($a_calendar_id, $a_ref_id=0)
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 

Protected Member Functions

 show ()
 Show subscription info. More...
 
 getModalForSubscription ()
 gGet modal for subscription More...
 

Private Member Functions

 createToken ($user_id, $selection, $id)
 Create calendar token. More...
 

Private Attributes

 $cal_id = 0
 
 $calendar = null
 

Detailed Description

Show calendar subscription info.

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

Definition at line 12 of file class.ilCalendarSubscriptionGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilCalendarSubscriptionGUI::__construct (   $a_calendar_id,
  $a_ref_id = 0 
)

Constructor.

Parameters
int$a_clendar_id

Definition at line 21 of file class.ilCalendarSubscriptionGUI.php.

22 {
23 global $DIC;
24
25 $this->cal_id = $a_calendar_id;
26 $this->ref_id = $a_ref_id;
27 $this->user = $DIC->user();
28 $this->lng = $DIC->language();
29 $this->tpl = $DIC["tpl"];
30
31 include_once './Services/Calendar/classes/class.ilCalendarCategory.php';
32 }
user()
Definition: user.php:4
$DIC
Definition: xapitoken.php:46

References $DIC, and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ createToken()

ilCalendarSubscriptionGUI::createToken (   $user_id,
  $selection,
  $id 
)
private

Create calendar token.

Definition at line 88 of file class.ilCalendarSubscriptionGUI.php.

89 {
90 include_once './Services/Calendar/classes/class.ilCalendarAuthenticationToken.php';
91 $hash = ilCalendarAuthenticationToken::lookupAuthToken($user_id, $selection, $id);
92 if (strlen($hash)) {
93 return $hash;
94 }
96 $token->setSelectionType($selection);
97 $token->setCalendar($id);
98 return $token->add();
99 }
Handles calendar authentication tokens for external calendar subscriptions.
static lookupAuthToken($a_user_id, $a_selection, $a_calendar=0)
$token
Definition: xapitoken.php:57

References $token, and ilCalendarAuthenticationToken\lookupAuthToken().

Referenced by getModalForSubscription(), and show().

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

◆ executeCommand()

ilCalendarSubscriptionGUI::executeCommand ( )

Execute command.

Definition at line 37 of file class.ilCalendarSubscriptionGUI.php.

38 {
39 global $DIC;
40
41 $ilCtrl = $DIC['ilCtrl'];
42
43 $next_class = $ilCtrl->getNextClass($this);
44 switch ($next_class) {
45 default:
46 $cmd = $ilCtrl->getCmd("show");
47
48 $this->$cmd();
49 break;
50 }
51 return true;
52 }
global $ilCtrl
Definition: ilias.php:18

References $DIC, and $ilCtrl.

◆ getModalForSubscription()

ilCalendarSubscriptionGUI::getModalForSubscription ( )
protected

gGet modal for subscription

Definition at line 104 of file class.ilCalendarSubscriptionGUI.php.

105 {
106 global $DIC;
107
108 $lng = $DIC->language();
109
110 $ui_factory = $DIC->ui()->factory();
111 $ui_renderer = $DIC->ui()->renderer();
112
113 $tpl = new ilTemplate(
114 'tpl.subscription_dialog.html',
115 true,
116 true,
117 'Services/Calendar'
118 );
119
120 $tpl->setVariable('TXT_SUBSCRIPTION_INFO', $lng->txt('cal_subscription_info'));
121
122
123 if ($this->cal_id > 0) {
125 $id = $this->cal_id;
126 } elseif ($this->ref_id > 0) {
129 $id = $category->getCategoryID();
130 } else {
132 $id = 0;
133 }
134 $hash = $this->createToken($this->user->getID(), $selection, $id);
135 $url = ILIAS_HTTP_PATH . '/calendar.php?client_id=' . CLIENT_ID . '&token=' . $hash;
136
137 $tpl->setVariable('LINK', $url);
138 $tpl->setVariable('TXT_PERMA', $lng->txt('cal_ical_url'));
139
140 $roundtrip = $ui_factory->modal()->roundtrip(
141 $lng->txt('cal_calendar_subscription_modal_title'),
142 $ui_factory->legacy($tpl->get())
143 );
144 echo $ui_renderer->render($roundtrip);
145 exit;
146 }
static _getInstanceByObjId($a_obj_id)
get instance by obj_id
createToken($user_id, $selection, $id)
Create calendar token.
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
exit
Definition: login.php:29
$url
$lng
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl

References $cal_id, $DIC, $lng, $tpl, $url, ilCalendarCategory\_getInstanceByObjId(), ilObject\_lookupObjId(), createToken(), exit, ILIAS_HTTP_PATH, ilCalendarAuthenticationToken\SELECTION_CALENDAR, ilCalendarAuthenticationToken\SELECTION_PD, and user().

+ Here is the call graph for this function:

◆ show()

ilCalendarSubscriptionGUI::show ( )
protected

Show subscription info.

Definition at line 57 of file class.ilCalendarSubscriptionGUI.php.

58 {
59 ilUtil::sendInfo($this->lng->txt('cal_subscription_info'));
60
61 include_once './Services/InfoScreen/classes/class.ilInfoScreenGUI.php';
62 $info = new ilInfoScreenGUI($this);
63 $info->setFormAction($GLOBALS['DIC']['ilCtrl']->getFormAction($this));
64
65 if ($this->cal_id > 0) {
67 $id = $this->cal_id;
68 } elseif ($this->ref_id > 0) {
71 $id = $category->getCategoryID();
72 } else {
74 $id = 0;
75 }
76
77 $hash = $this->createToken($this->user->getID(), $selection, $id);
78 $url = ILIAS_HTTP_PATH . '/calendar.php?client_id=' . CLIENT_ID . '&token=' . $hash;
79 $info->addSection($this->lng->txt("cal_subscription"));
80 $info->addProperty($this->lng->txt('cal_ical_url'), $url, $url);
81
82 $this->tpl->setContent($info->getHTML());
83 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
Class ilInfoScreenGUI.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References $cal_id, $GLOBALS, $url, ilCalendarCategory\_getInstanceByObjId(), ilObject\_lookupObjId(), createToken(), ILIAS_HTTP_PATH, ilCalendarAuthenticationToken\SELECTION_CALENDAR, ilCalendarAuthenticationToken\SELECTION_PD, ilUtil\sendInfo(), and user().

+ Here is the call graph for this function:

Field Documentation

◆ $cal_id

ilCalendarSubscriptionGUI::$cal_id = 0
private

Definition at line 14 of file class.ilCalendarSubscriptionGUI.php.

Referenced by getModalForSubscription(), and show().

◆ $calendar

ilCalendarSubscriptionGUI::$calendar = null
private

Definition at line 15 of file class.ilCalendarSubscriptionGUI.php.


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