mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 08:55:15 +02:00
MDL-33600 Assign: Add an admin setting to set the default for sendstudentnotifications
This commit is contained in:
parent
f7dc9871e7
commit
8e1266bf77
@ -51,6 +51,7 @@ class backup_assign_activity_structure_step extends backup_activity_structure_st
|
||||
'submissiondrafts',
|
||||
'sendnotifications',
|
||||
'sendlatenotifications',
|
||||
'sendstudentnotifications',
|
||||
'duedate',
|
||||
'cutoffdate',
|
||||
'allowsubmissionsfromdate',
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<XMLDB PATH="mod/assign/db" VERSION="20130314" COMMENT="XMLDB file for Moodle mod/assign"
|
||||
<XMLDB PATH="mod/assign/db" VERSION="20131220" COMMENT="XMLDB file for Moodle mod/assign"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
|
||||
>
|
||||
@ -32,6 +32,7 @@
|
||||
<FIELD NAME="maxattempts" TYPE="int" LENGTH="6" NOTNULL="true" DEFAULT="-1" SEQUENCE="false" COMMENT="What is the maximum number of student attempts allowed for this assignment? -1 means unlimited."/>
|
||||
<FIELD NAME="markingworkflow" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="If enabled, marking workflow features will be used in this assignment."/>
|
||||
<FIELD NAME="markingallocation" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="If enabled, marking allocation features will be used in this assignment"/>
|
||||
<FIELD NAME="sendstudentnotifications" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="1" SEQUENCE="false" COMMENT="Default for send student notifications checkbox when grading."/>
|
||||
</FIELDS>
|
||||
<KEYS>
|
||||
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="The unique id for this assignment instance."/>
|
||||
@ -135,4 +136,4 @@
|
||||
</INDEXES>
|
||||
</TABLE>
|
||||
</TABLES>
|
||||
</XMLDB>
|
||||
</XMLDB>
|
@ -462,5 +462,27 @@ function xmldb_assign_upgrade($oldversion) {
|
||||
// Moodle v2.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2014010801) {
|
||||
|
||||
// Define field sendstudentnotifications to be added to assign.
|
||||
$table = new xmldb_table('assign');
|
||||
$field = new xmldb_field('sendstudentnotifications',
|
||||
XMLDB_TYPE_INTEGER,
|
||||
'2',
|
||||
null,
|
||||
XMLDB_NOTNULL,
|
||||
null,
|
||||
'1',
|
||||
'markingallocation');
|
||||
|
||||
// Conditionally launch add field sendstudentnotifications.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Assign savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2014010801, 'assign');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -312,11 +312,29 @@ class mod_assign_external extends external_api {
|
||||
unset($courses[$id]);
|
||||
}
|
||||
}
|
||||
$extrafields='m.id as assignmentid, m.course, m.nosubmissions, m.submissiondrafts, m.sendnotifications, '.
|
||||
'm.sendlatenotifications, m.duedate, m.allowsubmissionsfromdate, m.grade, m.timemodified, '.
|
||||
'm.completionsubmit, m.cutoffdate, m.teamsubmission, m.requireallteammemberssubmit, '.
|
||||
'm.teamsubmissiongroupingid, m.blindmarking, m.revealidentities, m.attemptreopenmethod, '.
|
||||
'm.maxattempts, m.markingworkflow, m.markingallocation, m.requiresubmissionstatement';
|
||||
$extrafields='m.id as assignmentid, ' .
|
||||
'm.course, ' .
|
||||
'm.nosubmissions, ' .
|
||||
'm.submissiondrafts, ' .
|
||||
'm.sendnotifications, '.
|
||||
'm.sendlatenotifications, ' .
|
||||
'm.sendstudentnotifications, ' .
|
||||
'm.duedate, ' .
|
||||
'm.allowsubmissionsfromdate, '.
|
||||
'm.grade, ' .
|
||||
'm.timemodified, '.
|
||||
'm.completionsubmit, ' .
|
||||
'm.cutoffdate, ' .
|
||||
'm.teamsubmission, ' .
|
||||
'm.requireallteammemberssubmit, '.
|
||||
'm.teamsubmissiongroupingid, ' .
|
||||
'm.blindmarking, ' .
|
||||
'm.revealidentities, ' .
|
||||
'm.attemptreopenmethod, '.
|
||||
'm.maxattempts, ' .
|
||||
'm.markingworkflow, ' .
|
||||
'm.markingallocation, ' .
|
||||
'm.requiresubmissionstatement';
|
||||
$coursearray = array();
|
||||
foreach ($courses as $id => $course) {
|
||||
$assignmentarray = array();
|
||||
@ -359,6 +377,7 @@ class mod_assign_external extends external_api {
|
||||
'submissiondrafts' => $module->submissiondrafts,
|
||||
'sendnotifications' => $module->sendnotifications,
|
||||
'sendlatenotifications' => $module->sendlatenotifications,
|
||||
'sendstudentnotifications' => $module->sendstudentnotifications,
|
||||
'duedate' => $module->duedate,
|
||||
'allowsubmissionsfromdate' => $module->allowsubmissionsfromdate,
|
||||
'grade' => $module->grade,
|
||||
@ -412,6 +431,7 @@ class mod_assign_external extends external_api {
|
||||
'submissiondrafts' => new external_value(PARAM_INT, 'submissions drafts'),
|
||||
'sendnotifications' => new external_value(PARAM_INT, 'send notifications'),
|
||||
'sendlatenotifications' => new external_value(PARAM_INT, 'send notifications'),
|
||||
'sendstudentnotifications' => new external_value(PARAM_INT, 'send student notifications (default)'),
|
||||
'duedate' => new external_value(PARAM_INT, 'assignment due date'),
|
||||
'allowsubmissionsfromdate' => new external_value(PARAM_INT, 'allow submissions from date'),
|
||||
'grade' => new external_value(PARAM_INT, 'grade type'),
|
||||
|
@ -312,6 +312,8 @@ $string['savegradingresult'] = 'Grade';
|
||||
$string['saveallquickgradingchanges'] = 'Save all quick grading changes';
|
||||
$string['savenext'] = 'Save and show next';
|
||||
$string['scale'] = 'Scale';
|
||||
$string['sendstudentnotificationsdefault'] = 'Default setting for "Notify students"';
|
||||
$string['sendstudentnotificationsdefault_help'] = 'Set the default value for the "Notify students" checkbox on the grading form.';
|
||||
$string['sendstudentnotifications'] = 'Notify students';
|
||||
$string['sendstudentnotifications_help'] = 'If enabled, students receive a message about the updated grade or feedback.';
|
||||
$string['sendnotifications'] = 'Notify graders about submissions';
|
||||
|
@ -538,6 +538,7 @@ class assign {
|
||||
*/
|
||||
public function add_instance(stdClass $formdata, $callplugins) {
|
||||
global $DB;
|
||||
$adminconfig = $this->get_admin_config();
|
||||
|
||||
$err = '';
|
||||
|
||||
@ -555,6 +556,10 @@ class assign {
|
||||
$update->requiresubmissionstatement = $formdata->requiresubmissionstatement;
|
||||
$update->sendnotifications = $formdata->sendnotifications;
|
||||
$update->sendlatenotifications = $formdata->sendlatenotifications;
|
||||
$update->sendstudentnotifications = $adminconfig->sendstudentnotifications;
|
||||
if (isset($formdata->sendstudentnotifications)) {
|
||||
$update->sendstudentnotifications = $formdata->sendstudentnotifications;
|
||||
}
|
||||
$update->duedate = $formdata->duedate;
|
||||
$update->cutoffdate = $formdata->cutoffdate;
|
||||
$update->allowsubmissionsfromdate = $formdata->allowsubmissionsfromdate;
|
||||
@ -878,6 +883,7 @@ class assign {
|
||||
*/
|
||||
public function update_instance($formdata) {
|
||||
global $DB;
|
||||
$adminconfig = $this->get_admin_config();
|
||||
|
||||
$update = new stdClass();
|
||||
$update->id = $formdata->instance;
|
||||
@ -891,6 +897,10 @@ class assign {
|
||||
$update->requiresubmissionstatement = $formdata->requiresubmissionstatement;
|
||||
$update->sendnotifications = $formdata->sendnotifications;
|
||||
$update->sendlatenotifications = $formdata->sendlatenotifications;
|
||||
$update->sendstudentnotifications = $adminconfig->sendstudentnotifications;
|
||||
if (isset($formdata->sendstudentnotifications)) {
|
||||
$update->sendstudentnotifications = $formdata->sendstudentnotifications;
|
||||
}
|
||||
$update->duedate = $formdata->duedate;
|
||||
$update->cutoffdate = $formdata->cutoffdate;
|
||||
$update->allowsubmissionsfromdate = $formdata->allowsubmissionsfromdate;
|
||||
@ -3107,7 +3117,9 @@ class assign {
|
||||
if ($showquickgrading && $quickgrading) {
|
||||
$gradingtable = new assign_grading_table($this, $perpage, $filter, 0, true);
|
||||
$table = $this->get_renderer()->render($gradingtable);
|
||||
$quickformparams = array('cm'=>$this->get_course_module()->id, 'gradingtable'=>$table);
|
||||
$quickformparams = array('cm'=>$this->get_course_module()->id,
|
||||
'gradingtable'=>$table,
|
||||
'sendstudentnotifications'=>$this->get_instance()->sendstudentnotifications);
|
||||
$quickgradingform = new mod_assign_quick_grading_form(null, $quickformparams);
|
||||
|
||||
$o .= $this->get_renderer()->render(new assign_form('quickgradingform', $quickgradingform));
|
||||
@ -5724,7 +5736,7 @@ class assign {
|
||||
}
|
||||
}
|
||||
$mform->addElement('selectyesno', 'sendstudentnotifications', get_string('sendstudentnotifications', 'assign'));
|
||||
$mform->setDefault('sendstudentnotifications', 1);
|
||||
$mform->setDefault('sendstudentnotifications', $this->get_instance()->sendstudentnotifications);
|
||||
|
||||
$mform->addElement('hidden', 'action', 'submitgrade');
|
||||
$mform->setType('action', PARAM_ALPHA);
|
||||
|
@ -159,6 +159,10 @@ class mod_assign_mod_form extends moodleform_mod {
|
||||
$mform->addHelpButton('sendlatenotifications', 'sendlatenotifications', 'assign');
|
||||
$mform->disabledIf('sendlatenotifications', 'sendnotifications', 'eq', 1);
|
||||
|
||||
$name = get_string('sendstudentnotificationsdefault', 'assign');
|
||||
$mform->addElement('selectyesno', 'sendstudentnotifications', $name);
|
||||
$mform->addHelpButton('sendstudentnotifications', 'sendstudentnotificationsdefault', 'assign');
|
||||
|
||||
// Plagiarism enabling form.
|
||||
if (!empty($CFG->enableplagiarism)) {
|
||||
require_once($CFG->libdir . '/plagiarismlib.php');
|
||||
|
@ -54,7 +54,7 @@ class mod_assign_quick_grading_form extends moodleform {
|
||||
|
||||
// Skip notifications option.
|
||||
$mform->addElement('selectyesno', 'sendstudentnotifications', get_string('sendstudentnotifications', 'assign'));
|
||||
$mform->setDefault('sendstudentnotifications', 1);
|
||||
$mform->setDefault('sendstudentnotifications', $instance['sendstudentnotifications']);
|
||||
|
||||
// Buttons.
|
||||
$savemessage = get_string('saveallquickgradingchanges', 'assign');
|
||||
|
@ -213,6 +213,16 @@ if ($ADMIN->fulltree) {
|
||||
$setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
|
||||
$settings->add($setting);
|
||||
|
||||
$name = new lang_string('sendstudentnotificationsdefault', 'mod_assign');
|
||||
$description = new lang_string('sendstudentnotificationsdefault_help', 'mod_assign');
|
||||
$setting = new admin_setting_configcheckbox('assign/sendstudentnotifications',
|
||||
$name,
|
||||
$description,
|
||||
1);
|
||||
$setting->set_advanced_flag_options(admin_setting_flag::ENABLED, false);
|
||||
$setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
|
||||
$settings->add($setting);
|
||||
|
||||
$name = new lang_string('blindmarking', 'mod_assign');
|
||||
$description = new lang_string('blindmarking_help', 'mod_assign');
|
||||
$setting = new admin_setting_configcheckbox('assign/blindmarking',
|
||||
|
@ -34,6 +34,7 @@ class mod_assign_generator extends testing_module_generator {
|
||||
'submissiondrafts' => 1,
|
||||
'requiresubmissionstatement' => 0,
|
||||
'sendnotifications' => 0,
|
||||
'sendstudentnotifications' => 1,
|
||||
'sendlatenotifications' => 0,
|
||||
'duedate' => 0,
|
||||
'allowsubmissionsfromdate' => 0,
|
||||
|
@ -527,7 +527,7 @@ class mod_assign_locallib_testcase extends mod_assign_base_testcase {
|
||||
|
||||
// Now create an assignment and add some feedback.
|
||||
$this->setUser($this->editingteachers[0]);
|
||||
$assign = $this->create_instance();
|
||||
$assign = $this->create_instance(array('sendstudentnotifications'=>1));
|
||||
|
||||
// Simulate adding a grade.
|
||||
$this->setUser($this->teachers[0]);
|
||||
|
@ -1,4 +1,7 @@
|
||||
This files describes API changes in the assign code.
|
||||
=== 2.7 ===
|
||||
* Added setting sendstudentnotifications to assign DB table with admin defaults. This sets the default value for the
|
||||
"Notify students" option on the grading forms. This setting can be retrieved via webservices.
|
||||
|
||||
=== 2.6.1 ===
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$module->component = 'mod_assign'; // Full name of the plugin (used for diagnostics).
|
||||
$module->version = 2014010700; // The current module version (Date: YYYYMMDDXX).
|
||||
$module->version = 2014010801; // The current module version (Date: YYYYMMDDXX).
|
||||
$module->requires = 2013110500; // Requires this Moodle version.
|
||||
$module->cron = 60;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user