diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php index 92c6500f07e..e84a0f36cc3 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -2332,9 +2332,12 @@ class assign { $this->show_intro(), $this->get_course_module()->id, get_string('quickgradingresult', 'assign'))); + $lastpage = optional_param('lastpage', null, PARAM_INT); $gradingresult = new assign_gradingmessage(get_string('quickgradingresult', 'assign'), $message, - $this->get_course_module()->id); + $this->get_course_module()->id, + false, + $lastpage); $o .= $this->get_renderer()->render($gradingresult); $o .= $this->view_footer(); return $o; @@ -3093,7 +3096,10 @@ class assign { if ($showquickgrading && $quickgrading) { $gradingtable = new assign_grading_table($this, $perpage, $filter, 0, true); $table = $this->get_renderer()->render($gradingtable); - $quickformparams = array('cm'=>$this->get_course_module()->id, 'gradingtable'=>$table); + $page = optional_param('page', null, PARAM_INT); + $quickformparams = array('cm' => $this->get_course_module()->id, + 'gradingtable' => $table, + 'page' => $page); $quickgradingform = new mod_assign_quick_grading_form(null, $quickformparams); $o .= $this->get_renderer()->render(new assign_form('quickgradingform', $quickgradingform)); diff --git a/mod/assign/quickgradingform.php b/mod/assign/quickgradingform.php index 85d0985eb17..fa81a49f856 100644 --- a/mod/assign/quickgradingform.php +++ b/mod/assign/quickgradingform.php @@ -51,6 +51,8 @@ class mod_assign_quick_grading_form extends moodleform { $mform->setType('id', PARAM_INT); $mform->addElement('hidden', 'action', 'quickgrade'); $mform->setType('action', PARAM_ALPHA); + $mform->addElement('hidden', 'lastpage', $instance['page']); + $mform->setType('lastpage', PARAM_INT); // Skip notifications option. $mform->addElement('selectyesno', 'sendstudentnotifications', get_string('sendstudentnotifications', 'assign')); diff --git a/mod/assign/renderable.php b/mod/assign/renderable.php index de696a2549a..3a89f70ecc7 100644 --- a/mod/assign/renderable.php +++ b/mod/assign/renderable.php @@ -74,12 +74,14 @@ class assign_gradingmessage implements renderable { * @param string $message This is the message to display * @param bool $gradingerror Set to true to display the message as an error. * @param int $coursemoduleid + * @param int $page This is the current quick grading page */ - public function __construct($heading, $message, $coursemoduleid, $gradingerror = false) { + public function __construct($heading, $message, $coursemoduleid, $gradingerror = false, $page = null) { $this->heading = $heading; $this->message = $message; $this->coursemoduleid = $coursemoduleid; $this->gradingerror = $gradingerror; + $this->page = $page; } } diff --git a/mod/assign/renderer.php b/mod/assign/renderer.php index d1ceb4b01ac..53427bf2783 100644 --- a/mod/assign/renderer.php +++ b/mod/assign/renderer.php @@ -91,6 +91,9 @@ class mod_assign_renderer extends plugin_renderer_base { */ public function render_assign_gradingmessage(assign_gradingmessage $result) { $urlparams = array('id' => $result->coursemoduleid, 'action'=>'grading'); + if (!empty($result->page)) { + $urlparams['page'] = $result->page; + } $url = new moodle_url('/mod/assign/view.php', $urlparams); $classes = $result->gradingerror ? 'notifyproblem' : 'notifysuccess';