1 | <?php |
||
41 | class Skautis |
||
42 | { |
||
43 | |||
44 | use HelperTrait; |
||
45 | |||
46 | /** |
||
47 | * @var WsdlManager |
||
48 | */ |
||
49 | private $wsdlManager; |
||
50 | |||
51 | /** |
||
52 | * @var User |
||
53 | */ |
||
54 | private $user; |
||
55 | |||
56 | /** |
||
57 | * Zaznamy o provedenych dotazech na Skautis |
||
58 | * Pokud je null, query logging je vypnuto |
||
59 | * |
||
60 | * @var SkautisQuery[]|null |
||
61 | */ |
||
62 | private $log; |
||
63 | |||
64 | |||
65 | /** |
||
66 | * @param WsdlManager $wsdlManager |
||
67 | * @param User $user |
||
68 | */ |
||
69 | 4 | public function __construct(WsdlManager $wsdlManager, User $user) |
|
74 | |||
75 | public function getWsdlManager(): WsdlManager |
||
79 | |||
80 | 3 | public function getConfig(): Config |
|
81 | { |
||
82 | 3 | return $this->wsdlManager->getConfig(); |
|
83 | } |
||
84 | |||
85 | public function getUser(): User |
||
89 | |||
90 | /** |
||
91 | * Získá objekt webové služby |
||
92 | */ |
||
93 | 2 | public function getWebService(string $name): WebServiceInterface |
|
98 | |||
99 | /** |
||
100 | * Trocha magie pro snadnější přístup k webovým službám. |
||
101 | */ |
||
102 | 2 | public function __get(string $name): WebServiceInterface |
|
106 | |||
107 | /** |
||
108 | * NEPOUŽÍVAT - vždy vyhodí výjimku |
||
109 | * |
||
110 | * @deprecated |
||
111 | * @param string $name |
||
112 | * @param mixed $value |
||
113 | */ |
||
114 | 1 | public function __set( |
|
120 | |||
121 | |||
122 | /** |
||
123 | * Vrací URL na přihlášení |
||
124 | */ |
||
125 | 1 | public function getLoginUrl(string $backlink = ''): string |
|
126 | { |
||
127 | 1 | $query = []; |
|
128 | 1 | $query['appid'] = $this->getConfig()->getAppId(); |
|
129 | 1 | if (!empty($backlink)) { |
|
130 | 1 | $query['ReturnUrl'] = $backlink; |
|
131 | } |
||
132 | 1 | return $this->getConfig()->getBaseUrl() . 'Login/?' . http_build_query($query, '', '&'); |
|
133 | } |
||
134 | |||
135 | /** |
||
136 | * Vrací URL na odhlášení |
||
137 | */ |
||
138 | 1 | public function getLogoutUrl(): string |
|
139 | { |
||
140 | 1 | $query = []; |
|
141 | 1 | $query['appid'] = $this->getConfig()->getAppId(); |
|
142 | 1 | $query['token'] = $this->user->getLoginId(); |
|
143 | 1 | return $this->getConfig()->getBaseUrl() . 'Login/LogOut.aspx?' . http_build_query($query, '', '&'); |
|
144 | } |
||
145 | |||
146 | /** |
||
147 | * Vrací URL k registraci |
||
148 | */ |
||
149 | 1 | public function getRegisterUrl(string $backlink = ''): string |
|
150 | { |
||
151 | 1 | $query = []; |
|
152 | 1 | $query['appid'] = $this->getConfig()->getAppId(); |
|
153 | 1 | if (!empty($backlink)) { |
|
154 | $query['ReturnUrl'] = $backlink; |
||
155 | } |
||
156 | 1 | return $this->getConfig()->getBaseUrl() . 'Login/Registration.aspx?' . http_build_query($query, '', '&'); |
|
157 | } |
||
158 | |||
159 | /** |
||
160 | * Hromadné nastavení po přihlášení |
||
161 | */ |
||
162 | public function setLoginData(array $data): void |
||
167 | |||
168 | /** |
||
169 | * Ověřuje, zda je skautIS odstaven pro údržbu |
||
170 | */ |
||
171 | public function isMaintenance(): bool |
||
175 | |||
176 | /** |
||
177 | * Zapne logování všech SOAP callů |
||
178 | */ |
||
179 | public function enableDebugLog(): void |
||
193 | |||
194 | /** |
||
195 | * Vrací zalogované SOAP cally |
||
196 | */ |
||
197 | public function getDebugLog(): array |
||
201 | |||
202 | /** |
||
203 | * Vrací celé jméno webové služby |
||
204 | * |
||
205 | * @param string $name jméno nebo alias webové služby |
||
206 | * |
||
207 | * @throws WsdlException |
||
208 | */ |
||
209 | 2 | protected function getWebServiceName(string $name): string |
|
222 | } |
||
223 |