MDL-10207 Tabs added to category admin page and grader report page. I also changed the id URL variable to courseid. This may cause some issues as long as the current grade/lib.php library is used, but I thought we should use courseid instead of id.

This commit is contained in:
nicolasconnault 2007-06-22 17:34:14 +00:00
parent 91bfdd664c
commit 5ff96295e6
5 changed files with 47 additions and 9 deletions

View File

@ -26,13 +26,13 @@
require_once("../config.php");
require_once("../lib/gradelib.php");
$id = required_param('id'); // course id
$courseid = required_param('courseid'); // course id
$report = optional_param('report', 'user', PARAM_FILE); // course id
/// Make sure they can even access this course
if (!$course = get_record('course', 'id', $id)) {
if (!$course = get_record('course', 'id', $courseid)) {
print_error('nocourseid');
}
@ -93,7 +93,7 @@
/// Print the report selector at the top if there is more than one report
if ($reportnames) {
popup_form($CFG->wwwroot.'/grade/report.php?id='.$course->id.'&report=', $reportnames,
popup_form($CFG->wwwroot.'/grade/report.php?courseid='.$course->id.'&report=', $reportnames,
'choosegradereport', $report, '', '', '', false, 'self', get_string('gradereports', 'grades').':');
}

View File

@ -42,6 +42,8 @@ $param->categories = optional_param('categories', 0, PARAM_INT);
$param->element_type = optional_param('element_type', 0, PARAM_ALPHA);
$param->category_name = optional_param('category_name', 0, PARAM_ALPHA);
$report = optional_param('report', 0, PARAM_ALPHANUM);
print_object($param);
$tree = new grade_tree($param->courseid);
@ -178,5 +180,20 @@ if (!empty($param->action) && !empty($param->source) && confirm_sesskey()) {
}
}
print_heading(get_string('graderreport', 'grades'));
// Add tabs
if (empty($report)) {
$report = 'admin';
}
$tabs = $row = array();
$row[] = new tabobject('grader', 'report.php?courseid='.$course->id.'&report=grader',
get_string('viewgrades', 'grades'));
$row[] = new tabobject('admin', 'report.php?courseid='.$course->id.'&report=admin',
get_string('categories', 'grades'));
$tabs[] = $row;
print_tabs($tabs, $report);
echo $tree->get_edit_tree(1, null, $param->source, $param->action, $param->type);
?>

View File

@ -6,10 +6,11 @@ require_once($CFG->libdir.'/tablelib.php');
include_once($CFG->libdir.'/gradelib.php');
// get the params
$courseid = required_param('id', PARAM_INT);
$courseid = required_param('courseid', PARAM_INT);
$context = get_context_instance(CONTEXT_COURSE, $courseid);
$page = optional_param('page', 0, PARAM_INT);
$sortitemid = optional_param('sortitemid', 0, PARAM_ALPHANUM); // sort by which grade item
$report = optional_param('report', 0, PARAM_ALPHANUM);
// setting the sort order, this depends on last state
// all this should be in the new table class that we might need to use
@ -108,10 +109,24 @@ if ($grades = get_records_sql($sql)) {
print_heading('Grader Report');
// Add tabs
if (empty($report)) {
$report = 'grader';
}
$tabs = $row = array();
$row[] = new tabobject('grader', 'report.php?courseid='.$course->id.'&report=grader',
get_string('viewgrades', 'grades'));
$row[] = new tabobject('categories', 'report.php?courseid='.$course->id.'&report=admin',
get_string('categories', 'grades'));
$tabs[] = $row;
print_tabs($tabs, $report);
// base url for sorting by first/last name
$baseurl = 'report.php?id='.$courseid.'&report=grader&page='.$page;
$baseurl = 'report.php?courseid='.$courseid.'&report=grader&page='.$page;
// base url for paging
$pbarurl = 'report.php?id='.$courseid.'&report=grader&';
$pbarurl = 'report.php?courseid='.$courseid.'&report=grader&';
print_paging_bar($numusers, $page, $perpage, $pbarurl);
@ -229,4 +244,4 @@ if ($gtree = new grade_tree($courseid, false)) {
echo $reporthtml;
}
?>
?>

View File

@ -6,7 +6,7 @@ require_once($CFG->libdir.'/tablelib.php');
include_once($CFG->libdir.'/gradelib.php');
// get the params
$courseid = required_param('id', PARAM_INT);
$courseid = required_param('courseid', PARAM_INT);
if (!$userid = optional_param('user', 0, PARAM_INT)) {
// current user
$userid = $USER->id;
@ -22,7 +22,7 @@ if ($gradetree = new grade_tree($courseid)) {
* Table has 6 columns
*| pic | itemname/description | grade (grade_final) | percentage | rank | feedback |
*/
$baseurl = $CFG->wwwroot.'/grade/report?id='.$id.'&userid='.$userid;
$baseurl = $CFG->wwwroot.'/grade/report?courseid='.$id.'&userid='.$userid;
// setting up table headers
$tablecolumns = array('itempic', 'itemname', 'grade', 'percentage', 'rank', 'feedback');

View File

@ -0,0 +1,6 @@
<?PHP // $Id$
$string['modulename'] = 'Categories';
$string['admin:manage'] = 'Edit Grade Categories';
?>