mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-41611 mod_quiz: Offer to return to course when supported
This commit is contained in:
parent
98e9e91505
commit
eb665c34ef
@ -1,4 +1 @@
|
|||||||
/* In mod_quiz hide "Back to course" button */
|
|
||||||
.format-singleactivity.path-mod-quiz .quizattempt .continuebutton {display:none;}
|
|
||||||
|
|
||||||
.format-singleactivity .tree_item.orphaned a {color:red;}
|
.format-singleactivity .tree_item.orphaned a {color:red;}
|
||||||
|
@ -703,6 +703,7 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
|||||||
* @return string HTML to output.
|
* @return string HTML to output.
|
||||||
*/
|
*/
|
||||||
public function view_page_buttons(mod_quiz_view_object $viewobj) {
|
public function view_page_buttons(mod_quiz_view_object $viewobj) {
|
||||||
|
global $CFG;
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|
||||||
if (!$viewobj->quizhasquestions) {
|
if (!$viewobj->quizhasquestions) {
|
||||||
@ -716,8 +717,9 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
|||||||
$viewobj->startattempturl, $viewobj->startattemptwarning,
|
$viewobj->startattempturl, $viewobj->startattemptwarning,
|
||||||
$viewobj->popuprequired, $viewobj->popupoptions);
|
$viewobj->popuprequired, $viewobj->popupoptions);
|
||||||
|
|
||||||
} else if ($viewobj->buttontext === '') {
|
}
|
||||||
// We should show a 'back to the course' button.
|
|
||||||
|
if ($viewobj->showbacktocourse) {
|
||||||
$output .= $this->single_button($viewobj->backtocourseurl,
|
$output .= $this->single_button($viewobj->backtocourseurl,
|
||||||
get_string('backtocourse', 'quiz'), 'get',
|
get_string('backtocourse', 'quiz'), 'get',
|
||||||
array('class' => 'continuebutton'));
|
array('class' => 'continuebutton'));
|
||||||
@ -1220,6 +1222,8 @@ class mod_quiz_view_object {
|
|||||||
public $startattempturl;
|
public $startattempturl;
|
||||||
/** @var moodle_url $startattempturl URL for any Back to the course button. */
|
/** @var moodle_url $startattempturl URL for any Back to the course button. */
|
||||||
public $backtocourseurl;
|
public $backtocourseurl;
|
||||||
|
/** @var bool $showbacktocourse should we show a back to the course button? */
|
||||||
|
public $showbacktocourse;
|
||||||
/** @var bool whether the attempt must take place in a popup window. */
|
/** @var bool whether the attempt must take place in a popup window. */
|
||||||
public $popuprequired;
|
public $popuprequired;
|
||||||
/** @var array options to use for the popup window, if required. */
|
/** @var array options to use for the popup window, if required. */
|
||||||
|
@ -29,6 +29,7 @@ require_once(dirname(__FILE__) . '/../../config.php');
|
|||||||
require_once($CFG->libdir.'/gradelib.php');
|
require_once($CFG->libdir.'/gradelib.php');
|
||||||
require_once($CFG->dirroot.'/mod/quiz/locallib.php');
|
require_once($CFG->dirroot.'/mod/quiz/locallib.php');
|
||||||
require_once($CFG->libdir . '/completionlib.php');
|
require_once($CFG->libdir . '/completionlib.php');
|
||||||
|
require_once($CFG->dirroot . '/course/format/lib.php');
|
||||||
|
|
||||||
$id = optional_param('id', 0, PARAM_INT); // Course Module ID, or ...
|
$id = optional_param('id', 0, PARAM_INT); // Course Module ID, or ...
|
||||||
$q = optional_param('q', 0, PARAM_INT); // Quiz ID.
|
$q = optional_param('q', 0, PARAM_INT); // Quiz ID.
|
||||||
@ -225,6 +226,9 @@ if (!$viewobj->quizhasquestions) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$viewobj->showbacktocourse = ($viewobj->buttontext === '' &&
|
||||||
|
course_get_format($course)->has_view_page());
|
||||||
|
|
||||||
echo $OUTPUT->header();
|
echo $OUTPUT->header();
|
||||||
|
|
||||||
if (isguestuser()) {
|
if (isguestuser()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user