145 Commits

Author SHA1 Message Date
Tim Hunt
6a981b45c3 MDL-31262 fix quiz review capability check.
This change is logically the same as changing
    $this->has_capability('mod/quiz:viewreports')
to
    $this->has_capability('mod/quiz:viewreports') || $this->has_capability('mod/quiz:preview')
in the original code. However, I rewrote the logic so that we test the
most common and performance-critical case first - that of a student
lookign at their own attempt.
2014-03-28 18:37:21 +00:00
Tim Hunt
ccba5b8805 MDL-43749 normalise quiz database structure.
The sequence of questions that made up a quiz used to be stored as a
comma-separated list in quiz.questions. Now the same information is
stored in the rows in the quiz_slots table. This is not just 'better' in
a database design sense, but it allows for the future changes we will
need as we enhance the quiz in the MDL-40987 epic.

Having changed the database structure, all the rest of the code needs to
be changed to account for it, and that is done here.

Note that there are not many unit tests for the changed bit. That is
because as part of MDL-40987 we will be changing the code further, and
we will add unit tests then.
2014-03-02 10:00:40 +01:00
Rajesh Taneja
fdc729ea57 MDL-43736 Events: event->contextinstanceid should be used where possible
While restoring event context might not be present (deleted)
So before using context api's check context or use event properties
2014-01-29 11:39:44 +08:00
Tim Hunt
dc4a3ea1ee MDL-43670 quiz_question_instances to match coding guidelines.
Some columns needed to be renamed:
* quiz     -> quizid
* question -> questionid
* grade    -> maxmark

Then all the places that refer to those needed to be fixed.
2014-01-17 10:56:07 +00:00
M Kassaei
0328341f97 MDL-42181 quiz nav: highight all buttons when all Qs on one page 2013-11-15 15:30:31 +00:00
Tim Hunt
e74aa0aa97 MDL-32188 question CBM: compute summary stats for CBM behaviours
We now compute the average CBM score, accuracy, CBM bonus and enhanced
accuracy, both for the entire quiz, and for just the questions answered.

Note that these calculations must work correctly in the presence of
descriptions, ungraded questions, and manually graded questions. For
example, imagine a essay added at the end of the quiz "Summarise what
you learned attempting this exercise." This might have max mark zero or
non-zero. The CBM statistics just ignores questions like that.
2013-10-04 17:56:36 +01:00
Tim Hunt
474aa125ca MDL-32188 quiz/question: behaviours can add to the review summary.
At the top of the quiz reivew page, there is a table that summarises
infomration about the quiz attempt as a whole. For some question
behaviours, we would like to be able to add additional information to
that summary.

This commit introduces a generic method for the behaviour to provide
summary information about an entire question usage.
2013-10-04 17:52:16 +01:00
Frederic Massart
0a8b091d41 MDL-41039 mod_quiz: Renaming event to attempt_becameoverdue 2013-09-26 16:43:20 +08:00
Frederic Massart
d900f1dc05 MDL-41039 mod_quiz: Replace events_trigger to new events 2013-09-26 16:43:03 +08:00
Damyon Wiese
74df2951d1 Revert "MDL-39876 Change get_record('course') calls to get_course"
This reverts commit ab7632b74c331540c90229bf03d13aa2e6bdd9be.
2013-08-21 13:42:30 +08:00
sam marshall
ab7632b74c MDL-39876 Change get_record('course') calls to get_course 2013-08-15 11:31:20 +01:00
Jamie Pratt
388f047345 MDL-40543 convert from simulated responses
to post data
2013-07-23 15:00:02 +08:00
Jamie Pratt
1cd7c92ece MDL-40074 refactoring of quiz code
to reuse code fro quiz attempt walk through
2013-07-14 16:28:39 +07:00
Jayesh Anandani
1ecd3c304d MDL-39155 Quiz: Provide 3 image-size options on the settings page 2013-05-10 08:38:13 +05:30
Tim Hunt
595708884a MDL-38538 quiz auto-save front end.
1. There is a new admin setting to control whether this feature is
enabled. The admin can set the auto-save frequency to 1, 2 or 5 minutes,
or disable it.

2. When autosave is enabled, there is code in the quiz that monitors the
main quiz form, and does an ajax save call at the given frequency when
changes are being made by the student.

3. The ajax saves go to a new script that calls the question engine to
do the work.

4. To avoid simultaneous autosave + submit and finish, the auto-save
system shuts down shortly before time expires in a timed quiz.
2013-03-28 16:57:24 +00:00
Tim Hunt
2515be0e80 MDL-38647 quiz review question issues
1. Page URL should contain 'step=0' if necessary, but not 'step='.
2. Review specific step was not using the right display options.
2013-03-22 11:16:02 +00:00
Matt Petro
8e771aed93 MDL-35717 quiz: fix overdue attempt processing 2012-11-16 21:32:09 -05:00
Tim Hunt
32953f37b6 MDL-34399 quiz cleanup: remove ugly question/page number hack
It used to be necessary to store the question number and question page
by adding them as random extra fields on the question object (but
I can no longer remember what that reason was). Now it is possible
to store this sensibly in the quiz_attempt object, which is much
cleaner, so do that.
2012-10-26 11:58:25 +08:00
Tim Hunt
d869de66a6 MDL-34733 quiz 'secure' mode: finish review link broken in previews
This fix a small API change in mod_quiz_renderer::finish_review_link.
At least the required change is an improvement, since it gives the
renderer more flexibility.
2012-08-21 12:08:57 +01:00
Tim Hunt
4be550c57d MDL-34905 quiz: missing global $DB;
This code normally only runs when JS is disabled, which is why this was
not noticed before.
2012-08-15 10:25:25 +01:00
Tim Hunt
ff2ec2cb95 MDL-34599 quiz attempts: more robust if page number out of range.
Rather than throwing an exception, we should just show the first/last
page of the quiz if the page number is out-of-range.
2012-07-27 11:42:03 +01:00
Ankit Agarwal
c492a78ee2 MDL-34468 quiz: Replace all instances of get_context_instance() with respective context_XXXX class in mod/quiz 2012-07-24 17:08:05 +08:00
Tim Hunt
9e83f3d11d MDL-32788 quiz: clean up codechecker issues before the 2.3 release. 2012-05-04 15:12:23 +01:00
Tim Hunt
96e5168c7e MDL-32740 / MDL-3030 quiz summary: no Return to attempt for overdue. 2012-05-03 12:16:43 +01:00
Tim Hunt
be18f589e2 MDL-3030 quiz overdue handling: test state, not timefinish where applicable. 2012-04-27 15:07:40 +01:00
Tim Hunt
a403bce0bd MDL-3030 quiz overdue handling: back-end code for the new transitions 2012-04-27 15:07:36 +01:00
Tim Hunt
34b7d8383d MDL-3030 quiz overdue handling: trigger automatic state transitions.
Here, we catch all the places where a student might be accessing their
own attempts, and make sure any automatic state transitions that
should happen, do happen, before the student sees the attempt.

The places where we need to check this are view.php, startattempt.php
and processattempt.php.

We do not really need to check attempt.php or summary.php, because if
the student is on one of those pages, the JavaScript timer will
auto-submit when time expires, taking them to processattempt.php,
which will do the acutal work.

We intentionally do not trigger state transition when a teacher is
looking at a student's quiz attemp. We will trigger state transitions
on cron, but that is still to do.

Also, the body of the process_... methods still needs to be written.
2012-04-27 15:07:35 +01:00
Tim Hunt
b39b5d77c3 MDL-3030 quiz overdue handling: show attempt state on the review page. 2012-04-27 15:07:30 +01:00
Tim Hunt
2b2b645842 MDL-3030 quiz overdue handling: display message on the summary page.
This change also includes a clean-up of how we display and initialise the countdown timer.
2012-04-27 15:07:29 +01:00
Tim Hunt
2de9be52aa MDL-3030 quiz overdue handling: show attempt state on the view page 2012-04-27 15:07:27 +01:00
Charles Fulton
33c8d37b6f MDL-11047 quiz: enable sequential navigation 2012-03-15 10:09:27 -07:00
Kyle Temkin
704f062b87 MDL-31407 quiz: finish_attempt method should not rely on $USER 2012-02-02 18:37:05 +00:00
Sam Hemelryk
d36b5d1177 Merge branch 'MDL-31095' of git://github.com/timhunt/moodle 2012-01-16 16:58:32 +08:00
Aparup Banerjee
c5fd16826a MDL-3054 quiz : cleaned whitespaces. 2012-01-16 13:41:12 +08:00
Charles Fulton
5db8294940 MDL-3054 record the current page of a quiz attempt 2012-01-12 09:15:37 -08:00
Tim Hunt
389cb58948 MDL-31095 quiz: fix bug in quiz::has_questions. 2012-01-12 12:10:06 +00:00
Tim Hunt
08502b574d MDL-30182 quiz grade.php should support userid param. 2011-11-15 11:36:10 +00:00
Tim Hunt
987c2d491e MDL-29627 quiz access refactor password check into a generic check page. 2011-10-13 11:13:20 +01:00
Tim Hunt
0eafc98852 MDL-29627 fix code-checker issues throughout the quiz code. 2011-10-13 11:13:16 +01:00
Tim Hunt
d755b0f577 MDL-29627 quiz_access_manager move all output code to the renderer.
This achieves a massive clean-up. It simplifies comples code in a number
of places. It allows some methods and functions to be moved to a more
appropriate home (for example cannot_review_message to the quiz class).
It moves more logic out of the renderer.
2011-10-13 11:13:12 +01:00
Tim Hunt
dd70d561ef MDL-29627 quiz load access settings when a quiz is being attempted. 2011-10-13 11:13:10 +01:00
Tim Hunt
79a46626d3 MDL-29427 quiz nav: information items should should have a state tooltip 2011-09-22 18:12:43 +01:00
Tim Hunt
cbb8b55c33 MDL-28166 send quiz event notifications asynchronously.
This avoids the problem that you cannot send messages in transactions.

It also means that the quiz submission will not be prevented, and the
message will still be sent eventually, if any part of the messaging
system is giving intermittent errors when the student wants to submit
their quiz.
2011-07-06 14:16:30 +01:00
Eloy Lafuente (stronk7)
a2854474ce Merge branch 'MDL-27979' of git://github.com/timhunt/moodle 2011-06-23 00:34:03 +02:00
Tim Hunt
da72991636 MDL-27979 Should be an edit link for each question when previewing or reviewing a quiz. 2011-06-22 21:07:40 +01:00
Eloy Lafuente (stronk7)
8032990022 Merge branch 'MDL-26948' of git://github.com/timhunt/moodle 2011-06-22 02:35:25 +02:00
Tim Hunt
e28bbd8919 MDL-27942 Use picture not displayed during quiz attempts. 2011-06-20 10:26:01 +01:00
Tim Hunt
83f93ec41f MDL-26948 quiz navigation fake block should have an id to allow styling. 2011-06-17 17:26:28 +01:00
Tim Hunt
97cdc1de72 MDL-27747 quiz summary, add a CSS class to the table rows based on question state.
The standard themes do not use this for anything, but it makes it easier for themers to do cool stuff.
Also improve the API for getting the question state class.
2011-06-07 15:11:04 +01:00
Tim Hunt
c9272e87f9 MDL-27747 quiz End test... link was not working. #387
I don't know why this was ever changed from class to id. That was done in commit a1eb3a4466cd.
2011-06-07 14:29:11 +01:00