diff --git a/local/o365/lang/en/local_o365.php b/local/o365/lang/en/local_o365.php index 69b72c196..556334d41 100644 --- a/local/o365/lang/en/local_o365.php +++ b/local/o365/lang/en/local_o365.php @@ -600,7 +600,7 @@ $string['settings_teams_deploy_bot_1'] = 'Once you have completed the above steps and have an active Azure subscription, click here to deploy the bot:'; $string['settings_teams_deploy_bot_2'] = 'Need help?'; $string['settings_bot_feature_enabled'] = 'Bot feature enabled'; -$string['settings_bot_feature_enabled_desc'] = ''; +$string['settings_bot_feature_enabled_desc'] = 'NOTE: There is a known issue in which if the bot feature is enabled in the Teams app, the Moodle Teams app cannot be provisioned to class teams unless the team is manually activated.'; $string['settings_bot_app_id'] = 'Application ID'; $string['settings_bot_app_id_desc'] = ''; $string['settings_bot_app_password'] = 'Client Secret'; diff --git a/local/o365/lib.php b/local/o365/lib.php index 3ad820f25..7552028fe 100644 --- a/local/o365/lib.php +++ b/local/o365/lib.php @@ -395,3 +395,36 @@ function local_o365_get_auth_token() { return $authtoken; } + +/** + * Check Moodle and local_o365 versions to see if LTI feature is included in the plugin. + * + * @return bool + */ +function local_o365_is_lti_feature_included() { + global $CFG; + + $hasltifeature = false; + + $releaseparts = explode(' ', $CFG->release); + $release = $releaseparts[0]; + $localo365version = get_config('local_o365', 'version'); + switch ($release) { + case '3.10': + if ($localo365version >= 2020110935) { + $hasltifeature = true; + } + break; + case '3.11': + if ($localo365version >= 2021051720) { + $hasltifeature = true; + } + break; + default: + if (substr($release, 0, 1) >= 4) { + $hasltifeature = true; + } + } + + return $hasltifeature; +} diff --git a/local/o365/settings.php b/local/o365/settings.php index a91f7bd04..5e1b3cb8e 100644 --- a/local/o365/settings.php +++ b/local/o365/settings.php @@ -599,9 +599,20 @@ 'Moodle')); // Setting bot_feature_enabled. + $botfeatureenableddescription = ''; + if (local_o365_is_lti_feature_included()) { + if (\local_o365\utils::is_connected() === true) { + $graphclient = utils::get_graphclient(); + if ($graphclient) { + if ($graphclient->has_education_license()) { + $botfeatureenableddescription = get_string('settings_bot_feature_enabled_desc', 'local_o365'); + } + } + } + } $settings->add(new admin_setting_configcheckbox('local_o365/bot_feature_enabled', get_string('settings_bot_feature_enabled', 'local_o365'), - get_string('settings_bot_feature_enabled_desc', 'local_o365'), + $botfeatureenableddescription, '0')); // Setting bot_webhook_endpoint.