MDL-73335 mod_quiz: Add tertiary nav for the quiz module
The tertiary navigation added for quiz module. - Added tertiary nav buttons for the edit, attempt and view page - urlselector is added to the overrides page to access user/groups - The secondary tabs are highlighted when user navigates to each page in quiz. - Updated the behat tests for the changes made. This commit is mostly Sujith's work, with further changes by Tim Hunt <[email protected]> so we share the blame/credit.
This commit is contained in:
committed by
Ilya Tregubov
parent
299504281e
commit
3458d159e1
@@ -47,6 +47,8 @@ $PAGE->set_url($attemptobj->attempt_url(null, $page));
|
||||
// During quiz attempts, the browser back/forwards buttons should force a reload.
|
||||
$PAGE->set_cacheable(false);
|
||||
|
||||
$PAGE->set_secondary_active_tab("modulepage");
|
||||
|
||||
// Check login.
|
||||
require_login($attemptobj->get_course(), false, $attemptobj->get_cm());
|
||||
|
||||
|
||||
@@ -275,7 +275,7 @@ class quiz {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool wether the current user is someone who previews the quiz,
|
||||
* @return bool whether the current user is someone who previews the quiz,
|
||||
* rather than attempting it.
|
||||
*/
|
||||
public function is_preview_user() {
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace mod_quiz\local\views;
|
||||
|
||||
use core\navigation\views\secondary as core_secondary;
|
||||
|
||||
/**
|
||||
* Class secondary_navigation_view.
|
||||
*
|
||||
* Custom implementation for a plugin.
|
||||
*
|
||||
* @package mod_quiz
|
||||
* @category navigation
|
||||
* @copyright 2021 Sujith Haridasan <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class secondary extends core_secondary {
|
||||
/**
|
||||
* Define a custom secondary nav order/view.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function get_default_module_mapping(): array {
|
||||
$defaultmaping = parent::get_default_module_mapping();
|
||||
|
||||
$defaultmaping[self::TYPE_SETTING] = array_merge($defaultmaping[self::TYPE_SETTING], [
|
||||
'mod_quiz_edit' => 3,
|
||||
'quiz_report' => 4,
|
||||
'mod_quiz_useroverrides' => 6,
|
||||
'roleassign' => 7,
|
||||
'filtermanage' => 8,
|
||||
'roleoverride' => 9,
|
||||
'rolecheck' => 9.1,
|
||||
'logreport' => 10,
|
||||
'backup' => 11,
|
||||
'restore' => 12,
|
||||
'competencybreakdown' => 13,
|
||||
]);
|
||||
|
||||
$defaultmaping[self::TYPE_CONTAINER] = [
|
||||
'questionbank' => 5,
|
||||
];
|
||||
|
||||
return $defaultmaping;
|
||||
}
|
||||
}
|
||||
@@ -58,9 +58,7 @@ class edit_renderer extends \plugin_renderer_base {
|
||||
$output = '';
|
||||
|
||||
// Page title.
|
||||
$output .= $this->heading_with_help(get_string('editingquizx', 'quiz',
|
||||
format_string($quizobj->get_quiz_name())), 'editingquiz', 'quiz', '',
|
||||
get_string('basicideasofquiz', 'quiz'), 2);
|
||||
$output .= $this->heading(get_string('questions', 'quiz'));
|
||||
|
||||
// Information at the top.
|
||||
$output .= $this->quiz_state_warnings($structure);
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace mod_quiz\output;
|
||||
|
||||
use moodle_url;
|
||||
use renderable;
|
||||
use renderer_base;
|
||||
use templatable;
|
||||
use url_select;
|
||||
|
||||
/**
|
||||
* Render overrides action in the quiz secondary navigation
|
||||
*
|
||||
* The user/group overrides are now handled in the secondary navigation.
|
||||
* This class provides the data for the templates to handle the data for
|
||||
* overrides tab.
|
||||
*
|
||||
* @package mod_quiz
|
||||
* @copyright 2021 Sujith Haridasan <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class overrides_actions implements renderable, templatable {
|
||||
/** @var int The course module ID. */
|
||||
private $cmid;
|
||||
|
||||
/** @var string The mode passed for the overrides url. */
|
||||
private $mode;
|
||||
|
||||
/** @var bool Check if the user have capabilities to list overrides. */
|
||||
private $canedit;
|
||||
|
||||
/** @var bool Should the add override button be enabled or disabled. */
|
||||
private $addenabled;
|
||||
|
||||
/**
|
||||
* overrides_action constructor.
|
||||
*
|
||||
* @param int $cmid The course module id.
|
||||
* @param string $mode The mode passed for the overrides url.
|
||||
* @param bool $canedit Does the user have capabilities to list overrides.
|
||||
* @param bool $addenabled Whether the add button should be enabled or disabled.
|
||||
*/
|
||||
public function __construct(int $cmid, string $mode, bool $canedit, bool $addenabled) {
|
||||
$this->cmid = $cmid;
|
||||
$this->mode = $mode;
|
||||
$this->canedit = $canedit;
|
||||
$this->addenabled = $addenabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the add override button.
|
||||
*
|
||||
* @param \renderer_base $output an instance of the quiz renderer.
|
||||
* @return \single_button the button, ready to reander.
|
||||
*/
|
||||
public function create_add_button(\renderer_base $output): \single_button {
|
||||
$addoverrideurl = new moodle_url('/mod/quiz/overrideedit.php',
|
||||
['cmid' => $this->cmid, 'action' => 'add' . $this->mode]);
|
||||
|
||||
if ($this->mode === 'group') {
|
||||
$label = get_string('addnewgroupoverride', 'quiz');
|
||||
} else {
|
||||
$label = get_string('addnewuseroverride', 'quiz');
|
||||
}
|
||||
|
||||
$addoverridebutton = new \single_button($addoverrideurl, $label, 'get', true);
|
||||
if (!$this->addenabled) {
|
||||
$addoverridebutton->disabled = true;
|
||||
}
|
||||
|
||||
return $addoverridebutton;
|
||||
}
|
||||
|
||||
public function export_for_template(renderer_base $output): array {
|
||||
global $PAGE;
|
||||
$templatecontext = [];
|
||||
|
||||
// Build the navigation drop-down.
|
||||
$useroverridesurl = new moodle_url('/mod/quiz/overrides.php', ['cmid' => $this->cmid, 'mode' => 'user']);
|
||||
$groupoverridesurl = new moodle_url('/mod/quiz/overrides.php', ['cmid' => $this->cmid, 'mode' => 'group']);
|
||||
|
||||
$menu = [
|
||||
$useroverridesurl->out(false) => get_string('useroverrides', 'quiz'),
|
||||
$groupoverridesurl->out(false) => get_string('groupoverrides', 'quiz')
|
||||
];
|
||||
|
||||
$overridesnav = new url_select($menu, $PAGE->url->out(false), null, 'quizoverrides');
|
||||
$templatecontext['overridesnav'] = $overridesnav->export_for_template($output);
|
||||
|
||||
// Build the add button - but only if the user can edit.
|
||||
if ($this->canedit) {
|
||||
$templatecontext['addoverridebutton'] = $this->create_add_button($output)->export_for_template($output);
|
||||
}
|
||||
|
||||
return $templatecontext;
|
||||
}
|
||||
}
|
||||
@@ -59,6 +59,7 @@ $defaultcategory = $defaultcategoryobj->id . ',' . $defaultcategoryobj->contexti
|
||||
$quizhasattempts = quiz_has_attempts($quiz->id);
|
||||
|
||||
$PAGE->set_url($thispageurl);
|
||||
$PAGE->set_secondary_active_tab("mod_quiz_edit");
|
||||
|
||||
// Get the course object and related bits.
|
||||
$course = $DB->get_record('course', array('id' => $quiz->course), '*', MUST_EXIST);
|
||||
|
||||
@@ -3,3 +3,4 @@ completionpassdesc,mod_quiz
|
||||
completionpass_help,mod_quiz
|
||||
completiondetail:passgrade,mod_quiz
|
||||
gradetopassnotset,mod_quiz
|
||||
basicideasofquiz,mod_quiz
|
||||
|
||||
@@ -100,6 +100,7 @@ $string['attemptincomplete'] = 'That attempt (by {$a}) is not yet completed.';
|
||||
$string['attemptlast'] = 'Last attempt';
|
||||
$string['attemptnumber'] = 'Attempt';
|
||||
$string['attemptquiznow'] = 'Attempt quiz now';
|
||||
$string['attemptquiz'] = 'Attempt quiz';
|
||||
$string['attemptreviewtitle'] = '{$a}: Attempt review';
|
||||
$string['attemptreviewtitlepaged'] = '{$a->name}: Attempt review (page {$a->currentpage} of {$a->totalpages})';
|
||||
$string['attempts'] = 'Attempts';
|
||||
@@ -124,7 +125,6 @@ $string['back'] = 'Back to preview question';
|
||||
$string['backtocourse'] = 'Back to the course';
|
||||
$string['backtoquestionlist'] = 'Back to question list';
|
||||
$string['backtoquiz'] = 'Back to quiz editing';
|
||||
$string['basicideasofquiz'] = 'The basic ideas of quiz-making';
|
||||
$string['bestgrade'] = 'Best grade';
|
||||
$string['bothattempts'] = 'Show students with and without attempts';
|
||||
$string['browsersecurity'] = 'Browser security';
|
||||
@@ -687,6 +687,7 @@ $string['preprocesserror'] = 'Error occurred during pre-processing!';
|
||||
$string['preview'] = 'Preview';
|
||||
$string['previewquestion'] = 'Preview question';
|
||||
$string['previewquiz'] = 'Preview {$a}';
|
||||
$string['previewquizstart'] = 'Preview quiz';
|
||||
$string['previewquiznow'] = 'Preview quiz now';
|
||||
$string['previous'] = 'Previous state';
|
||||
$string['privacy:metadata:core_question'] = 'The quiz activity stores question usage information in the core_question subsystem.';
|
||||
@@ -1065,3 +1066,4 @@ $string['completionpassdesc'] = 'Student must achieve a passing grade to complet
|
||||
$string['completionpass_help'] = 'If enabled, this activity is considered complete when the student receives a pass grade (as specified in the Grade section of the quiz settings) or higher.';
|
||||
$string['completiondetail:passgrade'] = 'Receive a pass grade';
|
||||
$string['gradetopassnotset'] = 'This quiz does not yet have a grade to pass set. It may be set in the Grade section of the quiz settings.';
|
||||
$string['basicideasofquiz'] = 'The basic ideas of quiz-making';
|
||||
|
||||
+11
-16
@@ -570,7 +570,7 @@ function quiz_user_complete($course, $user, $mod, $quiz) {
|
||||
* @param int $userid the userid.
|
||||
* @param string $status 'all', 'finished' or 'unfinished' to control
|
||||
* @param bool $includepreviews
|
||||
* @return an array of all the user's attempts at this quiz. Returns an empty
|
||||
* @return array of all the user's attempts at this quiz. Returns an empty
|
||||
* array if there are none.
|
||||
*/
|
||||
function quiz_get_user_attempts($quizids, $userid, $status = 'finished', $includepreviews = false) {
|
||||
@@ -1724,20 +1724,14 @@ function quiz_extend_settings_navigation($settings, $quiznode) {
|
||||
}
|
||||
|
||||
if (has_any_capability(['mod/quiz:manageoverrides', 'mod/quiz:viewoverrides'], $PAGE->cm->context)) {
|
||||
$url = new moodle_url('/mod/quiz/overrides.php', array('cmid'=>$PAGE->cm->id));
|
||||
$node = navigation_node::create(get_string('groupoverrides', 'quiz'),
|
||||
new moodle_url($url, array('mode'=>'group')),
|
||||
navigation_node::TYPE_SETTING, null, 'mod_quiz_groupoverrides');
|
||||
$quiznode->add_node($node, $beforekey);
|
||||
|
||||
$node = navigation_node::create(get_string('useroverrides', 'quiz'),
|
||||
new moodle_url($url, array('mode'=>'user')),
|
||||
navigation_node::TYPE_SETTING, null, 'mod_quiz_useroverrides');
|
||||
$quiznode->add_node($node, $beforekey);
|
||||
$url = new moodle_url('/mod/quiz/overrides.php', array('cmid' => $PAGE->cm->id));
|
||||
$node = navigation_node::create(get_string('overrides', 'quiz'),
|
||||
$url, navigation_node::TYPE_SETTING, null, 'mod_quiz_useroverrides');
|
||||
$settingsoverride = $quiznode->add_node($node, $beforekey);
|
||||
}
|
||||
|
||||
if (has_capability('mod/quiz:manage', $PAGE->cm->context)) {
|
||||
$node = navigation_node::create(get_string('editquiz', 'quiz'),
|
||||
$node = navigation_node::create(get_string('questions', 'quiz'),
|
||||
new moodle_url('/mod/quiz/edit.php', array('cmid'=>$PAGE->cm->id)),
|
||||
navigation_node::TYPE_SETTING, null, 'mod_quiz_edit',
|
||||
new pix_icon('t/edit', ''));
|
||||
@@ -1750,9 +1744,12 @@ function quiz_extend_settings_navigation($settings, $quiznode) {
|
||||
$node = navigation_node::create(get_string('preview', 'quiz'), $url,
|
||||
navigation_node::TYPE_SETTING, null, 'mod_quiz_preview',
|
||||
new pix_icon('i/preview', ''));
|
||||
$quiznode->add_node($node, $beforekey);
|
||||
$previewnode = $quiznode->add_node($node, $beforekey);
|
||||
$previewnode->set_show_in_secondary_navigation(false);
|
||||
}
|
||||
|
||||
question_extend_settings_navigation($quiznode, $PAGE->cm->context)->trim_if_empty();
|
||||
|
||||
if (has_any_capability(array('mod/quiz:viewreports', 'mod/quiz:grade'), $PAGE->cm->context)) {
|
||||
require_once($CFG->dirroot . '/mod/quiz/report/reportlib.php');
|
||||
$reportlist = quiz_report_list($PAGE->cm->context);
|
||||
@@ -1761,7 +1758,7 @@ function quiz_extend_settings_navigation($settings, $quiznode) {
|
||||
array('id' => $PAGE->cm->id, 'mode' => reset($reportlist)));
|
||||
$reportnode = $quiznode->add_node(navigation_node::create(get_string('results', 'quiz'), $url,
|
||||
navigation_node::TYPE_SETTING,
|
||||
null, null, new pix_icon('i/report', '')), $beforekey);
|
||||
null, 'quiz_report', new pix_icon('i/report', '')));
|
||||
|
||||
foreach ($reportlist as $report) {
|
||||
$url = new moodle_url('/mod/quiz/report.php',
|
||||
@@ -1771,8 +1768,6 @@ function quiz_extend_settings_navigation($settings, $quiznode) {
|
||||
null, 'quiz_report_' . $report, new pix_icon('i/item', '')));
|
||||
}
|
||||
}
|
||||
|
||||
question_extend_settings_navigation($quiznode, $PAGE->cm->context)->trim_if_empty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -66,6 +66,9 @@ if ($overrideid) {
|
||||
|
||||
$PAGE->set_url($url);
|
||||
|
||||
// Activate the secondary nav tab.
|
||||
$PAGE->set_secondary_active_tab("mod_quiz_useroverrides");
|
||||
|
||||
require_login($course, false, $cm);
|
||||
|
||||
$context = context_module::instance($cm->id);
|
||||
|
||||
+48
-39
@@ -70,6 +70,9 @@ $PAGE->set_title($title);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->activityheader->disable();
|
||||
|
||||
// Activate the secondary nav tab.
|
||||
$PAGE->set_secondary_active_tab("mod_quiz_useroverrides");
|
||||
|
||||
// Delete orphaned group overrides.
|
||||
$sql = 'SELECT o.id
|
||||
FROM {quiz_overrides} o
|
||||
@@ -299,9 +302,50 @@ foreach ($overrides as $override) {
|
||||
}
|
||||
}
|
||||
|
||||
// Display a list of overrides.
|
||||
// Work out what else needs to be displayed.
|
||||
$addenabled = true;
|
||||
$warningmessage = '';
|
||||
if ($canedit) {
|
||||
if ($groupmode) {
|
||||
if (empty($groups)) {
|
||||
// There are no groups.
|
||||
$warningmessage = get_string('groupsnone', 'quiz');
|
||||
$addenabled = false;
|
||||
}
|
||||
} else {
|
||||
// See if there are any students in the quiz.
|
||||
if ($showallgroups) {
|
||||
$users = get_users_by_capability($context, 'mod/quiz:attempt', 'u.id');
|
||||
$nousermessage = get_string('usersnone', 'quiz');
|
||||
} else if ($groups) {
|
||||
$users = get_users_by_capability($context, 'mod/quiz:attempt', 'u.id', '', '', '', array_keys($groups));
|
||||
$nousermessage = get_string('usersnone', 'quiz');
|
||||
} else {
|
||||
$users = [];
|
||||
$nousermessage = get_string('groupsnone', 'quiz');
|
||||
}
|
||||
$info = new \core_availability\info_module($cm);
|
||||
$users = $info->filter_user_list($users);
|
||||
|
||||
if (empty($users)) {
|
||||
// There are no students.
|
||||
$warningmessage = $nousermessage;
|
||||
$addenabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Tertiary navigation.
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($title);
|
||||
$renderer = $PAGE->get_renderer('mod_quiz');
|
||||
$tertiarynav = new \mod_quiz\output\overrides_actions($cmid, $mode, $canedit, $addenabled);
|
||||
echo $renderer->render($tertiarynav);
|
||||
|
||||
if ($mode === 'user') {
|
||||
echo $OUTPUT->heading(get_string('useroverrides', 'quiz'));
|
||||
} else {
|
||||
echo $OUTPUT->heading(get_string('groupoverrides', 'quiz'));
|
||||
}
|
||||
|
||||
// Output the table and button.
|
||||
echo html_writer::start_tag('div', ['id' => 'quizoverrides']);
|
||||
@@ -318,43 +362,8 @@ if ($hasinactive) {
|
||||
echo $OUTPUT->notification(get_string('inactiveoverridehelp', 'quiz'), 'info', false);
|
||||
}
|
||||
|
||||
if ($canedit) {
|
||||
echo html_writer::start_tag('div', ['class' => 'buttons']);
|
||||
$options = [];
|
||||
if ($groupmode) {
|
||||
if (empty($groups)) {
|
||||
// There are no groups.
|
||||
echo $OUTPUT->notification(get_string('groupsnone', 'quiz'), 'error');
|
||||
$options['disabled'] = true;
|
||||
}
|
||||
echo $OUTPUT->single_button($overrideediturl->out(true,
|
||||
['action' => 'addgroup', 'cmid' => $cm->id]),
|
||||
get_string('addnewgroupoverride', 'quiz'), 'post', $options);
|
||||
} else {
|
||||
$users = [];
|
||||
// See if there are any students in the quiz.
|
||||
if ($showallgroups) {
|
||||
$users = get_users_by_capability($context, 'mod/quiz:attempt', 'u.id');
|
||||
$nousermessage = get_string('usersnone', 'quiz');
|
||||
} else if ($groups) {
|
||||
$users = get_users_by_capability($context, 'mod/quiz:attempt', 'u.id', '', '', '', array_keys($groups));
|
||||
$nousermessage = get_string('usersnone', 'quiz');
|
||||
} else {
|
||||
$nousermessage = get_string('groupsnone', 'quiz');
|
||||
}
|
||||
$info = new \core_availability\info_module($cm);
|
||||
$users = $info->filter_user_list($users);
|
||||
|
||||
if (empty($users)) {
|
||||
// There are no students.
|
||||
echo $OUTPUT->notification($nousermessage, 'error');
|
||||
$options['disabled'] = true;
|
||||
}
|
||||
echo $OUTPUT->single_button($overrideediturl->out(true,
|
||||
['action' => 'adduser', 'cmid' => $cm->id]),
|
||||
get_string('addnewuseroverride', 'quiz'), 'get', $options);
|
||||
}
|
||||
echo html_writer::end_tag('div');
|
||||
if ($warningmessage) {
|
||||
echo $OUTPUT->notification($warningmessage, 'error');
|
||||
}
|
||||
|
||||
echo html_writer::end_tag('div');
|
||||
|
||||
+102
-62
@@ -428,6 +428,7 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
||||
public function start_attempt_page(quiz $quizobj, mod_quiz_preflight_check_form $mform) {
|
||||
$output = '';
|
||||
$output .= $this->header();
|
||||
$output .= $this->during_attempt_tertiary_nav($quizobj->view_url());
|
||||
$output .= $this->heading(format_string($quizobj->get_quiz_name(), true,
|
||||
array("context" => $quizobj->get_context())));
|
||||
$output .= $this->quiz_intro($quizobj->get_quiz(), $quizobj->get_cm());
|
||||
@@ -446,11 +447,13 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
||||
* @param array $slots Contains an array of integers that relate to questions
|
||||
* @param int $id The ID of an attempt
|
||||
* @param int $nextpage The number of the next page
|
||||
* @return string HTML to output.
|
||||
*/
|
||||
public function attempt_page($attemptobj, $page, $accessmanager, $messages, $slots, $id,
|
||||
$nextpage) {
|
||||
$output = '';
|
||||
$output .= $this->header();
|
||||
$output .= $this->during_attempt_tertiary_nav($attemptobj->view_url());
|
||||
$output .= $this->quiz_notices($messages);
|
||||
$output .= $this->countdown_timer($attemptobj, time());
|
||||
$output .= $this->attempt_form($attemptobj, $page, $slots, $id, $nextpage);
|
||||
@@ -458,6 +461,25 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the tertiary navigation for pages during the attempt.
|
||||
*
|
||||
* @param string|moodle_url $quizviewurl url of the view.php page for this quiz.
|
||||
* @return string HTML to output.
|
||||
*/
|
||||
public function during_attempt_tertiary_nav($quizviewurl): string {
|
||||
$output = '';
|
||||
$output .= html_writer::start_div('container-fluid mb-3');
|
||||
$output .= html_writer::start_div('row');
|
||||
|
||||
$output .= html_writer::link($quizviewurl, get_string('back'),
|
||||
['class' => 'btn btn-secondary']);
|
||||
|
||||
$output .= html_writer::end_div();
|
||||
$output .= html_writer::end_div();
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns any notices.
|
||||
*
|
||||
@@ -625,7 +647,7 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
||||
public function access_messages($messages) {
|
||||
$output = '';
|
||||
foreach ($messages as $message) {
|
||||
$output .= html_writer::tag('p', $message) . "\n";
|
||||
$output .= html_writer::tag('p', $message, ['class' => 'text-left']);
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
@@ -642,6 +664,7 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
||||
public function summary_page($attemptobj, $displayoptions) {
|
||||
$output = '';
|
||||
$output .= $this->header();
|
||||
$output .= $this->during_attempt_tertiary_nav($attemptobj->view_url());
|
||||
$output .= $this->heading(format_string($attemptobj->get_quiz_name()));
|
||||
$output .= $this->heading(get_string('summaryofattempt', 'quiz'), 3);
|
||||
$output .= $this->summary_table($attemptobj, $displayoptions);
|
||||
@@ -677,21 +700,22 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
||||
foreach ($slots as $slot) {
|
||||
// Add a section headings if we need one here.
|
||||
$heading = $attemptobj->get_heading_before_slot($slot);
|
||||
if ($heading) {
|
||||
$heading = format_string($heading);
|
||||
}
|
||||
$sections = $attemptobj->get_quizobj()->get_sections();
|
||||
if (!is_null($heading) && empty($heading) && count($sections) > 1) {
|
||||
$heading = get_string('sectionnoname', 'quiz');
|
||||
$heading = \html_writer::span($heading, 'dimmed_text');
|
||||
}
|
||||
|
||||
if ($heading) {
|
||||
$cell = new html_table_cell($heading);
|
||||
if ($heading !== null) {
|
||||
// There is a heading here.
|
||||
$rowclasses = 'quizsummaryheading';
|
||||
if ($heading) {
|
||||
$heading = format_string($heading);
|
||||
} else if (count($attemptobj->get_quizobj()->get_sections()) > 1) {
|
||||
// If this is the start of an unnamed section, and the quiz has more
|
||||
// than one section, then add a default heading.
|
||||
$heading = get_string('sectionnoname', 'quiz');
|
||||
$rowclasses .= ' dimmed_text';
|
||||
}
|
||||
$cell = new html_table_cell(format_string($heading));
|
||||
$cell->header = true;
|
||||
$cell->colspan = $tablewidth;
|
||||
$table->data[] = array($cell);
|
||||
$table->rowclasses[] = 'quizsummaryheading';
|
||||
$table->rowclasses[] = $rowclasses;
|
||||
}
|
||||
|
||||
// Don't display information items.
|
||||
@@ -763,6 +787,7 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
||||
$button->add_action(new confirm_action(get_string('confirmclose', 'quiz'), null,
|
||||
get_string('submitallandfinish', 'quiz')));
|
||||
}
|
||||
$button->primary = true;
|
||||
|
||||
$duedate = $attemptobj->get_due_date();
|
||||
$message = '';
|
||||
@@ -786,19 +811,17 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
||||
/**
|
||||
* Generates the view page
|
||||
*
|
||||
* @param int $course The id of the course
|
||||
* @param array $quiz Array conting quiz data
|
||||
* @param int $cm Course Module ID
|
||||
* @param int $context The page context ID
|
||||
* @param array $infomessages information about this quiz
|
||||
* @param stdClass $course the course settings row from the database.
|
||||
* @param stdClass $quiz the quiz settings row from the database.
|
||||
* @param stdClass $cm the course_module settings row from the database.
|
||||
* @param context_module $context the quiz context.
|
||||
* @param mod_quiz_view_object $viewobj
|
||||
* @param string $buttontext text for the start/continue attempt button, if
|
||||
* it should be shown.
|
||||
* @param array $infomessages further information about why the student cannot
|
||||
* attempt this quiz now, if appicable this quiz
|
||||
* @return string HTML to display
|
||||
*/
|
||||
public function view_page($course, $quiz, $cm, $context, $viewobj) {
|
||||
$output = '';
|
||||
|
||||
$output .= $this->view_page_tertiary_nav($viewobj);
|
||||
$output .= $this->view_information($quiz, $cm, $context, $viewobj->infomessages);
|
||||
$output .= $this->view_table($quiz, $context, $viewobj);
|
||||
$output .= $this->view_result_info($quiz, $context, $cm, $viewobj);
|
||||
@@ -806,29 +829,51 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the tertiary navigation for the view page.
|
||||
*
|
||||
* @param mod_quiz_view_object $viewobj the information required to display the view page.
|
||||
* @return string HTML to output.
|
||||
*/
|
||||
public function view_page_tertiary_nav(mod_quiz_view_object $viewobj): string {
|
||||
$content = '';
|
||||
|
||||
if ($viewobj->buttontext) {
|
||||
$attemptbtn = $this->start_attempt_button($viewobj->buttontext,
|
||||
$viewobj->startattempturl, $viewobj->preflightcheckform,
|
||||
$viewobj->popuprequired, $viewobj->popupoptions);
|
||||
$content .= $attemptbtn;
|
||||
}
|
||||
|
||||
if ($viewobj->canedit && !$viewobj->quizhasquestions) {
|
||||
$content .= html_writer::link($viewobj->editurl, get_string('addquestion', 'quiz'),
|
||||
['class' => 'btn btn-secondary']);
|
||||
}
|
||||
|
||||
if ($content) {
|
||||
return html_writer::div(html_writer::div($content, 'row'), 'container-fluid mb-3');
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Work out, and render, whatever buttons, and surrounding info, should appear
|
||||
* at the end of the review page.
|
||||
* @param mod_quiz_view_object $viewobj the information required to display
|
||||
* the view page.
|
||||
*
|
||||
* @param mod_quiz_view_object $viewobj the information required to display the view page.
|
||||
* @return string HTML to output.
|
||||
*/
|
||||
public function view_page_buttons(mod_quiz_view_object $viewobj) {
|
||||
global $CFG;
|
||||
$output = '';
|
||||
|
||||
if (!$viewobj->quizhasquestions) {
|
||||
$output .= $this->no_questions_message($viewobj->canedit, $viewobj->editurl);
|
||||
$output .= html_writer::div(
|
||||
$this->notification(get_string('noquestions', 'quiz'), 'warning', false),
|
||||
'text-left mb-3');
|
||||
}
|
||||
|
||||
$output .= $this->access_messages($viewobj->preventmessages);
|
||||
|
||||
if ($viewobj->buttontext) {
|
||||
$output .= $this->start_attempt_button($viewobj->buttontext,
|
||||
$viewobj->startattempturl, $viewobj->preflightcheckform,
|
||||
$viewobj->popuprequired, $viewobj->popupoptions);
|
||||
}
|
||||
|
||||
if ($viewobj->showbacktocourse) {
|
||||
$output .= $this->single_button($viewobj->backtocourseurl,
|
||||
get_string('backtocourse', 'quiz'), 'get',
|
||||
@@ -887,12 +932,16 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
||||
/**
|
||||
* Generate a message saying that this quiz has no questions, with a button to
|
||||
* go to the edit page, if the user has the right capability.
|
||||
* @param object $quiz the quiz settings.
|
||||
* @param object $cm the course_module object.
|
||||
* @param object $context the quiz context.
|
||||
*
|
||||
* @param bool $canedit can the current user edit the quiz?
|
||||
* @param moodle_url $editurl URL of the edit quiz page.
|
||||
* @return string HTML to output.
|
||||
*
|
||||
* @deprecated since Moodle 4.0 MDL-71915 - please do not use this function any more.
|
||||
*/
|
||||
public function no_questions_message($canedit, $editurl) {
|
||||
debugging('no_questions_message() is deprecated, please use generate_no_questions_message() instead.', DEBUG_DEVELOPER);
|
||||
|
||||
$output = html_writer::start_tag('div', array('class' => 'card text-center mb-3'));
|
||||
$output .= html_writer::start_tag('div', array('class' => 'card-body'));
|
||||
|
||||
@@ -909,14 +958,16 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
||||
/**
|
||||
* Outputs an error message for any guests accessing the quiz
|
||||
*
|
||||
* @param int $course The course ID
|
||||
* @param array $quiz Array contingin quiz data
|
||||
* @param int $cm Course Module ID
|
||||
* @param int $context The page contect ID
|
||||
* @param stdClass $course the course settings row from the database.
|
||||
* @param stdClass $quiz the quiz settings row from the database.
|
||||
* @param stdClass $cm the course_module settings row from the database.
|
||||
* @param context_module $context the quiz context.
|
||||
* @param array $messages Array containing any messages
|
||||
* @param mod_quiz_view_object $viewobj
|
||||
*/
|
||||
public function view_page_guest($course, $quiz, $cm, $context, $messages) {
|
||||
public function view_page_guest($course, $quiz, $cm, $context, $messages, $viewobj) {
|
||||
$output = '';
|
||||
$output .= $this->view_page_tertiary_nav($viewobj);
|
||||
$output .= $this->view_information($quiz, $cm, $context, $messages);
|
||||
$guestno = html_writer::tag('p', get_string('guestsno', 'quiz'));
|
||||
$liketologin = html_writer::tag('p', get_string('liketologin'));
|
||||
@@ -928,15 +979,17 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
||||
/**
|
||||
* Outputs and error message for anyone who is not enrolle don the course
|
||||
*
|
||||
* @param int $course The course ID
|
||||
* @param array $quiz Array contingin quiz data
|
||||
* @param int $cm Course Module ID
|
||||
* @param int $context The page contect ID
|
||||
* @param stdClass $course the course settings row from the database.
|
||||
* @param stdClass $quiz the quiz settings row from the database.
|
||||
* @param stdClass $cm the course_module settings row from the database.
|
||||
* @param context_module $context the quiz context.
|
||||
* @param array $messages Array containing any messages
|
||||
* @param mod_quiz_view_object $viewobj
|
||||
*/
|
||||
public function view_page_notenrolled($course, $quiz, $cm, $context, $messages) {
|
||||
public function view_page_notenrolled($course, $quiz, $cm, $context, $messages, $viewobj) {
|
||||
global $CFG;
|
||||
$output = '';
|
||||
$output .= $this->view_page_tertiary_nav($viewobj);
|
||||
$output .= $this->view_information($quiz, $cm, $context, $messages);
|
||||
$youneedtoenrol = html_writer::tag('p', get_string('youneedtoenrol', 'quiz'));
|
||||
$button = html_writer::tag('p',
|
||||
@@ -952,25 +1005,12 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
||||
* @param object $cm the course_module object.
|
||||
* @param context $context the quiz context.
|
||||
* @param array $messages any access messages that should be described.
|
||||
* @param bool $quizhasquestions does quiz has questions added.
|
||||
* @return string HTML to output.
|
||||
*/
|
||||
public function view_information($quiz, $cm, $context, $messages) {
|
||||
global $USER;
|
||||
|
||||
public function view_information($quiz, $cm, $context, $messages, bool $quizhasquestions = false) {
|
||||
$output = '';
|
||||
|
||||
// Print quiz name.
|
||||
$output .= $this->heading(format_string($quiz->name));
|
||||
|
||||
// Print any activity information (eg completion requirements / dates).
|
||||
$cminfo = cm_info::create($cm);
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cminfo, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cminfo, $USER->id);
|
||||
$output .= $this->output->activity_information($cminfo, $completiondetails, $activitydates);
|
||||
|
||||
// Print quiz description.
|
||||
$output .= $this->quiz_intro($quiz, $cm);
|
||||
|
||||
// Output any access messages.
|
||||
if ($messages) {
|
||||
$output .= $this->box($this->access_messages($messages), 'quizinfo');
|
||||
@@ -1422,7 +1462,7 @@ class mod_quiz_view_object {
|
||||
public $buttontext;
|
||||
/** @var moodle_url $startattempturl URL to start an attempt. */
|
||||
public $startattempturl;
|
||||
/** @var moodleform|null $preflightcheckform confirmation form that must be
|
||||
/** @var mod_quiz_preflight_check_form|null $preflightcheckform confirmation form that must be
|
||||
* submitted before an attempt is started, if required. */
|
||||
public $preflightcheckform;
|
||||
/** @var moodle_url $startattempturl URL for any Back to the course button. */
|
||||
|
||||
@@ -68,7 +68,9 @@ abstract class quiz_default_report {
|
||||
$PAGE->set_heading($course->fullname);
|
||||
echo $OUTPUT->header();
|
||||
$context = context_module::instance($cm->id);
|
||||
echo $OUTPUT->heading(format_string($quiz->name, true, array('context' => $context)));
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($quiz->name, true, array('context' => $context)));
|
||||
}
|
||||
if (!empty($CFG->enableplagiarism)) {
|
||||
require_once($CFG->libdir . '/plagiarismlib.php');
|
||||
echo plagiarism_update_status($course, $cm);
|
||||
|
||||
@@ -42,7 +42,8 @@ Feature: Basic use of the Manual grading report
|
||||
|
||||
# Check report shows nothing when there are no attempts.
|
||||
When I am on the "Quiz 1" "mod_quiz > View" page logged in as "teacher1"
|
||||
And I navigate to "Results > Manual grading" in current page administration
|
||||
And I navigate to "Results" in current page administration
|
||||
And I select "Manual grading" from the "jump" singleselect
|
||||
Then I should see "Quiz 1" in the "//nav[contains(concat(' ', normalize-space(@aria-label), ' '), ' Navigation bar ')]" "xpath_element"
|
||||
And I should see "Quiz 1"
|
||||
And I should see "Nothing to display"
|
||||
@@ -126,7 +127,8 @@ Feature: Basic use of the Manual grading report
|
||||
| slot | response |
|
||||
| 1 | Paris |
|
||||
When I am on the "Quiz 1" "mod_quiz > View" page logged in as "teacher1"
|
||||
And I navigate to "Results > Manual grading" in current page administration
|
||||
And I navigate to "Results" in current page administration
|
||||
And I select "Manual grading" from the "jump" singleselect
|
||||
And I follow "Also show questions that have been graded automatically"
|
||||
And I click on "update grades" "link" in the "Short answer 001" "table_row"
|
||||
Then I should see "Attempt number 1 for S1 Student1 (student1, S1000, student1@example.com, little yellow frog)"
|
||||
|
||||
@@ -34,7 +34,8 @@ Feature: Basic use of the Responses report
|
||||
@javascript
|
||||
Scenario: Report works when there are no attempts
|
||||
Given I am on the "Quiz 1" "quiz activity" page logged in as teacher
|
||||
When I navigate to "Results > Responses" in current page administration
|
||||
When I navigate to "Results" in current page administration
|
||||
And I select "Responses" from the "jump" singleselect
|
||||
Then I should see "Attempts: 0"
|
||||
And I should see "Nothing to display"
|
||||
And I set the field "Attempts from" to "enrolled users who have not attempted the quiz"
|
||||
@@ -54,7 +55,8 @@ Feature: Basic use of the Responses report
|
||||
And user "student1" has finished an attempt at quiz "Quiz 1"
|
||||
|
||||
And I am on the "Quiz 1" "quiz activity" page logged in as teacher
|
||||
And I navigate to "Results > Responses" in current page administration
|
||||
And I navigate to "Results" in current page administration
|
||||
And I select "Responses" from the "jump" singleselect
|
||||
Then I should see "Attempts: 1"
|
||||
And I should see "Student One"
|
||||
And I should not see "Student Two"
|
||||
@@ -71,7 +73,8 @@ Feature: Basic use of the Responses report
|
||||
@javascript
|
||||
Scenario: Report does not allow strange combinations of options
|
||||
Given I am on the "Quiz 1" "quiz activity" page logged in as teacher
|
||||
And I navigate to "Results > Responses" in current page administration
|
||||
And I navigate to "Results" in current page administration
|
||||
And I select "Responses" from the "jump" singleselect
|
||||
And the "Which tries" "select" should be enabled
|
||||
When I set the field "Attempts from" to "enrolled users who have not attempted the quiz"
|
||||
Then the "Which tries" "select" should be disabled
|
||||
|
||||
@@ -40,7 +40,8 @@ Feature: Basic use of the Statistics report
|
||||
@javascript
|
||||
Scenario: Report works when there are no attempts
|
||||
Given I am on the "Quiz 1" "quiz activity" page logged in as teacher1
|
||||
And I navigate to "Results > Statistics" in current page administration
|
||||
And I navigate to "Results" in current page administration
|
||||
And I select "Statistics" from the "jump" singleselect
|
||||
Then I should see "No attempts have been made at this quiz, or all attempts have questions that need manual grading."
|
||||
And I should not see "Statistics for question positions"
|
||||
And "Show chart data" "link" should not exist
|
||||
@@ -60,7 +61,8 @@ Feature: Basic use of the Statistics report
|
||||
| 2 | False |
|
||||
| 3 | False |
|
||||
And I am on the "Quiz 1" "quiz activity" page logged in as teacher1
|
||||
And I navigate to "Results > Statistics" in current page administration
|
||||
And I navigate to "Results" in current page administration
|
||||
And I select "Statistics" from the "jump" singleselect
|
||||
And I press "Show report"
|
||||
Then I should not see "No questions have been attempted yet"
|
||||
And "Show chart data" "link" should exist
|
||||
|
||||
@@ -42,6 +42,7 @@ if ($page !== 0) {
|
||||
$url->param('showall', $showall);
|
||||
}
|
||||
$PAGE->set_url($url);
|
||||
$PAGE->set_secondary_active_tab("modulepage");
|
||||
|
||||
$attemptobj = quiz_create_attempt_handling_errors($attemptid, $cmid);
|
||||
$attemptobj->preload_all_attempt_step_users();
|
||||
|
||||
+1
-2
@@ -243,8 +243,7 @@
|
||||
|
||||
/** Mod quiz view **/
|
||||
#page-mod-quiz-view .quizinfo,
|
||||
#page-mod-quiz-view #page .quizgradefeedback,
|
||||
#page-mod-quiz-view #page .quizattempt {
|
||||
#page-mod-quiz-view #page .quizgradefeedback {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ $cmid = optional_param('cmid', null, PARAM_INT);
|
||||
$PAGE->set_url('/mod/quiz/summary.php', array('attempt' => $attemptid));
|
||||
// During quiz attempts, the browser back/forwards buttons should force a reload.
|
||||
$PAGE->set_cacheable(false);
|
||||
$PAGE->set_secondary_active_tab("modulepage");
|
||||
|
||||
$attemptobj = quiz_create_attempt_handling_errors($attemptid, $cmid);
|
||||
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
{{!
|
||||
This file is part of Moodle - http://moodle.org/
|
||||
|
||||
Moodle is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Moodle is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
}}
|
||||
{{!
|
||||
@template mod_quiz/overrides_actions
|
||||
Actions bar at the top of the overrides page UI.
|
||||
|
||||
Classes required for JS:
|
||||
* none
|
||||
|
||||
Data attributes required for JS:
|
||||
* none
|
||||
|
||||
Context variables required for this template:
|
||||
* overridesnav - must alwasy be present.
|
||||
* addoverridebutton - should only be present if the user has permission to add a new override.
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
"overridesnav": {
|
||||
"options": [{
|
||||
"name": "User overrides",
|
||||
"value": "/mod/quiz/overrides.php?cmid=71&mode=user"
|
||||
},
|
||||
{
|
||||
"name": "Group overrides",
|
||||
"value": "/mod/quiz/overrides.php?cmid=71&mode=group"
|
||||
}
|
||||
]
|
||||
},
|
||||
"addoverridebutton": {
|
||||
"id": "single_button1234",
|
||||
"method": "get",
|
||||
"url": "http://localhost/moodle/mod/quiz/overrideedit.php",
|
||||
"lablel": "Add user override",
|
||||
"classes": "singlebutton",
|
||||
"disabled": false,
|
||||
"params": [
|
||||
{
|
||||
"name": "cmid",
|
||||
"value": "73"
|
||||
},
|
||||
{
|
||||
"name": "action",
|
||||
"value": "adduser"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}}
|
||||
<div class="container-fluid mb-3">
|
||||
<div class="row">
|
||||
{{#overridesnav}}
|
||||
<div class="col-xs-6">
|
||||
{{>core/url_select}}
|
||||
</div>
|
||||
{{/overridesnav}}
|
||||
{{#addoverridebutton}}
|
||||
<div class="ml-3">
|
||||
{{>core/single_button}}
|
||||
</div>
|
||||
{{/addoverridebutton}}
|
||||
</div>
|
||||
</div>
|
||||
@@ -36,7 +36,7 @@ Feature: Add a quiz
|
||||
And I log out
|
||||
|
||||
And I am on the "Test quiz name" "quiz activity" page logged in as student1
|
||||
And I press "Attempt quiz now"
|
||||
And I press "Attempt quiz"
|
||||
Then I should see "Question 1"
|
||||
And I should see "Answer the first question"
|
||||
And I set the field "True" to "1"
|
||||
|
||||
@@ -73,7 +73,7 @@ Feature: Attempt a quiz
|
||||
| Section 3 | 5 | 1 |
|
||||
|
||||
When I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
|
||||
And I press "Attempt quiz now"
|
||||
And I press "Attempt quiz"
|
||||
|
||||
Then I should see "Section 1" in the "Quiz navigation" "block"
|
||||
And I should see question "1" in section "Section 1" in the quiz navigation
|
||||
@@ -125,7 +125,7 @@ Feature: Attempt a quiz
|
||||
| TF1 | 1 |
|
||||
| TF2 | 2 |
|
||||
When I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
|
||||
And I press "Attempt quiz now"
|
||||
And I press "Attempt quiz"
|
||||
Then I should see "Text of the first question"
|
||||
And I should not see "Text of the second question"
|
||||
And I press "Next page"
|
||||
|
||||
@@ -30,7 +30,7 @@ Feature: The various checks that may happen when an attept is started
|
||||
| question | page |
|
||||
| TF1 | 1 |
|
||||
When I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
|
||||
And I press "Attempt quiz now"
|
||||
And I press "Attempt quiz"
|
||||
Then I should see "Text of the first question"
|
||||
|
||||
@javascript
|
||||
@@ -42,7 +42,7 @@ Feature: The various checks that may happen when an attept is started
|
||||
| question | page |
|
||||
| TF1 | 1 |
|
||||
When I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
|
||||
And I press "Attempt quiz now"
|
||||
And I press "Attempt quiz"
|
||||
Then I should see "To attempt this quiz you need to know the quiz password" in the "Start attempt" "dialogue"
|
||||
And I should see "Your attempt will have a time limit of 1 hour. When you " in the "Start attempt" "dialogue"
|
||||
And I set the field "Quiz password" to "Frog"
|
||||
@@ -58,10 +58,10 @@ Feature: The various checks that may happen when an attept is started
|
||||
| question | page |
|
||||
| TF1 | 1 |
|
||||
When I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
|
||||
And I press "Attempt quiz now"
|
||||
And I press "Attempt quiz"
|
||||
And I click on "Cancel" "button" in the "Start attempt" "dialogue"
|
||||
Then I should see "Quiz 1 description"
|
||||
And "Attempt quiz now" "button" should be visible
|
||||
And "Attempt quiz" "button" should be visible
|
||||
|
||||
@javascript
|
||||
Scenario: Start a quiz with time limit and password, get the password wrong first time
|
||||
@@ -72,7 +72,7 @@ Feature: The various checks that may happen when an attept is started
|
||||
| question | page |
|
||||
| TF1 | 1 |
|
||||
When I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
|
||||
And I press "Attempt quiz now"
|
||||
And I press "Attempt quiz"
|
||||
And I set the field "Quiz password" to "Toad"
|
||||
And I click on "Start attempt" "button" in the "Start attempt" "dialogue"
|
||||
Then I should see "Quiz 1 description"
|
||||
@@ -94,7 +94,7 @@ Feature: The various checks that may happen when an attept is started
|
||||
| question | page |
|
||||
| TF1 | 1 |
|
||||
When I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
|
||||
And I press "Attempt quiz now"
|
||||
And I press "Attempt quiz"
|
||||
And I set the field "Quiz password" to "Toad"
|
||||
And I click on "Start attempt" "button" in the "Start attempt" "dialogue"
|
||||
And I should see "Quiz 1 description"
|
||||
@@ -106,4 +106,4 @@ Feature: The various checks that may happen when an attept is started
|
||||
And I press tab key in "Quiz password" "field"
|
||||
And I press "Cancel"
|
||||
Then I should see "Quiz 1 description"
|
||||
And "Attempt quiz now" "button" should be visible
|
||||
And "Attempt quiz" "button" should be visible
|
||||
|
||||
@@ -34,7 +34,7 @@ Feature: Allow students to redo questions in a practice quiz, without starting a
|
||||
@javascript
|
||||
Scenario: After completing a question, there is a redo question button that restarts the question
|
||||
Given I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
|
||||
When I press "Attempt quiz now"
|
||||
When I press "Attempt quiz"
|
||||
And I click on "False" "radio" in the "First question" "question"
|
||||
And I click on "Check" "button" in the "First question" "question"
|
||||
And I press "Try another question like this one"
|
||||
@@ -44,7 +44,7 @@ Feature: Allow students to redo questions in a practice quiz, without starting a
|
||||
@javascript
|
||||
Scenario: The redo question button is visible but disabled for teachers
|
||||
Given I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
|
||||
When I press "Attempt quiz now"
|
||||
When I press "Attempt quiz"
|
||||
And I click on "False" "radio" in the "First question" "question"
|
||||
And I click on "Check" "button" in the "First question" "question"
|
||||
And I log out
|
||||
@@ -56,7 +56,7 @@ Feature: Allow students to redo questions in a practice quiz, without starting a
|
||||
@javascript
|
||||
Scenario: The redo question buttons are no longer visible after the attempt is submitted.
|
||||
Given I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
|
||||
When I press "Attempt quiz now"
|
||||
When I press "Attempt quiz"
|
||||
And I click on "False" "radio" in the "First question" "question"
|
||||
And I click on "Check" "button" in the "First question" "question"
|
||||
And I press "Finish attempt ..."
|
||||
@@ -67,7 +67,7 @@ Feature: Allow students to redo questions in a practice quiz, without starting a
|
||||
@javascript @_switch_window
|
||||
Scenario: Teachers reviewing can see all the questions attempted in a slot
|
||||
Given I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
|
||||
When I press "Attempt quiz now"
|
||||
When I press "Attempt quiz"
|
||||
And I click on "False" "radio" in the "First question" "question"
|
||||
And I click on "Check" "button" in the "First question" "question"
|
||||
And I press "Try another question like this one"
|
||||
@@ -87,7 +87,8 @@ Feature: Allow students to redo questions in a practice quiz, without starting a
|
||||
And the state of "First question" question is shown as "Not answered"
|
||||
And I should not see "Submit" in the ".history" "css_element"
|
||||
And I am on the "Quiz 1" "mod_quiz > View" page
|
||||
And I navigate to "Results > Statistics" in current page administration
|
||||
And I navigate to "Results" in current page administration
|
||||
And I select "Statistics" from the "jump" singleselect
|
||||
And I follow "TF1"
|
||||
And "False" row "Frequency" column of "quizresponseanalysis" table should contain "100.00%"
|
||||
And "True" row "Frequency" column of "quizresponseanalysis" table should contain "0.00%"
|
||||
@@ -96,7 +97,7 @@ Feature: Allow students to redo questions in a practice quiz, without starting a
|
||||
@javascript
|
||||
Scenario: Redoing question 1 should save any changes to question 2 on the same page
|
||||
Given I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
|
||||
When I press "Attempt quiz now"
|
||||
When I press "Attempt quiz"
|
||||
And I click on "False" "radio" in the "First question" "question"
|
||||
And I click on "Check" "button" in the "First question" "question"
|
||||
And I click on "True" "radio" in the "Second question" "question"
|
||||
@@ -117,7 +118,7 @@ Feature: Allow students to redo questions in a practice quiz, without starting a
|
||||
| slot | actualquestion |
|
||||
| 1 | TF1 |
|
||||
And I am on the "Quiz 2" "mod_quiz > View" page logged in as "student"
|
||||
When I press "Continue the last attempt"
|
||||
When I press "Continue your attempt"
|
||||
And I should see "First question"
|
||||
And I click on "False" "radio"
|
||||
And I click on "Check" "button"
|
||||
@@ -139,7 +140,8 @@ Feature: Allow students to redo questions in a practice quiz, without starting a
|
||||
| slot | response |
|
||||
| 1 | J.K.Rowling |
|
||||
And I am on the "Quiz 2" "mod_quiz > View" page logged in as "teacher"
|
||||
And I navigate to "Results > Manual grading" in current page administration
|
||||
And I navigate to "Results" in current page administration
|
||||
And I select "Manual grading" from the "jump" singleselect
|
||||
And I follow "Also show questions that have been graded automatically"
|
||||
When I click on "update grades" "link" in the "SA1" "table_row"
|
||||
Then I set the field "Comment" to "I have adjusted your mark to 1.0"
|
||||
|
||||
@@ -35,7 +35,7 @@ Feature: Attempt a quiz where some questions require that the previous question
|
||||
| TF2 | 1 | 1 |
|
||||
|
||||
When I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
|
||||
And I press "Attempt quiz now"
|
||||
And I press "Attempt quiz"
|
||||
|
||||
Then I should see "First question"
|
||||
And I should see "This question cannot be attempted until the previous question has been completed."
|
||||
@@ -63,7 +63,7 @@ Feature: Attempt a quiz where some questions require that the previous question
|
||||
| TF2 | 1 | 1 |
|
||||
|
||||
When I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
|
||||
And I press "Attempt quiz now"
|
||||
And I press "Attempt quiz"
|
||||
And I click on "True" "radio" in the "First question" "question"
|
||||
And I press "Check"
|
||||
|
||||
@@ -88,7 +88,7 @@ Feature: Attempt a quiz where some questions require that the previous question
|
||||
| TF2 | 1 | 1 |
|
||||
|
||||
When I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
|
||||
And I press "Attempt quiz now"
|
||||
And I press "Attempt quiz"
|
||||
And I press "Finish attempt ..."
|
||||
And I press "Submit all and finish"
|
||||
And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
|
||||
@@ -111,7 +111,7 @@ Feature: Attempt a quiz where some questions require that the previous question
|
||||
| TF2 | 1 | 1 |
|
||||
|
||||
When I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
|
||||
And I press "Attempt quiz now"
|
||||
And I press "Attempt quiz"
|
||||
|
||||
Then I should see "First question"
|
||||
And I should see "Second question"
|
||||
@@ -135,7 +135,7 @@ Feature: Attempt a quiz where some questions require that the previous question
|
||||
| Section 1 | 1 | 1 |
|
||||
|
||||
When I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
|
||||
And I press "Attempt quiz now"
|
||||
And I press "Attempt quiz"
|
||||
|
||||
Then I should see "First question"
|
||||
And I should see "Second question"
|
||||
@@ -160,7 +160,7 @@ Feature: Attempt a quiz where some questions require that the previous question
|
||||
| Section 2 | 2 | 0 |
|
||||
|
||||
When I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
|
||||
And I press "Attempt quiz now"
|
||||
And I press "Attempt quiz"
|
||||
And I press "Next page"
|
||||
|
||||
Then I should see "Second question"
|
||||
@@ -181,7 +181,7 @@ Feature: Attempt a quiz where some questions require that the previous question
|
||||
| TF2 | 1 | 1 |
|
||||
|
||||
When I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
|
||||
And I press "Attempt quiz now"
|
||||
And I press "Attempt quiz"
|
||||
|
||||
Then I should see "First question"
|
||||
And I should see "Second question"
|
||||
@@ -202,7 +202,7 @@ Feature: Attempt a quiz where some questions require that the previous question
|
||||
| TF2 | 1 | 1 |
|
||||
|
||||
When I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
|
||||
And I press "Attempt quiz now"
|
||||
And I press "Attempt quiz"
|
||||
|
||||
Then I should see "First question"
|
||||
And I should see "Second question"
|
||||
@@ -223,7 +223,7 @@ Feature: Attempt a quiz where some questions require that the previous question
|
||||
| TF1 | 1 | 1 |
|
||||
|
||||
When I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
|
||||
And I press "Attempt quiz now"
|
||||
And I press "Attempt quiz"
|
||||
|
||||
Then I should see "Read me"
|
||||
And I should see "First question"
|
||||
|
||||
@@ -18,7 +18,6 @@ Feature: Edit quiz page - adding things
|
||||
| activity | name | intro | course | idnumber |
|
||||
| quiz | Quiz 1 | Quiz 1 for testing the Add menu | C1 | quiz1 |
|
||||
And I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
|
||||
And I should see "Editing quiz: Quiz 1"
|
||||
|
||||
@javascript
|
||||
Scenario: Add some new question to the quiz using '+ a new question' options of the 'Add' menu.
|
||||
@@ -30,7 +29,6 @@ Feature: Edit quiz page - adding things
|
||||
And I set the field "Question name" to "Essay 01 new"
|
||||
And I set the field "Question text" to "Please write 200 words about Essay 01"
|
||||
And I press "id_submitbutton"
|
||||
Then I should see "Editing quiz: Quiz 1"
|
||||
And I should see "Essay 01 new" on quiz page "1"
|
||||
|
||||
And I open the "Page 1" add to quiz menu
|
||||
@@ -41,7 +39,6 @@ Feature: Edit quiz page - adding things
|
||||
And I set the field "Question name" to "Essay 02 new"
|
||||
And I set the field "Question text" to "Please write 200 words about Essay 02"
|
||||
And I press "id_submitbutton"
|
||||
Then I should see "Editing quiz: Quiz 1"
|
||||
And I should see "Essay 01 new" on quiz page "1"
|
||||
And I should see "Essay 02 new" on quiz page "1"
|
||||
|
||||
@@ -53,7 +50,6 @@ Feature: Edit quiz page - adding things
|
||||
And I set the field "Question name" to "Essay 03 new"
|
||||
And I set the field "Question text" to "Please write 300 words about Essay 03"
|
||||
And I press "id_submitbutton"
|
||||
Then I should see "Editing quiz: Quiz 1"
|
||||
And I should see "Essay 01 new" on quiz page "1"
|
||||
And I should see "Essay 02 new" on quiz page "1"
|
||||
And I should see "Essay 03 new" on quiz page "1"
|
||||
@@ -66,7 +62,6 @@ Feature: Edit quiz page - adding things
|
||||
And I set the field "Question name" to "Essay 04 new"
|
||||
And I set the field "Question text" to "Please write 300 words about Essay 04"
|
||||
And I press "id_submitbutton"
|
||||
Then I should see "Editing quiz: Quiz 1"
|
||||
And I should see "Essay 01 new" on quiz page "1"
|
||||
And I should see "Essay 02 new" on quiz page "1"
|
||||
And I should see "Essay 03 new" on quiz page "1"
|
||||
@@ -77,7 +72,7 @@ Feature: Edit quiz page - adding things
|
||||
When I press "Repaginate"
|
||||
Then I should see "Repaginate with"
|
||||
And I set the field "menuquestionsperpage" to "2"
|
||||
When I click on "Go" "button" in the "Repaginate" "dialogue"
|
||||
And I click on "Go" "button" in the "Repaginate" "dialogue"
|
||||
And I should see "Essay 01 new" on quiz page "1"
|
||||
And I should see "Essay 02 new" on quiz page "1"
|
||||
And I should see "Essay 03 new" on quiz page "2"
|
||||
@@ -89,10 +84,9 @@ Feature: Edit quiz page - adding things
|
||||
And I set the field "item_qtype_essay" to "1"
|
||||
And I press "submitbutton"
|
||||
Then I should see "Adding an Essay question"
|
||||
When I set the field "Question name" to "Essay for page 2"
|
||||
And I set the field "Question name" to "Essay for page 2"
|
||||
And I set the field "Question text" to "Please write 200 words about Essay for page 2"
|
||||
And I press "id_submitbutton"
|
||||
Then I should see "Editing quiz: Quiz 1"
|
||||
And I should see "Essay 01 new" on quiz page "1"
|
||||
And I should see "Essay 02 new" on quiz page "1"
|
||||
And I should see "Essay 03 new" on quiz page "2"
|
||||
@@ -106,22 +100,25 @@ Feature: Edit quiz page - adding things
|
||||
|
||||
# Create a couple of sub categories.
|
||||
When I am on "Course 1" course homepage
|
||||
And I navigate to "Question bank > Categories" in current page administration
|
||||
And I navigate to "Question bank" in current page administration
|
||||
And I select "Categories" from the "questionbankactionselect" singleselect
|
||||
Then I should see "Add category"
|
||||
And I follow "Add category"
|
||||
Then I set the field "Parent category" to "Default for C1"
|
||||
And I set the field "Name" to "Subcat 1"
|
||||
And I set the field "Category info" to "This is sub category 1"
|
||||
Then I press "id_submitbutton"
|
||||
And I press "id_submitbutton"
|
||||
And I should see "Subcat 1"
|
||||
|
||||
And I follow "Add category"
|
||||
Then I set the field "Parent category" to "Default for C1"
|
||||
And I set the field "Name" to "Subcat 2"
|
||||
And I set the field "Category info" to "This is sub category 2"
|
||||
Then I press "id_submitbutton"
|
||||
And I press "id_submitbutton"
|
||||
And I should see "Subcat 2"
|
||||
|
||||
And I click on "Questions" "link"
|
||||
Then I should see "Question bank"
|
||||
And I select "Questions" from the "questionbankactionselect" singleselect
|
||||
And I should see "Question bank"
|
||||
And I should see "Select a category"
|
||||
|
||||
# Create the Essay 01 question.
|
||||
@@ -194,14 +191,12 @@ Feature: Edit quiz page - adding things
|
||||
And I click on "Select" "checkbox" in the "Essay 03" "table_row"
|
||||
Then the "Add selected questions to the quiz" "button" should be enabled
|
||||
And I click on "Add to quiz" "link" in the "Essay 03" "table_row"
|
||||
Then I should see "Editing quiz: Quiz 1"
|
||||
And I should see "Essay 03" on quiz page "1"
|
||||
|
||||
# Add Essay 01 from question bank.
|
||||
And I open the "Page 1" add to quiz menu
|
||||
And I follow "from question bank"
|
||||
And I click on "Add to quiz" "link" in the "Essay 01" "table_row"
|
||||
Then I should see "Editing quiz: Quiz 1"
|
||||
And I should see "Essay 03" on quiz page "1"
|
||||
And I should see "Essay 01" on quiz page "1"
|
||||
|
||||
@@ -211,7 +206,6 @@ Feature: Edit quiz page - adding things
|
||||
And I should see "Select a category"
|
||||
And I set the field "Select a category" to "Subcat 1"
|
||||
And I click on "Add to quiz" "link" in the "Essay 02" "table_row"
|
||||
Then I should see "Editing quiz: Quiz 1"
|
||||
And I should see "Essay 03" on quiz page "1"
|
||||
And I should see "Essay 01" on quiz page "1"
|
||||
And I should see "Essay 02" on quiz page "1"
|
||||
@@ -220,7 +214,6 @@ Feature: Edit quiz page - adding things
|
||||
And I open the "Page 1" add to quiz menu
|
||||
And I follow "a random question"
|
||||
And I press "Add random question"
|
||||
Then I should see "Editing quiz: Quiz 1"
|
||||
And I should see "Essay 03" on quiz page "1"
|
||||
And I should see "Essay 01" on quiz page "1"
|
||||
And I should see "Essay 02" on quiz page "1"
|
||||
@@ -246,7 +239,6 @@ Feature: Edit quiz page - adding things
|
||||
And I set the field "Question name" to "Essay for page 4"
|
||||
And I set the field "Question text" to "Please write 200 words about Essay for page 4"
|
||||
And I press "id_submitbutton"
|
||||
Then I should see "Editing quiz: Quiz 1"
|
||||
And I should see "Essay 03" on quiz page "1"
|
||||
And I should see "Essay 01" on quiz page "2"
|
||||
And I should see "Essay 02" on quiz page "3"
|
||||
|
||||
@@ -25,8 +25,6 @@ Feature: Edit quiz page - pagination
|
||||
Scenario: Repaginate questions with N question(s) per page as well as clicking
|
||||
on "add page break" or "Remove page break" icons to repaginate in any desired format.
|
||||
|
||||
Then I should see "Editing quiz: Quiz 1"
|
||||
|
||||
# Add the first Essay question.
|
||||
And I open the action menu in ".page-add-actions" "css_element"
|
||||
And I follow "a new question"
|
||||
@@ -36,8 +34,7 @@ Feature: Edit quiz page - pagination
|
||||
And I set the field "Question name" to "Essay 01 new"
|
||||
And I set the field "Question text" to "Please write 100 words about Essay 01"
|
||||
And I press "id_submitbutton"
|
||||
Then I should see "Editing quiz: Quiz 1"
|
||||
And I should see "Essay 01 new" on quiz page "1"
|
||||
Then I should see "Essay 01 new" on quiz page "1"
|
||||
|
||||
# Add the second Essay question.
|
||||
And I open the action menu in ".page-add-actions" "css_element"
|
||||
@@ -48,8 +45,7 @@ Feature: Edit quiz page - pagination
|
||||
And I set the field "Question name" to "Essay 02 new"
|
||||
And I set the field "Question text" to "Please write 200 words about Essay 02"
|
||||
And I press "id_submitbutton"
|
||||
Then I should see "Editing quiz: Quiz 1"
|
||||
And I should see "Essay 01 new" on quiz page "1"
|
||||
Then I should see "Essay 01 new" on quiz page "1"
|
||||
And I should see "Essay 02 new" on quiz page "1"
|
||||
|
||||
# Start repaginating.
|
||||
@@ -73,8 +69,7 @@ Feature: Edit quiz page - pagination
|
||||
And I set the field "Question name" to "Essay 03 new"
|
||||
And I set the field "Question text" to "Please write 200 words about Essay 03"
|
||||
And I press "id_submitbutton"
|
||||
Then I should see "Editing quiz: Quiz 1"
|
||||
And I should see "Essay 01 new" on quiz page "1"
|
||||
Then I should see "Essay 01 new" on quiz page "1"
|
||||
And I should see "Essay 02 new" on quiz page "1"
|
||||
And I should see "Essay 03 new" on quiz page "1"
|
||||
And I should not see "Page 2"
|
||||
@@ -121,8 +116,7 @@ Feature: Edit quiz page - pagination
|
||||
When I set the field "Question name" to "Essay 04 new"
|
||||
And I set the field "Question text" to "Please write 300 words about Essay 04"
|
||||
And I press "id_submitbutton"
|
||||
Then I should see "Editing quiz: Quiz 1"
|
||||
And I should see "Essay 01 new" on quiz page "1"
|
||||
Then I should see "Essay 01 new" on quiz page "1"
|
||||
And I should see "Essay 02 new" on quiz page "2"
|
||||
And I should see "Essay 03 new" on quiz page "3"
|
||||
And I should see "Essay 04 new" on quiz page "3"
|
||||
|
||||
@@ -31,7 +31,7 @@ Feature: Edit quiz marks with attempts
|
||||
| Default mark | 3.0 |
|
||||
And I log out
|
||||
And I am on the "Quiz 1" "mod_quiz > View" page logged in as "student1"
|
||||
And I press "Attempt quiz now"
|
||||
And I press "Attempt quiz"
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on the "Quiz 1" "mod_quiz > Edit" page
|
||||
|
||||
@@ -29,7 +29,7 @@ Feature: Teachers can override the grade for any question
|
||||
| question | page |
|
||||
| TF1 | 1 |
|
||||
And I am on the "Quiz 1" "mod_quiz > View" page logged in as "student1"
|
||||
And I press "Attempt quiz now"
|
||||
And I press "Attempt quiz"
|
||||
And I follow "Finish attempt ..."
|
||||
And I press "Submit all and finish"
|
||||
And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
|
||||
|
||||
@@ -44,6 +44,6 @@ Feature: Preview a quiz as a teacher
|
||||
@javascript
|
||||
Scenario: Preview the quiz
|
||||
Given I am on the "Quiz 1" "mod_quiz > View" page logged in as "teacher"
|
||||
When I press "Preview quiz now"
|
||||
When I press "Preview quiz"
|
||||
Then I should see "Question 1"
|
||||
And "Start a new preview" "button" should exist
|
||||
|
||||
@@ -56,7 +56,7 @@ Feature: Quiz group override
|
||||
Then the "Override group" select box should contain "Group 1"
|
||||
And the "Override group" select box should not contain "Group 2"
|
||||
|
||||
Scenario: Override Group 1 as teacher in no group
|
||||
Scenario: Add button disabled if there are no groups
|
||||
Given the following "permission overrides" exist:
|
||||
| capability | permission | role | contextlevel | reference |
|
||||
| moodle/site:accessallgroups | Prevent | editingteacher | Course | C1 |
|
||||
|
||||
@@ -33,7 +33,7 @@ Feature: Quiz user override
|
||||
| quiz | Test quiz | C1 | quiz1 |
|
||||
And I am on the "Test quiz" "mod_quiz > View" page logged in as "teacher"
|
||||
And I change window size to "large"
|
||||
And I navigate to "User overrides" in current page administration
|
||||
And I navigate to "Overrides" in current page administration
|
||||
And I press "Add user override"
|
||||
And I set the following fields to these values:
|
||||
| Override user | Student One (student1@example.com) |
|
||||
@@ -147,7 +147,7 @@ Feature: Quiz user override
|
||||
| Test quiz | student1 | 2 |
|
||||
| Test quiz | student2 | 2 |
|
||||
And I am on the "Test quiz" "mod_quiz > View" page logged in as "helper"
|
||||
When I navigate to "User overrides" in current page administration
|
||||
When I navigate to "Overrides" in current page administration
|
||||
Then "Student One" "table_row" should exist
|
||||
And "Student Two" "table_row" should exist
|
||||
And "Add user override" "button" should not exist
|
||||
@@ -186,3 +186,13 @@ Feature: Quiz user override
|
||||
|
||||
And I click on "Delete" "link" in the "Student One" "table_row"
|
||||
And I should see "Student One (student1@example.com, yellow frog)"
|
||||
|
||||
Scenario: Add button disabled if no users
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 2 | C2 | 0 |
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber |
|
||||
| quiz | Other quiz | C2 | quiz2 |
|
||||
When I am on the "Other quiz" "mod_quiz > User overrides" page logged in as "admin"
|
||||
Then the "Add user override" "button" should be disabled
|
||||
|
||||
@@ -52,7 +52,7 @@ Feature: Settings form fields disabled if not required
|
||||
# And the "id_delay2_enabled" "field" should be enabled
|
||||
|
||||
When I press "Save and display"
|
||||
And I navigate to "User overrides" in current page administration
|
||||
And I navigate to "Overrides" in current page administration
|
||||
And I press "Add user override"
|
||||
And I set the following fields to these values:
|
||||
| Override user | Student1 |
|
||||
@@ -67,7 +67,7 @@ Feature: Settings form fields disabled if not required
|
||||
And the "id_delay2_enabled" "field" should be enabled
|
||||
|
||||
When I press "Save and display"
|
||||
And I navigate to "User overrides" in current page administration
|
||||
And I navigate to "Overrides" in current page administration
|
||||
And I click on "Edit" "link" in the "region-main" "region"
|
||||
And I set the field "Attempts allowed" to "2"
|
||||
And I press "Save"
|
||||
@@ -80,7 +80,7 @@ Feature: Settings form fields disabled if not required
|
||||
And the "id_delay2_enabled" "field" should be disabled
|
||||
|
||||
When I press "Save and display"
|
||||
And I navigate to "User overrides" in current page administration
|
||||
And I navigate to "Overrides" in current page administration
|
||||
And I press "Add user override"
|
||||
And I set the following fields to these values:
|
||||
| Override user | Student2 |
|
||||
|
||||
@@ -8,6 +8,8 @@ This files describes API changes in the quiz code.
|
||||
- quiz_send_notification_messages() in mod/quiz/locallib.php
|
||||
* The completionpass criteria has been moved to core as 'completionpassgrade'. Refer to completion/upgrade.txt for
|
||||
further information.
|
||||
* New argument quizhasquestions has been added to public methods: view_information in mod/quiz/renderer.php.
|
||||
* The function no_questions_message() in class mod_quiz_renderer is deprecated. There is no replacement.
|
||||
* quiz_slots has been updated as a part of https://docs.moodle.org/dev/Question_bank_improvements_for_Moodle_4.0
|
||||
The fields removed will be now manage by a new table in core_question:
|
||||
- question_set_reference -> Records where a specific question is used.
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2022020300;
|
||||
$plugin->version = 2022020301;
|
||||
$plugin->requires = 2021052500;
|
||||
$plugin->component = 'mod_quiz';
|
||||
|
||||
+5
-9
@@ -147,12 +147,8 @@ if (html_is_blank($quiz->intro)) {
|
||||
$PAGE->activityheader->set_description('');
|
||||
}
|
||||
$PAGE->add_body_class('limitedwidth');
|
||||
/** @var mod_quiz_renderer $output */
|
||||
$output = $PAGE->get_renderer('mod_quiz');
|
||||
// MDL-71915 Will remove this place holder.
|
||||
if (defined('BEHAT_SITE_RUNNING')) {
|
||||
$PAGE->has_secondary_navigation_setter(false);
|
||||
}
|
||||
$PAGE->add_header_action($OUTPUT->region_main_settings_menu());
|
||||
|
||||
// Print table with existing attempts.
|
||||
if ($attempts) {
|
||||
@@ -225,13 +221,13 @@ if (!$viewobj->quizhasquestions) {
|
||||
if ($viewobj->preventmessages) {
|
||||
$viewobj->buttontext = '';
|
||||
} else if ($viewobj->numattempts == 0) {
|
||||
$viewobj->buttontext = get_string('attemptquiznow', 'quiz');
|
||||
$viewobj->buttontext = get_string('attemptquiz', 'quiz');
|
||||
} else {
|
||||
$viewobj->buttontext = get_string('reattemptquiz', 'quiz');
|
||||
}
|
||||
|
||||
} else if ($canpreview) {
|
||||
$viewobj->buttontext = get_string('previewquiznow', 'quiz');
|
||||
$viewobj->buttontext = get_string('previewquizstart', 'quiz');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,11 +250,11 @@ echo $OUTPUT->header();
|
||||
|
||||
if (isguestuser()) {
|
||||
// Guests can't do a quiz, so offer them a choice of logging in or going back.
|
||||
echo $output->view_page_guest($course, $quiz, $cm, $context, $viewobj->infomessages);
|
||||
echo $output->view_page_guest($course, $quiz, $cm, $context, $viewobj->infomessages, $viewobj);
|
||||
} else if (!isguestuser() && !($canattempt || $canpreview
|
||||
|| $viewobj->canreviewmine)) {
|
||||
// If they are not enrolled in this course in a good enough role, tell them to enrol.
|
||||
echo $output->view_page_notenrolled($course, $quiz, $cm, $context, $viewobj->infomessages);
|
||||
echo $output->view_page_notenrolled($course, $quiz, $cm, $context, $viewobj->infomessages, $viewobj);
|
||||
} else {
|
||||
echo $output->view_page($course, $quiz, $cm, $context, $viewobj);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user