From: nicolasconnault Date: Thu, 28 Jun 2007 11:15:12 +0000 (+0000) Subject: MDL-10209 MDL-10211 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=1ec74ea5aaa1778c93277f094dd5dc7d6c1f4fb5;p=moodle.git MDL-10209 MDL-10211 Added two tiny feedback/add_feedback icons. Enabled feedback mode with button next to "Turn editing on". Added tooltip (with overlib for the time being) for "Show feedback" when edit mode is off, and for "Edit feedback" when edit is on. --- diff --git a/grade/report.php b/grade/report.php index c9dc916dd6..1ca197bb34 100644 --- a/grade/report.php +++ b/grade/report.php @@ -29,6 +29,7 @@ $courseid = required_param('id'); // course id $report = optional_param('report', 'user', PARAM_FILE); // course id $edit = optional_param('edit', -1, PARAM_BOOL); // sticky editting mode + $feedback = optional_param('feedback', -1, PARAM_BOOL); // sticky feedback mode /// Make sure they can even access this course @@ -97,8 +98,19 @@ } else if (($edit == 0) and confirm_sesskey()) { $USER->gradeediting = 0; } + + // Setup feedback mode + if (!isset($USER->gradefeedback)) { + $USER->gradefeedback = 0; + } + + if (($feedback == 1) and confirm_sesskey()) { + $USER->gradefeedback = 1; + } else if (($feedback == 0) and confirm_sesskey()) { + $USER->gradefeedback = 0; + } - // params for the turn editting on button + // params for the turn editting on and feedback buttons $options['id'] = $courseid; $options['report'] = $report; @@ -113,8 +125,20 @@ $options['sesskey'] = sesskey(); $link = 'report.php'; - // turn eidtting on and off buttons + // turn editting on and off buttons $buttons = print_single_button($link, $options, $string, 'get', '_self', true); + unset($options['edit']); + + if ($USER->gradefeedback) { + $options['feedback'] = 0; + $string = get_string('turnfeedbackoff', 'grades'); + } else { + $options['feedback'] = 1; + $string = get_string('turnfeedbackon', 'grades'); + } + + // turn editting on and off buttons + $buttons .= print_single_button($link, $options, $string, 'get', '_self', true); print_header_simple($strgrades.':'.$reportnames[$report], ':'.$strgrades, $navigation, '', '', true, $buttons, navmenu($course)); diff --git a/grade/report/grader/index.php b/grade/report/grader/index.php index 06672d2607..f00c4588ad 100644 --- a/grade/report/grader/index.php +++ b/grade/report/grader/index.php @@ -5,6 +5,10 @@ require_once($CFG->libdir.'/tablelib.php'); include_once($CFG->libdir.'/gradelib.php'); +// Prepare language strings +$strsortasc = get_string('sortasc', 'grades'); +$strsortdesc = get_string('sortdesc', 'grades'); + /// processing posted grades here if ($data = data_submitted()) { @@ -261,9 +265,9 @@ $cathtml = ' '; if ($sortitemid === 'lastname') { if ($sortorder == 'ASC') { - $lastarrow = ' '; + $lastarrow = ' '.$strsortasc.' '; } else { - $lastarrow = ' '; + $lastarrow = ' '.$strsortdesc.' '; } } else { $lastarrow = ''; @@ -271,9 +275,9 @@ if ($sortitemid === 'lastname') { if ($sortitemid === 'firstname') { if ($sortorder == 'ASC') { - $firstarrow = ' '; + $firstarrow = ' '.$strsortasc.' '; } else { - $firstarrow = ' '; + $firstarrow = ' '.$strsortdesc.' '; } } else { $firstarrow = ''; @@ -296,9 +300,9 @@ foreach ($tree as $topcat) { if ($item['object']->id == $sortitemid) { if ($sortorder == 'ASC') { - $arrow = ' '; + $arrow = ' '.$strsortasc.' '; } else { - $arrow = ' '; + $arrow = ' '.$strsortdesc.' '; } } else { $arrow = ''; @@ -313,10 +317,8 @@ foreach ($tree as $topcat) { . $item['object']->id .'">'. $item['object']->itemname . '' . $arrow; - // Print icons if grade editing is on - if ($USER->gradeediting) { - $itemhtml .= grade_get_icons($item['object'], $gtree) . ''; - } + // Print icons + $itemhtml .= grade_get_icons($item['object'], $gtree) . ''; $items[] = $item; } @@ -332,10 +334,8 @@ foreach ($tree as $topcat) { $cat['object']->load_grade_item(); $cathtml .= '' . $cat['object']->fullname; - // Print icons if grade editing is on - if ($USER->gradeediting) { - $cathtml .= grade_get_icons($cat['object'], $gtree) . ''; - } + // Print icons + $cathtml .= grade_get_icons($cat['object'], $gtree) . ''; } } @@ -353,10 +353,8 @@ foreach ($tree as $topcat) { $topcathtml .= '' . $topcat['object']->fullname; - // Print icons if grade editing is on - if ($USER->gradeediting) { - $topcathtml .= grade_get_icons($topcat['object'], $gtree) . ''; - } + // Print icons + $topcathtml .= grade_get_icons($topcat['object'], $gtree) . ''; } } @@ -372,6 +370,7 @@ foreach ($users as $userid => $user) { if (isset($finalgrades[$userid][$item['object']->id])) { $gradeval = $finalgrades[$userid][$item['object']->id]->finalgrade; $grade_grades = new grade_grades($finalgrades[$userid][$item['object']->id], false); + $grade_grades->feedback = $finalgrades[$userid][$item['object']->id]->feedback; } else { $gradeval = '-'; $grade_grades = new grade_grades(array('userid' => $userid, 'itemid' => $item['object']->id), false); @@ -398,10 +397,6 @@ foreach ($users as $userid => $user) { $studentshtml .= ''; } - // Do not show any icons if no grade (no record in DB to match) - if (!empty($grade_grades->id)) { - $studentshtml .= grade_get_icons($grade_grades, $gtree); - } } else { // finalgrades[$userid][$itemid] could be null because of the outer join // in this case it's different than a 0 @@ -423,6 +418,11 @@ foreach ($users as $userid => $user) { } } + // Do not show any icons if no grade (no record in DB to match) + if (!empty($grade_grades->id)) { + $studentshtml .= grade_get_icons($grade_grades, $gtree); + } + $studentshtml .= '' . "\n"; } $studentshtml .= ''; diff --git a/lang/en_utf8/grades.php b/lang/en_utf8/grades.php index 94963bf185..f5d11f7c1b 100644 --- a/lang/en_utf8/grades.php +++ b/lang/en_utf8/grades.php @@ -5,6 +5,7 @@ $string['addcategory'] = 'Add Category'; $string['addcategoryerror'] = 'Could not add category.'; $string['addexceptionerror'] = 'Error occurred while adding exception for userid:gradeitem'; +$string['addfeedback'] = 'Add Feedback'; $string['allgrades'] = 'All grades by category'; $string['allstudents'] = 'All Students'; $string['average'] = 'Average'; @@ -28,6 +29,7 @@ $string['displayweighted'] = 'Display Weighted Grades'; $string['dropped'] = 'Dropped'; $string['dropxlowest'] = 'Drop X Lowest'; $string['dropxlowestwarning'] = 'Note: If you use drop x lowest the grading assumes that all items in the category have the same point value. If point values differ results will be unpredictable'; +$string['editfeedback'] = 'Edit Feedback'; $string['encoding'] = 'Encoding'; $string['errorgradevaluenonnumeric'] = 'Received non-numeric for low or high grade for'; $string['errornocategorizedid'] = 'Could not get an uncategorized id!'; @@ -138,6 +140,8 @@ $string['setweights'] = 'Set Weights'; $string['showallstudents'] = 'Show All Students'; $string['showhiddenitems'] = 'Show Hidden Items'; $string['sort'] = 'sort'; +$string['sortasc'] = 'Sort in ascending order'; +$string['sortdesc'] = 'Sort in descending order'; $string['sortbyfirstname'] = 'Sort by Firstname'; $string['sortbylastname'] = 'Sort by Lastname'; $string['standarddeviation'] = 'Standard Deviation'; @@ -149,6 +153,8 @@ $string['topcategory'] = 'Super Category'; $string['total'] = 'Total'; $string['totalweight100'] = 'The total weight is equal to 100'; $string['totalweightnot100'] = 'The total weight is not equal to 100'; +$string['turnfeedbackoff'] = 'Turn feedback off'; +$string['turnfeedbackon'] = 'Turn feedback on'; $string['uncategorised'] = 'Uncategorised'; $string['unlock'] = 'Unlock'; $string['uploadgrades'] = 'Upload grades'; diff --git a/lib/gradelib.php b/lib/gradelib.php index 809758e148..b8cc8b4578 100644 --- a/lib/gradelib.php +++ b/lib/gradelib.php @@ -688,8 +688,12 @@ function grade_oldgradebook_upgrade($courseid) { */ function grade_get_icons($object, $tree) { global $CFG; + global $USER; + $straddfeedback = get_string("addfeedback", 'grades'); $stredit = get_string("edit"); + $streditfeedback = get_string("editfeedback", 'grades'); + $strfeedback = get_string("feedback"); $strmove = get_string("move"); $strmoveup = get_string("moveup"); $strmovedown = get_string("movedown"); @@ -704,47 +708,80 @@ function grade_get_icons($object, $tree) { $html = '
'; - // Edit icon (except for grade_grades) - if (get_class($object) != 'grade_grades') { - $html .= 'commonvars\">\n"; - $html .= ''
-              .$stredit.''. "\n"; - } - - // Hide/Show icon - $hide_show = 'hide'; - if ($object->is_hidden()) { - $hide_show = 'show'; - } - - if (get_class($object) != 'grade_grades') { - $identifier = $object->get_sortorder(); - } else { - $identifier = 'grade' . $object->id; - } + // Icons shown when edit mode is on + if ($USER->gradeediting) { + // Edit icon (except for grade_grades) + if (get_class($object) != 'grade_grades') { + $html .= 'commonvars\">\n"; + $html .= ''
+                  .$stredit.''. "\n"; + } - $html .= 'commonvars\">\n"; - $html .= ''
-          .${'str' . $hide_show}.''. "\n"; + // Prepare Hide/Show icon state + $hide_show = 'hide'; + if ($object->is_hidden()) { + $hide_show = 'show'; + } + + // Setup object identifier and show feedback icon if applicable + if (get_class($object) != 'grade_grades') { + $identifier = $object->get_sortorder(); + } else { + $identifier = 'grade' . $object->id; + + if ($USER->gradefeedback) { + // Display Edit/Add feedback icon + if (empty($object->feedback)) { + $html .= 'commonvars\">\n"; + $html .= ''.$straddfeedback.''. "\n"; + } else { + $html .= 'commonvars\">\n"; + $html .= ''.$streditfeedback.''. "\n"; + } + } + } - // Prepare lock/unlock string - $lock_unlock = 'lock'; - if ($object->is_locked()) { - $lock_unlock = 'unlock'; - } - - // Print lock/unlock icon - $html .= 'commonvars\">\n"; - $html .= ''
-          .${'str' . $lock_unlock}.''. "\n"; + // Display Hide/Show icon + $html .= 'commonvars\">\n"; + $html .= ''
+              .${'str' . $hide_show}.''. "\n"; - if ($grade) { + // Prepare lock/unlock string + $lock_unlock = 'lock'; + if ($object->is_locked()) { + $lock_unlock = 'unlock'; + } + // Print lock/unlock icon + $html .= 'commonvars\">\n"; + $html .= ''
+              .${'str' . $lock_unlock}.''. "\n"; + + if ($grade) { + + } + } else { + if ($USER->gradefeedback) { + // Display Edit/Add feedback icon + if (!empty($object->feedback)) { + $html .= 'commonvars\">\n"; + $html .= ''. "\n"; + } + } } return $html . '
'; } + ?> diff --git a/pix/i/feedback_add.gif b/pix/i/feedback_add.gif new file mode 100644 index 0000000000..a39b5fa097 Binary files /dev/null and b/pix/i/feedback_add.gif differ diff --git a/pix/t/feedback.gif b/pix/t/feedback.gif new file mode 100644 index 0000000000..e1cf9bb9d3 Binary files /dev/null and b/pix/t/feedback.gif differ diff --git a/pix/t/feedback_add.gif b/pix/t/feedback_add.gif new file mode 100644 index 0000000000..742ed4682e Binary files /dev/null and b/pix/t/feedback_add.gif differ