28 Commits

Author SHA1 Message Date
Tim Hunt
839cccead4 MDL-74255 quiz: handle draft question status correctly
The main issue to fix is that questions vesions which should not have
been used (that is, hidden or draft versions) were getting offered
as an option and acutally being used.

As part of this I was able to substantially un-tangle
mod_quiz\question\bank\qbank_helper, which previously was
a mass of functions calling other functions in a complicated way.
Hopefully, it is now a bit easer to understand, and perhaps
less buggy.
2022-04-08 12:19:53 +01:00
Marc-Alexandre Ghaly
c3ac868bf7 MDL-73763 core : Index fixes for reference tables
This commit will add the index for the question_reference
and the question_set_reference table if its not already
added. This commit will also implement the logic of adding
the question area and component in the joins of the question
reference table in order to make sure any other plugin using
the qbank api does not conflict with each other.
2022-03-24 18:04:47 +11:00
Safat Shahin
bf55e5a481 MDL-71696 core_question: class autoload changes
This commit implements some class autoloading
fixes to align with core question structure.
2022-02-03 22:22:50 +11:00
Safat Shahin
111951d861 MDL-71696 mod_quiz: quiz updates and behat coverage
The versioning changes will require some major changes
in the backup and restore of question bank and its
elements. This change introduces those changes to make
it compatible with the new world of versioning in question
bank. This commit also removes quiz_slots fields and
quiz_slot_tags table.
This commit will also introduce the versioning db
structure and some major changes to the quiz
and quiz attempts for the question, random
question and the view.
This commit implements the behat changes for versioning
in core question and associated locations.
2022-02-03 22:22:44 +11:00
Guillermo Gomez
c6cfca2a08 MDL-71696 core_question: Changes for versioning
This commit adds the changes in questiontype base
to work with new question tables and the new structure in the
databse. Also needed for versioning.
This implementation will also introduct the question status
which allows a question to be in draft and ready status.
I also introduces changes to the base view where it shows
the latest version of the questions. The view of versions
for a question is not implemented in this commit.
This implementation will also introduce changes in the core
qtype plugins to support versioning and the changed
db schema.
2022-02-03 22:22:44 +11:00
Tien Nguyen
e21a8577c6 MDL-73337 Quiz: Editing quizzes should be logged in detail 2022-01-27 22:49:54 +00:00
Marina Glancy
612c230709 MDL-70966 various: Under PHP8 empty string is no longer equals to 0 2021-02-28 19:16:09 +01:00
Shamim Rezaie
3840540790 MDL-64340 mod_quiz: not display "add random question" when no permission 2019-06-21 08:52:14 +10:00
Shamim Rezaie
a834294228 MDL-65399 mod_quiz: remove_slot should update the existing info
The remove_slot method should update the remaining slot's slot
attribute. It also should update the remaining slot's question number
and section info.
2019-05-06 15:34:50 +10:00
Shamim Rezaie
8affd823a4 MDL-65399 mod_quiz: Remove $slots from the \mod_quiz\structure class
It's enough to have $slotsinorder, and the $slots property
was redundant. There should only be a single source of truth.
2019-05-06 15:30:59 +10:00
Ryan Wyllie
8f0f0a5903 MDL-62149 quiz: include tag ids in random question link 2018-04-30 17:03:03 +08:00
Shamim Rezaie
3090719d7d MDL-61614 Quiz: Deleting a quiz slot should delete its random tags 2018-04-18 13:07:08 +10:00
Shamim Rezaie
6650c66b59 MDL-61380 Questions: Editing configuration of existing random questions
Editing "random" questions follows a different procedure than adding them.
This commit takes care of editing a "random" question's configuration.
This commit also introduces mod_quiz\form\randomquestion_form, so mod_quiz
can edit random questions without having to use the form that is inside qtype_random.
2018-03-07 05:32:40 +11:00
Jake Dallimore
32c369818c Merge branch 'MDL-57228' of git://github.com/timhunt/moodle 2017-10-04 13:42:51 +08:00
Tim Hunt
5cbb7bf887 MDL-58790 quiz editing: translate hard-coded new heading string 2017-09-26 11:17:27 +01:00
Tim Hunt
6c73dd9593 MDL-57228 quiz: fix editing when there are one-question sections
Fix based on a patch by Joost van der Borg <j.van.der.borg@ssr.nl>.
2017-09-25 12:16:12 +01:00
Tim Lock
72b8806abc MDL-55979 quiz: Fix error moving question from last page
When moving the last question from the last page to the last slot of the previous page would show the error in the error
log but move successfully.
2017-06-09 08:33:38 +09:30
Tim Hunt
0c8a90d7cb MDL-53507 quiz editing: was possible to lose questions
If you dragged a question to the top of the quiz, it could
disappear. Several other cases of dragging questions to the
same place in sequence, but to a different page/section were
also failing, and have been fixed.
2016-03-21 23:14:53 +00:00
Tim Hunt
6d19eb4b23 MDL-52879 quiz editing: allow removal of the last question in a quiz
Even though you are not normally allowed to remove the last question
in a section.
2016-02-09 21:45:13 +00:00
Tim Hunt
fdd629667e MDL-52791 quiz editing: handle unknown question types 2016-01-18 17:35:50 +00:00
Tim Hunt
d4572c1716 MDL-50026 quiz: don't show locks for random Qs in deferred feedback
can_finish_during_the_attempt was returning the wrong result for
random questions for behaviours like deferred feedback.
2015-04-28 13:37:00 +01:00
M Kassaei
5d949702f8 MDL-40988 quiz: ability to break quizzes into sections
The sections are created on the edit quiz page, and then appear in the
navigation panel when the quiz is being attempted to help students find
their way around.

The 'Shuffle questions' setting has been moved from being per-quiz
to being a per-section.

This commit is actually the joint work of Mahmoud Kassaei and Tim Hunt
from The Open University. We could only use one persons name for the
commit and this time Mahmoud gets the credit/blame.
2015-04-05 14:30:53 +01:00
Tim Hunt
441d284ada MDL-40990 quiz: option to require prev Q finished before next shown
Further improvements to this code, including resolving edge cases:

* The new feature can only be used when it is possible for the
previous question in the quiz to be complete.

* Also, this new feature cannot be used in combination with shuffle
questions, because that make no sense; nor in combination with
sequential navigation, because to make that work properly would be a lot
of effort. If someone needs that to work later, it should be possible
for them to implement it.

* There were changes in the edit renderer API, to try to make things
more  consistent, and to make it less likely we will need to change
things again in the future. See mod/quiz/upgrade.txt.

* As part of this change, the styling of the Edit quiz page was tweaked
to make slighly more efficient use of the horizontal space, and to be
more symmetrical.
2015-03-17 17:16:22 +00:00
M Kassaei
f7785e42b3 MDL-40990 quiz: option to require prev Q finished before next shown 2015-03-17 17:10:13 +00:00
Tim Hunt
58413f613e MDL-47963 quiz editing: fix failing unit tests
The unit tests were initialising the structure class in a different way
from real use. That was clearly silly, so I got rid of create_for,
leaving just the real create_for_quiz.
2014-10-31 17:22:38 +00:00
Tim Hunt
6870a6b8d0 MDL-47963 quiz editing: block ajax edits once there are attempts 2014-10-30 16:24:55 +00:00
Colin Chambers
6375e98cbb MDL-47959 Number of questions not updated dynamically in new quiz edit page 2014-10-29 16:26:49 +00:00
Colin Chambers
e1a2d0d92d 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.)
2014-10-02 17:22:23 +01:00