$strgrades = get_string('grades');
$pagename = get_string('outcomescourse', 'grades');
-$navlinks = array(array('name'=>$strgrades, 'link'=>$CFG->wwwroot.'/grade/index.php?id='.$courseid, 'type'=>'misc'),
- array('name'=>$pagename, 'link'=>'', 'type'=>'misc'));
+$navlinks = array(array('name'=>$strgrades,
+ 'link'=>$CFG->wwwroot.'/grade/index.php?id='.$courseid,
+ 'type'=>'misc'),
+ array('name'=>$pagename,
+ 'link'=>'',
+ 'type'=>'misc')
+ );
$navigation = build_navigation($navlinks);
-
+$navigation = grade_build_nav(__FILE__, $pagename, $courseid);
/// Print header
print_header_simple($strgrades.': '.$pagename, ': '.$strgrades, $navigation, '', '', true, '', navmenu($course));
require('course_form.html');
print_footer($course);
-?>
\ No newline at end of file
+?>
$stroutcomeedit = get_string('outcome', 'grades');
if ($courseid) {
- $nav = array(array('name'=>$strgrades,'link'=>$CFG->wwwroot.'/grade/index.php?id='.$courseid, 'type'=>'misc'),
- array('name'=>$stroutcomeedit, 'link'=>'', 'type'=>'misc'));
- $navigation = build_navigation($nav);
+ $navigation = grade_build_nav(__FILE__, $stroutcomeedit, array('courseid' => $courseid));
print_header_simple($strgrades.': '.$strgraderreport, ': '.$stroutcomeedit, $navigation, '', '', true, '', navmenu($course));
} else {
$strgrades = get_string('grades');
$pagename = get_string('outcomes', 'grades');
-$navlinks = array(array('name'=>$strgrades, 'link'=>$CFG->wwwroot.'/grade/index.php?id='.$courseid, 'type'=>'misc'),
- array('name'=>$pagename, 'link'=>'', 'type'=>'misc'));
-$navigation = build_navigation($navlinks);
+$navigation = grade_build_nav(__FILE__, $pagename, $courseid);
$strshortname = get_string('shortname');
$strfullname = get_string('fullname');
$coursecontext = get_context_instance(CONTEXT_COURSE, $courseid);
+ $row[] = new tabobject('courseoutcomes',
+ $CFG->wwwroot.'/grade/edit/outcome/course.php?id='.$courseid,
+ get_string('outcomescourse', 'grades'));
+
if (has_capability('moodle/grade:manage', $context)) {
$row[] = new tabobject('outcomes',
$CFG->wwwroot.'/grade/edit/outcome/index.php?id='.$courseid,
- get_string('outcomes', 'grades'));
+ get_string('editoutcomes', 'grades'));
}
- $row[] = new tabobject('courseoutcomes',
- $CFG->wwwroot.'/grade/edit/outcome/course.php?id='.$courseid,
- get_string('outcomescourse', 'grades'));
$tabs[] = $row;
$strscaleedit = get_string('scale');
if ($courseid) {
- $nav = array(array('name'=>$strgrades,'link'=>$CFG->wwwroot.'/grade/index.php?id='.$courseid, 'type'=>'misc'),
- array('name'=>$strscaleedit, 'link'=>'', 'type'=>'misc'));
- $navigation = build_navigation($nav);
+ $navigation = grade_build_nav(__FILE__, $strscaleedit, $courseid);
print_header_simple($strgrades.': '.$strgraderreport, ': '.$strscaleedit, $navigation, '', '', true, '', navmenu($course));
} else {
$strgrades = get_string('grades');
$pagename = get_string('scales');
-$navlinks = array(array('name'=>$strgrades, 'link'=>$CFG->wwwroot.'/grade/index.php?id='.$courseid, 'type'=>'misc'),
- array('name'=>$pagename, 'link'=>'', 'type'=>'misc'));
-$navigation = build_navigation($navlinks);
+$navigation = grade_build_nav(__FILE__, $pagename, array('courseid' => $courseid));
$strscale = get_string('scale');
$strstandardscale = get_string('scalesstandard');
$strgraderreport = get_string('graderreport', 'grades');
$strcalculationedit = get_string('editcalculation', 'grades');
-$nav = array(array('name'=>$strgrades,'link'=>$CFG->wwwroot.'/grade/index.php?id='.$courseid, 'type'=>'misc'),
- array('name'=>$strcalculationedit, 'link'=>'', 'type'=>'misc'));
-
-$navigation = build_navigation($nav);
-
+$navigation = grade_build_nav(__FILE__, $strcalculationedit, array('courseid' => $courseid));
print_header_simple($strgrades . ': ' . $strgraderreport, ': ' . $strcalculationedit, $navigation, '', '', true, '', navmenu($course));
$strgrades = get_string('grades');
$strgraderreport = get_string('graderreport', 'grades');
-$strcategoriesedit = get_string('categoriesedit', 'grades');
-
-$nav = array(array('name'=>$strgrades,'link'=>$CFG->wwwroot.'/grade/index.php?id='.$courseid, 'type'=>'misc'),
- array('name'=>$strcategoriesedit, 'link'=>'', 'type'=>'misc'));
-
-$navigation = build_navigation($nav);
+$strcategoriesedit = get_string('categoryedit', 'grades');
+$strcategory = get_string('category', 'grades');
+$navigation = grade_build_nav(__FILE__, $strcategory, array('courseid' => $courseid));
print_header_simple($strgrades . ': ' . $strgraderreport, ': ' . $strcategoriesedit, $navigation, '', '', true, '', navmenu($course));
$strgradeedit = get_string('editgrade', 'grades');
$struser = get_string('user');
-$nav = array(array('name'=>$strgrades,'link'=>$CFG->wwwroot.'/grade/index.php?id='.$courseid, 'type'=>'misc'),
- array('name'=>$strgradeedit, 'link'=>'', 'type'=>'misc'));
-
-$navigation = build_navigation($nav);
+$navigation = grade_build_nav(__FILE__, $strgradeedit, array('courseid' => $courseid));
/*********** BEGIN OUTPUT *************/
}
-$strgrades = get_string('grades');
-$strgraderreport = get_string('graderreport', 'grades');
-$strcategoriesedit = get_string('categoriesedit', 'grades');
+$strgrades = get_string('grades');
+$strgraderreport = get_string('graderreport', 'grades');
+$strcategoriesedit = get_string('categoriesedit', 'grades');
+$strcategoriesanditems = get_string('categoriesanditems', 'grades');
-$nav = array(array('name'=>$strgrades,'link'=>$CFG->wwwroot.'/grade/index.php?id='.$courseid, 'type'=>'misc'),
- array('name'=>$strcategoriesedit, 'link'=>'', 'type'=>'misc'));
-
-$navigation = build_navigation($nav);
+$navigation = grade_build_nav(__FILE__, $strcategoriesanditems, array('courseid' => $courseid));
$moving = false;
switch ($action) {
$strgrades = get_string('grades');
$strgraderreport = get_string('graderreport', 'grades');
$stritemsedit = get_string('itemsedit', 'grades');
+$stritem = get_string('item', 'grades');
-$nav = array(array('name'=>$strgrades,'link'=>$CFG->wwwroot.'/grade/index.php?id='.$courseid, 'type'=>'misc'),
- array('name'=>$stritemsedit, 'link'=>'', 'type'=>'misc'));
-
-$navigation = build_navigation($nav);
+$navigation = grade_build_nav(__FILE__, $stritem, array('courseid' => $courseid));
print_header_simple($strgrades . ': ' . $strgraderreport, ': ' . $stritemsedit, $navigation, '', '', true, '', navmenu($course));
$strgrades = get_string('grades');
$strgraderreport = get_string('graderreport', 'grades');
$stroutcomesedit = get_string('outcomeitemsedit', 'grades');
+$stroutcome = get_string('outcomeitem', 'grades');
-$nav = array(array('name'=>$strgrades,'link'=>$CFG->wwwroot.'/grade/index.php?id='.$courseid, 'type'=>'misc'),
- array('name'=>$stroutcomesedit, 'link'=>'', 'type'=>'misc'));
-
-$navigation = build_navigation($nav);
-
+$navigation = grade_build_nav(__FILE__, $stroutcome, array('courseid' => $courseid));
print_header_simple($strgrades . ': ' . $strgraderreport, ': ' . $stroutcomesedit, $navigation, '', '', true, '', navmenu($course));
$strgrades = get_string('grades', 'grades');
$actionstr = get_string('modulename', 'gradeexport_ods');
+$navigation = grade_build_nav(__FILE__, $actionstr, array('courseid' => $course->id));
-$gradenav = "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a>";
-$gradenav .= " -> <a href=\"$CFG->wwwroot/grade/index.php?id=$course->id\">$strgrades</a>";
-$gradenav .= " -> $actionstr";
-
-print_header($course->shortname.': '.get_string('grades'), $course->fullname, $gradenav);
+print_header($course->shortname.': '.get_string('grades'), $course->fullname, $navigation);
print_grade_plugin_selector($id, 'export', 'ods');
// process post information
if (($data = data_submitted()) && confirm_sesskey()) {
$strgrades = get_string('grades', 'grades');
$actionstr = get_string('modulename', 'gradeexport_txt');
+$navigation = grade_build_nav(__FILE__, $actionstr, array('courseid' => $course->id));
-$gradenav = "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a>";
-$gradenav .= " -> <a href=\"$CFG->wwwroot/grade/index.php?id=$course->id\">$strgrades</a>";
-$gradenav .= " -> $actionstr";
-
-print_header($course->shortname.': '.get_string('grades'), $course->fullname, $gradenav);
+print_header($course->shortname.': '.get_string('grades'), $course->fullname, $navigation);
print_grade_plugin_selector($id, 'export', 'txt');
// process post information
if (($data = data_submitted()) && confirm_sesskey()) {
$strgrades = get_string('grades', 'grades');
$actionstr = get_string('modulename', 'gradeexport_xls');
-$gradenav = "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a>";
-$gradenav .= " -> <a href=\"$CFG->wwwroot/grade/index.php?id=$course->id\">$strgrades</a>";
-$gradenav .= " -> $actionstr";
-print_header($course->shortname.': '.get_string('grades'), $course->fullname, $gradenav);
+$navigation = grade_build_nav(__FILE__, $actionstr, array('courseid' => $course->id));
+
+print_header($course->shortname.': '.get_string('grades'), $course->fullname, $navigation);
print_grade_plugin_selector($id, 'export', 'xls');
// process post information
if (($data = data_submitted()) && confirm_sesskey()) {
$strgrades = get_string('grades', 'grades');
$actionstr = get_string('modulename', 'gradeexport_xml');
-$gradenav = "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a>";
-$gradenav .= " -> <a href=\"$CFG->wwwroot/grade/index.php?id=$course->id\">$strgrades</a>";
-$gradenav .= " -> $actionstr";
-print_header($course->shortname.': '.get_string('grades'), $course->fullname, $gradenav);
+$navigation = grade_build_nav(__FILE__, $actionstr, array('courseid' => $course->id));
+
+print_header($course->shortname.': '.get_string('grades'), $course->fullname, $navigation);
print_grade_plugin_selector($id, 'export', 'xml');
// process post information
if (($data = data_submitted()) && confirm_sesskey()) {
}
$strgrades = get_string('grades', 'grades');
-$actionstr = get_string('importcsv', 'grades');
-$gradenav = "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a>";
-$gradenav .= " -> <a href=\"$CFG->wwwroot/grade/index.php?id=$course->id\">$strgrades</a>";
-$gradenav .= " -> $actionstr";
-print_header($course->shortname.': '.get_string('grades'), $course->fullname, $gradenav);
+$actionstr = get_string('csv', 'grades');
+$navigation = grade_build_nav(__FILE__, $actionstr, array('courseid' => $course->id));
+
+print_header($course->shortname.': '.get_string('grades'), $course->fullname, $navigation);
print_grade_plugin_selector($id, 'import', 'csv');
$mform = new grade_import_form();
//$mform2 = new grade_import_mapping_form();
}
print_footer();
-?>
\ No newline at end of file
+?>
// print header
$strgrades = get_string('grades', 'grades');
-$actionstr = get_string('importxml', 'grades');
-$gradenav = "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a>";
-$gradenav .= " -> <a href=\"$CFG->wwwroot/grade/index.php?id=$course->id\">$strgrades</a>";
-$gradenav .= " -> $actionstr";
-print_header($course->shortname.': '.get_string('grades'), $course->fullname, $gradenav);
+$actionstr = get_string('xml', 'grades');
+$navigation = grade_build_nav(__FILE__, $actionstr, array('courseid' => $course->id));
+
+print_header($course->shortname.': '.get_string('grades'), $course->fullname, $navigation);
print_grade_plugin_selector($id, 'import', 'xml');
$mform = new grade_import_form();
}
print_footer();
-?>
\ No newline at end of file
+?>
}
}
+/**
+ * Function central to gradebook for building and printing the navigation (breadcrumb trail).
+ * @param string $path The path of the calling script (using __FILE__?)
+ * @param string $pagename The language string to use as the last part of the navigation (non-link)
+ * @param mixed $id Either a plain integer (assuming the key is 'id') or an array of keys and values (e.g courseid => $courseid, itemid...)
+ * @return string
+ */
+function grade_build_nav($path, $pagename=null, $id=null) {
+ global $CFG, $COURSE;
+
+ $strgrades = get_string('grades', 'grades');
+
+ // Parse the path and build navlinks from its elements
+ $dirroot_length = strlen($CFG->dirroot) + 1; // Add 1 for the first slash
+ $path = substr($path, $dirroot_length);
+ $path = str_replace('\\', '/', $path);
+
+ $path_elements = explode('/', $path);
+
+ $path_elements_count = count($path_elements);
+
+ $last_element = $path_elements[$path_elements_count-1]; // Should be the filename (including extension)
+
+ // First link is always 'grade'
+ $navlinks = array();
+ $navlinks[] = array('name' => $strgrades,
+ 'link' => $CFG->wwwroot.'/grade/index.php?id='.$COURSE->id,
+ 'type' => 'misc');
+
+ $link = '';
+ $numberofelements = 3;
+
+ // Prepare URL params string
+ $id_string = '?';
+ if (!is_null($id)) {
+ if (is_array($id)) {
+ foreach ($id as $idkey => $idvalue) {
+ $id_string .= "$idkey=$idvalue&";
+ }
+ } else {
+ $id_string .= "id=$id";
+ }
+ }
+
+ $navlink4 = null;
+
+ // Second level links
+ switch ($path_elements[1]) {
+ case 'edit': // No link
+ if ($path_elements[3] != 'index.php') {
+ $numberofelements = 4;
+ }
+ break;
+ case 'import': // No link
+ break;
+ case 'export': // No link
+ break;
+ case 'report':
+ // $id is required for this link. Do not print it if $id isn't given
+ if (!is_null($id)) {
+ $link = $CFG->wwwroot . '/grade/report/index.php' . $id_string;
+ }
+
+ if ($path_elements[2] == 'grader') {
+ $numberofelements = 4;
+ }
+ break;
+
+ default:
+ // If this element isn't among the ones already listed above, it isn't supported, throw an error.
+ debugging("grade_build_nav() doesn't support ". $path_elements[1] . " as the second path element after 'grade'.");
+ return false;
+ }
+
+ $navlinks[] = array('name' => get_string($path_elements[1], 'grades'), 'link' => $link, 'type' => 'misc');
+
+ // Third level links
+ if (empty($pagename)) {
+ $pagename = get_string($path_elements[2], 'grades');
+ }
+
+ switch ($numberofelements) {
+ case 3:
+ $navlinks[] = array('name' => $pagename, 'link' => $link, 'type' => 'misc');
+ break;
+ case 4:
+
+ if ($path_elements[2] == 'grader' AND $path_elements[3] != 'index.php') {
+ $navlinks[] = array('name' => get_string('grader', 'grades'),
+ 'link' => "$CFG->wwwroot/grade/report/grader/index.php$id_string",
+ 'type' => 'misc');
+ }
+ $navlinks[] = array('name' => $pagename, 'link' => '', 'type' => 'misc');
+ break;
+ }
+ $navigation = build_navigation($navlinks);
+
+ return $navigation;
+ }
/**
* This class represents a complete tree of categories, grade_items and final grades,
$strgrades = get_string('grades');
$reportname = get_string('modulename', 'gradereport_grader');
-$navlinks = array(array('name'=>$strgrades, 'link'=>$CFG->wwwroot.'/grade/index.php?id='.$courseid, 'type'=>'misc'),
- array('name'=>$reportname, 'link'=>'', 'type'=>'misc'));
-$navigation = build_navigation($navlinks);
-
+$navigation = grade_build_nav(__FILE__, get_string('grader', 'grades'), $courseid);
/// Build editing on/off buttons
$strgraderreport = get_string('modulename', 'gradereport_grader');
$strgradepreferences = get_string('gradepreferences', 'grades');
-$navlinks = array();
-$navlinks[] = array('name' => $strgrades, 'link' => $CFG->wwwroot . '/grade/index.php?id='.$courseid, 'type' => 'misc');
-$navlinks[] = array('name' => $strgraderreport,
- 'link' => $CFG->wwwroot . '/grade/report/grader/index.php?id=' . $courseid, 'type' => 'misc');
-$navlinks[] = array('name' => $strgradepreferences, 'link' => '', 'type' => 'misc');
-
-$navigation = build_navigation($navlinks);
+$navigation = grade_build_nav(__FILE__, $strgradepreferences, $courseid);
print_header_simple($strgrades.': '.$strgraderreport . ': ' . $strgradepreferences,': '.$strgradepreferences, $navigation,
'', '', true, '', navmenu($course));
// Build navigation
$strgrades = get_string('grades');
$stroutcomes = get_string('outcomes', 'grades');
-$navlinks = array();
-$navlinks[] = array('name' => $strgrades, 'link' => $CFG->wwwroot . '/grade/index.php?id='.$courseid, 'type' => 'misc');
-$navlinks[] = array('name' => $stroutcomes, 'link' => '', 'type' => 'misc');
-$navigation = build_navigation($navlinks);
+$navigation = grade_build_nav(__FILE__, $stroutcomes, $course->id);
/// Print header
print_header_simple($strgrades.':'.$stroutcomes, ':'.$strgrades, $navigation, '', '', true);
$strgrades = get_string('grades');
$reportname = get_string('modulename', 'gradereport_user');
-$navlinks = array(array('name'=>$strgrades, 'link'=>$CFG->wwwroot.'/grade/index.php?id='.$courseid, 'type'=>'misc'),
- array('name'=>$reportname, 'link'=>'', 'type'=>'misc'));
-$navigation = build_navigation($navlinks);
-
+$navigation = grade_build_nav(__FILE__, get_string('user', 'grades'), $courseid);
/// Print header
print_header_simple($strgrades.': '.$reportname, ': '.$strgrades, $navigation,
-<?PHP // $Id$
+<?PHP // $Id$
-$string['modulename'] = 'Export to CSV file';
+$string['modulename'] = 'CSV file';
?>
-<?PHP // $Id$
+<?PHP // $Id$
-$string['modulename'] = 'Export to OpenOffice spreadsheet';
+$string['modulename'] = 'OpenOffice spreadsheet';
?>
-<?PHP // $Id$
+<?PHP // $Id$
-$string['modulename'] = 'Export to plain text file';
+$string['modulename'] = 'Plain text file';
?>
-<?PHP // $Id$
+<?PHP // $Id$
-$string['modulename'] = 'Export to Excel spreadsheet';
+$string['modulename'] = 'Excel spreadsheet';
?>
-<?PHP // $Id$
+<?PHP // $Id$
-$string['modulename'] = 'Export to XML file';
+$string['modulename'] = 'XML file';
?>
-<?PHP // $Id$
+<?PHP // $Id$
-$string['modulename'] = 'Import CSV file';
+$string['modulename'] = 'CSV file';
?>
-<?PHP // $Id$
+<?PHP // $Id$
-$string['modulename'] = 'Import XML file';
+$string['modulename'] = 'XML file';
?>
$string['calculationview'] = 'View calculation';
$string['calculationsaved'] = 'Calculation saved';
$string['categories'] = 'Categories';
+$string['categoriesanditems'] = 'Categories and Items';
+$string['categoriesedit'] = 'Edit Categories and Items';
$string['category'] = 'Category';
-$string['categoriesedit'] = 'Edit Categories';
+$string['categoryedit'] = 'Edit Category';
$string['categoryname'] = 'Category name';
$string['changesitedefaults'] = 'Change site defaults';
$string['choosecategory'] = 'Select Category';
$string['createcategory'] = 'Create Category';
$string['createcategoryerror'] = 'Could not create a new category';
$string['creatinggradebooksettings'] = 'Creating Gradebook settings';
+$string['csv'] = 'CSV';
$string['curveto'] = 'Curve To';
$string['decimalpoints'] = 'Overall decimal points';
$string['default'] = 'Default';
$string['dropped'] = 'Dropped';
$string['dropxlowest'] = 'Drop X Lowest';
$string['dropxlowestwarning'] = 'Note: If you use drop x lowest the grading assumes that all items in the category have the same point value. If point values differ results will be unpredictable';
+$string['edit'] = 'Edit';
$string['editcalculation'] = 'Edit Calculation';
$string['editfeedback'] = 'Edit Feedback';
$string['editgrade'] = 'Edit Grade';
$string['exceptions'] = 'Exceptions';
$string['excluded'] = 'Excluded';
$string['expand'] = 'Expand Category';
+$string['export'] = 'Export';
$string['exportplugins'] = 'Export plugins';
$string['extracredit'] = 'Extra Credit';
$string['extracreditwarning'] = 'Note: Setting all items for a category to extra credit will effectively remove them from the grade calculation. Since there will be no point total';
$string['highgradedescending'] = 'Sort by high grade descending';
$string['highgradeletter'] = 'High';
$string['identifier'] = 'Identify user by';
+$string['import'] = 'Import';
$string['importcsv'] = 'Import CSV';
$string['importfailed'] = 'Import failed';
$string['importfile'] = 'Import file';
$string['operations'] = 'Operations';
$string['outcome'] = 'Outcome';
$string['outcomecreate'] = 'Add a new outcome';
+$string['outcomeitem'] = 'Outcome item';
$string['outcomeitemsedit'] = 'Edit outcome item';
$string['outcomes'] = 'Outcomes';
$string['outcomescustom'] = 'Custom outcomes';
$string['rangesdecimalpoints'] = 'Decimals shown in ranges';
$string['rangesdisplaytype'] = 'Range display type';
$string['rank'] = 'Rank';
-$string['real'] = 'Real';
$string['rawpct'] = 'Raw %%';
+$string['real'] = 'Real';
+$string['report'] = 'Report';
$string['reportplugins'] = 'Report plugins';
$string['reportsettings'] = 'Report settings';
$string['reprintheaders'] = 'Reprint Headers';
$string['usenooutcome'] = 'Use no outcome';
$string['usenoscale'] = 'Use no scale';
$string['usepercent'] = 'Use Percent';
+$string['user'] = 'User';
$string['userpreferences'] = 'User preferences';
$string['useweighted'] = 'Use Weighted';
$string['viewbygroup'] = 'Group';
$string['weightedpct'] = 'weighted %%';
$string['weightedpctcontribution'] = 'weighted %% contribution';
$string['writinggradebookinfo'] = 'Writing Gradebook settings';
+$string['xml'] = 'XML';
$string['yes'] = 'Yes';
$string['yourgrade'] = 'Your grade';
?>