Merge branch 'MDL-85002-main' of https://github.com/lucaboesch/moodle
This commit is contained in:
@@ -20,7 +20,7 @@ use moodle_url;
|
||||
use renderable;
|
||||
use renderer_base;
|
||||
use templatable;
|
||||
use url_select;
|
||||
use core\output\select_menu;
|
||||
|
||||
/**
|
||||
* Represents the tertiary navigation around the quiz edit pages.
|
||||
@@ -64,15 +64,18 @@ class edit_nav_actions implements renderable, templatable {
|
||||
$gradeitemsetupurl->out(false) => get_string('gradeitemsetup', 'quiz'),
|
||||
];
|
||||
|
||||
$overridesnav = new url_select(
|
||||
$overridesnav = new select_menu(
|
||||
'quizsetupnavigation',
|
||||
$menu,
|
||||
$this->whichpage === self::SUMMARY ? $questionsurl->out(false) : $gradeitemsetupurl->out(false),
|
||||
null
|
||||
);
|
||||
$overridesnav->set_label(get_string('quizsetupnavigation', 'quiz'), ['class' => 'visually-hidden']);
|
||||
$overridesnav->set_label(
|
||||
get_string('quizsetupnavigation', 'quiz'),
|
||||
['class' => 'visually-hidden']
|
||||
);
|
||||
|
||||
return [
|
||||
'navmenu' => $overridesnav->export_for_template($output),
|
||||
'navigation' => $overridesnav->export_for_template($output),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ use moodle_url;
|
||||
use renderable;
|
||||
use renderer_base;
|
||||
use templatable;
|
||||
use url_select;
|
||||
use core\output\select_menu;
|
||||
|
||||
/**
|
||||
* Render overrides action in the quiz secondary navigation
|
||||
@@ -98,8 +98,17 @@ class overrides_actions implements renderable, templatable {
|
||||
$groupoverridesurl->out(false) => get_string('groupoverrides', 'quiz')
|
||||
];
|
||||
|
||||
$overridesnav = new url_select($menu, $PAGE->url->out(false), null, 'quizoverrides');
|
||||
$templatecontext['overridesnav'] = $overridesnav->export_for_template($output);
|
||||
$overridesnav = new select_menu(
|
||||
'quizoverrides',
|
||||
$menu,
|
||||
$PAGE->url->out(false),
|
||||
);
|
||||
$overridesnav->set_label(
|
||||
get_string('overrides', 'quiz'),
|
||||
['class' => 'visually-hidden']
|
||||
);
|
||||
|
||||
$templatecontext['navigation'] = $overridesnav->export_for_template($output);
|
||||
|
||||
// Build the add button - but only if the user can edit.
|
||||
if ($this->canedit) {
|
||||
|
||||
@@ -26,23 +26,27 @@
|
||||
* none
|
||||
|
||||
Context variables required for this template:
|
||||
* overridesnav - must alwasy be present.
|
||||
* addoverridebutton - should only be present if the user has permission to add a new override.
|
||||
* navigation - must always be present.
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
"id": "url_select_test",
|
||||
"action": "https://example.com/post",
|
||||
"formid": "url_select_form",
|
||||
"sesskey": "sesskey",
|
||||
"navmenu": {
|
||||
"options": [{
|
||||
"navigation": {
|
||||
"name": "tertiarynavigation",
|
||||
"value": "/mod/quiz/edit.php?cmid=123",
|
||||
"baseid": "select-menu56789",
|
||||
"selectedoption": "Complex grading",
|
||||
"options": [
|
||||
{
|
||||
"name": "Questions",
|
||||
"value": "/mod/quiz/edit.php?cmid=123"
|
||||
"value": "/mod/quiz/edit.php?cmid=123",
|
||||
"id": "select-menu-option1",
|
||||
"selected": false
|
||||
},
|
||||
{
|
||||
"name": "Complex grading",
|
||||
"value": "/mod/quiz/editgrading.php?cmid=123"
|
||||
"value": "/mod/quiz/editgrading.php?cmid=123",
|
||||
"id": "select-menu-option2",
|
||||
"selected": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -50,10 +54,10 @@
|
||||
}}
|
||||
<div class="tertiary-navigation">
|
||||
<div class="d-flex">
|
||||
{{#navmenu}}
|
||||
{{#navigation}}
|
||||
<div class="navitem">
|
||||
{{>core/url_select}}
|
||||
{{>core/tertiary_navigation_selector}}
|
||||
</div>
|
||||
{{/navmenu}}
|
||||
{{/navigation}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -25,28 +25,30 @@
|
||||
* none
|
||||
|
||||
Context variables required for this template:
|
||||
* overridesnav - must alwasy be present.
|
||||
* navigation - must always be present.
|
||||
* addoverridebutton - should only be present if the user has permission to add a new override.
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
"overridesnav": {
|
||||
"id": "url_select_test",
|
||||
"action": "https://example.com/post",
|
||||
"formid": "url_select_form",
|
||||
"sesskey": "sesskey",
|
||||
"label": "core/url_select",
|
||||
"options": [{
|
||||
"navigation": {
|
||||
"name": "tertiarynavigation",
|
||||
"value": "/mod/quiz/overrides.php?cmid=71&mode=group",
|
||||
"baseid": "select-menu56789",
|
||||
"selectedoption": "Group overrides",
|
||||
"options": [
|
||||
{
|
||||
"name": "User overrides",
|
||||
"value": "/mod/quiz/overrides.php?cmid=71&mode=user"
|
||||
"value": "/mod/quiz/overrides.php?cmid=71&mode=user",
|
||||
"id": "select-menu-option1",
|
||||
"selected": false
|
||||
},
|
||||
{
|
||||
"name": "Group overrides",
|
||||
"value": "/mod/quiz/overrides.php?cmid=71&mode=group"
|
||||
"value": "/mod/quiz/overrides.php?cmid=71&mode=group",
|
||||
"id": "select-menu-option2",
|
||||
"selected": true
|
||||
}
|
||||
],
|
||||
"disabled": false,
|
||||
"title": "Some cool title"
|
||||
]
|
||||
},
|
||||
"addoverridebutton": {
|
||||
"id": "single_button1234",
|
||||
@@ -71,11 +73,11 @@
|
||||
}}
|
||||
<div class="tertiary-navigation">
|
||||
<div class="d-flex">
|
||||
{{#overridesnav}}
|
||||
{{#navigation}}
|
||||
<div class="navitem">
|
||||
{{>core/url_select}}
|
||||
{{>core/tertiary_navigation_selector}}
|
||||
</div>
|
||||
{{/overridesnav}}
|
||||
{{/navigation}}
|
||||
{{#addoverridebutton}}
|
||||
<div class="navitem">
|
||||
{{>core/single_button}}
|
||||
|
||||
@@ -118,6 +118,7 @@ Feature: Quiz group override
|
||||
And "Copy" "link" should not exist in the "Group 1" "table_row"
|
||||
And "Delete" "link" should not exist in the "Group 1" "table_row"
|
||||
|
||||
@javascript
|
||||
Scenario: "Not visible" groups should not be available for group overrides
|
||||
Given the following "groups" exist:
|
||||
| name | course | idnumber | visibility | participation |
|
||||
@@ -129,7 +130,7 @@ Feature: Quiz group override
|
||||
| Only visible to members/Non-Participation | C1 | MN | 1 | 0 |
|
||||
When I am on the "quiz1" Activity page logged in as teacher1
|
||||
And I navigate to "Overrides" in current page administration
|
||||
And I select "Group overrides" from the "jump" singleselect
|
||||
And I set the field "Overrides" to "Group overrides"
|
||||
And I press "Add group override"
|
||||
Then I should see "Visible to everyone/Participation" in the "Override group" "select"
|
||||
And I should see "Visible to everyone/Non-Participation" in the "Override group" "select"
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ Feature: Use the qbank plugin manager page for managecategories
|
||||
And I navigate to "Plugins > Question bank plugins > Manage question bank plugins" in site administration
|
||||
And I click on "Enable" "link" in the "Manage categories" "table_row"
|
||||
And I am on the "Test quiz" "mod_quiz > question bank" page
|
||||
And I should see "Categories" in the "Question bank tertiary navigation" "select"
|
||||
And "Categories" "text" should exist in the "nav.tertiary-navigation-selector > div.dropdown.select-menu" "css_element"
|
||||
|
||||
Scenario: Enable/disable the tab New category when trying to add a random question to a quiz
|
||||
Given I log in as "admin"
|
||||
|
||||
@@ -16,19 +16,18 @@
|
||||
|
||||
namespace core_question\output;
|
||||
|
||||
use core\output\select_menu;
|
||||
use core_question\local\bank\navigation_node_base;
|
||||
use core_question\local\bank\plugin_features_base;
|
||||
use moodle_url;
|
||||
use renderer_base;
|
||||
use templatable;
|
||||
use renderable;
|
||||
use url_select;
|
||||
|
||||
/**
|
||||
* Rendered HTML elements for tertiary nav for Question bank.
|
||||
*
|
||||
* Provides a menu of links for question bank tertiary navigation, based on get_navigation_node() implemented by each plugin.
|
||||
* Optionally includes and additional action button to display alongside the menu.
|
||||
*
|
||||
* @package core_question
|
||||
* @copyright 2021 Sujith Haridasan <[email protected]>
|
||||
@@ -92,7 +91,6 @@ class qbank_action_menu implements templatable, renderable {
|
||||
$url->params($this->currenturl->params());
|
||||
$menu[$url->out(false)] = $navigationnode->get_navigation_title();
|
||||
}
|
||||
|
||||
$actionbutton = null;
|
||||
if ($this->actionurl) {
|
||||
$actionbutton = [
|
||||
@@ -101,11 +99,19 @@ class qbank_action_menu implements templatable, renderable {
|
||||
];
|
||||
}
|
||||
|
||||
$urlselect = new url_select($menu, $this->currenturl->out(false), null, 'questionbankaction');
|
||||
$urlselect->set_label(get_string('questionbanknavigation', 'question'), ['class' => 'accesshide']);
|
||||
$selectmenu = new select_menu(
|
||||
'questionbanknavigation',
|
||||
$menu,
|
||||
$this->currenturl->out(false)
|
||||
);
|
||||
$selectmenu->set_label(
|
||||
get_string('questionbanknavigation', 'question'),
|
||||
['class' => 'visually-hidden']
|
||||
);
|
||||
|
||||
return [
|
||||
'questionbankselect' => $urlselect->export_for_template($output),
|
||||
'navigation' => $selectmenu->export_for_template($output),
|
||||
'headinglevel' => 2,
|
||||
'actionbutton' => $actionbutton
|
||||
];
|
||||
}
|
||||
|
||||
@@ -23,35 +23,39 @@
|
||||
* none
|
||||
|
||||
Context variables required for this template:
|
||||
* see question/classes/output/qbank_actionbar.php
|
||||
* navigation - must always be present.
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
"questionbankselect": {
|
||||
"action": "http://localhost/moodle/course/jumpto.php",
|
||||
"classes": "urlselect",
|
||||
"formid": "questionbankaction",
|
||||
"id": "url_select61a85bc543dca7",
|
||||
"label": "Question bank tertiary navigation",
|
||||
"options": [{
|
||||
"navigation": {
|
||||
"name": "tertiarynavigation",
|
||||
"value": "/question/edit.php?cmid=7",
|
||||
"baseid": "select-menu56789",
|
||||
"selectedoption": "Questions",
|
||||
"options": [
|
||||
{
|
||||
"name": "Questions",
|
||||
"selected": true,
|
||||
"value": "/question/edit.php?cmid=7"
|
||||
"value": "/question/edit.php?cmid=7",
|
||||
"id": "select-menu-option1",
|
||||
"selected": true
|
||||
},
|
||||
{
|
||||
"name": "Categories",
|
||||
"selected": false,
|
||||
"value": "/question/bank/managecategories/category.php?cmid=7"
|
||||
"value": "/question/bank/managecategories/category.php?cmid=7",
|
||||
"id": "select-menu-option2",
|
||||
"selected": false
|
||||
},
|
||||
{
|
||||
"name": "Import",
|
||||
"selected": false,
|
||||
"value": "/question/bank/importquestions/import.php?cmid=7"
|
||||
"value": "/question/bank/importquestions/import.php?cmid=7",
|
||||
"id": "select-menu-option3",
|
||||
"selected": false
|
||||
},
|
||||
{
|
||||
"name": "Export",
|
||||
"selected": false,
|
||||
"value": "/question/bank/exportquestions/export.php?cmid=7"
|
||||
"value": "/question/bank/exportquestions/export.php?cmid=7",
|
||||
"id": "select-menu-option4",
|
||||
"selected": false
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -61,13 +65,13 @@
|
||||
}
|
||||
}
|
||||
}}
|
||||
<div class="tertiary-navigation">
|
||||
<div class="tertiary-navigation" id="tertiary-navigation">
|
||||
<div class="d-flex">
|
||||
{{#questionbankselect}}
|
||||
{{#navigation}}
|
||||
<div class="navitem">
|
||||
{{>core/url_select}}
|
||||
{{>core/tertiary_navigation_selector}}
|
||||
</div>
|
||||
{{/questionbankselect}}
|
||||
{{/navigation}}
|
||||
{{#actionbutton}}
|
||||
<div class="navitem">
|
||||
<a class="btn btn-primary ms-2" href="{{url}}">{{label}}</a>
|
||||
|
||||
@@ -42,7 +42,13 @@ if ($PAGE->has_secondary_navigation()) {
|
||||
$secondarynavigation = $moremenu->export_for_template($OUTPUT);
|
||||
$overflowdata = $PAGE->secondarynav->get_overflow_menu_data();
|
||||
if (!is_null($overflowdata)) {
|
||||
$overflow = $overflowdata->export_for_template($OUTPUT);
|
||||
$selectmenu = new \core\output\select_menu(
|
||||
'tertiarynavigation',
|
||||
$overflowdata->urls,
|
||||
$overflowdata->selected,
|
||||
);
|
||||
$selectmenu->set_label($overflowdata->label, $overflowdata->labelattributes);
|
||||
$overflow = $selectmenu->export_for_template($OUTPUT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,13 @@ if ($PAGE->has_secondary_navigation()) {
|
||||
$secondarynavigation = $moremenu->export_for_template($OUTPUT);
|
||||
$overflowdata = $PAGE->secondarynav->get_overflow_menu_data();
|
||||
if (!is_null($overflowdata)) {
|
||||
$overflow = $overflowdata->export_for_template($OUTPUT);
|
||||
$selectmenu = new \core\output\select_menu(
|
||||
'tertiarynavigation',
|
||||
$overflowdata->urls,
|
||||
$overflowdata->selected,
|
||||
);
|
||||
$selectmenu->set_label($overflowdata->label, $overflowdata->labelattributes);
|
||||
$overflow = $selectmenu->export_for_template($OUTPUT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,11 @@
|
||||
{{> core/activity_header }}
|
||||
{{/headercontent}}
|
||||
{{#overflow}}
|
||||
{{> core/url_select}}
|
||||
<div class="container-fluid tertiary-navigation">
|
||||
<div class="navitem">
|
||||
{{> core/tertiary_navigation_selector}}
|
||||
</div>
|
||||
</div>
|
||||
{{/overflow}}
|
||||
{{{ output.main_content }}}
|
||||
{{{ output.activity_navigation }}}
|
||||
|
||||
@@ -164,7 +164,7 @@
|
||||
{{#overflow}}
|
||||
<div class="container-fluid tertiary-navigation">
|
||||
<div class="navitem">
|
||||
{{> core/url_select}}
|
||||
{{> core/tertiary_navigation_selector}}
|
||||
</div>
|
||||
</div>
|
||||
{{/overflow}}
|
||||
|
||||
Reference in New Issue
Block a user