Permalink
Browse files

workshop_user_complete now prints out something meaningful. Bug 2931.

General tidy up.
CSS styles added. (SE)
  • Loading branch information...
1 parent 7131f72 commit cd30e6a32cc5af3ba5dbccbc77bb9a5dc40bdb64 moodler committed Apr 21, 2005
Showing with 85 additions and 39 deletions.
  1. +52 −6 mod/workshop/lib.php
  2. +0 −33 mod/workshop/locallib.php
  3. +33 −0 mod/workshop/styles.php
View
58 mod/workshop/lib.php
@@ -931,7 +931,7 @@ function workshop_user_complete($course, $user, $mod, $workshop) {
if ($submission = workshop_get_student_submission($workshop, $user)) {
if ($basedir = workshop_file_area($workshop, $user)) {
if ($files = get_directory_list($basedir)) {
- $countfiles = count($files)." ".get_string("submissions", "workshop");
+ $countfiles = count($files).' '.get_string('submissions', 'workshop');
foreach ($files as $file) {
$countfiles .= "; $file";
}
@@ -940,21 +940,67 @@ function workshop_user_complete($course, $user, $mod, $workshop) {
print_simple_box_start();
- //workshop_print_user_files($workshop, $user);
+ echo $submission->description.'<br />';
- echo "Submission was made but no way to show you yet."; //xxx
-
- //workshop_print_feedback($course, $submission);
+ if (!empty($countfiles)) {
+ echo $countfiles,'<br />';
+ }
+
+ workshop_print_feedback($course, $submission);
print_simple_box_end();
} else {
- print_string("notsubmittedyet", "workshop");
+ print_string('notsubmittedyet', 'workshop');
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////////////
+function workshop_print_feedback($course, $submission) {
+ global $CFG, $RATING;
+
+ if (! $feedbacks = get_records('workshop_assessments', 'submissionid', $submission->id)) {
+ return;
+ }
+
+ $strgrade = get_string('grade');
+ $strnograde = get_string('nograde');
+
+ foreach ($feedbacks as $feedback) {
+ if (! $user = get_record('user', 'id', $feedback->userid)) {
+ /// Weird error but we'll just ignore it and continue with other feedback
+ continue;
+ }
+
+ echo '<table cellspacing="0" class="workshop_feedbackbox">';
+
+ echo '<tr>';
+ echo '<td class="picture left">';
+ print_user_picture($user->id, $course->id, $user->picture);
+ echo '</td>';
+ echo '<td><span class="author">'.fullname($user).'</span>';
+ echo '<span class="time">'.userdate($feedback->timegraded).'</span>';
+ echo '</tr>';
+
+ echo '<tr><td class="left side">&nbsp;</td>';
+ echo '<td class="content">';
+
+ if ($feedback->grade) {
+ echo $strgrade.': '.$feedback->grade;
+ } else {
+ echo $strnograde;
+ }
+
+ echo '<span class="comment">'.format_text($feedback->generalcomment).'</span>';
+ echo '<span class="teachercomment">'.format_text($feedback->teachercomment).'</span>';
+ echo '</td></tr></table>';
+
}
}
+
///////////////////////////////////////////////////////////////////////////////
function workshop_user_outline($course, $user, $mod, $workshop) {
if ($submissions = workshop_get_user_submissions($workshop, $user)) {
View
33 mod/workshop/locallib.php
@@ -2685,39 +2685,6 @@ function workshop_print_difference($time) {
//////////////////////////////////////////////////////////////////////////////////////
-function workshop_print_feedback($course, $submission) {
- global $CFG, $RATING;
-
- if (! $teacher = get_record("user", "id", $submission->teacher)) {
- error("Weird workshop error");
- }
-
- echo "\n<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" class=\"feedbackbox\">";
-
- echo "\n<tr>";
- echo "\n<td rowspan=\"3\" class=\"userpicture\" width=\"35\" valign=\"top\">";
- print_user_picture($teacher->id, $course->id, $teacher->picture);
- echo "</td>";
- echo "<td nowrap=\"nowrap\" width=\"100%\" class=\"feedbackby\">".fullname($teacher);
- echo "&nbsp;&nbsp;<font size=\"2\"><i>".userdate($submission->timemarked)."</i>";
- echo "</tr>";
-
- echo "\n<tr><td width=\"100%\" class=\"feedback\">";
-
- echo "<p align=\"right\"><font size=\"-1\"><i>";
- if ($submission->grade) {
- echo get_string("grade").": $submission->grade";
- } else {
- echo get_string("nograde");
- }
- echo "</i></font></p>";
-
- echo format_text($submission->assessorcomment);
- echo "</td></tr></table>";
-}
-
-
-//////////////////////////////////////////////////////////////////////////////////////
function workshop_print_key($workshop) {
// print an explaination of the grades
View
33 mod/workshop/styles.php
@@ -0,0 +1,33 @@
+.workshop_feedbackbox {
+ margin-top: 5px;
+ border-width: 1px;
+ border-style: solid;
+ border-color: #999999;
+}
+
+.workshop_feedbackbox .picture {
+ vertical-align: top;
+}
+
+.workshop_feedbackbox .author {
+ vertical-align: top;
+ display: block;
+}
+
+.workshop_feedbackbox .time {
+ vertical-align: top;
+ display: block;
+}
+
+.workshop_feedbackbox .content {
+ vertical-align: top;
+}
+
+.workshop_feedbackbox .comment {
+ display: block;
+}
+
+.workshop_feedbackbox .teachercomment {
+ display: block;
+ font-weight: bold;
+}

0 comments on commit cd30e6a

Please sign in to comment.