ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilCalendarSubscriptionGUI Class Reference

Show calendar subscription info. More...

+ Collaboration diagram for ilCalendarSubscriptionGUI:

Public Member Functions

 __construct (int $a_calendar_id, int $a_ref_id=0)
 
 executeCommand ()
 

Protected Member Functions

 show ()
 Show subscription info. More...
 
 getModalForSubscription ()
 

Protected Attributes

ilObjUser $user
 
ilCtrlInterface $ctrl
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
Factory $ui_factory
 
Renderer $ui_renderer
 

Private Member Functions

 createToken ($user_id, $selection, $id)
 

Private Attributes

int $cal_id = 0
 
int $ref_id = 0
 

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

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

Constructor & Destructor Documentation

◆ __construct()

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

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

References $DIC, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

25  {
26  global $DIC;
27 
28  $this->cal_id = $a_calendar_id;
29  $this->ref_id = $a_ref_id;
30  $this->user = $DIC->user();
31  $this->ctrl = $DIC->ctrl();
32  $this->lng = $DIC->language();
33  $this->tpl = $DIC->ui()->mainTemplate();
34  $this->ui_factory = $DIC->ui()->factory();
35  $this->ui_renderer = $DIC->ui()->renderer();
36  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ createToken()

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

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

References $id, $token, and ilCalendarAuthenticationToken\lookupAuthToken().

Referenced by getModalForSubscription(), and show().

79  : string
80  {
81  $hash = ilCalendarAuthenticationToken::lookupAuthToken($user_id, $selection, $id);
82  if (strlen($hash)) {
83  return $hash;
84  }
85  $token = new ilCalendarAuthenticationToken($user_id);
86  $token->setSelectionType($selection);
87  $token->setCalendar($id);
88  return $token->add();
89  }
static lookupAuthToken(int $a_user_id, int $a_selection, int $a_calendar=0)
$token
Definition: xapitoken.php:70
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Handles calendar authentication tokens for external calendar subscriptions.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilCalendarSubscriptionGUI::executeCommand ( )

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

References ILIAS\Repository\ctrl().

38  : void
39  {
40  $next_class = $this->ctrl->getNextClass($this);
41  switch ($next_class) {
42  default:
43  $cmd = $this->ctrl->getCmd("show");
44  $this->$cmd();
45  break;
46  }
47  }
+ Here is the call graph for this function:

◆ getModalForSubscription()

ilCalendarSubscriptionGUI::getModalForSubscription ( )
protected

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

References $cal_id, $id, $url, ilCalendarCategory\_getInstanceByObjId(), ilObject\_lookupObjId(), CLIENT_ID, createToken(), exit, ilGlobalTemplateInterface\get(), ILIAS\Repository\lng(), ilCalendarAuthenticationToken\SELECTION_CALENDAR, ilCalendarAuthenticationToken\SELECTION_PD, ilGlobalTemplateInterface\setVariable(), and ILIAS\Repository\user().

91  : void
92  {
93  $tpl = new ilTemplate(
94  'tpl.subscription_dialog.html',
95  true,
96  true,
97  'Services/Calendar'
98  );
99 
100  $tpl->setVariable('TXT_SUBSCRIPTION_INFO', $this->lng->txt('cal_subscription_info'));
101 
102  if ($this->cal_id > 0) {
104  $id = $this->cal_id;
105  } elseif ($this->ref_id > 0) {
108  $id = $category->getCategoryID();
109  } else {
111  $id = 0;
112  }
113  $hash = $this->createToken($this->user->getId(), $selection, $id);
114  $url = ILIAS_HTTP_PATH . '/calendar.php?client_id=' . CLIENT_ID . '&token=' . $hash;
115 
116  $tpl->setVariable('LINK', $url . '&limited=0');
117  $tpl->setVariable('TXT_PERMA', $this->lng->txt('cal_ical_url'));
118 
119  $tpl->setVariable('LINK_LIMITED', $url . '&limited=1');
120  $tpl->setVariable('TXT_PERMA_LIMITED', $this->lng->txt('cal_ical_url_google'));
121 
122  $roundtrip = $this->ui_factory->modal()->roundtrip(
123  $this->lng->txt('cal_calendar_subscription_modal_title'),
124  $this->ui_factory->legacy($tpl->get())
125  );
126  echo $this->ui_renderer->render($roundtrip);
127  exit;
128  }
exit
Definition: login.php:28
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
static _getInstanceByObjId(int $a_obj_id)
get instance by obj_id
setVariable(string $variable, $value='')
Sets the given variable to the given value.
static _lookupObjId(int $ref_id)
const CLIENT_ID
Definition: constants.php:41
createToken($user_id, $selection, $id)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$url
+ Here is the call graph for this function:

◆ show()

ilCalendarSubscriptionGUI::show ( )
protected

Show subscription info.

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

References $cal_id, $GLOBALS, $id, $url, ilCalendarCategory\_getInstanceByObjId(), ilObject\_lookupObjId(), CLIENT_ID, createToken(), ILIAS\Repository\lng(), ilCalendarAuthenticationToken\SELECTION_CALENDAR, ilCalendarAuthenticationToken\SELECTION_PD, and ILIAS\Repository\user().

52  : void
53  {
54  $this->tpl->setOnScreenMessage('info', $this->lng->txt('cal_subscription_info'));
55 
56  $info = new ilInfoScreenGUI($this);
57  $info->setFormAction($GLOBALS['DIC']['ilCtrl']->getFormAction($this));
58 
59  if ($this->cal_id > 0) {
62  } elseif ($this->ref_id > 0) {
65  $id = $category->getCategoryID();
66  } else {
68  $id = 0;
69  }
70 
71  $hash = $this->createToken($this->user->getId(), $selection, $id);
72  $url = ILIAS_HTTP_PATH . '/calendar.php?client_id=' . CLIENT_ID . '&token=' . $hash;
73  $info->addSection($this->lng->txt("cal_subscription"));
74  $info->addProperty($this->lng->txt('cal_ical_url'), $url, $url);
75 
76  $this->tpl->setContent($info->getHTML());
77  }
Class ilInfoScreenGUI.
static _getInstanceByObjId(int $a_obj_id)
get instance by obj_id
static _lookupObjId(int $ref_id)
const CLIENT_ID
Definition: constants.php:41
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
createToken($user_id, $selection, $id)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$url
+ Here is the call graph for this function:

Field Documentation

◆ $cal_id

int ilCalendarSubscriptionGUI::$cal_id = 0
private

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

Referenced by getModalForSubscription(), and show().

◆ $ctrl

ilCtrlInterface ilCalendarSubscriptionGUI::$ctrl
protected

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

◆ $lng

ilLanguage ilCalendarSubscriptionGUI::$lng
protected

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

◆ $ref_id

int ilCalendarSubscriptionGUI::$ref_id = 0
private

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

◆ $tpl

ilGlobalTemplateInterface ilCalendarSubscriptionGUI::$tpl
protected

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

◆ $ui_factory

Factory ilCalendarSubscriptionGUI::$ui_factory
protected

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

◆ $ui_renderer

Renderer ilCalendarSubscriptionGUI::$ui_renderer
protected

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

◆ $user

ilObjUser ilCalendarSubscriptionGUI::$user
protected

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


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