Skip to content

Commit

Permalink
MDL-66360 mod_forum: added settings for send notifications default val
Browse files Browse the repository at this point in the history
AMOS BEGIN
 CPY [sendstudentnotifications, mod_assign],[sendstudentnotifications, mod_forum]
 CPY [sendstudentnotifications_help, mod_assign],[sendstudentnotifications_help, mod_forum]
AMOS END
  • Loading branch information
rezaies authored and lameze committed Nov 11, 2019
1 parent 3ab419a commit 7758056
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mod/forum/lang/en/forum.php
Expand Up @@ -639,6 +639,8 @@
$string['searchwhichforums'] = 'Choose which forums to search';
$string['searchwords'] = 'These words can appear anywhere in the post';
$string['seeallposts'] = 'See all posts made by this user';
$string['sendstudentnotificationsdefault'] = 'Default setting for "Notify students"';
$string['sendstudentnotificationsdefault_help'] = 'Set the default value for the "Notify students" checkbox on the grading form.';
$string['settings'] = 'Settings';
$string['shortpost'] = 'Short post';
$string['showingcountoftotaldiscussions'] = 'Showing {$a->count} of {$a->total} discussions';
Expand Down
10 changes: 10 additions & 0 deletions mod/forum/mod_form.php
Expand Up @@ -235,6 +235,8 @@ private function add_forum_grade_settings($mform, string $itemname) {
$gradefieldname = component_gradeitems::get_field_name_for_itemnumber($component, $itemnumber, 'grade');
$gradecatfieldname = component_gradeitems::get_field_name_for_itemnumber($component, $itemnumber, 'gradecat');
$gradepassfieldname = component_gradeitems::get_field_name_for_itemnumber($component, $itemnumber, 'gradepass');
$sendstudentnotificationsfieldname = component_gradeitems::get_field_name_for_itemnumber($component, $itemnumber,
'sendstudentnotifications');

// The advancedgradingmethod is different in that it is suffixed with an area name... which is not the
// itemnumber.
Expand Down Expand Up @@ -304,6 +306,14 @@ private function add_forum_grade_settings($mform, string $itemname) {
$mform->setDefault($gradepassfieldname, '');
$mform->setType($gradepassfieldname, PARAM_RAW);
$mform->hideIf($gradepassfieldname, "{$gradefieldname}[modgrade_type]", 'eq', 'none');

$mform->addElement(
'selectyesno',
$sendstudentnotificationsfieldname,
get_string('sendstudentnotificationsdefault', 'forum')
);
$mform->addHelpButton($sendstudentnotificationsfieldname, 'sendstudentnotificationsdefault', 'forum');
$mform->hideIf($sendstudentnotificationsfieldname, "{$gradefieldname}[modgrade_type]", 'eq', 'none');
}

function definition_after_data() {
Expand Down

0 comments on commit 7758056

Please sign in to comment.