function journal_print_user_entry($course, $user, $entry, $teachers, $grades) { global $USER, $OUTPUT, $DB, $CFG; require_once $CFG->dirroot . '/lib/gradelib.php'; echo "\n<table class=\"journaluserentry\">"; echo "\n<tr>"; echo "\n<td class=\"userpix\" rowspan=\"2\">"; echo $OUTPUT->user_picture($user, array('courseid' => $course->id, 'alttext' => true)); echo "</td>"; echo "<td class=\"userfullname\">" . fullname($user); if ($entry) { echo " <span class=\"lastedit\">" . get_string("lastedited") . ": " . userdate($entry->modified) . "</span>"; } echo "</td>"; echo "</tr>"; echo "\n<tr><td>"; if ($entry) { echo journal_format_entry_text($entry, $course); } else { print_string("noentry", "journal"); } echo "</td></tr>"; if ($entry) { echo "\n<tr>"; echo "<td class=\"userpix\">"; if (!$entry->teacher) { $entry->teacher = $USER->id; } if (empty($teachers[$entry->teacher])) { $teachers[$entry->teacher] = $DB->get_record('user', array('id' => $entry->teacher)); } echo $OUTPUT->user_picture($teachers[$entry->teacher], array('courseid' => $course->id, 'alttext' => true)); echo "</td>"; echo "<td>" . get_string("feedback") . ":"; $attrs = array(); $hiddengradestr = ''; $gradebookgradestr = ''; $feedbackdisabledstr = ''; $feedbacktext = $entry->entrycomment; // If the grade was modified from the gradebook disable edition also skip if journal is not graded. $grading_info = grade_get_grades($course->id, 'mod', 'journal', $entry->journal, array($user->id)); if (!empty($grading_info->items[0]->grades[$entry->userid]->str_long_grade)) { if ($gradingdisabled = $grading_info->items[0]->grades[$user->id]->locked || $grading_info->items[0]->grades[$user->id]->overridden) { $attrs['disabled'] = 'disabled'; $hiddengradestr = '<input type="hidden" name="r' . $entry->id . '" value="' . $entry->rating . '"/>'; $gradebooklink = '<a href="' . $CFG->wwwroot . '/grade/report/grader/index.php?id=' . $course->id . '">'; $gradebooklink .= $grading_info->items[0]->grades[$user->id]->str_long_grade . '</a>'; $gradebookgradestr = '<br/>' . get_string("gradeingradebook", "journal") . ': ' . $gradebooklink; $feedbackdisabledstr = 'disabled="disabled"'; $feedbacktext = $grading_info->items[0]->grades[$user->id]->str_feedback; } } // Grade selector $attrs['id'] = 'r' . $entry->id; echo html_writer::label(fullname($user) . " " . get_string('grade'), 'r' . $entry->id, true, array('class' => 'accesshide')); echo html_writer::select($grades, 'r' . $entry->id, $entry->rating, get_string("nograde") . '...', $attrs); echo $hiddengradestr; // Rewrote next three lines to show entry needs to be regraded due to resubmission. if (!empty($entry->timemarked) && $entry->modified > $entry->timemarked) { echo " <span class=\"lastedit\">" . get_string("needsregrade", "journal") . "</span>"; } else { if ($entry->timemarked) { echo " <span class=\"lastedit\">" . userdate($entry->timemarked) . "</span>"; } } echo $gradebookgradestr; // Feedback text echo html_writer::label(fullname($user) . " " . get_string('feedback'), 'c' . $entry->id, true, array('class' => 'accesshide')); echo "<p><textarea id=\"c{$entry->id}\" name=\"c{$entry->id}\" rows=\"12\" cols=\"60\" {$feedbackdisabledstr}>"; p($feedbacktext); echo "</textarea></p>"; if ($feedbackdisabledstr != '') { echo '<input type="hidden" name="c' . $entry->id . '" value="' . $feedbacktext . '"/>'; } echo "</td></tr>"; } echo "</table>\n"; }
$journal->days = 0; } if ($timenow > $timestart) { echo $OUTPUT->box_start(); // Edit button if ($timenow < $timefinish) { if ($canadd) { echo $OUTPUT->single_button('edit.php?id=' . $cm->id, get_string('startoredit', 'journal'), 'get', array("class" => "singlebutton journalstart")); } } // Display entry if ($entry = $DB->get_record('journal_entries', array('userid' => $USER->id, 'journal' => $journal->id))) { if (empty($entry->text)) { echo '<p align="center"><b>' . get_string('blankentry', 'journal') . '</b></p>'; } else { echo journal_format_entry_text($entry, $course, $cm); } } else { echo '<span class="warning">' . get_string('notstarted', 'journal') . '</span>'; } echo $OUTPUT->box_end(); // Info if ($timenow < $timefinish) { if (!empty($entry->modified)) { echo '<div class="lastedit"><strong>' . get_string('lastedited') . ': </strong> '; echo userdate($entry->modified); echo ' (' . get_string('numwords', '', count_words($entry->text)) . ')'; echo "</div>"; } //Added three lines to mark entry as being dirty and needing regrade. if (!empty($entry->modified) and !empty($entry->timemarked) and $entry->modified > $entry->timemarked) {