Permalink
Browse files

MDL-10386

- 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)
  • Loading branch information...
1 parent 72e4214 commit ce0c946a1fe5b6e2a7edcd175b79874a548b7aed nicolasconnault committed Jul 9, 2007
@@ -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 @@ function grader_report_print_toggle($type, $baseurl, $return=false) {
$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 @@ function grader_report_print_toggle($type, $baseurl, $return=false) {
/// 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.'&perpage='.$perpage.'&report=grader&page='.$page;
@@ -388,7 +390,7 @@ function grader_report_print_toggle($type, $baseurl, $return=false) {
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 @@ function grader_report_print_toggle($type, $baseurl, $return=false) {
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 @@ function grader_report_print_toggle($type, $baseurl, $return=false) {
$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
@@ -51,6 +51,7 @@
break;
}
}
+
redirect($CFG->wwwroot . '/grade/report.php?report=grader&amp;id='.$courseid, get_string('changessaved'), 1);
exit;
}
@@ -19,15 +19,17 @@ function definition() {
/// 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 @@ function definition() {
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 @@ function definition() {
$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);
@@ -15,7 +15,7 @@
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 @@
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'),
View
@@ -37,12 +37,14 @@
$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['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['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['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';
Oops, something went wrong.

0 comments on commit ce0c946

Please sign in to comment.