Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
integration
prechecker
Commits
0f6cdc51
Commit
0f6cdc51
authored
Jul 31, 2012
by
Dan Poltawski
Browse files
Merge branch 'MDL-34599' of
git://github.com/timhunt/moodle
parents
70ad5136
ff2ec2cb
Changes
4
Hide whitespace changes
Inline
Side-by-side
mod/quiz/attempt.php
View file @
0f6cdc51
...
...
@@ -41,6 +41,7 @@ $attemptid = required_param('attempt', PARAM_INT);
$page
=
optional_param
(
'page'
,
0
,
PARAM_INT
);
$attemptobj
=
quiz_attempt
::
create
(
$attemptid
);
$page
=
$attemptobj
->
force_page_number_into_range
(
$page
);
$PAGE
->
set_url
(
$attemptobj
->
attempt_url
(
null
,
$page
));
// Check login.
...
...
mod/quiz/attemptlib.php
View file @
0f6cdc51
...
...
@@ -555,6 +555,16 @@ class quiz_attempt {
}
}
/**
* If the given page number is out of range (before the first page, or after
* the last page, chnage it to be within range).
* @param int $page the requested page number.
* @return int a safe page number to use.
*/
public
function
force_page_number_into_range
(
$page
)
{
return
min
(
max
(
$page
,
0
),
count
(
$this
->
pagelayout
)
-
1
);
}
// Simple getters ==========================================================
public
function
get_quiz
()
{
return
$this
->
quizobj
->
get_quiz
();
...
...
@@ -1101,7 +1111,7 @@ class quiz_attempt {
}
/**
* Initialise the JS etc. required all the questions on a page.
.
* Initialise the JS etc. required all the questions on a page.
* @param mixed $page a page number, or 'all'.
*/
public
function
get_html_head_contributions
(
$page
=
'all'
,
$showall
=
false
)
{
...
...
mod/quiz/processattempt.php
View file @
0f6cdc51
...
...
@@ -37,13 +37,13 @@ require_once($CFG->dirroot . '/mod/quiz/locallib.php');
$timenow
=
time
();
// Get submitted parameters.
$attemptid
=
required_param
(
'attempt'
,
PARAM_INT
);
$
next
=
optional_param
(
'next'
,
false
,
PARAM_
BOOL
);
$
this
page
=
optional
_param
(
'
this
page'
,
0
,
PARAM_INT
);
$next
page
=
optional_param
(
'next
page'
,
0
,
PARAM_
INT
);
$attemptid
=
required_param
(
'attempt'
,
PARAM_INT
);
$
thispage
=
required_param
(
'thispage'
,
PARAM_
INT
);
$
next
page
=
required
_param
(
'
next
page'
,
PARAM_INT
);
$next
=
optional_param
(
'next
'
,
false
,
PARAM_
BOOL
);
$finishattempt
=
optional_param
(
'finishattempt'
,
false
,
PARAM_BOOL
);
$timeup
=
optional_param
(
'timeup'
,
0
,
PARAM_BOOL
);
// True if form was submitted by timer.
$scrollpos
=
optional_param
(
'scrollpos'
,
''
,
PARAM_RAW
);
$timeup
=
optional_param
(
'timeup'
,
0
,
PARAM_BOOL
);
// True if form was submitted by timer.
$scrollpos
=
optional_param
(
'scrollpos'
,
''
,
PARAM_RAW
);
$transaction
=
$DB
->
start_delegated_transaction
();
$attemptobj
=
quiz_attempt
::
create
(
$attemptid
);
...
...
mod/quiz/review.php
View file @
0f6cdc51
...
...
@@ -31,8 +31,8 @@ require_once($CFG->dirroot . '/mod/quiz/locallib.php');
require_once
(
$CFG
->
dirroot
.
'/mod/quiz/report/reportlib.php'
);
$attemptid
=
required_param
(
'attempt'
,
PARAM_INT
);
$page
=
optional_param
(
'page'
,
0
,
PARAM_INT
);
$showall
=
optional_param
(
'showall'
,
0
,
PARAM_BOOL
);
$page
=
optional_param
(
'page'
,
0
,
PARAM_INT
);
$showall
=
optional_param
(
'showall'
,
0
,
PARAM_BOOL
);
$url
=
new
moodle_url
(
'/mod/quiz/review.php'
,
array
(
'attempt'
=>
$attemptid
));
if
(
$page
!==
0
)
{
...
...
@@ -44,6 +44,7 @@ if ($showall !== 0) {
$PAGE
->
set_url
(
$url
);
$attemptobj
=
quiz_attempt
::
create
(
$attemptid
);
$page
=
$attemptobj
->
force_page_number_into_range
(
$page
);
// Check login.
require_login
(
$attemptobj
->
get_course
(),
false
,
$attemptobj
->
get_cm
());
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment