Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moodle
moodle
Commits
fc23bc85
Commit
fc23bc85
authored
Feb 13, 2018
by
Simey Lameze
Browse files
MDL-61135 mod_quiz: move fragment_view functions to custom_view class
parent
f40d707d
Changes
2
Hide whitespace changes
Inline
Side-by-side
mod/quiz/classes/question/bank/custom_view.php
View file @
fc23bc85
...
...
@@ -238,4 +238,42 @@ class custom_view extends \core_question\bank\view {
protected
function
create_new_question_form
(
$category
,
$canadd
)
{
// Don't display this.
}
/**
* Override the base implementation in \core_question\bank\view
* because we don't want to print the headers in the fragment
* for the modal.
*/
protected
function
display_question_bank_header
()
{
}
/**
* Override the base implementation in \core_question\bank\view
* because we don't want it to read from the $_POST global variables
* for the sort parameters since they are not present in a fragment.
*
* Unfortunately the best we can do is to look at the URL for
* those parameters (only marginally better really).
*/
protected
function
init_sort_from_params
()
{
$this
->
sort
=
[];
for
(
$i
=
1
;
$i
<=
self
::
MAX_SORTS
;
$i
++
)
{
if
(
!
$sort
=
$this
->
baseurl
->
param
(
'qbs'
.
$i
))
{
break
;
}
// Work out the appropriate order.
$order
=
1
;
if
(
$sort
[
0
]
==
'-'
)
{
$order
=
-
1
;
$sort
=
substr
(
$sort
,
1
);
if
(
!
$sort
)
{
break
;
}
}
// Deal with subsorts.
list
(
$colname
,
$subsort
)
=
$this
->
parse_subsort
(
$sort
);
$this
->
requiredcolumns
[
$colname
]
=
$this
->
get_column_type
(
$colname
);
$this
->
sort
[
$sort
]
=
$order
;
}
}
}
mod/quiz/lib.php
View file @
fc23bc85
...
...
@@ -2436,7 +2436,7 @@ function mod_quiz_output_fragment_quiz_question_bank($args) {
require_capability
(
'mod/quiz:manage'
,
$contexts
->
lowest
());
// Create quiz question bank view.
$questionbank
=
new
mod_quiz\question\bank\
fragment
_view
(
$contexts
,
$thispageurl
,
$course
,
$cm
,
$quiz
);
$questionbank
=
new
mod_quiz\question\bank\
custom
_view
(
$contexts
,
$thispageurl
,
$course
,
$cm
,
$quiz
);
$questionbank
->
set_quiz_has_attempts
(
quiz_has_attempts
(
$quiz
->
id
));
// Output.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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