See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * Allow the editing of grades for a grade item 19 * 20 * @package gradereport_grader 21 * @copyright 2009 Nicolas Connault 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 require_once '../../../config.php'; 26 require_once $CFG->libdir.'/gradelib.php'; 27 require_once $CFG->dirroot.'/grade/lib.php'; 28 require_once $CFG->dirroot.'/grade/report/grader/lib.php'; 29 30 $courseid = required_param('id', PARAM_INT); // course id 31 $itemid = required_param('itemid', PARAM_INT); // item id 32 $page = optional_param('page', 0, PARAM_INT); // active page 33 $perpageurl = optional_param('perpage', 0, PARAM_INT); 34 35 $url = new moodle_url('/grade/report/grader/quickedit_item.php', array('id'=>$courseid, 'itemid'=>$itemid)); 36 if ($page !== 0) { 37 $url->param('page', $page); 38 } 39 if ($perpage !== 0) { 40 $url->param('perpage', $perpage); 41 } 42 $PAGE->set_url($url); 43 44 45 /// basic access checks 46 if (!$course = $DB->get_record('course', array('id' => $courseid))) { 47 throw new \moodle_exception('invalidcourseid'); 48 } 49 50 if (!$item = $DB->get_record('grade_items', array('id' => $itemid))) { 51 throw new \moodle_exception('noitemid', 'grades'); 52 } 53 54 require_login($course); 55 $context = context_course::instance($course->id); 56 57 require_capability('gradereport/grader:view', $context); 58 require_capability('moodle/grade:viewall', $context); 59 require_capability('moodle/grade:edit', $context); 60 61 /// return tracking object 62 $gpr = new grade_plugin_return(array('type'=>'report', 'plugin'=>'grader', 'courseid'=>$courseid, 'page'=>$page)); 63 64 /// last selected report session tracking 65 if (!isset($USER->grade_last_report)) { 66 $USER->grade_last_report = array(); 67 } 68 $USER->grade_last_report[$course->id] = 'grader'; 69 70 // Initialise the grader report object 71 $report = new grade_report_grader($courseid, $gpr, $context, $page); 72 73 /// processing posted grades & feedback here 74 if ($data = data_submitted() and confirm_sesskey() and has_capability('moodle/grade:edit', $context)) { 75 $warnings = $report->process_data($data); 76 } else { 77 $warnings = array(); 78 } 79 80 // Override perpage if set in URL 81 if ($perpageurl) { 82 $report->user_prefs['studentsperpage'] = $perpageurl; 83 } 84 85 // final grades MUST be loaded after the processing 86 $report->load_users(); 87 $numusers = $report->get_numusers(); 88 $report->load_final_grades(); 89 90 /// Print header 91 $a->item = $item->itemname; 92 $reportname = get_string('quickedititem', 'gradereport_grader', $a); 93 print_grade_page_head($COURSE->id, 'report', 'grader', $reportname); 94 95 echo $report->group_selector; 96 echo '<div class="clearer"></div>'; 97 98 //show warnings if any 99 foreach($warnings as $warning) { 100 echo $OUTPUT->notification($warning); 101 } 102 103 $studentsperpage = $report->get_pref('studentsperpage'); 104 // Don't use paging if studentsperpage is empty or 0 at course AND site levels 105 if (!empty($studentsperpage)) { 106 echo $OUTPUT->paging_bar($numusers, $report->page, $studentsperpage, $report->pbarurl); 107 } 108 109 /// TODO Print links to previous - next grade items in this course 110 /// TODO Print Quick Edit Interface here 111 /// TODO The teacher may only be allowed to view one group: check capabilities 112 113 // print submit button 114 echo '<div class="submit"><input type="submit" value="'.get_string('update').'" /></div>'; 115 echo '</div></form>'; 116 117 // prints paging bar at bottom for large pages 118 if (!empty($studentsperpage) && $studentsperpage >= 20) { 119 echo $OUTPUT->paging_bar($numusers, $report->page, $studentsperpage, $report->pbarurl); 120 } 121 122 echo $OUTPUT->footer(); 123
title
Description
Body
title
Description
Body
title
Description
Body
title
Body