|
6 | 6 | * @package chamilo.plugin.azure_active_directory
|
7 | 7 | */
|
8 | 8 |
|
9 |
| -/** @var AzureActiveDirectory $activeDirectoryPlugin */ |
10 |
| -$activeDirectoryPlugin = AzureActiveDirectory::create(); |
| 9 | +// Check if AzureActiveDirectory exists, since this is not loaded as a page. |
| 10 | +// index.php is shown as a block when showing the region to which the plugin is assigned |
| 11 | +if (class_exists(AzureActiveDirectory::class)) { |
| 12 | + /** @var AzureActiveDirectory $activeDirectoryPlugin */ |
| 13 | + $activeDirectoryPlugin = AzureActiveDirectory::create(); |
11 | 14 |
|
12 |
| -if ($activeDirectoryPlugin->get(AzureActiveDirectory::SETTING_ENABLE) === 'true') { |
13 |
| - $_template['block_title'] = $activeDirectoryPlugin->get(AzureActiveDirectory::SETTING_BLOCK_NAME); |
| 15 | + if ($activeDirectoryPlugin->get(AzureActiveDirectory::SETTING_ENABLE) === 'true') { |
| 16 | + $_template['block_title'] = $activeDirectoryPlugin->get(AzureActiveDirectory::SETTING_BLOCK_NAME); |
14 | 17 |
|
15 |
| - $_template['signin_url'] = $activeDirectoryPlugin->getUrl(AzureActiveDirectory::URL_TYPE_AUTHORIZE); |
| 18 | + $_template['signin_url'] = $activeDirectoryPlugin->getUrl(AzureActiveDirectory::URL_TYPE_AUTHORIZE); |
16 | 19 |
|
17 |
| - if ('true' === $activeDirectoryPlugin->get(AzureActiveDirectory::SETTING_FORCE_LOGOUT_BUTTON)) { |
18 |
| - $_template['signout_url'] = $activeDirectoryPlugin->getUrl(AzureActiveDirectory::URL_TYPE_LOGOUT); |
19 |
| - } |
| 20 | + if ('true' === $activeDirectoryPlugin->get(AzureActiveDirectory::SETTING_FORCE_LOGOUT_BUTTON)) { |
| 21 | + $_template['signout_url'] = $activeDirectoryPlugin->getUrl(AzureActiveDirectory::URL_TYPE_LOGOUT); |
| 22 | + } |
20 | 23 |
|
21 |
| - $managementLoginEnabled = 'true' === $activeDirectoryPlugin->get(AzureActiveDirectory::SETTING_MANAGEMENT_LOGIN_ENABLE); |
| 24 | + $managementLoginEnabled = 'true' === $activeDirectoryPlugin->get(AzureActiveDirectory::SETTING_MANAGEMENT_LOGIN_ENABLE); |
22 | 25 |
|
23 |
| - $_template['management_login_enabled'] = $managementLoginEnabled; |
| 26 | + $_template['management_login_enabled'] = $managementLoginEnabled; |
24 | 27 |
|
25 |
| - if ($managementLoginEnabled) { |
26 |
| - $managementLoginName = $activeDirectoryPlugin->get(AzureActiveDirectory::SETTING_MANAGEMENT_LOGIN_NAME); |
| 28 | + if ($managementLoginEnabled) { |
| 29 | + $managementLoginName = $activeDirectoryPlugin->get(AzureActiveDirectory::SETTING_MANAGEMENT_LOGIN_NAME); |
27 | 30 |
|
28 |
| - if (empty($managementLoginName)) { |
29 |
| - $managementLoginName = $activeDirectoryPlugin->get_lang('ManagementLogin'); |
30 |
| - } |
| 31 | + if (empty($managementLoginName)) { |
| 32 | + $managementLoginName = $activeDirectoryPlugin->get_lang('ManagementLogin'); |
| 33 | + } |
31 | 34 |
|
32 |
| - $_template['management_login_name'] = $managementLoginName; |
| 35 | + $_template['management_login_name'] = $managementLoginName; |
| 36 | + } |
33 | 37 | }
|
34 | 38 | }
|
0 commit comments