/** * Defines forms elements */ public function definition() { global $COURSE, $DB, $CFG; $criterion = $this->_customdata['criterion']; $mform = $this->_form; // Add header $mform->addElement('header', 'general', get_string('regraderequest', 'mod_emarking') . ' ' . strtolower(get_string('for')) . ' ' . $criterion->description); // Array of motives for regrading $motives = array(); $motives[] =& $mform->createElement('radio', 'motive', '', emarking_get_regrade_type_string(EMARKING_REGRADE_MISASSIGNED_SCORE), EMARKING_REGRADE_MISASSIGNED_SCORE); $motives[] =& $mform->createElement('radio', 'motive', '', emarking_get_regrade_type_string(EMARKING_REGRADE_CORRECT_ALTERNATIVE_ANSWER), EMARKING_REGRADE_CORRECT_ALTERNATIVE_ANSWER); $motives[] =& $mform->createElement('radio', 'motive', '', emarking_get_regrade_type_string(EMARKING_REGRADE_ERROR_CARRIED_FORWARD), EMARKING_REGRADE_ERROR_CARRIED_FORWARD); $motives[] =& $mform->createElement('radio', 'motive', '', emarking_get_regrade_type_string(EMARKING_REGRADE_UNCLEAR_FEEDBACK), EMARKING_REGRADE_UNCLEAR_FEEDBACK); $motives[] =& $mform->createElement('radio', 'motive', '', emarking_get_regrade_type_string(EMARKING_REGRADE_STATEMENT_PROBLEM), EMARKING_REGRADE_STATEMENT_PROBLEM); $motives[] =& $mform->createElement('radio', 'motive', '', emarking_get_regrade_type_string(EMARKING_REGRADE_OTHER), EMARKING_REGRADE_OTHER); // Add motives group as radio buttons $mform->addGroup($motives, 'radioar', get_string('motive', 'mod_emarking'), array('<br />'), false); $mform->addRule('radioar', get_string('required'), 'required', null, 'client'); $mform->setType('radioar', PARAM_INT); $mform->addHelpButton('radioar', 'motive', 'mod_emarking'); // Add justification as text area $mform->addElement('textarea', 'comment', get_string('justification', 'mod_emarking'), array('wrap' => 'virtual', 'rows' => 10, 'cols' => 80)); $mform->addRule('comment', get_string('required'), 'required', null, 'client'); $mform->addRule('comment', get_string('maximumchars', '', 500), 'maxlength', 500, 'client'); $mform->setType('comment', PARAM_TEXT); $mform->addHelpButton('comment', 'justification', 'mod_emarking'); // Add action buttons $this->add_action_buttons(); }
/** * Defines forms elements */ public function definition() { global $COURSE, $DB, $CFG; $definition = $this->_customdata['criteria']; $draft = $this->_customdata['draft']; $mform = $this->_form; // Add header. $mform->addElement('header', 'general', get_string('regraderequest', 'mod_emarking')); // Obtain criteria that hasn't been regraded yet. $regrades = $DB->get_records("emarking_regrade", array("draft" => $draft->id)); $accepted = array(); foreach ($regrades as $regrade) { $accepted[] = $regrade->criterion; } $criteria = array(); $criteria[0] = get_string("select"); foreach ($definition->rubric_criteria as $criterion) { if (!in_array($criterion["id"], $accepted)) { $criteria[$criterion['id']] = $criterion['description']; } } $mform->addElement('select', 'criterion', get_string('criterion', 'mod_emarking'), $criteria); $mform->setDefault('criterion', 0); $mform->setType('criterion', PARAM_INT); // Array of motives for regrading. $motives = array(); $motives[] =& $mform->createElement('radio', 'motive', '', emarking_get_regrade_type_string(EMARKING_REGRADE_MISASSIGNED_SCORE), EMARKING_REGRADE_MISASSIGNED_SCORE); $motives[] =& $mform->createElement('radio', 'motive', '', emarking_get_regrade_type_string(EMARKING_REGRADE_CORRECT_ALTERNATIVE_ANSWER), EMARKING_REGRADE_CORRECT_ALTERNATIVE_ANSWER); $motives[] =& $mform->createElement('radio', 'motive', '', emarking_get_regrade_type_string(EMARKING_REGRADE_ERROR_CARRIED_FORWARD), EMARKING_REGRADE_ERROR_CARRIED_FORWARD); $motives[] =& $mform->createElement('radio', 'motive', '', emarking_get_regrade_type_string(EMARKING_REGRADE_UNCLEAR_FEEDBACK), EMARKING_REGRADE_UNCLEAR_FEEDBACK); $motives[] =& $mform->createElement('radio', 'motive', '', emarking_get_regrade_type_string(EMARKING_REGRADE_STATEMENT_PROBLEM), EMARKING_REGRADE_STATEMENT_PROBLEM); $motives[] =& $mform->createElement('radio', 'motive', '', emarking_get_regrade_type_string(EMARKING_REGRADE_OTHER), EMARKING_REGRADE_OTHER); // Add motives group as radio buttons. $mform->addGroup($motives, 'radioar', get_string('motive', 'mod_emarking'), array('<br />'), false); $mform->addRule('radioar', get_string('required'), 'required', null, 'client'); $mform->setType('radioar', PARAM_INT); $mform->addHelpButton('radioar', 'motive', 'mod_emarking'); // Add justification as text area. $mform->addElement('textarea', 'comment', get_string('justification', 'mod_emarking'), array('wrap' => 'virtual', 'rows' => 10, 'cols' => 80)); $mform->addRule('comment', get_string('required'), 'required', null, 'client'); $mform->addRule('comment', get_string('maximumchars', '', 500), 'maxlength', 500, 'client'); $mform->setType('comment', PARAM_TEXT); $mform->addHelpButton('comment', 'justification', 'mod_emarking'); // Add action buttons. $this->add_action_buttons(); }
if (count($records) == 0) { echo $OUTPUT->notification(get_string('noregraderequests', 'mod_emarking'), 'notifyproblem'); echo $OUTPUT->footer(); die; } $table = new html_table(); $table->head = array(get_string('student', 'grades') . '-' . get_string('criterion', 'mod_emarking'), get_string('motive', 'mod_emarking'), get_string('grade', 'mod_emarking'), get_string('regrade', 'mod_emarking'), ' '); $data = array(); foreach ($records as $record) { if ($record->accepted) { $statusicon = $OUTPUT->pix_icon("i/valid", get_string('replied', 'mod_emarking')); } else { $statusicon = $OUTPUT->pix_icon("i/flagged", get_string('sent', 'mod_emarking')); } $regradecomment = emarking_view_more(get_string("justification", "mod_emarking"), $record->comment, "comment", $record->id); $motive = emarking_get_regrade_type_string($record->motive) . '<br/>' . $regradecomment; // Student info $url = new moodle_url('/user/view.php', array('id' => $record->userid, 'course' => $course->id)); $studentcriterion = $OUTPUT->action_link($url, $record->firstname . ' ' . $record->lastname); $studentcriterion .= '<br/>' . $record->criterion; $studentcriterion .= '<br/>' . emarking_time_ago($record->timecreated, true); // Original grade $original = ' [' . round($record->originalscore, 2) . '/' . round($record->maxscore, 2) . ']'; // After regrade $current = $record->accepted ? '[' . round($record->currentscore, 2) . '/' . round($record->maxscore, 2) . '] ' : ''; $current .= ' ' . $statusicon; $current .= $record->accepted ? '<br/>' . $record->markercomment : ''; $current .= ' ' . emarking_time_ago($record->timemodified, true); // Actions $urlsub = new moodle_url('/mod/emarking/marking/index.php', array('id' => $record->ids)); $actions = $OUTPUT->action_link($urlsub, get_string('annotatesubmission', 'mod_emarking'), new popup_action('click', $urlsub, 'emarking' . $record->ids, array('menubar' => 'no', 'titlebar' => 'no', 'status' => 'no', 'toolbar' => 'no', 'width' => 860, 'height' => 600)), array("class" => "rowactions"));
$urldelete = new moodle_url('/mod/emarking/marking/regrades.php', array("id" => $cm->id, "criterion" => $question->id, 'delete' => 'true')); $linktext = ""; $statusicon = get_string("statusnotsent", "mod_emarking"); if ($question->regradeid != null) { if ($requestswithindate && !$question->rgaccepted) { $linktext = $OUTPUT->action_link($urledit, null, null, null, new pix_icon('i/manual_item', get_string('edit'))); $linktext .= ' ' . $OUTPUT->action_link($urldelete, null, null, null, new pix_icon('t/delete', get_string('delete'))); } else { $linktext = ' '; } if ($question->rgaccepted) { $statusicon = $OUTPUT->pix_icon("i/valid", get_string('replied', 'mod_emarking')); } else { $statusicon = $OUTPUT->pix_icon("i/flagged", get_string('sent', 'mod_emarking')); } $statusicon .= '<br/>' . emarking_get_regrade_type_string($question->motive); $statusicon .= '<br/>' . emarking_view_more(get_string("regradingcomment", "mod_emarking"), $question->comment, "cc", $question->regradeid); } elseif ($requestswithindate && $emarkingdraft->status >= EMARKING_STATUS_PUBLISHED) { $linktext = $OUTPUT->action_link($urledit, null, null, null, new pix_icon('t/add', 'Solicitar')); } else { $linktext = ' '; } $originalinfo = round($question->originalscore, 2) . ' / ' . round($question->maxscore, 2) . ' : ' . $question->originaldefinition; if ($question->feedback && core_text::strlen($question->feedback) > 0) { $originalinfo .= '<br/>' . $question->feedback; } $currentinfo = round($question->score, 2) . ' / ' . round($question->maxscore, 2) . ' : ' . $question->currentdefinition; if ($question->markercomment && core_text::strlen($question->markercomment) > 0) { $currentinfo .= '<br/>' . $question->markercomment; } $row = array();
/** * Returns an associative array with regrade motives IDs and their * descriptions * * @return multitype:associative array with keys and descriptions */ function emarking_get_regrade_motives() { $motives = array(); foreach (emarking_get_regrade_motives_array() as $m) { $motive = new stdClass(); $motive->id = $m; $motive->description = emarking_get_regrade_type_string($m); $motives[] = $motive; } return $motives; }