/**
  * 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', '', get_string_status(EMARKING_REGRADE_MISASSIGNED_SCORE), EMARKING_REGRADE_MISASSIGNED_SCORE);
     $motives[] =& $mform->createElement('radio', 'motive', '', get_string_status(EMARKING_REGRADE_UNCLEAR_FEEDBACK), EMARKING_REGRADE_UNCLEAR_FEEDBACK);
     $motives[] =& $mform->createElement('radio', 'motive', '', get_string_status(EMARKING_REGRADE_STATEMENT_PROBLEM), EMARKING_REGRADE_STATEMENT_PROBLEM);
     $motives[] =& $mform->createElement('radio', 'motive', '', get_string_status(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' => 20, 'cols' => 50));
     $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();
 }
Example #2
0
$table = new html_table();
$table->head = array(get_string('criterion', 'mod_emarking'), get_string('score', 'mod_emarking'), get_string('markingcomment', 'mod_emarking'), get_string('status', 'mod_emarking'), get_string('regradingcomment', 'mod_emarking'), get_string('actions', 'mod_emarking'));
$data = array();
foreach ($questions as $question) {
    $urledit = new moodle_url('/mod/emarking/regrades.php', array("id" => $cm->id, "criterion" => $question->id));
    $urldelete = new moodle_url('/mod/emarking/regrades.php', array("id" => $cm->id, "criterion" => $question->id, 'delete' => 'true'));
    $status = 'No solicitada';
    if ($question->regradeid != null) {
        if ($requestswithindate) {
            $linktext = $OUTPUT->action_link($urledit, null, null, null, new pix_icon('i/manual_item', get_string('edit')));
            $linktext .= '&nbsp;' . $OUTPUT->action_link($urldelete, null, null, null, new pix_icon('t/delete', get_string('delete')));
        } else {
            $linktext = '&nbsp;';
        }
        $status = $question->rgaccepted ? "Aceptada" : "Solicitada";
        $status .= '<br/>' . get_string_status($question->motive);
        $status .= '<br/>' . substr($question->comment, 0, min(strlen($question->comment), 25));
        if (strlen($question->comment) > 25) {
            $status .= '...';
        }
    } elseif ($requestswithindate) {
        $linktext = $OUTPUT->action_link($urledit, null, null, null, new pix_icon('t/add', 'Solicitar'));
    } else {
        $linktext = '&nbsp;';
    }
    $row = array();
    $row[] = $question->description;
    $row[] = round($question->score, 2) . ' / ' . round($question->maxscore, 2);
    $row[] = $question->feedback;
    $row[] = $status;
    $row[] = $question->markercomment;
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('comment', 'mod_emarking'), get_string('regradedatecreated', 'mod_emarking'), get_string('regradelastchange', 'mod_emarking'), get_string('status', 'mod_emarking'), get_string('actions', 'mod_emarking'));
$data = array();
foreach ($records as $record) {
    $array = array();
    $url = new moodle_url('/user/view.php', array('id' => $record->userid, 'course' => $course->id));
    $urlsub = new moodle_url('/mod/emarking/ajax/a.php', array('ids' => $record->ids, 'action' => "emarking"));
    $array[] = '<a href="' . $url . '">' . $record->firstname . ' ' . $record->lastname . '</a>';
    $array[] = $record->criterio;
    //Stepstaken = 0 if no steps are taken, 1, if only first is taken, 2 if we are done.
    $stepstaken = 0;
    $array[] = get_string_status($record->motive);
    $array[] = $record->comment;
    $array[] = date("d/m/y H:i", $record->timecreated);
    $array[] = date("d/m/y H:i", $record->timemodified);
    $status = 'Solicitada';
    if ($record->accepted) {
        $status = 'Contestada';
    }
    $array[] = $status;
    $array[] = $OUTPUT->action_link($urlsub, null, new popup_action('click', $urlsub, 'emarking' . $record->ids, array('menubar' => 'no', 'titlebar' => 'no', 'status' => 'no', 'toolbar' => 'no')), null, new pix_icon('i/manual_item', get_string('annotatesubmission', 'mod_emarking')));
    $data[] = $array;
}
$table->data = $data;
echo html_writer::table($table);
echo $OUTPUT->footer();