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
fff03332
Commit
fff03332
authored
Feb 02, 2018
by
Ryan Wyllie
Browse files
MDL-61135 mod_quiz: add tag condition to question bank form
parent
171d7919
Changes
4
Hide whitespace changes
Inline
Side-by-side
mod/quiz/classes/output/edit_renderer.php
View file @
fff03332
...
...
@@ -1249,7 +1249,8 @@ class edit_renderer extends \plugin_renderer_base {
public
function
question_bank_contents
(
\
mod_quiz\question\bank\custom_view
$questionbank
,
array
$pagevars
)
{
$qbank
=
$questionbank
->
render
(
'editq'
,
$pagevars
[
'qpage'
],
$pagevars
[
'qperpage'
],
$pagevars
[
'cat'
],
$pagevars
[
'recurse'
],
$pagevars
[
'showhidden'
],
$pagevars
[
'qbshowtext'
]);
$pagevars
[
'cat'
],
$pagevars
[
'recurse'
],
$pagevars
[
'showhidden'
],
$pagevars
[
'qbshowtext'
],
$pagevars
[
'qtagids'
]);
return
html_writer
::
div
(
html_writer
::
div
(
$qbank
,
'bd'
),
'questionbankformforpopup'
);
}
}
mod/quiz/classes/question/bank/custom_view.php
View file @
fff03332
...
...
@@ -138,9 +138,10 @@ class custom_view extends \core_question\bank\view {
*
* @return string HTML code for the form
*/
public
function
render
(
$tabname
,
$page
,
$perpage
,
$cat
,
$recurse
,
$showhidden
,
$showquestiontext
)
{
public
function
render
(
$tabname
,
$page
,
$perpage
,
$cat
,
$recurse
,
$showhidden
,
$showquestiontext
,
$tagids
=
[])
{
ob_start
();
$this
->
display
(
$tabname
,
$page
,
$perpage
,
$cat
,
$recurse
,
$showhidden
,
$showquestiontext
);
$this
->
display
(
$tabname
,
$page
,
$perpage
,
$cat
,
$recurse
,
$showhidden
,
$showquestiontext
,
$tagids
);
$out
=
ob_get_contents
();
ob_end_clean
();
return
$out
;
...
...
question/classes/bank/view.php
View file @
fff03332
...
...
@@ -462,15 +462,18 @@ class view {
* displayoptions Sets display options
*/
public
function
display
(
$tabname
,
$page
,
$perpage
,
$cat
,
$recurse
,
$showhidden
,
$showquestiontext
)
{
global
$PAGE
,
$OUTPUT
;
$recurse
,
$showhidden
,
$showquestiontext
,
$tagids
=
[]
)
{
global
$PAGE
;
if
(
$this
->
process_actions_needing_ui
())
{
return
;
}
$editcontexts
=
$this
->
contexts
->
having_one_edit_tab_cap
(
$tabname
);
list
(
$categoryid
,
$contextid
)
=
explode
(
','
,
$cat
);
$catcontext
=
\
context
::
instance_by_id
(
$contextid
);
// Category selection form.
$this
->
display_question_bank_header
();
array_unshift
(
$this
->
searchconditions
,
new
\
core_question\bank\search\tag_condition
([
$catcontext
],
$tagids
));
array_unshift
(
$this
->
searchconditions
,
new
\
core_question\bank\search\hidden_condition
(
!
$showhidden
));
array_unshift
(
$this
->
searchconditions
,
new
\
core_question\bank\search\category_condition
(
$cat
,
$recurse
,
$editcontexts
,
$this
->
baseurl
,
$this
->
course
));
...
...
@@ -593,7 +596,19 @@ class view {
echo
\
html_writer
::
start_tag
(
'form'
,
array
(
'method'
=>
'get'
,
'action'
=>
new
\
moodle_url
(
$scriptpath
),
'id'
=>
'displayoptions'
));
echo
\
html_writer
::
start_div
();
echo
\
html_writer
::
input_hidden_params
(
$this
->
baseurl
,
array
(
'recurse'
,
'showhidden'
,
'qbshowtext'
));
$excludes
=
array
(
'recurse'
,
'showhidden'
,
'qbshowtext'
);
// If the URL contains any tags then we need to prevent them
// being added to the form as hidden elements because the tags
// are managed separately.
if
(
$this
->
baseurl
->
param
(
'qtagids[0]'
))
{
$index
=
0
;
while
(
$this
->
baseurl
->
param
(
"qtagids[
{
$index
}
]"
))
{
$excludes
[]
=
"qtagids[
{
$index
}
]"
;
$index
++
;
}
}
echo
\
html_writer
::
input_hidden_params
(
$this
->
baseurl
,
$excludes
);
foreach
(
$this
->
searchconditions
as
$searchcondition
)
{
echo
$searchcondition
->
display_options
(
$this
);
...
...
question/edit.php
View file @
fff03332
...
...
@@ -54,7 +54,7 @@ echo $renderer->extra_horizontal_navigation();
echo
'<div class="questionbankwindow boxwidthwide boxaligncenter">'
;
$questionbank
->
display
(
'questions'
,
$pagevars
[
'qpage'
],
$pagevars
[
'qperpage'
],
$pagevars
[
'cat'
],
$pagevars
[
'recurse'
],
$pagevars
[
'showhidden'
],
$pagevars
[
'qbshowtext'
]);
$pagevars
[
'qbshowtext'
]
,
$pagevars
[
'qtagids'
]
);
echo
"</div>
\n
"
;
echo
$OUTPUT
->
footer
();
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