ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilAccessibilitySupportContactsGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
11{
15 protected $tpl;
16
20 protected $lng;
21
25 protected $ctrl;
26
30 protected $http;
31
35 public function __construct()
36 {
37 global $DIC;
38
39 $ctrl = $DIC->ctrl();
40 $tpl = $DIC["tpl"];
41 $lng = $DIC->language();
42 $http = $DIC->http();
43
44 $this->ctrl = $ctrl;
45 $this->tpl = $tpl;
46 $this->lng = $lng;
47 $this->http = $http;
48 }
49
50
54 public function executeCommand()
55 {
56 $cmd = $this->ctrl->getCmd("sendIssueMail");
57 if (in_array($cmd, array("sendIssueMail"))) {
58 $this->$cmd();
59 }
60 }
61
62
63 public function sendIssueMail() : void
64 {
65 $back_url = $this->http->request()->getServerParams()['HTTP_REFERER'];
66 $this->ctrl->redirectToURL(
68 $back_url,
69 '',
70 [],
71 [
72 'type' => 'new',
73 'rcp_to' => $this->getContactLogins(),
74 'sig' => $this->getAccessibilityIssueMailMessage($back_url)
75 ]
76 )
77 );
78 }
79
83 private function getAccessibilityIssueMailMessage(string $back_url) : string
84 {
85 $sig = chr(13) . chr(10) . chr(13) . chr(10) . chr(13) . chr(10);
86 $sig .= $this->lng->txt('report_accessibility_link');
87 $sig .= chr(13) . chr(10);
88 $sig .= $back_url;
89 $sig = rawurlencode(base64_encode($sig));
90
91 return $sig;
92 }
93
99 private function getContactLogins() : string
100 {
101 $logins = [];
102
104 $logins[] = ilObjUser::_lookupLogin($contact_id);
105 }
106
107 return implode(',', $logins);
108 }
109
115 public static function getFooterLink()
116 {
117 global $DIC;
118
119 $ctrl = $DIC->ctrl();
120 $user = $DIC->user();
121 $http = $DIC->http();
122 $lng = $DIC->language();
123
124
126 if (count($users) > 0) {
127 if (!$user->getId() || $user->getId() == ANONYMOUS_USER_ID) {
129 $request_scheme =
130 isset($http->request()->getServerParams()['HTTPS'])
131 && $http->request()->getServerParams()['HTTPS'] !== 'off'
132 ? 'https' : 'http';
133 $url = $request_scheme . '://'
134 . $http->request()->getServerParams()['HTTP_HOST']
135 . $http->request()->getServerParams()['REQUEST_URI'];
136 return "mailto:" . $mails . "?body=%0D%0A%0D%0A" . $lng->txt("report_accessibility_link_mailto") . "%0A" . rawurlencode($url);
137 } else {
138 return $ctrl->getLinkTargetByClass("ilaccessibilitysupportcontactsgui", "");
139 }
140 }
141 return "";
142 }
143
149 public static function getFooterText()
150 {
151 global $DIC;
152
153 $lng = $DIC->language();
154 return $lng->txt("report_accessibility_issue");
155 }
156}
An exception for terminatinating execution or to throw for unit testing.
getContactLogins()
Get accessibility support contacts as comma separated string.
static getValidSupportContactIds()
Get valid support contacts.
static getRedirectTarget($gui, $cmd, array $gui_params=array(), array $mail_params=array(), array $context_params=array())
static _lookupLogin($a_user_id)
lookup login
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
static http()
Fetches the global http state from ILIAS.
$url
$DIC
Definition: xapitoken.php:46