+++ /dev/null
-<?php //$Id$
-
-require_once '../../../config.php';
-require_once $CFG->libdir.'/gradelib.php';
-require_once 'edit_feedback_form.php';
-
-$courseid = required_param('courseid', PARAM_INT);
-$id = optional_param('id', 0, PARAM_INT);
-$action = optional_param('action', 'view', PARAM_ALPHA);
-
-if (!$course = get_record('course', 'id', $courseid)) {
- print_error('nocourseid');
-}
-
-require_login($course);
-
-$context = get_context_instance(CONTEXT_COURSE, $course->id);
-require_capability('gradereport/grader:manage', $context);
-
-// default return url
-$returnurl = $CFG->wwwroot.'/grade/report.php?report=grader&id='.$course->id;
-
-$mform = new edit_feedback_form();
-if ($grade_text = get_record('grade_grades_text', 'gradeid', $id)) {
- $mform->set_data($grade_text);
-} else {
- $mform->set_data(array('courseid'=>$course->id, 'id' => $id));
-}
-
-if ($mform->is_cancelled()) {
- redirect($returnurl);
-
-} else if ($data = $mform->get_data()) {
- $data->gradeid = $data->id;
- unset($data->id);
-
- $grade_text = new grade_grades_text(array('gradeid'=>$id));
- grade_grades_text::set_properties($grade_text, $data);
- if (empty($grade_text->id)) {
- $grade_text->insert();
-
- } else {
- $grade_text->update();
- }
-
- redirect($returnurl, get_string('feedbacksaved', 'grades'), 1);
-}
-
-// Get extra data related to this feedback
-$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";
-
-$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);
-
-if (!empty($extra_info->itemmodule) && !empty($extra_info->iteminstance)) {
- $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' && !empty($grade_text->feedback)) {
- $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.'&report=grader', 'type'=>'misc'),
- array('name'=>$heading, 'link'=>'', 'type'=>'misc'));
-
-$navigation = build_navigation($nav);
-
-/*********** BEGIN OUTPUT *************/
-
-print_header_simple($strgrades . ': ' . $strgraderreport . ': ' . $heading,
- ': ' . $heading , $navigation, '', '', true, '', navmenu($course));
-
-print_heading($heading);
-
-print_simple_box_start("center");
-
-// Student name and link
-echo "<p><strong>$strstudent:</strong> <a href=\"" . $CFG->wwwroot . '/user/view.php?id='
- . $extra_info->userid . '">' . fullname($extra_info) . "</a></p>";
-
-// Grade item name and link
-if (!empty($extra_info->course_module) && !empty($extra_info->itemmodule)) {
- echo "<p><strong>$strgradeitem:</strong> <a href=\"" . $CFG->wwwroot . '/mod/' . $extra_info->itemmodule
- . '/view.php?id=' . $extra_info->course_module->id . "&courseid=$courseid\">$extra_info->itemname</a></p>";
-}
-
-// Final grade and link to scale if applicable
-if (!empty($extra_info->finalgrade)) {
- $openlink = '';
- $closelink = '';
-
- if (!empty($extra_info->scaleid)) {
- $openlink = '<a href="' . $CFG->wwwroot . '/course/scales.php?id=' . $courseid . '&scaleid='
- . $extra_info->scaleid . '">';
- $closelink = '</a>';
- }
- echo "<p><strong>$strgrade:</strong> " . $extra_info->finalgrade . "$openlink $stronascaleof $closelink</p>";
-}
-
-// Form if in edit or add modes
-if ($action != 'view') {
- $mform->display();
-} else { // Feedback string and Back button if in View mode
- echo $feedback;
- echo "<button onclick=\"window.location='" . $CFG->wwwroot . "/grade/report.php?report=grader&id=$courseid';\">"
- . get_string('back') . '</button>';
-}
-
-print_simple_box_end();
-
-print_footer($course);
-die;
+++ /dev/null
-<?php //$Id$
-
-require_once $CFG->libdir.'/formslib.php';
-
-class edit_feedback_form extends moodleform {
- function definition() {
- global $CFG, $USER;
- $mform =& $this->_form;
-
- $feedbackformat = get_user_preferences('grade_report_feedbackformat', $CFG->grade_report_feedbackformat);
-
- // visible elements
- // User preference determines the format
- if ($CFG->htmleditor && $USER->htmleditor && $feedbackformat == GRADER_REPORT_FEEDBACK_FORMAT_HTML) {
- $mform->addElement('htmleditor', 'feedback', get_string('feedback', 'grades'),
- array('rows'=> '15', 'course' => optional_param('courseid', PARAM_INT), 'cols'=>'45'));
- } else {
- $mform->addElement('textarea', 'feedback', get_string('feedback', 'grades'));
- }
-
- //TODO: add other elements
-
- // hidden params
- $mform->addElement('hidden', 'id', 0);
- $mform->setType('gradeid', PARAM_INT);
-
- $mform->addElement('hidden', 'courseid', 0);
- $mform->setType('courseid', PARAM_INT);
-
-//-------------------------------------------------------------------------------
- // buttons
- $this->add_action_buttons();
- }
-}
-
-?>
$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);
// Prepare language strings
$strsortasc = get_string('sortasc', 'grades');
$strsortdesc = get_string('sortdesc', 'grades');
+$strfeedback = get_string("feedback");
// base url for sorting by first/last name
$baseurl = 'report.php?id='.$courseid.'&perpage='.$perpage.'&report=grader&page='.$page;
grader_report_print_toggle('calculations', $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);
$studentshtml .= '<td>';
}
+ // Do not show any icons if no grade (no record in DB to match)
+ if (!empty($grade->id)) {
+ // emulate grade element
+ $grade->courseid = $course->id;
+ $grade->grade_item = $item; // this may speedup is_hidden() and other grade_grades methods
+ $element = array ('eid'=>'g'.$grade->id, 'object'=>$grade, 'type'=>'grade');
+ $studentshtml .= grade_get_icons($element, $gtree);
+ }
+
// if in editting mode, we need to print either a text box
// or a drop down (for scales)
}
}
- // Prepare icons for when quickgrading or quickfeedback are switched off
- $icons_html = '<div class="grade_icons">';
-
- // If quickgrading is off, print an edit icon
- if (!$quickgrading) {
- $icons_html .= grade_get_icons($element, $gtree, array('edit'));
- }
// If quickfeedback is on, print an input element
- if ($showfeedback && $quickfeedback) {
+ if ($quickfeedback) {
$studentshtml .= '<input size="6" type="text" name="feedback_'.$userid.'_'.$item->id.'" value="'. s($grade->feedback) . '"/>';
-
- } else if ($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>';
-
- if (!$quickfeedback || !$quickgrading) {
- $studentshtml .= $icons_html;
+ $studentshtml .= '<div class="grade_icons">' . grade_get_icons($element, $gtree, array('edit')) . '</div>';
+ } else {
+ // If feedback present, surround grade with feedback tooltip
+ if (!empty($grade->feedback)) {
+ $studentshtml .= '<span onmouseover="return overlib(\''.$grade->feedback.'\', CAPTION, \''
+ . $strfeedback.'\');" onmouseout="return nd();">';
}
- } else {
// finalgrades[$userid][$itemid] could be null because of the outer join
// in this case it's different than a 0
if ($item->scaleid) {
$studentshtml .= get_grade_clean($gradeval);
}
}
- }
-
- // Do not show any icons if no grade (no record in DB to match)
- if (!empty($grade->id)) {
- // emulate grade element
- $grade->courseid = $course->id;
- $grade->grade_item = $item; // this may speedup is_hidden() and other grade_grades methods
- $element = array ('eid'=>'g'.$grade->id, 'object'=>$grade, 'type'=>'grade');
- $studentshtml .= grade_get_icons($element, $gtree);
+ if (!empty($grade->feedback)) {
+ $studentshtml .= '</span>';
+ }
}
if (!empty($gradeserror[$item->id][$userid])) {
'showgrandtotals' => 'advcheckbox',
'showgroups' => 'advcheckbox',
'showlocks' => 'advcheckbox',
- 'showfeedback' => 'advcheckbox',
'showscales' => 'advcheckbox',
'quickgrading' => 'advcheckbox',
'quickfeedback' => 'advcheckbox',
$settings->add(new admin_setting_configselect('grade_report_aggregationposition', get_string('aggregationposition', 'grades'),
get_string('configaggregationposition', 'grades'), false,
array(get_string('left', 'grades'), get_string('right', 'grades'))));
+
$settings->add(new admin_setting_configselect('grade_report_aggregationview', get_string('aggregationview', 'grades'),
get_string('configaggregationview', 'grades'), false,
array(get_string('full', 'grades'), get_string('compact', 'grades'))));
+
$settings->add(new admin_setting_configcheckbox('grade_report_bulkcheckboxes', get_string('bulkcheckboxes', 'grades'),
get_string('configbulkcheckboxes', 'grades'), 0));
+
$settings->add(new admin_setting_configcheckbox('grade_report_enableajax', get_string('enableajax', 'grades'),
get_string('configenableajax', 'grades'), 0));
+
$settings->add(new admin_setting_configselect('grade_report_gradedisplaytype', get_string('gradedisplaytype', 'grades'),
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,
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));
+
$settings->add(new admin_setting_configcheckbox('grade_report_showeyecons', get_string('showeyecons', 'grades'),
get_string('configshoweyecons', 'grades'), 0));
+
$settings->add(new admin_setting_configcheckbox('grade_report_showgroups', get_string('showgroups', 'grades'),
get_string('configshowgroups', 'grades'), 0));
+
$settings->add(new admin_setting_configcheckbox('grade_report_showgrandtotals', get_string('showgrandtotals', 'grades'),
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_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'),
get_string('configfeedbackformat', 'grades'), false,
array(get_string('text', 'grades'), get_string('html', 'grades'))));
+
$settings->add(new admin_setting_configselect('grade_report_decimalpoints', get_string('decimalpoints', 'grades'),
get_string('configdecimalpoints', 'grades'), 2,
array( '0' => '0',
$string['configenableajax'] = 'Adds a layer of AJAX functionality to the grader report, simplifying and speeding up common operations. Depends on Javascript being switched on at the user\'s browser level.';
$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['configgrandtotalsdisplaytype'] = 'Column 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['configshoweyecons'] = 'Whether to show a show/hide icon near each grade (controlling its visibility to the user).';
+$string['configshowgrandtotals'] = 'Show column 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['configshowfeedback'] = 'Whether to show a feedback icon (for adding/editing) near each grade.';
$string['graderreport'] = 'Grader report';
$string['gradetype'] = 'Grade type';
$string['gradeweighthelp'] = 'Grade Weight Help';
-$string['grandtotalsdisplaytype'] = 'Grand totals display type';
+$string['grandtotalsdisplaytype'] = 'Column totals display type';
$string['hideadvanced'] = 'Hide Advanced Features';
$string['hidecalculations'] = 'Hide calculations';
$string['hidecategory'] = 'Hidden';
-$string['hideeyecons'] = 'Hide eyecons';
+$string['hideeyecons'] = 'Hide show/hide icons';
$string['hidegrandtotals'] = 'Hide grandtotals';
$string['hidegroups'] = 'Hide groups';
$string['hidelocks'] = 'Hide locks';
$string['setweights'] = 'Set Weights';
$string['showallstudents'] = 'Show All Students';
$string['showcalculations'] = 'Show calculations';
-$string['showeyecons'] = 'Show eye-cons';
-$string['showgrandtotals'] = 'Show grand totals';
+$string['showeyecons'] = 'Show show/hide icons';
+$string['showgrandtotals'] = 'Show column totals';
$string['showgroups'] = 'Show groups';
$string['showlocks'] = 'Show locks';
$string['showfeedback'] = 'Show feedback';
// Load language strings
- $straddfeedback = get_string("addfeedback", 'grades');
$stredit = get_string("edit");
- $streditfeedback = get_string("editfeedback", 'grades');
$streditcalculation= get_string("editcalculation", 'grades');
$strfeedback = get_string("feedback");
$strmove = get_string("move");
$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);
- $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_item_icon = '<a href="report/grader/edit_item.php?courseid='.$object->courseid.'&id='.$object->id.'">'
. '<img src="'.$CFG->pixpath.'/t/edit.gif" class="iconsmall" alt="'
. $stredit.'" title="'.$stredit.'" /></a>'. "\n";
+ $overlib = '';
+ if (!empty($object->feedback)) {
+ $overlib = 'onmouseover="return overlib(\''.$object->feedback.'\', CAPTION, \''
+ . $strfeedback.'\');" onmouseout="return nd();"';
+ }
$edit_grade_icon = '<a href="report/grader/edit_grade.php?courseid='.$object->courseid.'&id='.$object->id.'">'
- . '<img src="'.$CFG->pixpath.'/t/edit.gif" class="iconsmall" alt="'
- . $stredit.'" title="'.$stredit.'" /></a>'. "\n";
+ . '<img ' . $overlib . ' 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.'&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
- . "&action=add&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
- . "&action=edit&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
- . "&action=view&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()) {
}
// Print lock/unlock icon
+
$lock_unlock_icon = '<a href="report.php?report=grader&target='.$eid
. "&action=$lock_unlock$tree->commonvars\">\n"
. '<img src="'.$CFG->pixpath.'/t/'.$lock_unlock.'.gif" class="iconsmall" alt="'
$html .= $contract_expand_icon;
}
} else { // Editing mode is off
- if ($showfeedback) {
- // Display view feedback icon
- if (!empty($object->feedback)) {
- $html .= $view_feedback_icon;
- }
- }
}
return $html . '</div>';