diff --git a/mod/workshop/feedbackauthor_form.php b/mod/workshop/feedbackauthor_form.php index ab711b55a7e..c71bc847289 100644 --- a/mod/workshop/feedbackauthor_form.php +++ b/mod/workshop/feedbackauthor_form.php @@ -34,10 +34,17 @@ class workshop_feedbackauthor_form extends moodleform { $current = $this->_customdata['current']; $workshop = $this->_customdata['workshop']; - $opts = $this->_customdata['feedbackopts']; + $editoropts = $this->_customdata['editoropts']; + $options = $this->_customdata['options']; $mform->addElement('header', 'feedbackauthorform', get_string('feedbackauthor', 'workshop')); + if (!empty($options['editablepublished'])) { + $mform->addElement('checkbox', 'published', get_string('publishsubmission', 'workshop')); + $mform->addHelpButton('published', 'publishsubmission', 'workshop'); + $mform->setDefault('published', false); + } + $mform->addElement('static', 'grade', get_string('gradecalculated', 'workshop')); $grades = array('' => get_string('notoverridden', 'workshop')); @@ -46,7 +53,7 @@ class workshop_feedbackauthor_form extends moodleform { } $mform->addElement('select', 'gradeover', get_string('gradeover', 'workshop'), $grades); - $mform->addElement('editor', 'feedbackauthor_editor', get_string('feedbackauthor', 'workshop'), null, $opts); + $mform->addElement('editor', 'feedbackauthor_editor', get_string('feedbackauthor', 'workshop'), null, $editoropts); $mform->setType('feedbackauthor_editor', PARAM_RAW); $mform->addElement('hidden', 'submissionid'); diff --git a/mod/workshop/lang/en/workshop.php b/mod/workshop/lang/en/workshop.php index 2c308fed9ea..3ce80b6761e 100644 --- a/mod/workshop/lang/en/workshop.php +++ b/mod/workshop/lang/en/workshop.php @@ -161,6 +161,8 @@ $string['phasesetup'] = 'Setup phase'; $string['phasesubmission'] = 'Submission phase'; $string['prepareexamples'] = 'Prepare example submissions'; $string['previewassessmentform'] = 'Preview'; +$string['publishsubmission'] = 'Publish submission'; +$string['publishsubmission_help'] = 'Published submissions are available to the others when the workshop is closed.'; $string['reassess'] = 'Re-assess'; $string['receivedgrades'] = 'Grades received'; $string['saveandclose'] = 'Save and close'; diff --git a/mod/workshop/locallib.php b/mod/workshop/locallib.php index 0183d7569bd..8824de3ebce 100644 --- a/mod/workshop/locallib.php +++ b/mod/workshop/locallib.php @@ -487,7 +487,7 @@ class workshop { global $DB; $sql = 'SELECT s.id, s.workshopid, s.example, s.authorid, s.timecreated, s.timemodified, - s.title, s.grade, s.gradeover, s.gradeoverby, + s.title, s.grade, s.gradeover, s.gradeoverby, s.published, u.lastname AS authorlastname, u.firstname AS authorfirstname, u.picture AS authorpicture, u.imagealt AS authorimagealt, t.lastname AS overlastname, t.firstname AS overfirstname, @@ -1273,6 +1273,7 @@ class workshop { $grades[$participant->userid]->submissiongrade = null; $grades[$participant->userid]->submissiongradeover = null; $grades[$participant->userid]->submissiongradeoverby = null; + $grades[$participant->userid]->submissionpublished = null; $grades[$participant->userid]->reviewedby = array(); $grades[$participant->userid]->reviewerof = array(); } @@ -1285,6 +1286,7 @@ class workshop { $grades[$submission->authorid]->submissiongrade = $this->real_grade($submission->grade); $grades[$submission->authorid]->submissiongradeover = $this->real_grade($submission->gradeover); $grades[$submission->authorid]->submissiongradeoverby = $submission->gradeoverby; + $grades[$submission->authorid]->submissionpublished = $submission->published; } unset($submissions); unset($submission); @@ -1553,6 +1555,7 @@ class workshop { $current = new stdclass(); $current->submissionid = $submission->id; + $current->published = $submission->published; $current->grade = $this->real_grade($submission->grade); $current->gradeover = $this->real_grade($submission->gradeover); $current->feedbackauthor = $submission->feedbackauthor; @@ -1570,7 +1573,7 @@ class workshop { $current = file_prepare_standard_editor($current, 'feedbackauthor', array()); return new workshop_feedbackauthor_form($actionurl, - array('workshop' => $this, 'current' => $current, 'feedbackopts' => array(), 'options' => $options), + array('workshop' => $this, 'current' => $current, 'editoropts' => array(), 'options' => $options), 'post', '', null, $editable); } diff --git a/mod/workshop/renderer.php b/mod/workshop/renderer.php index dde54fcfdd5..bd570b57ee0 100644 --- a/mod/workshop/renderer.php +++ b/mod/workshop/renderer.php @@ -478,6 +478,7 @@ class mod_workshop_renderer extends plugin_renderer_base { foreach ($grades as $participant) { $numofreceived = count($participant->reviewedby); $numofgiven = count($participant->reviewerof); + $published = $participant->submissionpublished; // compute the number of