mirror of
https://github.com/moodle/moodle.git
synced 2025-08-09 10:56:56 +02:00
Merge branch 'MDL-56536-master' of git://github.com/jleyva/moodle
This commit is contained in:
commit
274c5837e7
3 changed files with 22 additions and 3 deletions
|
@ -100,7 +100,7 @@ class api {
|
||||||
* @return array with the settings and warnings
|
* @return array with the settings and warnings
|
||||||
*/
|
*/
|
||||||
public static function get_public_config() {
|
public static function get_public_config() {
|
||||||
global $CFG, $SITE, $PAGE;
|
global $CFG, $SITE, $PAGE, $OUTPUT;
|
||||||
|
|
||||||
$context = context_system::instance();
|
$context = context_system::instance();
|
||||||
// We need this to make work the format text functions.
|
// We need this to make work the format text functions.
|
||||||
|
@ -135,6 +135,14 @@ class api {
|
||||||
$url = new moodle_url("/$CFG->admin/tool/mobile/launch.php");
|
$url = new moodle_url("/$CFG->admin/tool/mobile/launch.php");
|
||||||
$settings['launchurl'] = $url->out(false);
|
$settings['launchurl'] = $url->out(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($logourl = $OUTPUT->get_logo_url()) {
|
||||||
|
$settings['logourl'] = $logourl->out(false);
|
||||||
|
}
|
||||||
|
if ($compactlogourl = $OUTPUT->get_compact_logo_url()) {
|
||||||
|
$settings['compactlogourl'] = $compactlogourl->out(false);
|
||||||
|
}
|
||||||
|
|
||||||
return $settings;
|
return $settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -144,6 +144,8 @@ class external extends external_api {
|
||||||
'enablemobilewebservice' => new external_value(PARAM_INT, 'Whether the Mobile service is enabled.'),
|
'enablemobilewebservice' => new external_value(PARAM_INT, 'Whether the Mobile service is enabled.'),
|
||||||
'maintenanceenabled' => new external_value(PARAM_INT, 'Whether site maintenance is enabled.'),
|
'maintenanceenabled' => new external_value(PARAM_INT, 'Whether site maintenance is enabled.'),
|
||||||
'maintenancemessage' => new external_value(PARAM_RAW, 'Maintenance message.'),
|
'maintenancemessage' => new external_value(PARAM_RAW, 'Maintenance message.'),
|
||||||
|
'logourl' => new external_value(PARAM_URL, 'The site logo URL', VALUE_OPTIONAL),
|
||||||
|
'compactlogourl' => new external_value(PARAM_URL, 'The site compact logo URL', VALUE_OPTIONAL),
|
||||||
'typeoflogin' => new external_value(PARAM_INT, 'The type of login. 1 for app, 2 for browser, 3 for embedded.'),
|
'typeoflogin' => new external_value(PARAM_INT, 'The type of login. 1 for app, 2 for browser, 3 for embedded.'),
|
||||||
'launchurl' => new external_value(PARAM_URL, 'SSO login launch URL. Empty if it won\'t be used.', VALUE_OPTIONAL),
|
'launchurl' => new external_value(PARAM_URL, 'SSO login launch URL. Empty if it won\'t be used.', VALUE_OPTIONAL),
|
||||||
'warnings' => new external_warnings(),
|
'warnings' => new external_warnings(),
|
||||||
|
|
|
@ -56,7 +56,7 @@ class tool_mobile_external_testcase extends externallib_advanced_testcase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_get_public_config() {
|
public function test_get_public_config() {
|
||||||
global $CFG, $SITE;
|
global $CFG, $SITE, $OUTPUT;
|
||||||
|
|
||||||
$this->resetAfterTest(true);
|
$this->resetAfterTest(true);
|
||||||
$result = external::get_public_config();
|
$result = external::get_public_config();
|
||||||
|
@ -89,11 +89,20 @@ class tool_mobile_external_testcase extends externallib_advanced_testcase {
|
||||||
$authinstructions = 'Something with <b>html tags</b>';
|
$authinstructions = 'Something with <b>html tags</b>';
|
||||||
set_config('auth_instructions', $authinstructions);
|
set_config('auth_instructions', $authinstructions);
|
||||||
set_config('typeoflogin', api::LOGIN_VIA_BROWSER, 'tool_mobile');
|
set_config('typeoflogin', api::LOGIN_VIA_BROWSER, 'tool_mobile');
|
||||||
|
set_config('logo', 'mock.png', 'core_admin');
|
||||||
|
set_config('logocompact', 'mock.png', 'core_admin');
|
||||||
|
|
||||||
$expected['registerauth'] = 'email';
|
$expected['registerauth'] = 'email';
|
||||||
$expected['authinstructions'] = format_text($authinstructions);
|
$expected['authinstructions'] = format_text($authinstructions);
|
||||||
$expected['typeoflogin'] = api::LOGIN_VIA_BROWSER;
|
$expected['typeoflogin'] = api::LOGIN_VIA_BROWSER;
|
||||||
$expected['launchurl'] = "$CFG->wwwroot/$CFG->admin/tool/mobile/launch.php";;
|
$expected['launchurl'] = "$CFG->wwwroot/$CFG->admin/tool/mobile/launch.php";
|
||||||
|
|
||||||
|
if ($logourl = $OUTPUT->get_logo_url()) {
|
||||||
|
$expected['logourl'] = $logourl->out(false);
|
||||||
|
}
|
||||||
|
if ($compactlogourl = $OUTPUT->get_compact_logo_url()) {
|
||||||
|
$expected['compactlogourl'] = $compactlogourl->out(false);
|
||||||
|
}
|
||||||
|
|
||||||
$result = external::get_public_config();
|
$result = external::get_public_config();
|
||||||
$result = external_api::clean_returnvalue(external::get_public_config_returns(), $result);
|
$result = external_api::clean_returnvalue(external::get_public_config_returns(), $result);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue