]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-10386
authornicolasconnault <nicolasconnault>
Mon, 9 Jul 2007 19:59:45 +0000 (19:59 +0000)
committernicolasconnault <nicolasconnault>
Mon, 9 Jul 2007 19:59:45 +0000 (19:59 +0000)
- Renamed grade_report_shownotes preference to grade_report_showfeedback
- Added grade_report_quickgrading and grade_report_quickfeedback preferences
- Re-organised the grade_get_icons() function: The icons are all prepared first,
    then the preferences and conditions are applied to the selection of icons.
    This allows for a third $icons parameter, an array of icon names, which
    explicitly sets which icons should be returned by the function, regardless
    of preferences and options.
- Identified and fixed MDL-10391 bug with updating boolean user preferences (advcheckbox used)

grade/report/grader/index.php
grade/report/grader/preferences.php
grade/report/grader/preferences_form.php
grade/report/grader/settings.php
lang/en_utf8/grades.php
lib/gradelib.php
version.php

index 6dd23b296a5c4466d197c73e7cdfa3cf6205610e..6c9515f60eb357d744874201374636db950395e3 100644 (file)
@@ -31,8 +31,7 @@ function grader_report_print_toggle($type, $baseurl, $return=false) {
     $icons = array('eyecons' => 'hide',
                    'calculations' => 'calc',
                    'locks' => 'lock',
-                   'grandtotals' => 'sigma',
-                   'notes' => 'feedback');
+                   'grandtotals' => 'sigma');
 
     $pref_name = 'grade_report_show' . $type;
     $show_pref = get_user_preferences($pref_name, $CFG->$pref_name);
@@ -131,6 +130,9 @@ $showgrandtotals      = get_user_preferences('grade_report_showgrandtotals', $CF
 $showgroups           = get_user_preferences('grade_report_showgroups', $CFG->grade_report_showgroups);
 $aggregation_position = get_user_preferences('grade_report_aggregationposition', $CFG->grade_report_aggregationposition);
 $showscales           = get_user_preferences('grade_report_showscales', $CFG->grade_report_showscales);
+$showfeedback         = get_user_preferences('grade_report_showfeedback', $CFG->grade_report_showfeedback);
+$quickgrading         = get_user_preferences('grade_report_quickgrading', $CFG->grade_report_quickgrading);
+$quickfeedback        = get_user_preferences('grade_report_quickfeedback', $CFG->grade_report_quickfeedback);
 
 // Override perpage if set in URL
 if ($perpageurl = optional_param('perpage', 0, PARAM_INT)) {
@@ -140,8 +142,8 @@ if ($perpageurl = optional_param('perpage', 0, PARAM_INT)) {
 /// setting up groups
 
 // Prepare language strings
-$strsortasc          = get_string('sortasc', 'grades');
-$strsortdesc         = get_string('sortdesc', 'grades');
+$strsortasc  = get_string('sortasc', 'grades');
+$strsortdesc = get_string('sortdesc', 'grades');
 
 // base url for sorting by first/last name
 $baseurl = 'report.php?id='.$courseid.'&amp;perpage='.$perpage.'&amp;report=grader&amp;page='.$page;
@@ -388,7 +390,7 @@ if ($USER->gradeediting) {
     grader_report_print_toggle('calculations', $baseurl);
 }
 
-grader_report_print_toggle('notes', $baseurl);
+grader_report_print_toggle('feedback', $baseurl);
 grader_report_print_toggle('grandtotals', $baseurl);
 grader_report_print_toggle('groups', $baseurl);
 grader_report_print_toggle('scales', $baseurl);
@@ -493,7 +495,6 @@ $studentshtml = '';
 
 foreach ($users as $userid => $user) {
     // Student name and link
-
     $studentshtml .= '<tr><th class="user"><a href="' . $CFG->wwwroot . '/user/view.php?id='
                   . $user->id . '">' . fullname($user) . '</a></th>';
     foreach ($items as $item) {
@@ -533,13 +534,50 @@ foreach ($users as $userid => $user) {
                         $i++;
                         $scaleopt[$i] = $scaleoption;
                     }
-                    $studentshtml .= choose_from_menu($scaleopt, 'grade_'.$userid.'_'.$item->id,
+
+                    if ($quickgrading) {
+                        $studentshtml .= choose_from_menu($scaleopt, 'grade_'.$userid.'_'.$item->id,
                                                       $gradeval, get_string('nograde'), '', -1, true);
+                    } elseif ($scale = get_record('scale', 'id', $item->scaleid)) {
+                        $scales = explode(",", $scale->scale);
+
+                        // invalid grade if gradeval < 1
+                        if ((int) $gradeval < 1) {
+                            $studentshtml .= '-';
+                        } else {
+                            $studentshtml .= $scales[$gradeval-1];
+                        }
+                    } else {
+                        // no such scale, throw error?
+                    }
                 }
             } else {
-                $studentshtml .= '<input size="6" type="text" name="grade_'.$userid.'_'.$item->id.'" value="'.$gradeval.'"/>';
+                if ($quickgrading) {
+                    $studentshtml .= '<input size="6" type="text" name="grade_'.$userid.'_'.$item->id.'" value="'.$gradeval.'"/>';
+                } else {
+                    $studentshtml .= $gradeval;
+                }
+            }
+
+            $icons_html = '<div class="grade_icons">';
+
+            if (!$quickgrading) {
+                // If quickgrading is off, print an edit icon
+                $icons_html .= grade_get_icons($element, $gtree, array('edit'));
+            }
+
+            if ($showfeedback && $quickfeedback) {
+                $studentshtml .= '<input size="6" type="text" name="feedback_'.$userid.'_'.$item->id.'" value="'. @$grade->feedback . '"/>';
+            } elseif ($showfeedback) { // If quickfeedback is off but showfeedback is on, print an edit feedback icon
+                if (empty($grade->feedback)) {
+                    $icons_html .= grade_get_icons($element, $gtree, array('add_feedback'));
+                } else {
+                    $icons_html .= grade_get_icons($element, $gtree, array('edit_feedback'));
+                }
             }
 
+            $icons_html .= '</div>';
+            $studentshtml .= $icons_html;
         } else {
             // finalgrades[$userid][$itemid] could be null because of the outer join
             // in this case it's different than a 0
index 52a7845e9b6d49e687d33658c795e04ba06adff7..f2ade4a847bf348a31622ce539aa936db9bcd698 100644 (file)
@@ -51,6 +51,7 @@ if ($form = data_submitted()) {
                 break;
         }
     }
+
     redirect($CFG->wwwroot . '/grade/report.php?report=grader&amp;id='.$courseid, get_string('changessaved'), 1);
     exit;
 }
index 2d9b3b0f1541efacc314249adb6cc56b11aede74..172cd30c510a4edcffe17342d6deba02529d9298 100644 (file)
@@ -19,15 +19,17 @@ class grader_report_preferences_form extends moodleform {
 
 /// form definition with preferences defaults
 //--------------------------------------------------------------------------------
-        $preferences = array('bulkcheckboxes'         => 'checkbox', 
-                             'enableajax'             => 'checkbox', 
-                             'showcalculations'       => 'checkbox',
-                             'showeyecons'            => 'checkbox', 
-                             'showgrandtotals'        => 'checkbox', 
-                             'showgroups'             => 'checkbox',
-                             'showlocks'              => 'checkbox',
-                             'shownotes'              => 'checkbox',
-                             'showscales'             => 'checkbox', 
+        $preferences = array('bulkcheckboxes'         => 'advcheckbox',
+                             'enableajax'             => 'advcheckbox',
+                             'showcalculations'       => 'advcheckbox',
+                             'showeyecons'            => 'advcheckbox',
+                             'showgrandtotals'        => 'advcheckbox',
+                             'showgroups'             => 'advcheckbox',
+                             'showlocks'              => 'advcheckbox',
+                             'showfeedback'           => 'advcheckbox',
+                             'showscales'             => 'advcheckbox',
+                             'quickgrading'           => 'advcheckbox',
+                             'quickfeedback'          => 'advcheckbox',
                              'aggregationposition'    => array(get_string('left', 'grades'), get_string('right', 'grades')),
                              'aggregationview'        => array(get_string('full', 'grades'), get_string('compact', 'grades')),
                              'gradedisplaytype'       => array(get_string('raw', 'grades'), get_string('percentage', 'grades')),
@@ -39,7 +41,7 @@ class grader_report_preferences_form extends moodleform {
         foreach ($preferences as $pref => $type) {
             $full_pref  = 'grade_report_' . $pref;
             $pref_value = get_user_preferences($full_pref, $CFG->$full_pref);
-            
+
             $options = null;
             if (is_array($type)) {
                 $options = $type;
@@ -51,7 +53,7 @@ class grader_report_preferences_form extends moodleform {
             $mform->setDefault($full_pref, $pref_value);
             $mform->setType($full_pref, PARAM_INT);
         }
-        
+
         $mform->addElement('hidden', 'id');
         $mform->setType('id', PARAM_INT);
         $mform->setDefault('id', $course->id);
index 6eb65580f63f2954decdad13fe0b7f169621acab..57f99069519feba7919ac4bac7a72206909b23ff 100644 (file)
@@ -15,7 +15,7 @@ $settings->add(new admin_setting_configselect('grade_report_gradedisplaytype', g
                                           get_string('configgradedisplaytype', 'grades'), false,
                                           array(get_string('raw', 'grades'), get_string('percentage', 'grades'))));
 $settings->add(new admin_setting_configselect('grade_report_grandtotalsdisplaytype', get_string('grandtotalsdisplaytype', 'grades'),
-                                          get_string('configgrandtotalsdisplaytype', 'grades'), false, 
+                                          get_string('configgrandtotalsdisplaytype', 'grades'), false,
                                           array(get_string('raw', 'grades'), get_string('percentage', 'grades'))));
 $settings->add(new admin_setting_configcheckbox('grade_report_showcalculations', get_string('showcalculations', 'grades'),
                                             get_string('configshowcalculations', 'grades'), 0));
@@ -27,10 +27,14 @@ $settings->add(new admin_setting_configcheckbox('grade_report_showgrandtotals',
                                             get_string('configshowgrandtotals', 'grades'), 0));
 $settings->add(new admin_setting_configcheckbox('grade_report_showlocks', get_string('showlocks', 'grades'),
                                             get_string('configshowlocks', 'grades'), 0));
-$settings->add(new admin_setting_configcheckbox('grade_report_shownotes', get_string('shownotes', 'grades'),
-                                            get_string('configshownotes', 'grades'), 0));
+$settings->add(new admin_setting_configcheckbox('grade_report_showfeedback', get_string('showfeedback', 'grades'),
+                                            get_string('configshowfeedback', 'grades'), 0));
 $settings->add(new admin_setting_configcheckbox('grade_report_showscales', get_string('showscales', 'grades'),
                                             get_string('configshowscales', 'grades'), 0));
+$settings->add(new admin_setting_configcheckbox('grade_report_quickgrading', get_string('quickgrading', 'grades'),
+                                            get_string('configquickgrading', 'grades'), 1));
+$settings->add(new admin_setting_configcheckbox('grade_report_quickfeedback', get_string('quickfeedback', 'grades'),
+                                            get_string('configquickfeedback', 'grades'), 1));
 $settings->add(new admin_setting_configtext('grade_report_studentsperpage', get_string('studentsperpage', 'grades'),
                                         get_string('configstudentsperpage', 'grades'), 20));
 $settings->add(new admin_setting_configselect('grade_report_feedbackformat', get_string('feedbackformat', 'grades'),
index ce63d9b3dd9baa0cbc1573cf4e7785d5df2b3572..ff032688b3ec909d08ad27d17dd478fb9c7afd51 100644 (file)
@@ -37,12 +37,14 @@ $string['configenableajax'] = 'Adds a layer of AJAX functionality to the grader
 $string['configfeedbackformat'] = 'The format of feedback notes attached to grades. This also determines the interface element used to enter such feedback (htmleditor for HTML format).';
 $string['configgradedisplaytype'] = 'Grades can be shown as raw grades or as percentages (in reference to the minimum and maximum grades).';
 $string['configgrandtotalsdisplaytype'] = 'Grand totals can be shown as raw grades or as percentages (in reference to the minimum and maximum grades).';
+$string['configquickfeedback'] = 'Quick Feedback adds a text input element in each grade cell on the grader report, allowing you to edit many grades at once. You can then click the Update button to perform all these changes at once, instead of one at a time.';
+$string['configquickgrading'] = 'Quick Grading adds a text input element in each grade cell on the grader report, allowing you to edit the feedback for many grades at once. You can then click the Update button to perform all these changes at once, instead of one at a time.';
 $string['configshowcalculations'] = 'Whether to show calculator icons near each grade item and category, tooltips over calculated items and a visual indicator that a column is calculated.';
 $string['configshoweyecons'] = 'Whether to show an eye-con near each grade (controlling its visibility to the user).';
 $string['configshowgrandtotals'] = 'Show grand totals in the grader report.';
 $string['configshowgroups'] = 'Show group totals and means in the grader report.';
 $string['configshowlocks'] = 'Whether to show a lock/unlock icon near each grade.';
-$string['configshownotes'] = 'Whether to show a feedback icon (for adding/editing) near each grade.';
+$string['configshowfeedback'] = 'Whether to show a feedback icon (for adding/editing) near each grade.';
 $string['configshowscales'] = 'Display a row showing the scale for each grading item, in the grader report.';
 $string['configstudentsperpage'] = 'The number of students to display per page in the grader report.';
 $string['contract'] = 'Contract Category';
@@ -124,7 +126,7 @@ $string['hideeyecons'] = 'Hide eyecons';
 $string['hidegrandtotals'] = 'Hide grandtotals';
 $string['hidegroups'] = 'Hide groups';
 $string['hidelocks'] = 'Hide locks';
-$string['hidenotes'] = 'Hide feedback';
+$string['hidefeedback'] = 'Hide feedback';
 $string['hidescales'] = 'Hide scales';
 $string['highgradeascending'] = 'Sort by high grade ascending';
 $string['highgradedescending'] = 'Sort by high grade descending';
@@ -186,6 +188,8 @@ $string['points'] = 'points';
 $string['pointsascending'] = 'Sort by points ascending';
 $string['pointsdescending'] = 'Sort by points descdending';
 $string['preferences'] = 'Preferences';
+$string['quickfeedback'] = 'Quick Feedback';
+$string['quickgrading'] = 'Quick Grading';
 $string['rank'] = 'Rank';
 $string['raw'] = 'Raw';
 $string['rawpct'] = 'Raw %%';
@@ -211,7 +215,7 @@ $string['showeyecons'] = 'Show eye-cons';
 $string['showgrandtotals'] = 'Show grand totals';
 $string['showgroups'] = 'Show groups';
 $string['showlocks'] = 'Show locks';
-$string['shownotes'] = 'Show feedback';
+$string['showfeedback'] = 'Show feedback';
 $string['showscales'] = 'Show scales';
 $string['showhiddenitems'] = 'Show Hidden Items';
 $string['sort'] = 'sort';
index 6f6037fee157439e61eddd33c76ec41590b95009..9c4156886dd8ace4e4c0a22a94d8b5a1ef27bead 100644 (file)
@@ -711,12 +711,15 @@ function grade_oldgradebook_upgrade($courseid) {
  *
  * @param object $object
  * @param object $tree (A complete grade_tree object)
+ * @param array $icons An array of icon names that this function is explicitly requested to print, regardless of settings
+ * @param bool $limit If true, use the $icons array as the only icons that will be printed. If false, use it to exclude these icons.
  * @return string HTML
  */
-function grade_get_icons($element, $tree) {
+function grade_get_icons($element, $tree, $icons=null, $limit=true) {
     global $CFG;
     global $USER;
 
+
     // Load language strings
     $straddfeedback    = get_string("addfeedback", 'grades');
     $stredit           = get_string("edit");
@@ -745,114 +748,140 @@ function grade_get_icons($element, $tree) {
     $object = $element['object'];
     $type   = $element['type'];
 
+    // Add mock attributes in case the object is not of the right type
+    if ($type != 'grade') {
+        $object->feedback = '';
+    }
+
     // Load user preferences
     $aggregationview  = get_user_preferences('grade_report_aggregationview', $CFG->grade_report_aggregationview);
     $showeyecons      = get_user_preferences('grade_report_showeyecons', $CFG->grade_report_showeyecons);
     $showlocks        = get_user_preferences('grade_report_showlocks', $CFG->grade_report_showlocks);
-    $shownotes        = get_user_preferences('grade_report_shownotes', $CFG->grade_report_shownotes);
+    $showfeedback     = get_user_preferences('grade_report_showfeedback', $CFG->grade_report_showfeedback);
     $showcalculations = get_user_preferences('grade_report_showcalculations', $CFG->grade_report_showcalculations);
 
+    // Prepare image strings
+    $edit_category_icon = '<a href="report/grader/edit_category.php?courseid='.$object->courseid.'&amp;id='.$object->id.'">'
+                        . '<img src="'.$CFG->pixpath.'/t/edit.gif" class="iconsmall" alt="'
+                        . $stredit.'" title="'.$stredit.'" /></a>'. "\n";
+
+    $edit_item_icon = '<a href="report/grader/edit_item.php?courseid='.$object->courseid.'&amp;id='.$object->id.'">'
+                    . '<img src="'.$CFG->pixpath.'/t/edit.gif" class="iconsmall" alt="'
+                    . $stredit.'" title="'.$stredit.'" /></a>'. "\n";
+
+    $edit_grade_icon = '<a href="report/grader/edit_grade.php?courseid='.$object->courseid.'&amp;id='.$object->id.'">'
+                     . '<img src="'.$CFG->pixpath.'/t/edit.gif" class="iconsmall" alt="'
+                     . $stredit.'" title="'.$stredit.'" /></a>'. "\n";
+
+    $edit_calculation_icon = '<a href="report/grader/edit_calculation.php?courseid='.$object->courseid.'&amp;id='.$object->id.'">'
+                           . '<img src="'.$CFG->pixpath.'/t/calc.gif" class="iconsmall" alt="'
+                           . $streditcalculation.'" title="'.$streditcalculation.'" /></a>'. "\n";
+
+    $add_feedback_icon = '<a href="report/grader/edit_feedback.php?id=' . $object->id
+                       . "&amp;action=add&amp;courseid=$object->courseid\">\n"
+                       . '<img src="'.$CFG->pixpath.'/t/feedback_add.gif" class="iconsmall" alt="'.$straddfeedback.'" '
+                       . 'title="'.$straddfeedback.'" /></a>'. "\n";
+
+    $edit_feedback_icon = '<a href="report/grader/edit_feedback.php?id=' . $object->id
+                        . "&amp;action=edit&amp;courseid=$object->courseid\">\n"
+                        . '<img src="'.$CFG->pixpath.'/t/feedback.gif" class="iconsmall" alt="'.$streditfeedback.'" '
+                        . 'title="'.$streditfeedback.'" onmouseover="return overlib(\''.$object->feedback.'\', CAPTION, \''
+                        . $strfeedback.'\');" onmouseout="return nd();" /></a>'. "\n";
+
+    $view_feedback_icon = '<a href="report/grader/edit_feedback.php?id=' . $object->id
+                        . "&amp;action=view&amp;courseid=$object->courseid\">\n"
+                        . '<img onmouseover="return overlib(\''.$object->feedback.'\', CAPTION, \''
+                        . $strfeedback.'\');" onmouseout="return nd();" '
+                        . 'src="'.$CFG->pixpath.'/t/feedback.gif" class="iconsmall" alt="" /></a>'. "\n";
+
+    // Prepare Hide/Show icon state
+    $hide_show = 'hide';
+    if ($object->is_hidden()) {
+        $hide_show = 'show';
+    }
+
+    $show_hide_icon = '<a href="report.php?report=grader&amp;target='.$eid
+                    . "&amp;action=$hide_show$tree->commonvars\">\n"
+                    . '<img src="'.$CFG->pixpath.'/t/'.$hide_show.'.gif" class="iconsmall" alt="'
+                    . ${'str' . $hide_show}.'" title="'.${'str' . $hide_show}.'" /></a>'. "\n";
+
+    // Prepare lock/unlock string
+    $lock_unlock = 'lock';
+    if ($object->is_locked()) {
+        $lock_unlock = 'unlock';
+    }
+
+    // Print lock/unlock icon
+    $lock_unlock_icon = '<a href="report.php?report=grader&amp;target='.$eid
+                      . "&amp;action=$lock_unlock$tree->commonvars\">\n"
+                      . '<img src="'.$CFG->pixpath.'/t/'.$lock_unlock.'.gif" class="iconsmall" alt="'
+                      . ${'str' . $lock_unlock}.'" title="'.${'str' . $lock_unlock}.'" /></a>'. "\n";
+
+    // Prepare expand/contract string
+    $expand_contract = 'switch_minus'; // Default: expanded
+    $state = get_user_preferences('grade_category_' . $object->id, GRADE_CATEGORY_EXPANDED);
+    if ($state == GRADE_CATEGORY_CONTRACTED) {
+        $expand_contract = 'switch_plus';
+    }
+
+    $contract_expand_icon = '<a href="report.php?report=grader&amp;target=' . $eid
+                          . "&amp;action=$expand_contract$tree->commonvars\">\n"
+                          . '<img src="'.$CFG->pixpath.'/t/'.$expand_contract.'.gif" class="iconsmall" alt="'
+                          . ${'str' . $expand_contract}.'" title="'.${'str' . $expand_contract}.'" /></a>'. "\n";
+
+    // If an array of icon names is given, return only these in the order they are given
+    if (!empty($icons) && is_array($icons)) {
+        $new_html = '';
+
+        foreach ($icons as $icon_name) {
+            if ($icon_name == 'edit') {
+                $icon_name .= "_$type";
+            }
+            if ($limit) {
+                $new_html .= ${$icon_name . '_icon'};
+            } else {
+                ${'show_' . $icon_name} = false;
+            }
+        }
+        if ($limit) {
+            return $new_html;
+        } else {
+            $html .= $new_html;
+        }
+    }
+
     // Icons shown when edit mode is on
     if ($USER->gradeediting) {
         // Edit icon (except for grade_grades)
         if ($type == 'category') {
-            $html .= '<a href="report/grader/edit_category.php?courseid='.$object->courseid.'&amp;id='.$object->id.'">';
-            $html .= '<img src="'.$CFG->pixpath.'/t/edit.gif" class="iconsmall" alt="'
-                  .$stredit.'" title="'.$stredit.'" /></a>'. "\n";
+            $html .= $edit_category_icon;
 
         } else if ($type == 'item' or $type == 'courseitem' or $type == 'categoryitem') {
-            $html .= '<a href="report/grader/edit_item.php?courseid='.$object->courseid.'&amp;id='.$object->id.'">';
-            $html .= '<img src="'.$CFG->pixpath.'/t/edit.gif" class="iconsmall" alt="'
-                  .$stredit.'" title="'.$stredit.'" /></a>'. "\n";
-
-        } else if ($type == 'grade') {
-            // What is the purpose of edit_grade page?
-            /*
-            $html .= '<a href="report/grader/edit_grade.php?courseid='.$object->courseid.'&amp;id='.$object->id.'">';
-            $html .= '<img src="'.$CFG->pixpath.'/t/edit.gif" class="iconsmall" alt="'
-                  .$stredit.'" title="'.$stredit.'" /></a>'. "\n";
-            */
+            $html .= $edit_item_icon;
         }
 
         // Calculation icon for items and categories
         if ($showcalculations && $type != 'grade') {
-            $html .= '<a href="report/grader/edit_calculation.php?courseid='.$object->courseid.'&amp;id='.$object->id.'">';
-            $html .= '<img src="'.$CFG->pixpath.'/t/calc.gif" class="iconsmall" alt="'
-                  .$streditcalculation.'" title="'.$streditcalculation.'" /></a>'. "\n";
-        }
-
-        if ($shownotes) {
-            // Setup object identifier and show feedback icon if applicable
-            if ($type == 'grade' and $shownotes) {
-                // Display Edit/Add feedback icon
-                if (empty($object->feedback)) {
-                    $html .= '<a href="report/grader/edit_feedback.php?id=' . $object->id
-                          . "&amp;action=add&amp;courseid=$object->courseid\">\n";
-                    $html .= '<img src="'.$CFG->pixpath.'/t/feedback_add.gif" class="iconsmall" alt="'.$straddfeedback.'" '
-                          . 'title="'.$straddfeedback.'" /></a>'. "\n";
-                } else {
-                    $html .= '<a href="report/grader/edit_feedback.php?id=' . $object->id
-                          . "&amp;action=edit&amp;courseid=$object->courseid\">\n";
-                    $html .= '<img src="'.$CFG->pixpath.'/t/feedback.gif" class="iconsmall" alt="'.$streditfeedback.'" '
-                          . 'title="'.$streditfeedback.'" onmouseover="return overlib(\''.$object->feedback.'\', CAPTION, \''
-                      . $strfeedback.'\');" onmouseout="return nd();" /></a>'. "\n";
-                }
-            }
+            $html .= $edit_calculation_icon;
         }
 
         if ($showeyecons) {
-
-            // Prepare Hide/Show icon state
-            $hide_show = 'hide';
-            if ($object->is_hidden()) {
-                $hide_show = 'show';
-            }
-
-            // Display Hide/Show icon
-            $html .= '<a href="report.php?report=grader&amp;target='.$eid
-                  . "&amp;action=$hide_show$tree->commonvars\">\n";
-            $html .= '<img src="'.$CFG->pixpath.'/t/'.$hide_show.'.gif" class="iconsmall" alt="'
-                  .${'str' . $hide_show}.'" title="'.${'str' . $hide_show}.'" /></a>'. "\n";
+            $html .= $show_hide_icon;
         }
 
         if ($showlocks) {
-            // Prepare lock/unlock string
-            $lock_unlock = 'lock';
-            if ($object->is_locked()) {
-                $lock_unlock = 'unlock';
-            }
-
-            // Print lock/unlock icon
-            $html .= '<a href="report.php?report=grader&amp;target='.$eid
-                  . "&amp;action=$lock_unlock$tree->commonvars\">\n";
-            $html .= '<img src="'.$CFG->pixpath.'/t/'.$lock_unlock.'.gif" class="iconsmall" alt="'
-                  .${'str' . $lock_unlock}.'" title="'.${'str' . $lock_unlock}.'" /></a>'. "\n";
+            $html .= $lock_unlock_icon;
         }
 
         // If object is a category, display expand/contract icon
         if (get_class($object) == 'grade_category' && $aggregationview == GRADER_REPORT_AGGREGATION_VIEW_COMPACT) {
-            $expand_contract = 'switch_minus'; // Default: expanded
-
-            $state = get_user_preferences('grade_category_' . $object->id, GRADE_CATEGORY_EXPANDED);
-
-            if ($state == GRADE_CATEGORY_CONTRACTED) {
-                $expand_contract = 'switch_plus';
-            }
-
-            $html .= '<a href="report.php?report=grader&amp;target=' . $eid
-                  . "&amp;action=$expand_contract$tree->commonvars\">\n";
-            $html .= '<img src="'.$CFG->pixpath.'/t/'.$expand_contract.'.gif" class="iconsmall" alt="'
-                  .${'str' . $expand_contract}.'" title="'.${'str' . $expand_contract}.'" /></a>'. "\n";
+            $html .= $contract_expand_icon;
         }
     } else { // Editing mode is off
-        if ($shownotes) {
+        if ($showfeedback) {
             // Display view feedback icon
             if (!empty($object->feedback)) {
-                $html .= '<a href="report/grader/edit_feedback.php?id=' . $object->id
-                      . "&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";
+                $html .= $view_feedback_icon;
             }
         }
     }
index ecbb6e10690805c963038d75318cb5ae980cb6c6..582a90c5795e654e32b0bc71a032ff765a45d699 100644 (file)
@@ -6,7 +6,7 @@
 // This is compared against the values stored in the database to determine
 // whether upgrades should be performed (see lib/db/*.php)
 
-   $version = 2007070900;  // YYYYMMDD = date
+   $version = 2007070902;  // YYYYMMDD = date
                            //       XY = increments within a single day
 
    $release = '1.9 dev';    // Human-friendly version name