Merge branch 'MDL-62223-master' of git://github.com/Kathrin84/moodle
This commit is contained in:
@@ -474,8 +474,25 @@ class mod_assign_external extends external_api {
|
||||
if ($module->requiresubmissionstatement) {
|
||||
// Submission statement is required, return the submission statement value.
|
||||
$adminconfig = get_config('assign');
|
||||
list($assignment['submissionstatement'], $assignment['submissionstatementformat']) = external_format_text(
|
||||
$adminconfig->submissionstatement, FORMAT_MOODLE, $context->id, 'mod_assign', '', 0);
|
||||
// Single submission.
|
||||
if (!$module->teamsubmission) {
|
||||
list($assignment['submissionstatement'], $assignment['submissionstatementformat']) =
|
||||
external_format_text($adminconfig->submissionstatement, FORMAT_MOODLE, $context->id,
|
||||
'mod_assign', '', 0);
|
||||
} else { // Team submission.
|
||||
// One user can submit for the whole team.
|
||||
if (!empty($adminconfig->submissionstatementteamsubmission) && !$module->requireallteammemberssubmit) {
|
||||
list($assignment['submissionstatement'], $assignment['submissionstatementformat']) =
|
||||
external_format_text($adminconfig->submissionstatementteamsubmission,
|
||||
FORMAT_MOODLE, $context->id, 'mod_assign', '', 0);
|
||||
} else if (!empty($adminconfig->submissionstatementteamsubmissionallsubmit) &&
|
||||
$module->requireallteammemberssubmit) {
|
||||
// All team members must submit.
|
||||
list($assignment['submissionstatement'], $assignment['submissionstatementformat']) =
|
||||
external_format_text($adminconfig->submissionstatementteamsubmissionallsubmit,
|
||||
FORMAT_MOODLE, $context->id, 'mod_assign', '', 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$assignmentarray[] = $assignment;
|
||||
|
||||
@@ -524,7 +524,14 @@ $string['submissionsclosed'] = 'Submissions closed';
|
||||
$string['submissionsettings'] = 'Submission settings';
|
||||
$string['submissionstatement'] = 'Submission statement';
|
||||
$string['submissionstatement_help'] = 'Assignment submission confirmation statement';
|
||||
$string['submissionstatementdefault'] = 'This assignment is my own work, except where I have acknowledged the use of the works of other people.';
|
||||
$string['submissionstatementdefault'] = 'This submission is my own work, except where I have acknowledged the use of the works of other people.';
|
||||
$string['submissionstatement_help'] = 'Statement that student must accept in order to submit their work';
|
||||
$string['submissionstatementteamsubmission'] = 'Group submission statement';
|
||||
$string['submissionstatementteamsubmissiondefault'] = 'This submission is the work of my group, except where we have acknowledged the use of the works of other people.';
|
||||
$string['submissionstatementteamsubmission_help'] = 'Statement that student must accept in order to submit the work of their group.';
|
||||
$string['submissionstatementteamsubmissionallsubmit'] = 'Group submission statement where all group members submit';
|
||||
$string['submissionstatementteamsubmissionallsubmitdefault'] = 'This submission is my own work as a group member, except where I have acknowledged the use of the works of other people.';
|
||||
$string['submissionstatementteamsubmissionallsubmit_help'] = 'Statement that student must accept in order to submit their work as a group member.';
|
||||
$string['submissionstatementacceptedlog'] = 'Submission statement accepted by user {$a}';
|
||||
$string['submissionstatus_draft'] = 'Draft (not submitted)';
|
||||
$string['submissionstatusheading'] = 'Submission status';
|
||||
|
||||
+89
-36
@@ -4992,18 +4992,17 @@ class assign {
|
||||
|
||||
$data = new stdClass();
|
||||
$adminconfig = $this->get_admin_config();
|
||||
$requiresubmissionstatement = $this->get_instance()->requiresubmissionstatement &&
|
||||
!empty($adminconfig->submissionstatement);
|
||||
|
||||
$requiresubmissionstatement = $this->get_instance()->requiresubmissionstatement;
|
||||
$submissionstatement = '';
|
||||
if (!empty($adminconfig->submissionstatement)) {
|
||||
// Format the submission statement before its sent. We turn off para because this is going within
|
||||
// a form element.
|
||||
$options = array(
|
||||
'context' => $this->get_context(),
|
||||
'para' => false
|
||||
);
|
||||
$submissionstatement = format_text($adminconfig->submissionstatement, FORMAT_MOODLE, $options);
|
||||
|
||||
if ($requiresubmissionstatement) {
|
||||
$submissionstatement = $this->get_submissionstatement($adminconfig, $this->get_instance(), $this->get_context());
|
||||
}
|
||||
|
||||
// If we get back an empty submission statement, we have to set $requiredsubmisisonstatement to false to prevent
|
||||
// that the submission statement checkbox will be displayed.
|
||||
if (empty($submissionstatement)) {
|
||||
$requiresubmissionstatement = false;
|
||||
}
|
||||
|
||||
if ($mform == null) {
|
||||
@@ -6397,21 +6396,20 @@ class assign {
|
||||
$notices[] = get_string('submissionsclosed', 'assign');
|
||||
return false;
|
||||
}
|
||||
$instance = $this->get_instance();
|
||||
|
||||
$data = new stdClass();
|
||||
$adminconfig = $this->get_admin_config();
|
||||
$requiresubmissionstatement = $instance->requiresubmissionstatement &&
|
||||
!empty($adminconfig->submissionstatement);
|
||||
$requiresubmissionstatement = $this->get_instance()->requiresubmissionstatement;
|
||||
|
||||
$submissionstatement = '';
|
||||
if (!empty($adminconfig->submissionstatement)) {
|
||||
// Format the submission statement before its sent. We turn off para because this is going within
|
||||
// a form element.
|
||||
$options = array(
|
||||
'context' => $this->get_context(),
|
||||
'para' => false
|
||||
);
|
||||
$submissionstatement = format_text($adminconfig->submissionstatement, FORMAT_MOODLE, $options);
|
||||
if ($requiresubmissionstatement) {
|
||||
$submissionstatement = $this->get_submissionstatement($adminconfig, $this->get_instance(), $this->get_context());
|
||||
}
|
||||
|
||||
// If we get back an empty submission statement, we have to set $requiredsubmisisonstatement to false to prevent
|
||||
// that the submission statement checkbox will be displayed.
|
||||
if (empty($submissionstatement)) {
|
||||
$requiresubmissionstatement = false;
|
||||
}
|
||||
|
||||
if ($mform == null) {
|
||||
@@ -7705,25 +7703,23 @@ class assign {
|
||||
|
||||
// Submission statement.
|
||||
$adminconfig = $this->get_admin_config();
|
||||
|
||||
$requiresubmissionstatement = $this->get_instance()->requiresubmissionstatement &&
|
||||
!empty($adminconfig->submissionstatement);
|
||||
$requiresubmissionstatement = $this->get_instance()->requiresubmissionstatement;
|
||||
|
||||
$draftsenabled = $this->get_instance()->submissiondrafts;
|
||||
$submissionstatement = '';
|
||||
|
||||
if ($requiresubmissionstatement) {
|
||||
$submissionstatement = $this->get_submissionstatement($adminconfig, $this->get_instance(), $this->get_context());
|
||||
}
|
||||
|
||||
// If we get back an empty submission statement, we have to set $requiredsubmisisonstatement to false to prevent
|
||||
// that the submission statement checkbox will be displayed.
|
||||
if (empty($submissionstatement)) {
|
||||
$requiresubmissionstatement = false;
|
||||
}
|
||||
|
||||
// Only show submission statement if we are editing our own submission.
|
||||
if ($requiresubmissionstatement && !$draftsenabled && $userid == $USER->id) {
|
||||
|
||||
$submissionstatement = '';
|
||||
if (!empty($adminconfig->submissionstatement)) {
|
||||
// Format the submission statement before its sent. We turn off para because this is going within
|
||||
// a form element.
|
||||
$options = array(
|
||||
'context' => $this->get_context(),
|
||||
'para' => false
|
||||
);
|
||||
$submissionstatement = format_text($adminconfig->submissionstatement, FORMAT_MOODLE, $options);
|
||||
}
|
||||
$mform->addElement('checkbox', 'submissionstatement', '', $submissionstatement);
|
||||
$mform->addRule('submissionstatement', get_string('required'), 'required', null, 'client');
|
||||
}
|
||||
@@ -9059,6 +9055,63 @@ class assign {
|
||||
}
|
||||
return $filters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the correct submission statement depending on single submisison, team submission or team submission
|
||||
* where all team memebers must submit.
|
||||
*
|
||||
* @param array $adminconfig
|
||||
* @param assign $instance
|
||||
* @param context $context
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function get_submissionstatement($adminconfig, $instance, $context) {
|
||||
$submissionstatement = '';
|
||||
|
||||
if (!($context instanceof context)) {
|
||||
return $submissionstatement;
|
||||
}
|
||||
|
||||
// Single submission.
|
||||
if (!$instance->teamsubmission) {
|
||||
// Single submission statement is not empty.
|
||||
if (!empty($adminconfig->submissionstatement)) {
|
||||
// Format the submission statement before its sent. We turn off para because this is going within
|
||||
// a form element.
|
||||
$options = array(
|
||||
'context' => $context,
|
||||
'para' => false
|
||||
);
|
||||
$submissionstatement = format_text($adminconfig->submissionstatement, FORMAT_MOODLE, $options);
|
||||
}
|
||||
} else { // Team submission.
|
||||
// One user can submit for the whole team.
|
||||
if (!empty($adminconfig->submissionstatementteamsubmission) && !$instance->requireallteammemberssubmit) {
|
||||
// Format the submission statement before its sent. We turn off para because this is going within
|
||||
// a form element.
|
||||
$options = array(
|
||||
'context' => $context,
|
||||
'para' => false
|
||||
);
|
||||
$submissionstatement = format_text($adminconfig->submissionstatementteamsubmission,
|
||||
FORMAT_MOODLE, $options);
|
||||
} else if (!empty($adminconfig->submissionstatementteamsubmissionallsubmit) &&
|
||||
$instance->requireallteammemberssubmit) {
|
||||
// All team members must submit.
|
||||
// Format the submission statement before its sent. We turn off para because this is going within
|
||||
// a form element.
|
||||
$options = array(
|
||||
'context' => $context,
|
||||
'para' => false
|
||||
);
|
||||
$submissionstatement = format_text($adminconfig->submissionstatementteamsubmissionallsubmit,
|
||||
FORMAT_MOODLE, $options);
|
||||
}
|
||||
}
|
||||
|
||||
return $submissionstatement;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -72,6 +72,26 @@ if ($ADMIN->fulltree) {
|
||||
$setting->set_force_ltr(false);
|
||||
$settings->add($setting);
|
||||
|
||||
$name = new lang_string('submissionstatementteamsubmission', 'mod_assign');
|
||||
$description = new lang_string('submissionstatement_help', 'mod_assign');
|
||||
$default = get_string('submissionstatementteamsubmissiondefault', 'mod_assign');
|
||||
$setting = new admin_setting_configtextarea('assign/submissionstatementteamsubmission',
|
||||
$name,
|
||||
$description,
|
||||
$default);
|
||||
$setting->set_force_ltr(false);
|
||||
$settings->add($setting);
|
||||
|
||||
$name = new lang_string('submissionstatementteamsubmissionallsubmit', 'mod_assign');
|
||||
$description = new lang_string('submissionstatement_help', 'mod_assign');
|
||||
$default = get_string('submissionstatementteamsubmissionallsubmitdefault', 'mod_assign');
|
||||
$setting = new admin_setting_configtextarea('assign/submissionstatementteamsubmissionallsubmit',
|
||||
$name,
|
||||
$description,
|
||||
$default);
|
||||
$setting->set_force_ltr(false);
|
||||
$settings->add($setting);
|
||||
|
||||
$name = new lang_string('maxperpage', 'mod_assign');
|
||||
$options = array(
|
||||
-1 => get_string('unlimitedpages', 'mod_assign'),
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->component = 'mod_assign'; // Full name of the plugin (used for diagnostics).
|
||||
$plugin->version = 2018120500; // The current module version (Date: YYYYMMDDXX).
|
||||
$plugin->version = 2018122000; // The current module version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2018112800; // Requires this Moodle version.
|
||||
$plugin->cron = 60;
|
||||
|
||||
Reference in New Issue
Block a user