2009-11-04 11:58:30 +00:00
|
|
|
<?php
|
2011-02-10 20:44:47 +00:00
|
|
|
// 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/>.
|
|
|
|
|
2009-01-19 05:30:01 +00:00
|
|
|
|
2005-05-06 06:24:04 +00:00
|
|
|
/**
|
2007-11-07 15:20:57 +00:00
|
|
|
* Page to edit quizzes
|
|
|
|
*
|
|
|
|
* This page generally has two columns:
|
|
|
|
* The right column lists all available questions in a chosen category and
|
|
|
|
* allows them to be edited or more to be added. This column is only there if
|
|
|
|
* the quiz does not already have student attempts
|
|
|
|
* The left column lists all questions that have been added to the current quiz.
|
|
|
|
* The lecturer can add questions from the right hand list to the quiz or remove them
|
|
|
|
*
|
|
|
|
* The script also processes a number of actions:
|
|
|
|
* Actions affecting a quiz:
|
|
|
|
* up and down Changes the order of questions and page breaks
|
|
|
|
* addquestion Adds a single question to the quiz
|
|
|
|
* add Adds several selected questions to the quiz
|
|
|
|
* addrandom Adds a certain number of random questions to the quiz
|
|
|
|
* repaginate Re-paginates the quiz
|
|
|
|
* delete Removes a question from the quiz
|
|
|
|
* savechanges Saves the order and grades for questions in the quiz
|
|
|
|
*
|
2014-02-16 11:59:15 +13:00
|
|
|
* @package mod_quiz
|
2011-02-21 16:13:25 +00:00
|
|
|
* @copyright 1999 onwards Martin Dougiamas and others {@link http://moodle.com}
|
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
2011-02-10 20:44:47 +00:00
|
|
|
*/
|
|
|
|
|
2022-12-20 10:50:35 +00:00
|
|
|
use mod_quiz\quiz_settings;
|
2009-01-19 05:30:01 +00:00
|
|
|
|
2014-10-02 23:15:59 +01:00
|
|
|
require_once(__DIR__ . '/../../config.php');
|
|
|
|
require_once($CFG->dirroot . '/mod/quiz/locallib.php');
|
|
|
|
require_once($CFG->dirroot . '/question/editlib.php');
|
2008-11-20 06:59:11 +00:00
|
|
|
|
2021-11-29 04:56:03 +07:00
|
|
|
$mdlscrollto = optional_param('mdlscrollto', '', PARAM_INT);
|
2010-05-21 03:15:48 +00:00
|
|
|
|
2008-11-20 06:59:11 +00:00
|
|
|
list($thispageurl, $contexts, $cmid, $cm, $quiz, $pagevars) =
|
2022-09-28 15:57:50 +10:00
|
|
|
question_edit_setup('editq', '/mod/quiz/edit.php', true);
|
2008-11-20 06:59:11 +00:00
|
|
|
|
2010-08-04 16:31:54 +00:00
|
|
|
$PAGE->set_url($thispageurl);
|
2022-02-05 19:20:15 +05:30
|
|
|
$PAGE->set_secondary_active_tab("mod_quiz_edit");
|
2008-11-20 06:59:11 +00:00
|
|
|
|
2023-02-08 16:55:42 +00:00
|
|
|
// You need mod/quiz:manage in addition to question capabilities to access this page.
|
|
|
|
require_capability('mod/quiz:manage', $contexts->lowest());
|
|
|
|
|
2008-11-20 06:59:11 +00:00
|
|
|
// Get the course object and related bits.
|
2023-02-08 16:55:42 +00:00
|
|
|
$course = get_course($quiz->course);
|
2022-12-20 10:50:35 +00:00
|
|
|
$quizobj = new quiz_settings($quiz, $cm, $course);
|
MDL-43089 quiz: improved interface for building quizzes
This commit is actually the joint work of Mahmoud Kassaei, Colin
Chambers and Tim Hunt from The Open University. We could only use one
persons name for the commit, and this time Colin gets the credit/blame.
The goal of this work was to increase usability, and also clean up
the page enough that it will be possible to add new features in future.
Display of mod/quiz/edit.php is now entirely generated by
mod_quiz\output\edit_renderer. This uses a helper class
mod_quiz\structure to provide details of the structure of the quiz, and
mod_quiz\repaginate to alter that structure. (Acutally, there are still
some modification methods on mod_quiz\structure. Expect that to be
cleaned up in future.)
The new code uses much more ajax, and there are new scripts
mod/quiz/edit_rest.php and mod/quiz/repaginate.php to handle this.
(Again, don't be surprised if those two scripts get merged in future.)
Also questionbank.ajax.php (which may, in future, be made more generic,
and moved into the core question bank code.)
Most of the new JavaScript code has intentionally copied the way things
are done when editing activities on the course page.
As a result of this, mod/quiz/editlib.php is now much shorter than it
was. (In future, expect the remaining code in here to move into
mod/quiz/classes.)
2013-12-05 16:18:24 +00:00
|
|
|
$structure = $quizobj->get_structure();
|
2023-02-08 16:55:42 +00:00
|
|
|
$gradecalculator = $quizobj->get_grade_calculator();
|
2009-01-22 05:38:18 +00:00
|
|
|
|
2023-02-08 16:55:42 +00:00
|
|
|
$defaultcategoryobj = question_make_default_categories($contexts->all());
|
|
|
|
$defaultcategory = $defaultcategoryobj->id . ',' . $defaultcategoryobj->contextid;
|
|
|
|
|
|
|
|
$quizhasattempts = quiz_has_attempts($quiz->id);
|
2002-10-14 12:21:18 +00:00
|
|
|
|
MDL-43089 quiz: improved interface for building quizzes
This commit is actually the joint work of Mahmoud Kassaei, Colin
Chambers and Tim Hunt from The Open University. We could only use one
persons name for the commit, and this time Colin gets the credit/blame.
The goal of this work was to increase usability, and also clean up
the page enough that it will be possible to add new features in future.
Display of mod/quiz/edit.php is now entirely generated by
mod_quiz\output\edit_renderer. This uses a helper class
mod_quiz\structure to provide details of the structure of the quiz, and
mod_quiz\repaginate to alter that structure. (Acutally, there are still
some modification methods on mod_quiz\structure. Expect that to be
cleaned up in future.)
The new code uses much more ajax, and there are new scripts
mod/quiz/edit_rest.php and mod/quiz/repaginate.php to handle this.
(Again, don't be surprised if those two scripts get merged in future.)
Also questionbank.ajax.php (which may, in future, be made more generic,
and moved into the core question bank code.)
Most of the new JavaScript code has intentionally copied the way things
are done when editing activities on the course page.
As a result of this, mod/quiz/editlib.php is now much shorter than it
was. (In future, expect the remaining code in here to move into
mod/quiz/classes.)
2013-12-05 16:18:24 +00:00
|
|
|
// Process commands ============================================================.
|
2009-02-27 08:45:05 +00:00
|
|
|
|
|
|
|
// Get the list of question ids had their check-boxes ticked.
|
2023-01-16 17:07:44 +00:00
|
|
|
$selectedslots = [];
|
2009-02-27 08:45:05 +00:00
|
|
|
$params = (array) data_submitted();
|
|
|
|
foreach ($params as $key => $value) {
|
|
|
|
if (preg_match('!^s([0-9]+)$!', $key, $matches)) {
|
2014-01-22 18:19:31 +00:00
|
|
|
$selectedslots[] = $matches[1];
|
2002-10-14 09:07:13 +00:00
|
|
|
}
|
2008-11-20 06:59:11 +00:00
|
|
|
}
|
|
|
|
|
2011-02-11 17:36:02 +00:00
|
|
|
$afteractionurl = new moodle_url($thispageurl);
|
2009-02-27 08:45:05 +00:00
|
|
|
|
|
|
|
if (optional_param('repaginate', false, PARAM_BOOL) && confirm_sesskey()) {
|
2012-05-04 12:40:21 +01:00
|
|
|
// Re-paginate the quiz.
|
2014-10-30 16:03:02 +00:00
|
|
|
$structure->check_can_be_edited();
|
2009-02-27 08:45:05 +00:00
|
|
|
$questionsperpage = optional_param('questionsperpage', $quiz->questionsperpage, PARAM_INT);
|
2014-01-22 18:19:31 +00:00
|
|
|
quiz_repaginate_questions($quiz->id, $questionsperpage );
|
2011-02-10 20:44:47 +00:00
|
|
|
quiz_delete_previews($quiz);
|
2011-02-11 17:36:02 +00:00
|
|
|
redirect($afteractionurl);
|
2008-11-20 06:59:11 +00:00
|
|
|
}
|
2009-02-26 08:30:45 +00:00
|
|
|
|
2021-11-29 04:56:03 +07:00
|
|
|
if ($mdlscrollto) {
|
|
|
|
$afteractionurl->param('mdlscrollto', $mdlscrollto);
|
|
|
|
}
|
|
|
|
|
2009-02-26 08:30:45 +00:00
|
|
|
if (($addquestion = optional_param('addquestion', 0, PARAM_INT)) && confirm_sesskey()) {
|
2012-05-04 12:40:21 +01:00
|
|
|
// Add a single question to the current quiz.
|
2014-10-30 16:03:02 +00:00
|
|
|
$structure->check_can_be_edited();
|
2012-03-28 13:55:17 +01:00
|
|
|
quiz_require_question_use($addquestion);
|
2009-02-26 08:30:45 +00:00
|
|
|
$addonpage = optional_param('addonpage', 0, PARAM_INT);
|
2008-11-20 06:59:11 +00:00
|
|
|
quiz_add_quiz_question($addquestion, $quiz, $addonpage);
|
2009-02-27 08:45:05 +00:00
|
|
|
quiz_delete_previews($quiz);
|
2023-02-08 16:55:42 +00:00
|
|
|
$gradecalculator->recompute_quiz_sumgrades();
|
2010-05-01 08:23:28 +00:00
|
|
|
$thispageurl->param('lastchanged', $addquestion);
|
2011-02-11 17:36:02 +00:00
|
|
|
redirect($afteractionurl);
|
2008-11-20 06:59:11 +00:00
|
|
|
}
|
|
|
|
|
2009-02-26 08:30:45 +00:00
|
|
|
if (optional_param('add', false, PARAM_BOOL) && confirm_sesskey()) {
|
2014-10-30 16:03:02 +00:00
|
|
|
$structure->check_can_be_edited();
|
MDL-43089 quiz: improved interface for building quizzes
This commit is actually the joint work of Mahmoud Kassaei, Colin
Chambers and Tim Hunt from The Open University. We could only use one
persons name for the commit, and this time Colin gets the credit/blame.
The goal of this work was to increase usability, and also clean up
the page enough that it will be possible to add new features in future.
Display of mod/quiz/edit.php is now entirely generated by
mod_quiz\output\edit_renderer. This uses a helper class
mod_quiz\structure to provide details of the structure of the quiz, and
mod_quiz\repaginate to alter that structure. (Acutally, there are still
some modification methods on mod_quiz\structure. Expect that to be
cleaned up in future.)
The new code uses much more ajax, and there are new scripts
mod/quiz/edit_rest.php and mod/quiz/repaginate.php to handle this.
(Again, don't be surprised if those two scripts get merged in future.)
Also questionbank.ajax.php (which may, in future, be made more generic,
and moved into the core question bank code.)
Most of the new JavaScript code has intentionally copied the way things
are done when editing activities on the course page.
As a result of this, mod/quiz/editlib.php is now much shorter than it
was. (In future, expect the remaining code in here to move into
mod/quiz/classes.)
2013-12-05 16:18:24 +00:00
|
|
|
$addonpage = optional_param('addonpage', 0, PARAM_INT);
|
2012-05-04 12:40:21 +01:00
|
|
|
// Add selected questions to the current quiz.
|
2008-11-20 06:59:11 +00:00
|
|
|
$rawdata = (array) data_submitted();
|
2012-05-04 12:40:21 +01:00
|
|
|
foreach ($rawdata as $key => $value) { // Parse input for question ids.
|
2008-11-20 06:59:11 +00:00
|
|
|
if (preg_match('!^q([0-9]+)$!', $key, $matches)) {
|
|
|
|
$key = $matches[1];
|
2012-03-28 13:55:17 +01:00
|
|
|
quiz_require_question_use($key);
|
MDL-43089 quiz: improved interface for building quizzes
This commit is actually the joint work of Mahmoud Kassaei, Colin
Chambers and Tim Hunt from The Open University. We could only use one
persons name for the commit, and this time Colin gets the credit/blame.
The goal of this work was to increase usability, and also clean up
the page enough that it will be possible to add new features in future.
Display of mod/quiz/edit.php is now entirely generated by
mod_quiz\output\edit_renderer. This uses a helper class
mod_quiz\structure to provide details of the structure of the quiz, and
mod_quiz\repaginate to alter that structure. (Acutally, there are still
some modification methods on mod_quiz\structure. Expect that to be
cleaned up in future.)
The new code uses much more ajax, and there are new scripts
mod/quiz/edit_rest.php and mod/quiz/repaginate.php to handle this.
(Again, don't be surprised if those two scripts get merged in future.)
Also questionbank.ajax.php (which may, in future, be made more generic,
and moved into the core question bank code.)
Most of the new JavaScript code has intentionally copied the way things
are done when editing activities on the course page.
As a result of this, mod/quiz/editlib.php is now much shorter than it
was. (In future, expect the remaining code in here to move into
mod/quiz/classes.)
2013-12-05 16:18:24 +00:00
|
|
|
quiz_add_quiz_question($key, $quiz, $addonpage);
|
2005-03-05 12:55:26 +00:00
|
|
|
}
|
|
|
|
}
|
2009-02-27 08:45:05 +00:00
|
|
|
quiz_delete_previews($quiz);
|
2023-02-08 16:55:42 +00:00
|
|
|
$gradecalculator->recompute_quiz_sumgrades();
|
2011-02-11 17:36:02 +00:00
|
|
|
redirect($afteractionurl);
|
2008-11-20 06:59:11 +00:00
|
|
|
}
|
|
|
|
|
2015-04-15 10:48:58 +01:00
|
|
|
if ($addsectionatpage = optional_param('addsectionatpage', false, PARAM_INT)) {
|
2015-04-02 15:23:04 +01:00
|
|
|
// Add a section to the quiz.
|
2015-04-15 10:48:58 +01:00
|
|
|
$structure->check_can_be_edited();
|
|
|
|
$structure->add_section_heading($addsectionatpage);
|
2015-04-02 15:23:04 +01:00
|
|
|
quiz_delete_previews($quiz);
|
|
|
|
redirect($afteractionurl);
|
|
|
|
}
|
|
|
|
|
2010-11-22 09:52:42 +00:00
|
|
|
if ((optional_param('addrandom', false, PARAM_BOOL)) && confirm_sesskey()) {
|
2012-05-04 12:40:21 +01:00
|
|
|
// Add random questions to the quiz.
|
2014-10-30 16:03:02 +00:00
|
|
|
$structure->check_can_be_edited();
|
2008-11-20 06:59:11 +00:00
|
|
|
$recurse = optional_param('recurse', 0, PARAM_BOOL);
|
2009-02-26 08:30:45 +00:00
|
|
|
$addonpage = optional_param('addonpage', 0, PARAM_INT);
|
2010-11-22 09:52:42 +00:00
|
|
|
$categoryid = required_param('categoryid', PARAM_INT);
|
|
|
|
$randomcount = required_param('randomcount', PARAM_INT);
|
|
|
|
quiz_add_random_questions($quiz, $addonpage, $categoryid, $randomcount, $recurse);
|
2002-10-14 09:07:13 +00:00
|
|
|
|
2009-02-27 08:45:05 +00:00
|
|
|
quiz_delete_previews($quiz);
|
2023-02-08 16:55:42 +00:00
|
|
|
$gradecalculator->recompute_quiz_sumgrades();
|
2011-02-11 17:36:02 +00:00
|
|
|
redirect($afteractionurl);
|
2008-11-20 06:59:11 +00:00
|
|
|
}
|
2009-02-26 08:30:45 +00:00
|
|
|
|
|
|
|
if (optional_param('savechanges', false, PARAM_BOOL) && confirm_sesskey()) {
|
quiz editing: MDL-17454 first attemtp, and MDL-18554
This is a minimal fix for MDL-18554, I have just added a cancel button and made it work.
The more substantial part of this is MDL-17454, trying to make the quiz editing screen behave appropriately when shuffle questions is on. I am sure Olli will have opinions about this and want to change it further. Rought summary:
* When shufflequestions is off, never restrict manual paging, even if questionsperpage is set.
* When shuffle questions is on:
** Always display the quiz with the defined number of questions per page.
** Remove controls to add things except at the end of the quiz.
** Disable most of the order and paging tab, but still allow the question list to be reordered, in case that helps teachers track which questions they have added.
** Still allow questions to be reordered on the edit tab, but when moving the top question on a page up, reorder with the previous question, rather than moving to the previous page.
* Change the status bar, so that the yellow highlight is reserved for alert information. The more informative stuff is now plain, and moved to under the title. To my mind that associates it more closely with the quiz name. Also it moves Total of grades and Maximum grade closer together.
* JavaScript cleaned up. I learn more about YUI every day.
* Some PHP code clean ups that I forgot to commit separately before making substantive changes.
2009-03-17 09:51:34 +00:00
|
|
|
|
2012-05-04 12:40:21 +01:00
|
|
|
// If rescaling is required save the new maximum.
|
2017-12-22 13:35:29 +00:00
|
|
|
$maxgrade = unformat_float(optional_param('maxgrade', '', PARAM_RAW_TRIMMED), true);
|
|
|
|
if (is_float($maxgrade) && $maxgrade >= 0) {
|
2023-02-24 13:43:48 +00:00
|
|
|
$gradecalculator->update_quiz_maximum_grade($maxgrade);
|
2011-02-10 20:44:47 +00:00
|
|
|
}
|
2014-11-10 18:46:53 +00:00
|
|
|
|
2011-02-11 17:36:02 +00:00
|
|
|
redirect($afteractionurl);
|
2008-11-20 06:59:11 +00:00
|
|
|
}
|
2006-02-17 17:15:17 +00:00
|
|
|
|
2021-12-17 16:40:59 +07:00
|
|
|
// Log this visit.
|
|
|
|
$event = \mod_quiz\event\edit_page_viewed::create([
|
|
|
|
'courseid' => $course->id,
|
|
|
|
'context' => $contexts->lowest(),
|
|
|
|
'other' => [
|
|
|
|
'quizid' => $quiz->id
|
|
|
|
]
|
|
|
|
]);
|
|
|
|
$event->trigger();
|
|
|
|
|
MDL-43089 quiz: improved interface for building quizzes
This commit is actually the joint work of Mahmoud Kassaei, Colin
Chambers and Tim Hunt from The Open University. We could only use one
persons name for the commit, and this time Colin gets the credit/blame.
The goal of this work was to increase usability, and also clean up
the page enough that it will be possible to add new features in future.
Display of mod/quiz/edit.php is now entirely generated by
mod_quiz\output\edit_renderer. This uses a helper class
mod_quiz\structure to provide details of the structure of the quiz, and
mod_quiz\repaginate to alter that structure. (Acutally, there are still
some modification methods on mod_quiz\structure. Expect that to be
cleaned up in future.)
The new code uses much more ajax, and there are new scripts
mod/quiz/edit_rest.php and mod/quiz/repaginate.php to handle this.
(Again, don't be surprised if those two scripts get merged in future.)
Also questionbank.ajax.php (which may, in future, be made more generic,
and moved into the core question bank code.)
Most of the new JavaScript code has intentionally copied the way things
are done when editing activities on the course page.
As a result of this, mod/quiz/editlib.php is now much shorter than it
was. (In future, expect the remaining code in here to move into
mod/quiz/classes.)
2013-12-05 16:18:24 +00:00
|
|
|
// End of process commands =====================================================.
|
|
|
|
|
|
|
|
$PAGE->set_pagelayout('incourse');
|
|
|
|
$PAGE->set_pagetype('mod-quiz-edit');
|
|
|
|
|
|
|
|
$output = $PAGE->get_renderer('mod_quiz', 'edit');
|
2008-11-20 06:59:11 +00:00
|
|
|
|
2012-06-08 11:46:59 +01:00
|
|
|
$PAGE->set_title(get_string('editingquizx', 'quiz', format_string($quiz->name)));
|
2010-05-21 03:15:48 +00:00
|
|
|
$PAGE->set_heading($course->fullname);
|
2021-09-22 10:56:46 +08:00
|
|
|
$PAGE->activityheader->disable();
|
2010-08-04 16:31:54 +00:00
|
|
|
$node = $PAGE->settingsnav->find('mod_quiz_edit', navigation_node::TYPE_SETTING);
|
|
|
|
if ($node) {
|
|
|
|
$node->make_active();
|
|
|
|
}
|
2009-07-17 06:54:58 +00:00
|
|
|
|
2022-09-28 15:57:50 +10:00
|
|
|
// Add random question - result message.
|
|
|
|
if ($message = optional_param('message', '', PARAM_TEXT)) {
|
|
|
|
core\notification::add($message, core\notification::SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
echo $OUTPUT->header();
|
2008-11-25 12:31:59 +00:00
|
|
|
// Initialise the JavaScript.
|
2011-02-21 18:10:19 +00:00
|
|
|
$quizeditconfig = new stdClass();
|
2023-01-16 17:07:44 +00:00
|
|
|
$quizeditconfig->url = $thispageurl->out(true, ['qbanktool' => '0']);
|
|
|
|
$quizeditconfig->dialoglisteners = [];
|
2014-01-22 18:19:31 +00:00
|
|
|
$numberoflisteners = $DB->get_field_sql("
|
|
|
|
SELECT COALESCE(MAX(page), 1)
|
|
|
|
FROM {quiz_slots}
|
2023-01-16 17:07:44 +00:00
|
|
|
WHERE quizid = ?", [$quiz->id]);
|
2014-01-22 18:19:31 +00:00
|
|
|
|
2008-11-25 12:31:59 +00:00
|
|
|
for ($pageiter = 1; $pageiter <= $numberoflisteners; $pageiter++) {
|
|
|
|
$quizeditconfig->dialoglisteners[] = 'addrandomdialoglaunch_' . $pageiter;
|
|
|
|
}
|
MDL-43089 quiz: improved interface for building quizzes
This commit is actually the joint work of Mahmoud Kassaei, Colin
Chambers and Tim Hunt from The Open University. We could only use one
persons name for the commit, and this time Colin gets the credit/blame.
The goal of this work was to increase usability, and also clean up
the page enough that it will be possible to add new features in future.
Display of mod/quiz/edit.php is now entirely generated by
mod_quiz\output\edit_renderer. This uses a helper class
mod_quiz\structure to provide details of the structure of the quiz, and
mod_quiz\repaginate to alter that structure. (Acutally, there are still
some modification methods on mod_quiz\structure. Expect that to be
cleaned up in future.)
The new code uses much more ajax, and there are new scripts
mod/quiz/edit_rest.php and mod/quiz/repaginate.php to handle this.
(Again, don't be surprised if those two scripts get merged in future.)
Also questionbank.ajax.php (which may, in future, be made more generic,
and moved into the core question bank code.)
Most of the new JavaScript code has intentionally copied the way things
are done when editing activities on the course page.
As a result of this, mod/quiz/editlib.php is now much shorter than it
was. (In future, expect the remaining code in here to move into
mod/quiz/classes.)
2013-12-05 16:18:24 +00:00
|
|
|
|
ajaxlib/require_js: MDL-16693 $PAGE->requires->... deprecates require_js etc.
There is a new implementation of require_js in lib/deprecatedlib.php,
based on $PAGE->requires.
There were a few other recently introduced functions in lib/weblib.php,
namely print_js_call, print_delayed_js_call, print_js_config and
standard_js_config. These have been removed, since they were never in
a stable branch, and all the places that used them have been changed
to use the newer $PAGE->requires->... methods.
get_require_js_code is also gone, and the evil places that were calling
it, even though it is an internal function, have been fixed.
Also, I made some minor improvements to the code I committed yesterday
for MDL-16695.
All that remains is to update all the places in core code that are
still using require_js.
(This commit also fixes the problem where the admin tree would not
start with the right categories expanded.)
2009-06-12 12:13:07 +00:00
|
|
|
$PAGE->requires->data_for_js('quiz_edit_config', $quizeditconfig);
|
2023-03-14 10:26:46 +07:00
|
|
|
$PAGE->requires->js_call_amd('core_question/question_engine');
|
2010-11-15 17:00:38 +00:00
|
|
|
|
MDL-43089 quiz: improved interface for building quizzes
This commit is actually the joint work of Mahmoud Kassaei, Colin
Chambers and Tim Hunt from The Open University. We could only use one
persons name for the commit, and this time Colin gets the credit/blame.
The goal of this work was to increase usability, and also clean up
the page enough that it will be possible to add new features in future.
Display of mod/quiz/edit.php is now entirely generated by
mod_quiz\output\edit_renderer. This uses a helper class
mod_quiz\structure to provide details of the structure of the quiz, and
mod_quiz\repaginate to alter that structure. (Acutally, there are still
some modification methods on mod_quiz\structure. Expect that to be
cleaned up in future.)
The new code uses much more ajax, and there are new scripts
mod/quiz/edit_rest.php and mod/quiz/repaginate.php to handle this.
(Again, don't be surprised if those two scripts get merged in future.)
Also questionbank.ajax.php (which may, in future, be made more generic,
and moved into the core question bank code.)
Most of the new JavaScript code has intentionally copied the way things
are done when editing activities on the course page.
As a result of this, mod/quiz/editlib.php is now much shorter than it
was. (In future, expect the remaining code in here to move into
mod/quiz/classes.)
2013-12-05 16:18:24 +00:00
|
|
|
// Questions wrapper start.
|
2023-01-16 17:07:44 +00:00
|
|
|
echo html_writer::start_tag('div', ['class' => 'mod-quiz-edit-content']);
|
2008-11-20 06:59:11 +00:00
|
|
|
|
MDL-43089 quiz: improved interface for building quizzes
This commit is actually the joint work of Mahmoud Kassaei, Colin
Chambers and Tim Hunt from The Open University. We could only use one
persons name for the commit, and this time Colin gets the credit/blame.
The goal of this work was to increase usability, and also clean up
the page enough that it will be possible to add new features in future.
Display of mod/quiz/edit.php is now entirely generated by
mod_quiz\output\edit_renderer. This uses a helper class
mod_quiz\structure to provide details of the structure of the quiz, and
mod_quiz\repaginate to alter that structure. (Acutally, there are still
some modification methods on mod_quiz\structure. Expect that to be
cleaned up in future.)
The new code uses much more ajax, and there are new scripts
mod/quiz/edit_rest.php and mod/quiz/repaginate.php to handle this.
(Again, don't be surprised if those two scripts get merged in future.)
Also questionbank.ajax.php (which may, in future, be made more generic,
and moved into the core question bank code.)
Most of the new JavaScript code has intentionally copied the way things
are done when editing activities on the course page.
As a result of this, mod/quiz/editlib.php is now much shorter than it
was. (In future, expect the remaining code in here to move into
mod/quiz/classes.)
2013-12-05 16:18:24 +00:00
|
|
|
echo $output->edit_page($quizobj, $structure, $contexts, $thispageurl, $pagevars);
|
2008-11-20 06:59:11 +00:00
|
|
|
|
MDL-43089 quiz: improved interface for building quizzes
This commit is actually the joint work of Mahmoud Kassaei, Colin
Chambers and Tim Hunt from The Open University. We could only use one
persons name for the commit, and this time Colin gets the credit/blame.
The goal of this work was to increase usability, and also clean up
the page enough that it will be possible to add new features in future.
Display of mod/quiz/edit.php is now entirely generated by
mod_quiz\output\edit_renderer. This uses a helper class
mod_quiz\structure to provide details of the structure of the quiz, and
mod_quiz\repaginate to alter that structure. (Acutally, there are still
some modification methods on mod_quiz\structure. Expect that to be
cleaned up in future.)
The new code uses much more ajax, and there are new scripts
mod/quiz/edit_rest.php and mod/quiz/repaginate.php to handle this.
(Again, don't be surprised if those two scripts get merged in future.)
Also questionbank.ajax.php (which may, in future, be made more generic,
and moved into the core question bank code.)
Most of the new JavaScript code has intentionally copied the way things
are done when editing activities on the course page.
As a result of this, mod/quiz/editlib.php is now much shorter than it
was. (In future, expect the remaining code in here to move into
mod/quiz/classes.)
2013-12-05 16:18:24 +00:00
|
|
|
// Questions wrapper end.
|
|
|
|
echo html_writer::end_tag('div');
|
2010-05-21 03:15:48 +00:00
|
|
|
|
2009-08-06 14:13:48 +00:00
|
|
|
echo $OUTPUT->footer();
|