require_once($CFG->libdir.'/tablelib.php');
include_once($CFG->libdir.'/gradelib.php');
-// Prepare language strings
-$strsortasc = get_string('sortasc', 'grades');
-$strsortdesc = get_string('sortasc', 'grades');
-
/// processing posted grades here
if ($data = data_submitted()) {
$perpage = $perpageurl;
}
+// Prepare language strings
+$strsortasc = get_string('sortasc', 'grades');
+$strsortdesc = get_string('sortasc', 'grades');
+
+// base url for sorting by first/last name
+$baseurl = 'report.php?id='.$courseid.'&report=grader&page='.$page;
+// base url for paging
+$pbarurl = 'report.php?id='.$courseid.'&report=grader&';
+
// Grab the grade_tree for this course
$gtree = new grade_tree($courseid);
// roles to be displaye in the gradebook
$gradebookroles = $CFG->gradebookroles;
-// pulls out the userids of the users to be display, and sort them
-// the right outer join is needed because potentially, it is possible not
-// to have the corresponding entry in grade_grades table for some users
-// this is check for user roles because there could be some users with grades
-// but not supposed to be displayed
-
+/*
+* pulls out the userids of the users to be display, and sort them
+* the right outer join is needed because potentially, it is possible not
+* to have the corresponding entry in grade_grades table for some users
+* this is check for user roles because there could be some users with grades
+* but not supposed to be displayed
+*/
if (is_numeric($sortitemid)) {
$sql = "SELECT u.id, u.firstname, u.lastname
FROM {$CFG->prefix}grade_grades g RIGHT OUTER JOIN
}
}
-print_heading('Grader Report');
-
-// Add tabs
-$currenttab = 'graderreport';
-include('tabs.php');
-
-// base url for sorting by first/last name
-$baseurl = 'report.php?id='.$courseid.'&report=grader&page='.$page;
-// base url for paging
-$pbarurl = 'report.php?id='.$courseid.'&report=grader&';
-
-print_paging_bar($numusers, $page, $perpage, $pbarurl);
-
/// With the users in an sorted array and grades fetched, we can not print the main html table
// 1. Fetch all top-level categories for this course, with all children preloaded, sorted by sortorder
$firstarrow = '';
}
-// first name/last name column
+/********* BEGIN OUTPUT *********/
+
+print_heading('Grader Report');
+
+// Add tabs
+$currenttab = 'graderreport';
+include('tabs.php');
+
+print_paging_bar($numusers, $page, $perpage, $pbarurl);
$items = array();
+// Prepare Table Headers
$headerhtml = '';
$numrows = count($gtree->levels);
+
foreach ($gtree->levels as $key=>$row) {
if ($key == 0) {
// do not diplay course grade category
$headerhtml .= '<tr class="heading">';
if ($key == $numrows - 1) {
- $headerhtml .= '<th class="user"><a href="'.$baseurl.'&sortitemid=firstname">Firstname</a> '. $firstarrow. '/ <a href="'.$baseurl.'&sortitemid=lastname">Lastname </a>'. $lastarrow .'</th>';
+ $headerhtml .= '<th class="user"><a href="'.$baseurl.'&sortitemid=firstname">Firstname</a> '
+ . $firstarrow. '/ <a href="'.$baseurl.'&sortitemid=lastname">Lastname </a>'. $lastarrow .'</th>';
} else {
$headerhtml .= '<td class="topleft"> </td>';
}
}
if ($object->itemtype == 'mod') {
- $icon = '<img src="'.$CFG->modpixpath.'/'.$object->itemmodule.'/icon.gif" class="icon" alt="'.get_string('modulename', $object->itemmodule).'"/>';
+ $icon = '<img src="'.$CFG->modpixpath.'/'.$object->itemmodule.'/icon.gif" class="icon" alt="'
+ .get_string('modulename', $object->itemmodule).'"/>';
} else if ($object->itemtype == 'manual') {
//TODO: add manual grading icon
- $icon = '<img src="'.$CFG->pixpath.'/t/edit.gif" class="icon" alt="'.get_string('manualgrade', 'grades').'"/>'; // TODO: localize
+ $icon = '<img src="'.$CFG->pixpath.'/t/edit.gif" class="icon" alt="'.get_string('manualgrade', 'grades')
+ .'"/>'; // TODO: localize
}
$headerhtml .= '</tr>';
}
-$studentshtml = '';
+// Prepare Table Rows
+$studentshtml = '';
foreach ($users as $userid => $user) {
$studentshtml .= '<tr><th class="user">' . $user->firstname . ' ' . $user->lastname . '</th>';
$i++;
$scaleopt[$i] = $scaleoption;
}
- $studentshtml .= choose_from_menu ($scaleopt, 'grade_'.$userid.'_'.$item->id, $gradeval, get_string('nograde'), '', -1, true);
+ $studentshtml .= choose_from_menu($scaleopt, 'grade_'.$userid.'_'.$item->id,
+ $gradeval, get_string('nograde'), '', -1, true);
}
} else {
$studentshtml .= '<input size="6" type="text" name="grade_'.$userid.'_'.$item->id.'" value="'.$gradeval.'"/>';
require_once '../../../config.php';
require_once $CFG->libdir . '/gradelib.php';
-$courseid = optional_param('id', 0 , PARAM_INT);
+$courseid = required_param('id', PARAM_INT);
/// Make sure they can even access this course
require_login($course->id);
$context = get_context_instance(CONTEXT_COURSE, $course->id);
+require_capability('gradereport/grader:manage', $context);
+
+// If data submitted, then process and store.
+if ($form = data_submitted()) {
+ foreach ($form as $preference => $value) {
+ switch ($preference) {
+ case 'persistflt':
+ set_user_preference('calendar_persistflt', intval($value));
+ break;
+ default:
+ set_user_preference($preference, $value);
+ break;
+ }
+ }
+ redirect($CFG->wwwroot . '/grade/report.php?report=grader&id='.$courseid, get_string('changessaved'), 1);
+ exit;
+}
$strgrades = get_string('grades');
$strgraderreport = get_string('graderreport', 'grades');
$navigation = build_navigation($crumbs);
-print_header_simple($strgrades.': '.$strgraderreport,': '.$strgradepreferences, $navigation,
+print_header_simple($strgrades.': '.$strgraderreport . ': ' . $strgradepreferences,': '.$strgradepreferences, $navigation,
'', '', true, '', navmenu($course));
print_heading(get_string('preferences'));
// Add tabs
$currenttab = 'preferences';
include('tabs.php');
+print_simple_box_start("center");
+
+include('./preferences_form.php');
+$mform = new grader_report_preferences_form('preferences.php', compact('course'));
+echo $mform->display();
+print_simple_box_end();
+
print_footer($course);
?>
$string['categoriesedit'] = 'Edit Categories';
$string['categoryname'] = 'Category name';
$string['choosecategory'] = 'Select Category';
+$string['compact'] = 'Compact';
$string['configaggregationposition'] = 'The position of the aggregation column in the grader report table, in reference to the raw grades.';
$string['configaggregationview'] = 'The way aggregations are displayed: either alongside the raw grades, or in a compact form in which only one type is shown in the table at once: the raw grades OR the aggregated grades.';
$string['configbulkcheckboxes'] = 'Checkboxes near each grade for Bulk grade operations.';
$string['feedbackformat'] = 'Feedback format';
$string['forelementtypes'] = ' for the selected $a';
$string['forstudents'] = 'For Students';
+$string['full'] = 'Full';
$string['grade'] = 'Grade';
$string['gradebook'] = 'Gradebook';
$string['gradebookhiddenerror'] = 'The gradebook is currently set to hide everything from students.';
$string['highgradeascending'] = 'Sort by high grade ascending';
$string['highgradedescending'] = 'Sort by high grade descending';
$string['highgradeletter'] = 'High';
+$string['html'] = 'HTML';
$string['identifier'] = 'Identify user by';
$string['importcsv'] = 'Import CSV';
$string['importfailed'] = 'Import failed';
$string['iteminfo'] = 'Item info';
$string['itemname'] = 'Item name';
$string['items'] = 'Items';
+$string['left'] = 'Left';
$string['lettergrade'] = 'Letter Grade';
$string['lettergradenonnumber'] = 'Low and/or High grade were non-numeric for';
$string['letters'] = 'Letters';
$string['outcome'] = 'Outcome';
$string['pctoftotalgrade'] = '%% of total grade';
$string['percent'] = 'Percent';
+$string['percentage'] = 'Percentage';
$string['percentascending'] = 'Sort by percent ascending';
$string['percentdescending'] = 'Sort by percent descending';
$string['percentshort'] = '%%';
$string['pointsdescending'] = 'Sort by points descdending';
$string['preferences'] = 'Preferences';
$string['rank'] = 'Rank';
+$string['raw'] = 'Raw';
$string['rawpct'] = 'Raw %%';
$string['reprintheaders'] = 'Reprint Headers';
+$string['right'] = 'Right';
$string['savechanges'] = 'Save Changes';
$string['savepreferences'] = 'Save Preferences';
$string['scaledpct'] = 'Scaled %%';
$string['studentsperpage'] = 'Students per page';
$string['subcategory'] = 'Normal Category';
$string['synclegacygrades'] = 'Synchronise legacy grades';
+$string['text'] = 'Text';
$string['topcategory'] = 'Super Category';
$string['total'] = 'Total';
$string['totalweight100'] = 'The total weight is equal to 100';