ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 26 of file class.ilCalendarSubscriptionGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

39 {
40 global $DIC;
41
42 $this->cal_id = $a_calendar_id;
43 $this->ref_id = $a_ref_id;
44 $this->user = $DIC->user();
45 $this->ctrl = $DIC->ctrl();
46 $this->lng = $DIC->language();
47 $this->tpl = $DIC->ui()->mainTemplate();
48 $this->ui_factory = $DIC->ui()->factory();
49 $this->ui_renderer = $DIC->ui()->renderer();
50 }
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ createToken()

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

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

93 : string
94 {
96 if (strlen($hash)) {
97 return $hash;
98 }
100 $token->setSelectionType($selection);
101 $token->setCalendar($id);
102 return $token->add();
103 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Handles calendar authentication tokens for external calendar subscriptions.
static lookupAuthToken(int $a_user_id, int $a_selection, int $a_calendar=0)
$token
Definition: xapitoken.php:70

References $id, $token, $user_id, 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 ( )

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

52 : void
53 {
54 $next_class = $this->ctrl->getNextClass($this);
55 switch ($next_class) {
56 default:
57 $cmd = $this->ctrl->getCmd("show");
58 $this->$cmd();
59 break;
60 }
61 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ getModalForSubscription()

ilCalendarSubscriptionGUI::getModalForSubscription ( )
protected

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

105 : void
106 {
107 $tpl = new ilTemplate(
108 'tpl.subscription_dialog.html',
109 true,
110 true,
111 'components/ILIAS/Calendar'
112 );
113
114 $tpl->setVariable('TXT_SUBSCRIPTION_INFO', $this->lng->txt('cal_subscription_info'));
115
116 if ($this->cal_id > 0) {
119 } elseif ($this->ref_id > 0) {
122 $id = $category->getCategoryID();
123 } else {
125 $id = 0;
126 }
127 $hash = $this->createToken($this->user->getId(), $selection, $id);
128 $url = ILIAS_HTTP_PATH . '/calendar.php?client_id=' . CLIENT_ID . '&token=' . $hash;
129
130 $tpl->setVariable('LINK', $url . '&limited=0');
131 $tpl->setVariable('TXT_PERMA', $this->lng->txt('cal_ical_url'));
132
133 $tpl->setVariable('LINK_LIMITED', $url . '&limited=1');
134 $tpl->setVariable('TXT_PERMA_LIMITED', $this->lng->txt('cal_ical_url_google'));
135
136 $roundtrip = $this->ui_factory->modal()->roundtrip(
137 $this->lng->txt('cal_calendar_subscription_modal_title'),
138 $this->ui_factory->legacy()->content($tpl->get())
139 );
140 echo $this->ui_renderer->render($roundtrip);
141 exit;
142 }
static _getInstanceByObjId(int $a_obj_id)
get instance by obj_id
createToken($user_id, $selection, $id)
static _lookupObjId(int $ref_id)
special template class to simplify handling of ITX/PEAR
const CLIENT_ID
Definition: constants.php:41
exit
setVariable(string $variable, $value='')
Sets the given variable to the given value.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
$url
Definition: shib_logout.php:68

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

+ Here is the call graph for this function:

◆ show()

ilCalendarSubscriptionGUI::show ( )
protected

Show subscription info.

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

66 : void
67 {
68 $this->tpl->setOnScreenMessage('info', $this->lng->txt('cal_subscription_info'));
69
70 $info = new ilInfoScreenGUI($this);
71 $info->setFormAction($GLOBALS['DIC']['ilCtrl']->getFormAction($this));
72
73 if ($this->cal_id > 0) {
76 } elseif ($this->ref_id > 0) {
79 $id = $category->getCategoryID();
80 } else {
82 $id = 0;
83 }
84
85 $hash = $this->createToken($this->user->getId(), $selection, $id);
86 $url = ILIAS_HTTP_PATH . '/calendar.php?client_id=' . CLIENT_ID . '&token=' . $hash;
87 $info->addSection($this->lng->txt("cal_subscription"));
88 $info->addProperty($this->lng->txt('cal_ical_url'), $url, $url);
89
90 $this->tpl->setContent($info->getHTML());
91 }
Class ilInfoScreenGUI.
$info
Definition: entry_point.php:21
$GLOBALS["DIC"]
Definition: wac.php:54

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

+ Here is the call graph for this function:

Field Documentation

◆ $cal_id

int ilCalendarSubscriptionGUI::$cal_id = 0
private

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

Referenced by getModalForSubscription(), and show().

◆ $ctrl

ilCtrlInterface ilCalendarSubscriptionGUI::$ctrl
protected

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

◆ $lng

ilLanguage ilCalendarSubscriptionGUI::$lng
protected

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

◆ $ref_id

int ilCalendarSubscriptionGUI::$ref_id = 0
private

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

◆ $tpl

ilGlobalTemplateInterface ilCalendarSubscriptionGUI::$tpl
protected

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

Referenced by getModalForSubscription().

◆ $ui_factory

Factory ilCalendarSubscriptionGUI::$ui_factory
protected

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

◆ $ui_renderer

Renderer ilCalendarSubscriptionGUI::$ui_renderer
protected

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

◆ $user

ilObjUser ilCalendarSubscriptionGUI::$user
protected

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


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