mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 13:38:32 +01:00
Merge branch 'MDL-81132-master' of https://github.com/jleyva/moodle
This commit is contained in:
commit
f150d5016d
@ -1197,6 +1197,7 @@ class externallib_test extends externallib_advanced_testcase {
|
||||
), $module['purpose']
|
||||
);
|
||||
$this->assertFalse($module['branded']);
|
||||
$this->assertStringContainsString('trackingtype', $module['customdata']); // The customdata is JSON encoded.
|
||||
$testexecuted = $testexecuted + 2;
|
||||
} else if ($module['id'] == $labelcm->id and $module['modname'] == 'label') {
|
||||
$cm = $modinfo->cms[$labelcm->id];
|
||||
|
@ -6478,7 +6478,7 @@ function forum_get_coursemodule_info($coursemodule) {
|
||||
global $DB;
|
||||
|
||||
$dbparams = ['id' => $coursemodule->instance];
|
||||
$fields = 'id, name, intro, introformat, completionposts, completiondiscussions, completionreplies, duedate, cutoffdate';
|
||||
$fields = 'id, name, intro, introformat, completionposts, completiondiscussions, completionreplies, duedate, cutoffdate, trackingtype';
|
||||
if (!$forum = $DB->get_record('forum', $dbparams, $fields)) {
|
||||
return false;
|
||||
}
|
||||
@ -6505,6 +6505,8 @@ function forum_get_coursemodule_info($coursemodule) {
|
||||
if ($forum->cutoffdate) {
|
||||
$result->customdata['cutoffdate'] = $forum->cutoffdate;
|
||||
}
|
||||
// Add the forum type to the custom data for Web Services (core_course_get_contents).
|
||||
$result->customdata['trackingtype'] = $forum->trackingtype;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
@ -1139,6 +1139,8 @@ class core_user_external extends \core_external\external_api {
|
||||
'theme' => new external_value(core_user::get_property_type('theme'), 'Theme name such as "standard", must exist on server', VALUE_OPTIONAL),
|
||||
'timezone' => new external_value(core_user::get_property_type('timezone'), 'Timezone code such as Australia/Perth, or 99 for default', VALUE_OPTIONAL),
|
||||
'mailformat' => new external_value(core_user::get_property_type('mailformat'), 'Mail format code is 0 for plain text, 1 for HTML etc', VALUE_OPTIONAL),
|
||||
'trackforums' => new external_value(core_user::get_property_type('trackforums'),
|
||||
'Whether the user is tracking forums.', VALUE_OPTIONAL),
|
||||
'description' => new external_value(core_user::get_property_type('description'), 'User profile description', VALUE_OPTIONAL),
|
||||
'descriptionformat' => new external_format_value(core_user::get_property_type('descriptionformat'), VALUE_OPTIONAL),
|
||||
'city' => new external_value(core_user::get_property_type('city'), 'Home city of the user', VALUE_OPTIONAL),
|
||||
|
@ -300,7 +300,7 @@ function user_get_default_fields() {
|
||||
'institution', 'interests', 'firstaccess', 'lastaccess', 'auth', 'confirmed',
|
||||
'idnumber', 'lang', 'theme', 'timezone', 'mailformat', 'description', 'descriptionformat',
|
||||
'city', 'country', 'profileimageurlsmall', 'profileimageurl', 'customfields',
|
||||
'groups', 'roles', 'preferences', 'enrolledcourses', 'suspended', 'lastcourseaccess'
|
||||
'groups', 'roles', 'preferences', 'enrolledcourses', 'suspended', 'lastcourseaccess', 'trackforums',
|
||||
);
|
||||
}
|
||||
|
||||
@ -612,7 +612,7 @@ function user_get_user_details($user, $course = null, array $userfields = array(
|
||||
}
|
||||
|
||||
if ($currentuser or has_capability('moodle/user:viewalldetails', $context)) {
|
||||
$extrafields = ['auth', 'confirmed', 'lang', 'theme', 'mailformat'];
|
||||
$extrafields = ['auth', 'confirmed', 'lang', 'theme', 'mailformat', 'trackforums'];
|
||||
foreach ($extrafields as $extrafield) {
|
||||
if (in_array($extrafield, $userfields) && isset($user->$extrafield)) {
|
||||
$userdetails[$extrafield] = $user->$extrafield;
|
||||
|
@ -304,6 +304,7 @@ class externallib_test extends externallib_advanced_testcase {
|
||||
}
|
||||
// Default language and no theme were used for the user.
|
||||
$this->assertEquals($CFG->lang, $returneduser['lang']);
|
||||
$this->assertEquals($generateduser->trackforums, $returneduser['trackforums']);
|
||||
$this->assertEmpty($returneduser['theme']);
|
||||
|
||||
if ($returneduser['id'] == $user1->id) {
|
||||
|
@ -892,6 +892,7 @@ class userlib_test extends \advanced_testcase {
|
||||
'theme' => $CFG->theme,
|
||||
'timezone' => '5',
|
||||
'mailformat' => '0',
|
||||
'trackforums' => '1',
|
||||
]);
|
||||
|
||||
// Fields that should get by default.
|
||||
@ -903,6 +904,7 @@ class userlib_test extends \advanced_testcase {
|
||||
self::assertSame($CFG->theme, $got['theme']);
|
||||
self::assertSame('5', $got['timezone']);
|
||||
self::assertSame('0', $got['mailformat']);
|
||||
self::assertSame('1', $got['trackforums']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user