]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-10286 Implementing the view feedback page. Added links to the user, module and...
authornicolasconnault <nicolasconnault>
Thu, 5 Jul 2007 07:01:48 +0000 (07:01 +0000)
committernicolasconnault <nicolasconnault>
Thu, 5 Jul 2007 07:01:48 +0000 (07:01 +0000)
grade/report/grader/edit_feedback.php
lang/en_utf8/grades.php
lib/gradelib.php

index f8a4e664f0ae8e69788cd0127a695e62227dbb9f..fa0f2eb3b1814d06c6398cefa2d671e2b4f6eaa9 100644 (file)
@@ -6,6 +6,7 @@ require_once 'edit_feedback_form.php';
 
 $courseid = required_param('courseid', PARAM_INT);
 $id       = optional_param('id', 0, PARAM_INT);
+$action   = optional_param('action', 0, PARAM_ALPHA);
 
 if (!$course = get_record('course', 'id', $courseid)) {
     print_error('nocourseid');
@@ -45,10 +46,12 @@ if ($mform->is_cancelled()) {
 }
 
 // Get name of student and gradeitem name
-$query = "SELECT a.firstname, a.lastname, b.itemname, c.finalgrade, b.grademin, b.grademax
-            FROM {$CFG->prefix}user AS a, 
-                 {$CFG->prefix}grade_items AS b, 
-                 {$CFG->prefix}grade_grades AS c
+$query = "SELECT a.id AS userid, a.firstname, a.lastname, 
+                 b.id AS itemid, b.itemname, b.grademin, b.grademax, b.iteminstance, b.itemmodule, b.scaleid,
+                 c.finalgrade 
+            FROM {$CFG->prefix}user a, 
+                 {$CFG->prefix}grade_items b, 
+                 {$CFG->prefix}grade_grades c
            WHERE c.id = $id
              AND b.id = c.itemid
              AND a.id = c.userid";
@@ -57,35 +60,60 @@ $extra_info = get_record_sql($query) ;
 $extra_info->grademin = round($extra_info->grademin);
 $extra_info->grademax = round($extra_info->grademax);
 $extra_info->finalgrade = round($extra_info->finalgrade);
+$extra_info->course_module = get_coursemodule_from_instance($extra_info->itemmodule, $extra_info->iteminstance, $courseid);
 
 $stronascaleof   = get_string('onascaleof', 'grades', $extra_info);
 $strgrades       = get_string('grades');
 $strgrade        = get_string('grade');
 $strgraderreport = get_string('graderreport', 'grades');
+$strfeedback     = get_string('feedback', 'grades');
 $strfeedbackedit = get_string('feedbackedit', 'grades');
+$strfeedbackview = get_string('feedbackview', 'grades');
+$strfeedbackadd  = get_string('feedbackadd', 'grades');
 $strstudent      = get_string('student', 'grades');
 $strgradeitem    = get_string('gradeitem', 'grades');
 
+$feedback = null;
+$heading = ${"strfeedback$action"};
+if (!empty($action) && $action == 'view') {
+    $feedback = "<p><strong>$strfeedback</strong>:</p><p>$grade_text->feedback</p>";
+}
+
 $nav = array(array('name'=>$strgrades,'link'=>$CFG->wwwroot.'/grade/index.php?id='.$courseid, 'type'=>'misc'),
              array('name'=>$strgraderreport, 'link'=>$CFG->wwwroot.'/grade/report.php?id='.$courseid.'&amp;report=grader', 'type'=>'misc'),
-             array('name'=>$strfeedbackedit, 'link'=>'', 'type'=>'misc'));
+             array('name'=>$heading, 'link'=>'', 'type'=>'misc'));
 
 $navigation = build_navigation($nav);
 
+print_header_simple($strgrades . ': ' . $strgraderreport . ': ' . $heading, 
+    ': ' . $heading , $navigation, '', '', true, '', navmenu($course));
+
+print_heading($heading);
 
-print_header_simple($strgrades . ': ' . $strgraderreport, ': ' . $strfeedbackedit, $navigation, '', '', true, '', navmenu($course));
+print_simple_box_start("center");
 
-print_heading(get_string('feedbackedit', 'grades'));
-print_box_start('gradefeedbackbox generalbox');
-echo "<p>$strstudent: " . fullname($extra_info) . "</p>";
-echo "<p>$strgradeitem: " . $extra_info->itemname . "</p>";
+echo "<p><strong>$strstudent:</strong> <a href=\"" . $CFG->wwwroot . '/user/view.php?id=' 
+     . $extra_info->userid . '">' . fullname($extra_info) . "</a></p>";
+echo "<p><strong>$strgradeitem:</strong> <a href=\"" . $CFG->wwwroot . '/mod/' . $extra_info->itemmodule 
+     . '/view.php?id=' . $extra_info->course_module->id . "&amp;courseid=$courseid\">$extra_info->itemname</a></p>";
 if (!empty($extra_info->finalgrade)) {
-    echo "<p>$strgrade: " . $extra_info->finalgrade . "$stronascaleof</p>";
+    $openlink = '';
+    $closelink = '';
+
+    if (!empty($extra_info->scaleid)) {
+        $openlink = '<a href="' . $CFG->wwwroot . '/course/scales.php?id=' . $courseid . '&amp;scaleid=' 
+                  . $extra_info->scaleid . '">';
+        $closelink = '</a>';
+    }
+    echo "<p><strong>$strgrade:</strong> " . $extra_info->finalgrade . "$openlink $stronascaleof $closelink</p>";
 }
+echo $feedback;
 
-$mform->display();
+if ($action != 'view') {
+    $mform->display();
+}
 
-print_box_end();
+print_simple_box_end();
 
 print_footer($course);
 die;
index f8977c8ebba3e4379295ca18fda792eb295ab64c..ab3198ddf9ceecd7bca78aebb13f9c0716757454 100644 (file)
@@ -68,7 +68,9 @@ $string['exportxml'] = 'Export XML';
 $string['extracredit'] = 'Extra Credit';
 $string['extracreditwarning'] = 'Note: Setting all items for a category to extra credit will effectively remove them from the grade calculation. Since there will be no point total';
 $string['feedback'] = 'Feedback';
+$string['feedbackadd'] = 'Add feedback';
 $string['feedbackedit'] = 'Edit feedback';
+$string['feedbackview'] = 'View feedback';
 $string['feedbackformat'] = 'Feedback format';
 $string['forelementtypes'] = ' for the selected $a';
 $string['forstudents'] = 'For Students';
index 9cfec768cee787a7767c7934ce7f9d6b6efff360..01a33cd5caf4537c17544547658fb5aa33def569 100644 (file)
@@ -817,10 +817,10 @@ function grade_get_icons($element, $tree) {
         }
     } else {
         if ($USER->gradefeedback) {
-            // Display Edit/Add feedback icon
+            // Display view feedback icon
             if (!empty($object->feedback)) {
                 $html .= '<a href="report/grader/edit_feedback.php?id=' . $object->id 
-                      . "&amp;action=edit&amp;courseid=$object->courseid\">\n";
+                      . "&amp;action=view&amp;courseid=$object->courseid\">\n";
                 $html .= '<img onmouseover="return overlib(\''.$object->feedback.'\', CAPTION, \''
                       . $strfeedback.'\');" onmouseout="return nd();" '
                       . 'src="'.$CFG->pixpath.'/t/feedback.gif" class="iconsmall" alt="" /></a>'. "\n";