diff --git a/grade/report.php b/grade/report.php
index 7448c15c739d1..c9dc916dd6220 100644
--- a/grade/report.php
+++ b/grade/report.php
@@ -81,7 +81,7 @@
$strgrades = get_string('grades');
- $crumbs[] = array('name' => $strgrades, 'link' => '', 'type' => 'misc');
+ $crumbs[] = array('name' => $strgrades, 'link' => $CFG->wwwroot . '/grade/index.php?id='.$courseid, 'type' => 'misc');
$crumbs[] = array('name' => $reportnames[$report], 'link' => '', 'type' => 'misc');
$navigation = build_navigation($crumbs);
diff --git a/grade/report/grader/category.php b/grade/report/grader/category.php
index 2c8e9e1b253b1..bd90ee11b7c01 100644
--- a/grade/report/grader/category.php
+++ b/grade/report/grader/category.php
@@ -27,6 +27,220 @@
require_once $CFG->libdir . '/grade/grade_tree.php';
require_once $CFG->libdir . '/gradelib.php';
+/**
+ * Returns a HTML list with sorting arrows and insert boxes. This is a recursive method.
+ * @param int $level The level of recursion
+ * @param array $elements The elements to display in a list. Defaults to this->tree_array
+ * @param int $source_sortorder A source sortorder, given when an element needs to be moved or inserted.
+ * @param string $action 'move' or 'insert'
+ * @param string $source_type 'topcat', 'subcat' or 'item'
+ * @return string HTML code
+ */
+function get_edit_tree($tree, $level=1, $elements=NULL, $source_sortorder=NULL, $action=NULL, $source_type=NULL) {
+ if (empty($tree->tree_array)) {
+ return null;
+ } else {
+ global $CFG;
+ global $USER;
+
+ $strmove = get_string("move");
+ $strmoveup = get_string("moveup");
+ $strmovedown = get_string("movedown");
+ $strmovehere = get_string("movehere");
+ $strcancel = get_string("cancel");
+ $stredit = get_string("edit");
+ $strdelete = get_string("delete");
+ $strhide = get_string("hide");
+ $strshow = get_string("show");
+ $strlock = get_string("lock", 'grades');
+ $strunlock = get_string("unlock", 'grades');
+ $strnewcategory = get_string("newcategory", 'grades');
+ $strcategoryname = get_string("categoryname", 'grades');
+ $strcreatecategory = get_string("createcategory", 'grades');
+ $strsubcategory = get_string("subcategory", 'grades');
+ $stritems = get_string("items", 'grades');
+ $strcategories = get_string("categories", 'grades');
+
+ $list = '';
+ $closing_form_tags = '';
+
+ if (empty($elements)) {
+ $list .= '
\n";
+ } else {
+ $list = '' . "\n$closing_form_tags";
+
+ return $list;
+ }
+
+ return false;
+}
+
$param = new stdClass();
$param->courseid = optional_param('id', 0 , PARAM_INT);
@@ -58,13 +272,14 @@
$strgraderreport = get_string('graderreport', 'grades');
$strcategoriesedit = get_string('categoriesedit', 'grades');
-$crumbs[] = array('name' => $strgrades, 'link' => '', 'type' => 'misc');
-$crumbs[] = array('name' => $strgraderreport, 'link' => '', 'type' => 'misc');
+$crumbs[] = array('name' => $strgrades, 'link' => $CFG->wwwroot . '/grade/index.php?id='.$courseid, 'type' => 'misc');
+$crumbs[] = array('name' => $strgraderreport,
+ 'link' => $CFG->wwwroot . '/grade/report.php?id=' . $courseid . '&report=grader', 'type' => 'misc');
$crumbs[] = array('name' => $strcategoriesedit, 'link' => '', 'type' => 'misc');
$navigation = build_navigation($crumbs);
-print_header_simple($strgrades.': '.$strgraderreport.': '.$strcategoriesedit, $navigation,
+print_header_simple($strgrades.': '.$strgraderreport, ': '.$strcategoriesedit, $navigation,
'', '', true, '', navmenu($course));
$tree = new grade_tree($param->courseid);
@@ -205,6 +420,6 @@
// Add tabs
$currenttab = 'editcategory';
include('tabs.php');
-echo $tree->get_edit_tree(1, null, $param->source, $param->action, $param->type);
+echo get_edit_tree($tree, 1, null, $param->source, $param->action, $param->type);
print_footer($course);
?>
diff --git a/grade/report/grader/preferences.php b/grade/report/grader/preferences.php
index f44fc81bf9bf2..02860eb2c5130 100644
--- a/grade/report/grader/preferences.php
+++ b/grade/report/grader/preferences.php
@@ -42,13 +42,14 @@
$strgraderreport = get_string('graderreport', 'grades');
$strgradepreferences = get_string('gradepreferences', 'grades');
-$crumbs[] = array('name' => $strgrades, 'link' => '', 'type' => 'misc');
-$crumbs[] = array('name' => $strgraderreport, 'link' => '', 'type' => 'misc');
+$crumbs[] = array('name' => $strgrades, 'link' => $CFG->wwwroot . '/grade/index.php?id='.$courseid, 'type' => 'misc');
+$crumbs[] = array('name' => $strgraderreport,
+ 'link' => $CFG->wwwroot . '/grade/report.php?id=' . $courseid . '&report=grader', 'type' => 'misc');
$crumbs[] = array('name' => $strgradepreferences, 'link' => '', 'type' => 'misc');
$navigation = build_navigation($crumbs);
-print_header_simple($strgrades.': '.$strgraderreport.': '.$strgradepreferences, $navigation,
+print_header_simple($strgrades.': '.$strgraderreport,': '.$strgradepreferences, $navigation,
'', '', true, '', navmenu($course));
print_heading(get_string('preferences'));
// Add tabs
diff --git a/lang/en_utf8/grades.php b/lang/en_utf8/grades.php
index b76b78f5bf5f7..94963bf185a87 100644
--- a/lang/en_utf8/grades.php
+++ b/lang/en_utf8/grades.php
@@ -59,6 +59,7 @@
$string['gradeletter'] = 'Grade Letter';
$string['gradeletterhelp'] = 'Grade Letter Help';
$string['gradeletternote'] = 'To delete a grade letter just empty any of the
three text areas for that letter and click submit.';
+$string['gradepreferences'] = 'Grade Preferences';
$string['gradepreferenceshelp'] = 'Grade Preferences Help';
$string['grades'] = 'Grades';
$string['gradereports'] = 'Grades report';
diff --git a/lib/grade/grade_tree.php b/lib/grade/grade_tree.php
index c05bd682489e9..2962a55b1c431 100644
--- a/lib/grade/grade_tree.php
+++ b/lib/grade/grade_tree.php
@@ -116,7 +116,7 @@ function grade_tree($courseid=NULL, $include_grades=false, $tree=NULL) {
$this->courseid = $courseid;
$this->include_grades = $include_grades;
- $this->commonvars = "&sesskey=$USER->sesskey&courseid=$this->courseid";
+ $this->commonvars = "&sesskey=$USER->sesskey&id=$this->courseid";
if (!empty($tree)) {
$this->tree_array = $tree;
@@ -832,97 +832,6 @@ function get_filler($object) {
return $filler_array;
}
- /**
- * Returns a HTML table with all the grades in the course requested, or all the grades in the site.
- * IMPORTANT: This method (and its associated methods) assumes that we are using only 2 levels of categories (topcat and subcat)
- * @todo Return extra column for students
- * @todo Return a row of final grades for each student
- * @todo Return icons
- * @todo Return totals
- * @todo Return row below headers for grading range
- * @return string HTML table
- */
- function display_grades() {
- global $CFG;
-
- // 1. Fetch all top-level categories for this course, with all children preloaded, sorted by sortorder
- $tree = $this->tree_filled;
- $this->fill_grades();
-
- if (empty($this->tree_filled)) {
- debugging("The tree_filled array wasn't initialised, grade_tree could not display the grades correctly.");
- return false;
- }
-
- // Fetch array of students enroled in this course
- if (!$context = get_context_instance(CONTEXT_COURSE, $this->courseid)) {
- return false;
- }
-
- $users = get_role_users(@implode(',', $CFG->gradebookroles), $context);
-
- $topcathtml = ' | ';
- $cathtml = '
| ';
- $itemhtml = '
| ';
- $items = array();
-
- foreach ($tree as $topcat) {
- $itemcount = 0;
-
- foreach ($topcat['children'] as $catkey => $cat) {
- $catitemcount = 0;
-
- foreach ($cat['children'] as $item) {
- $itemcount++;
- $catitemcount++;
- $itemhtml .= '' . $item['object']->itemname . ' | ';
- $items[] = $item;
- }
-
- if ($cat['object'] == 'filler') {
- $cathtml .= ' | ';
- } else {
- $cat['object']->load_grade_item();
- $cathtml .= '' . $cat['object']->fullname . ' | ';
- }
- }
-
- if ($topcat['object'] == 'filler') {
- $colspan = null;
- if (!empty($topcat['colspan'])) {
- $colspan = 'colspan="' . $topcat['colspan'] . '" ';
- }
- $topcathtml .= ' | ';
- } else {
- $topcathtml .= '' . $topcat['object']->fullname . ' | ';
- }
-
- }
-
- $studentshtml = '';
-
- foreach ($users as $userid => $user) {
- $studentshtml .= '
---|
' . $user->firstname . ' ' . $user->lastname . ' | ';
- foreach ($items as $item) {
- if (!empty($this->grades[$userid][$item['object']->id])) {
- $studentshtml .= '' . $this->grades[$userid][$item['object']->id] . ' | ' . "\n";
- } else {
- $studentshtml .= '0 | ' . "\n";
- }
- }
- $studentshtml .= '
';
- }
-
- $itemhtml .= '';
- $cathtml .= '';
- $topcathtml .= '';
-
- $reporthtml = "$topcathtml$cathtml$itemhtml";
- $reporthtml .= $studentshtml;
- $reporthtml .= "
";
- return $reporthtml;
-
- }
/**
* Using $this->tree_array, builds $this->tree_filled, which is the same array but with fake categories as
@@ -994,217 +903,4 @@ function update_db() {
$this->renumber();
}
- /**
- * Returns a HTML list with sorting arrows and insert boxes. This is a recursive method.
- * @param int $level The level of recursion
- * @param array $elements The elements to display in a list. Defaults to this->tree_array
- * @param int $source_sortorder A source sortorder, given when an element needs to be moved or inserted.
- * @param string $action 'move' or 'insert'
- * @param string $source_type 'topcat', 'subcat' or 'item'
- * @return string HTML code
- */
- function get_edit_tree($level=1, $elements=NULL, $source_sortorder=NULL, $action=NULL, $source_type=NULL) {
- if (empty($this->tree_array)) {
- return null;
- } else {
- global $CFG;
- global $USER;
-
- $strmove = get_string("move");
- $strmoveup = get_string("moveup");
- $strmovedown = get_string("movedown");
- $strmovehere = get_string("movehere");
- $strcancel = get_string("cancel");
- $stredit = get_string("edit");
- $strdelete = get_string("delete");
- $strhide = get_string("hide");
- $strshow = get_string("show");
- $strlock = get_string("lock", 'grades');
- $strunlock = get_string("unlock", 'grades');
- $strnewcategory = get_string("newcategory", 'grades');
- $strcategoryname = get_string("categoryname", 'grades');
- $strcreatecategory = get_string("createcategory", 'grades');
- $strsubcategory = get_string("subcategory", 'grades');
- $stritems = get_string("items", 'grades');
- $strcategories = get_string("categories", 'grades');
-
- $list = '';
- $closing_form_tags = '';
-
- if (empty($elements)) {
- $list .= '\n";
- } else {
- $list = '' . "\n$closing_form_tags";
-
- return $list;
- }
-
- return false;
- }
}