// // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * @package mod * @subpackage emarking * @copyright 2012 Jorge Villalón {@link http://www.uai.cl} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** General feedback to include in the marking **/ $generalfeedback = required_param('feedback', PARAM_RAW_TRIMMED); // Firstly create the response pdf if (emarking_create_response_pdf($submission, $user, $context, $cm->id)) { // If the pdf was created successfully then update the final grade and feedback list($finalgrade, $previouslvlid, $previouscomment) = emarking_set_finalgrade($submission->student, 0, null, $submission, $emarking, $context, $generalfeedback, false, $cm->id); // It is only publish if there just one draft if ($DB->count_records("emarking_draft", array("emarkingid" => $submission->emarkingid, "submissionid" => $submission->submissionid)) == 1) { emarking_publish_grade($submission); } $nextsubmission = emarking_get_next_submission($emarking, $submission); // Send the output $output = array('error' => '', 'message' => 'Feedback created successfully', 'finalgrade' => $finalgrade, 'previouslvlid' => $previouslvlid, 'previouscomment' => $previouscomment, 'nextsubmission' => $nextsubmission); } else { // Response couldn't be created $output = array('error' => 'Could not create response from eMarking.'); }
// // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * @package mod * @subpackage emarking * @copyright 2012 Jorge Villalón {@link http://www.uai.cl} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** General feedback to include in the marking **/ $generalfeedback = required_param('feedback', PARAM_RAW_TRIMMED); // Firstly create the response pdf if (emarking_create_response_pdf($draft, $user, $context, $cm->id)) { // If the pdf was created successfully then update the final grade and feedback list($finalgrade, $previouslvlid, $previouscomment) = emarking_set_finalgrade($submission->student, 0, null, $submission, $draft, $emarking, $context, $generalfeedback, false, $cm->id); // It is only publish if there just one draft if ($DB->count_records('emarking_draft', array('emarkingid' => $submission->emarking, 'submissionid' => $submission->id, 'qualitycontrol' => 0)) == 1) { emarking_publish_grade($draft); } $nextsubmission = emarking_get_next_submission($emarking, $draft, $context, $user, $issupervisor); // Send the output $output = array('error' => '', 'message' => 'Feedback created successfully', 'finalgrade' => $finalgrade, 'previouslvlid' => $previouslvlid, 'previouscomment' => $previouscomment, 'nextsubmission' => $nextsubmission); } else { // Response couldn't be created $output = array('error' => 'Could not create response from eMarking.'); }
require_once $CFG->dirroot . '/mod/emarking/marking/forms/export_form.php'; global $DB, $CFG, $USER; // Obtains basic data from cm id. list($cm, $emarking, $course, $context) = emarking_get_cm_course_instance(); $draftid = required_param('did', PARAM_INT); // Validate user is logged in and is not guest. require_login($course->id); if (isguestuser()) { die; } if (!($draft = $DB->get_record('emarking_draft', array('id' => $draftid)))) { print_error('Invalid draft id'); } if (!($submission = $DB->get_record('emarking_submission', array('id' => $draft->submissionid)))) { print_error('Invalid submission id'); } if (!($user = $DB->get_record('user', array('id' => $submission->student)))) { print_error('Invalid draft id, no user'); } $pdffilename = 'response_' . $emarking->id . '_' . $draft->id . '.pdf'; $fs = get_file_storage(); $pdffile = $fs->get_file($context->id, 'mod_emarking', 'response', $draft->id, '/', $pdffilename); if ($pdffile && $pdffile->get_timecreated() < $draft->timemodified) { $pdffile = NULL; } if (!$pdffile && !emarking_create_response_pdf($draft, $user, $context, $cm->id)) { print_error('Couldnt create feedback PDF'); } $url = $CFG->wwwroot . "/pluginfile.php/" . $context->id . "/mod_emarking/response/" . $draft->id . "/" . $pdffilename . '?' . random_string(); redirect($url); die;