Merge branch 'MDL-72875-master-v2' of https://github.com/peterRd/moodle

This commit is contained in:
Ilya Tregubov 2021-12-03 14:29:59 +02:00
commit 638c8c452c
33 changed files with 393 additions and 78 deletions

View File

@ -184,6 +184,25 @@ switch ($context->contextlevel) {
echo $OUTPUT->header();
$backurl = null;
// We are looking at a particular role. The page URL has been set correctly.
if ($roleid) {
$backurl = $pageurl;
} else if ($context->contextlevel == CONTEXT_COURSE && !$isfrontpage) {
// Return to the intermediary page when within the course context.
$backurl = new moodle_url('/enrol/otherusers.php', ['id' => $course->id]);
} else if ($returnurl) {
// Factor in for $returnurl being passed.
$backurl = new moodle_url($returnurl);
}
if ($backurl) {
echo $OUTPUT->render(new single_button($backurl, get_string('back'), 'get'));
} else if ($isfrontpage) {
// The front page doesn't have an intermediate page 'other users' but needs similar tertiary nav like a standard course.
echo $OUTPUT->render_participants_tertiary_nav($course);
}
// Print heading.
echo $OUTPUT->heading_with_help($title, 'assignroles', 'core_role');
@ -245,7 +264,6 @@ if ($roleid) {
$select = new single_select($PAGE->url, 'roleid', $nameswithcounts, $roleid, null);
$select->label = get_string('assignanotherrole', 'core_role');
echo $OUTPUT->render($select);
echo '<p><a href="' . $url . '">' . get_string('backtoallroles', 'core_role') . '</a></p>';
echo '</div>';
} else if (empty($assignableroles)) {
@ -314,17 +332,13 @@ if ($roleid) {
echo html_writer::table($table);
if ($context->contextlevel > CONTEXT_USER) {
if ($returnurl) {
$url = new moodle_url($returnurl);
} else {
if (!$PAGE->has_secondary_navigation() && $context->contextlevel > CONTEXT_USER) {
if (!$returnurl) {
$url = $context->get_url();
echo html_writer::start_tag('div', array('class' => 'backlink'));
echo html_writer::tag('a', get_string('backto', '', $contextname), array('href' => $url));
echo html_writer::end_tag('div');
}
echo html_writer::start_tag('div', array('class'=>'backlink'));
echo html_writer::tag('a', get_string('backto', '', $contextname), array('href' => $url));
echo html_writer::end_tag('div');
}
}

View File

@ -126,6 +126,10 @@ if (!is_null($reportuser)) {
}
echo $OUTPUT->header();
// Display the participants tertiary action bar if within a course context.
if ($course && $context->contextlevel == CONTEXT_COURSE) {
echo $OUTPUT->render_participants_tertiary_nav($course);
}
// Print heading.
echo $OUTPUT->heading($title);
@ -180,7 +184,7 @@ echo '</form>';
echo $OUTPUT->box_end();
// Appropriate back link.
if ($context->contextlevel > CONTEXT_USER) {
if (!$PAGE->has_secondary_navigation() && $context->contextlevel > CONTEXT_USER) {
echo html_writer::start_tag('div', array('class'=>'backlink'));
if ($returnurl) {
$backurl = new moodle_url($returnurl);

View File

@ -204,6 +204,9 @@ if ($capability && ($allowoverrides || ($allowsafeoverrides && is_safe_capabilit
}
echo $OUTPUT->header();
if ($context->contextlevel == CONTEXT_COURSE && $course) {
echo $OUTPUT->render_participants_tertiary_nav($course);
}
echo $OUTPUT->heading($title);
$adminurl = new moodle_url('/admin/');

View File

@ -61,7 +61,7 @@ Feature: Set up contextual data for tests
And I navigate to "Users > Groups" in current page administration
Then I should see "Group 1"
And I should see "Group 2"
And I follow "Groupings"
And I select "Groupings" from the "jump" singleselect
And I should see "Grouping 1"
And I should see "Grouping 2"

View File

@ -42,7 +42,7 @@ Feature: Edit capabilities
| mod/forum:editanypost | Prevent |
| mod/forum:addquestion | Allow |
When I set the field "Advanced role override" to "Student (3)"
And I press "Go"
And I click on "Go" "button" in the "div.advancedoverride" "css_element"
Then "mod/forum:deleteanypost" capability has "Prohibit" permission
And "mod/forum:editanypost" capability has "Prevent" permission
And "mod/forum:addquestion" capability has "Allow" permission

View File

@ -79,7 +79,7 @@ Feature: Basic recycle bin functionality
And I should see "Course 2" in the "#course-listing" "css_element"
And I am on "Course 2" course homepage
And I navigate to "Users > Groups" in current page administration
And I follow "Overview"
And I select "Overview" from the "jump" singleselect
And "Student 1" "text" should exist in the "Group A" "table_row"
And "Student 2" "text" should exist in the "Group A" "table_row"
And "Student 2" "text" should exist in the "Group B" "table_row"

View File

@ -43,7 +43,7 @@ Feature: Import course's contents into another course
And I navigate to "Users > Permissions" in current page administration
Then I should see "Non-editing teacher (1)"
And I set the field "Advanced role override" to "Non-editing teacher (1)"
And I press "Go"
And I click on "Go" "button" in the "div.advancedoverride" "css_element"
And "enrol/manual:enrol" capability has "Allow" permission
Scenario: Import process without permission option

View File

@ -33,7 +33,7 @@ Feature: Option to include groups and groupings when importing a course to anoth
When I navigate to "Users > Groups" in current page administration
Then I should see "Group 1"
And I should see "Group 2"
And I follow "Groupings"
And I select "Groupings" from the "jump" singleselect
And I should see "Grouping 1"
And I should see "Grouping 2"
@ -43,6 +43,6 @@ Feature: Option to include groups and groupings when importing a course to anoth
When I navigate to "Users > Groups" in current page administration
Then I should not see "Group 1"
And I should not see "Group 2"
And I follow "Groupings"
And I select "Groupings" from the "jump" singleselect
And I should not see "Grouping 1"
And I should not see "Grouping 2"

View File

@ -0,0 +1,115 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core_course/participants_actionbar
Displays the tertiary nav for the participants page
Context variables required for this template:
* urlselect Object - The content to be rendered within the url_select
* renderedcontent String - Any additional content/actions to be displayed inline with the select box
Example context (json):
{
"urlselect" : {
"formid": "url_select_f61834256d7754158",
"classes": "urlselect",
"label": "",
"disabled": false,
"title":null,
"id":"url_select61834256d7754159",
"sesskey":"LWILINyZMH",
"action":"http:\/\/localhost\/stable_master\/course\/jumpto.php",
"showbutton":null,
"options": [
{
"name":"Enrolments",
"isgroup":true,
"options": [
{
"name":"Enrolled users",
"value":"\/user\/index.php?id=4",
"selected":true
},
{
"name":"Enrolment methods",
"value":"\/enrol\/instances.php?id=4",
"selected":false
}
]
},
{
"name":"Groups",
"isgroup":true,
"options": [
{
"name":"Groups",
"value":"\/group\/index.php?id=4",
"selected":false
},
{
"name":"Groupings",
"value":"\/group\/groupings.php?id=4",
"selected":false
},
{
"name":"Overview",
"value":"\/group\/overview.php?id=4",
"selected":false
}
]
},
{
"name":"Permissions",
"isgroup":true,
"options": [
{
"name":"Permissions",
"value":"\/admin\/roles\/permissions.php?contextid=279",
"selected":false
},
{
"name":"Other users",
"value":"\/enrol\/otherusers.php?id=4",
"selected":false
},
{
"name":"Check permissions",
"value":"\/admin\/roles\/check.php?contextid=279",
"selected":false
}
]
}
],
"labelattributes":[],
"helpicon":false,
"attributes":[]
},
"renderedcontent":"<div data-region=\"wrapper\" data-table-uniqueid=\"user-index-participants-4\"><\/div>"
}
}}
<div class="container-fluid pl-0 pb-2" id="action_bar">
<div class="row pl-0 ml-0">
{{#urlselect}}
<div class="col-xs-4 pr-1">
{{> core/url_select }}
</div>
{{/urlselect}}
{{#renderedcontent}}
<div class="col-xs-4 pr-1">
{{{renderedcontent}}}
</div>
{{/renderedcontent}}
</div>
</div>

View File

@ -250,7 +250,7 @@ Feature: Test category management actions
# Redirect
And I should see "Assign roles in Category: Cat 1"
And I should see "Please choose a role to assign"
And I click on "Back to Category: Cat 1" "link"
And I click on "Back" "button"
# Redirect
And I should see the "Course categories and courses" management page
And "Cat 1" "link" should exist in the "#category-listing" "css_element"

View File

@ -186,6 +186,7 @@ if ($canconfig and $action and confirm_sesskey()) {
echo $OUTPUT->header();
echo $OUTPUT->render_participants_tertiary_nav($course);
echo $OUTPUT->heading(get_string('enrolmentinstances', 'enrol'));
echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthnormal');

View File

@ -218,6 +218,7 @@ class enrol_manual_plugin extends enrol_plugin {
$button = new enrol_user_button($link, get_string('enrolusers', 'enrol_manual'), 'get');
$button->class .= ' enrol_manual_plugin';
$button->primary = true;
$context = context_course::instance($instance->courseid);
$arguments = array('contextid' => $context->id);

View File

@ -94,5 +94,8 @@ $PAGE->set_title($course->fullname.': '.get_string('totalotherusers', 'enrol', $
$PAGE->set_heading($PAGE->title);
echo $OUTPUT->header();
$searchbutton = $table->get_user_search_button();
$searchbutton->primary = true;
echo $OUTPUT->render_participants_tertiary_nav($course, $OUTPUT->render($searchbutton));
echo $renderer->render($table);
echo $OUTPUT->footer();

View File

@ -41,7 +41,7 @@ class core_enrol_renderer extends plugin_renderer_base {
'value' => $button->label,
'disabled' => $button->disabled ? 'disabled' : null,
'title' => $button->tooltip,
'class' => 'btn btn-secondary my-1');
'class' => 'btn ' . ($button->primary ? 'btn-primary' : 'btn-secondary'));
if ($button->actions) {
$id = html_writer::random_id('single_button');
@ -96,18 +96,10 @@ class core_enrol_renderer extends plugin_renderer_base {
$table->initialise_javascript();
$content = '';
$searchbutton = $table->get_user_search_button();
if ($searchbutton) {
$content .= $this->output->render($searchbutton);
}
$content .= html_writer::tag('div', get_string('otheruserdesc', 'enrol'), array('class'=>'otherusersdesc'));
$content .= $this->output->render($table->get_paging_bar());
$content .= html_writer::table($table);
$content .= $this->output->render($table->get_paging_bar());
$searchbutton = $table->get_user_search_button();
if ($searchbutton) {
$content .= $this->output->render($searchbutton);
}
return $content;
}

View File

@ -59,10 +59,7 @@ $PAGE->set_heading($course->fullname);
$PAGE->set_pagelayout('standard');
echo $OUTPUT->header();
// Add tabs
$currenttab = 'groupings';
require('tabs.php');
echo $OUTPUT->render_participants_tertiary_nav($course);
echo $OUTPUT->heading($strgroupings);
$data = array();

View File

@ -170,10 +170,7 @@ $PAGE->set_heading($course->fullname);
$PAGE->set_pagelayout('standard');
echo $OUTPUT->header();
// Add tabs
$currenttab = 'groups';
require('tabs.php');
echo $OUTPUT->render_participants_tertiary_nav($course);
echo $OUTPUT->heading(format_string($course->shortname, true, array('context' => $context)) .' '.$strgroups, 3);
$groups = groups_get_all_groups($courseid);

View File

@ -195,10 +195,7 @@ $PAGE->set_heading($course->fullname);
$PAGE->set_pagelayout('standard');
echo $OUTPUT->header();
// Add tabs
$currenttab = 'overview';
require('tabs.php');
echo $OUTPUT->render_participants_tertiary_nav($course);
/// Print overview
echo $OUTPUT->heading(format_string($course->shortname, true, array('context' => $context)) .' '.$stroverview, 3);

View File

@ -67,7 +67,7 @@ Feature: Automatic creation of groups
And I should see "No" in the "Group messaging" "select"
And I press "Cancel"
# Check groupings.
And I follow "Groupings"
And I select "Groupings" from the "jump" singleselect
And I should see "Grouping name"
And I click on "Show groups in grouping" "link" in the "Grouping name" "table_row"
And the "removeselect" select box should contain "Group A"

View File

@ -114,7 +114,7 @@ Feature: Organize students into groups
| Group name | The greatest group that never existed |
And I press "Save changes"
And I should see "The greatest group that never existed"
And I follow "Groupings"
And I select "Groupings" from the "jump" singleselect
And I press "Create grouping"
And the "idnumber" "field" should be readonly
And I set the following fields to these values:

View File

@ -34,12 +34,12 @@ Feature: Custom profile fields in groups
And I navigate to "Users > Groups" in current page administration
# Check the Overview page.
And I follow "Overview"
And I select "Overview" from the "jump" singleselect
And "Robin Hood (user1, fox)" "text" should exist in the "Canines" "table_row"
And "Little John (user2, bear)" "text" should exist in the "No group" "table_row"
# Check the groups page.
And I follow "Groups"
And I select "Groups" from the "jump" singleselect
And I set the field "groups" to "Canines"
And I should see "Robin Hood (user1, fox)"
And I should not see "Little John (user2, bear)"

View File

@ -26,7 +26,7 @@ Feature: Automatic deletion of groups and groupings
| Group name | Group (with ID) |
| Group ID number | An ID |
And I press "Save changes"
And I follow "Groupings"
And I select "Groupings" from the "jump" singleselect
And I press "Create grouping"
And I set the following fields to these values:
| Grouping name | Grouping (without ID) |
@ -36,7 +36,7 @@ Feature: Automatic deletion of groups and groupings
| Grouping name | Grouping (with ID) |
| Grouping ID number | An ID |
And I press "Save changes"
And I follow "Groups"
And I select "Groups" from the "jump" singleselect
@javascript
Scenario: Delete groups and groupings with and without ID numbers
@ -48,7 +48,7 @@ Feature: Automatic deletion of groups and groupings
And I press "Delete selected group"
And I press "Yes"
And the "groups" select box should not contain "Group (with ID) (0)"
And I follow "Groupings"
And I select "Groupings" from the "jump" singleselect
And I click on "Delete" "link" in the "Grouping (without ID)" "table_row"
And I press "Yes"
And I should not see "Grouping (without ID)"
@ -72,7 +72,7 @@ Feature: Automatic deletion of groups and groupings
And I press "Delete selected group"
And I press "Yes"
And I should not see "Group (without ID)"
And I follow "Groupings"
And I select "Groupings" from the "jump" singleselect
And "Delete" "link" should not exist in the "Grouping (with ID)" "table_row"
And I click on "Delete" "link" in the "Grouping (without ID)" "table_row"
And I press "Yes"

View File

@ -42,7 +42,7 @@ Feature: Importing of groups and groupings
And I should see "No" in the "Group messaging" "select"
And I press "Cancel"
# Check groupings
And I follow "Groupings"
And I select "Groupings" from the "jump" singleselect
And I should see "Grouping-1"
And I should see "Grouping-2"
And I should see "Grouping-3"

View File

@ -42,7 +42,7 @@ Feature: Uniqueness of Group ID number
And I press "Cancel"
Scenario: Grouping ID number uniqueness
Given I follow "Groupings"
Given I select "Groupings" from the "jump" singleselect
And I press "Create grouping"
And I set the following fields to these values:
| Grouping name | Grouping 1 |

View File

@ -59,7 +59,7 @@ Feature: Group overview
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I follow "Overview"
And I select "Overview" from the "jump" singleselect
# Grouping All and Group All filter
When I select "All" from the "Grouping" singleselect

View File

@ -26,7 +26,7 @@ Feature: Automatic updating of groups and groupings
| Group name | Group (with ID) |
| Group ID number | An ID |
And I press "Save changes"
And I follow "Groupings"
And I select "Groupings" from the "jump" singleselect
And I press "Create grouping"
And I set the following fields to these values:
| Grouping name | Grouping (without ID) |
@ -36,7 +36,7 @@ Feature: Automatic updating of groups and groupings
| Grouping name | Grouping (with ID) |
| Grouping ID number | An ID |
And I press "Save changes"
And I follow "Groups"
And I select "Groups" from the "jump" singleselect
@javascript
Scenario: Update groups and groupings with ID numbers
@ -52,7 +52,7 @@ Feature: Automatic updating of groups and groupings
And I press "Edit group settings"
And the field "idnumber" matches value "An ID (updated)"
And I press "Save changes"
And I follow "Groupings"
And I select "Groupings" from the "jump" singleselect
And I click on "Edit" "link" in the "Grouping (with ID)" "table_row"
And the field "idnumber" matches value "An ID"
And I set the following fields to these values:
@ -86,7 +86,7 @@ Feature: Automatic updating of groups and groupings
And the "idnumber" "field" should be readonly
And the field "idnumber" matches value "An ID"
And I press "Save changes"
And I follow "Groupings"
And I select "Groupings" from the "jump" singleselect
And I click on "Edit" "link" in the "Grouping (with ID)" "table_row"
And the "idnumber" "field" should be readonly
And the field "idnumber" matches value "An ID"

View File

@ -97,6 +97,7 @@ $string['norecentaccessesinfomessage'] = 'Hi {$a->userfirstname},
<p>A number of students in {$a->coursename} have not accessed the course recently.</p>';
$string['noteachinginfomessage'] = 'Hi {$a->userfirstname},
<p>Courses with start dates in the next week have been identified as having no teacher or student enrolments.</p>';
$string['participantsnavigation'] = 'Participants tertiary navigation.';
$string['privacy:perpage'] = 'The number of courses to show per page.';
$string['privacy:completionpath'] = 'Course completion';
$string['privacy:favouritespath'] = 'Course starred information';

View File

@ -54,6 +54,13 @@ class secondary extends view {
],
self::TYPE_SETTING => [
'editsettings' => 0,
'review' => 1.1,
'manageinstances' => 1.2,
'groups' => 1.3,
'override' => 1.4,
'roles' => 1.5,
'permissions' => 1.6,
'otherusers' => 1.7,
'gradebooksetup' => 2.1,
'outcomes' => 2.2,
'coursecompletion' => 6,

View File

@ -0,0 +1,167 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core\output;
use moodle_page;
use navigation_node;
use moodle_url;
/**
* Class responsible for generating the action bar (tertiary nav) elements in the participants page and related pages.
*
* @package core
* @copyright 2021 Peter Dias
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class participants_action_bar implements \renderable {
/** @var object $course The course we are dealing with. */
private $course;
/** @var moodle_page $page The current page. */
private $page;
/** @var navigation_node $node The settings node for the participants page. */
private $node;
/** @var string|null $renderedcontent Rendered buttons to be displayed in-line with the select box */
private $renderedcontent;
/**
* Constructor participants_action_bar
* @param object $course The course that we are generating the nav for
* @param moodle_page $page The page object
* @param string|null $renderedcontent Any additional rendered content/actions to be displayed in line with the nav
*/
public function __construct(object $course, moodle_page $page, ?string $renderedcontent) {
$this->course = $course;
$this->page = $page;
$this->node = $this->page->settingsnav->find('users', navigation_node::TYPE_CONTAINER);
$this->renderedcontent = $renderedcontent;
}
/**
* Return the nodes required to be displayed in the url_select box.
* The nodes are divided into 3 sections each with the heading as the key.
*
* @return array
*/
protected function get_ordered_nodes(): array {
return [
'enrolments:enrol' => [
'review',
'manageinstances'
],
'groups:group' => [
'groups'
],
'permissions:role' => [
'override',
'roles',
'otherusers',
'permissions'
]
];
}
/**
* Get the content for the url_select select box.
*
* @return array
*/
protected function get_content_for_select(): array {
if (!$this->node) {
return [];
}
$nodes = $this->get_ordered_nodes();
$formattedcontent = [];
foreach ($nodes as $description => $content) {
list($stringid, $location) = explode(':', $description);
$heading = get_string($stringid, $location);
$items = [];
foreach ($content as $key) {
if ($node = $this->node->find($key, null)) {
$urldescription = $node->text;
$items[$node->action()->out()] = $urldescription;
// Additional items to be added.
if ($key === 'groups') {
$params = ['id' => $this->course->id];
$items += [
(new moodle_url('/group/groupings.php', $params))->out() => get_string('groupings', 'group'),
(new moodle_url('/group/overview.php', $params))->out() => get_string('overview', 'group')
];
}
}
}
if ($items) {
$formattedcontent[][$heading] = $items;
}
}
// TODO: Implement MDL-72930.
return $formattedcontent;
}
/**
* Recursively tries to find a matching url
* @param array $urlcontent The content for the url_select
* @param int $strictness Strictness for the compare criteria
* @return string The matching active url
*/
protected function find_active_page(array $urlcontent, int $strictness = URL_MATCH_EXACT): string {
foreach ($urlcontent as $key => $value) {
if (is_array($value) && $activeitem = $this->find_active_page($value, $strictness)) {
return $activeitem;
} else if ($this->page->url->compare(new moodle_url($key), $strictness)) {
return $key;
}
}
return "";
}
/**
* Gets the url_select to be displayed in the participants page if available.
*
* @param \renderer_base $output
* @return object|null The content required to render the url_select
*/
public function get_dropdown(\renderer_base $output): ?object {
if ($urlselectcontent = $this->get_content_for_select()) {
$activeurl = $this->find_active_page($urlselectcontent);
$activeurl = $activeurl ?: $this->find_active_page($urlselectcontent, URL_MATCH_BASE);
$urlselect = new \url_select($urlselectcontent, $activeurl, null);
$urlselect->set_label(get_string('participantsnavigation', 'course'), ['class' => 'sr-only']);
return $urlselect->export_for_template($output);
}
return null;
}
/**
* Export the content to be displayed on the participants page.
*
* @param \renderer_base $output
* @return array Consists of the following:
* - urlselect A stdclass representing the standard navigation options to be fed into a urlselect
* - renderedcontent Rendered content to be displayed in line with the tertiary nav
*/
public function export_for_template(\renderer_base $output) {
return [
'urlselect' => $this->get_dropdown($output),
'renderedcontent' => $this->renderedcontent,
];
}
}

View File

@ -433,13 +433,15 @@ function enrol_add_course_navigation(navigation_node $coursenode, $course) {
$usersnode = $coursenode->add(get_string('users'), null, navigation_node::TYPE_CONTAINER, null, 'users');
if ($course->id != SITEID) {
// list all participants - allows assigning roles, groups, etc.
if (has_capability('moodle/course:enrolreview', $coursecontext)) {
$url = new moodle_url('/user/index.php', array('id'=>$course->id));
$usersnode->add(get_string('enrolledusers', 'enrol'), $url, navigation_node::TYPE_SETTING, null, 'review', new pix_icon('i/enrolusers', ''));
}
// List all participants - allows assigning roles, groups, etc.
// Have this available even in the site context as the page is still accessible from the frontpage.
if (has_capability('moodle/course:enrolreview', $coursecontext)) {
$url = new moodle_url('/user/index.php', array('id' => $course->id));
$usersnode->add(get_string('enrolledusers', 'enrol'), $url, navigation_node::TYPE_SETTING,
null, 'review', new pix_icon('i/enrolusers', ''));
}
if ($course->id != SITEID) {
// manage enrol plugin instances
if (has_capability('moodle/course:enrolconfig', $coursecontext) or has_capability('moodle/course:enrolreview', $coursecontext)) {
$url = new moodle_url('/enrol/instances.php', array('id'=>$course->id));

View File

@ -4882,6 +4882,19 @@ EOD;
return $this->render_from_template($element->get_template(), $element->export_for_template($this));
}
/**
* Renders the tertiary nav for the participants page
*
* @param object $course The course we are operating within
* @param string|null $renderedbuttons Any additional buttons/content to be displayed in line with the nav
* @return string
*/
public function render_participants_tertiary_nav(object $course, ?string $renderedbuttons = null) {
$actionbar = new \core\output\participants_action_bar($course, $this->page, $renderedbuttons);
$content = $this->render_from_template('core_course/participants_actionbar', $actionbar->export_for_template($this));
return $content ?: "";
}
/**
* Renders release information in the footer popup
* @return string Moodle release info.

View File

@ -81,7 +81,7 @@ class behat_permissions extends behat_base {
);
if (!$this->running_javascript()) {
$this->execute("behat_general::i_click_on_in_the", [get_string('go'), 'button', 'region-main', 'region']);
$this->execute("behat_general::i_click_on_in_the", [get_string('go'), 'button', "div.advancedoverride", 'css_element']);
}
$this->execute("behat_permissions::i_fill_the_capabilities_form_with_the_following_permissions", $table);

View File

@ -100,13 +100,28 @@ if ($node) {
}
echo $OUTPUT->header();
$participanttable = new \core_user\table\participants("user-index-participants-{$course->id}");
// Manage enrolments.
$manager = new course_enrolment_manager($PAGE, $course);
$enrolbuttons = $manager->get_manual_enrol_buttons();
$enrolrenderer = $PAGE->get_renderer('core_enrol');
$enrolbuttonsout = '';
foreach ($enrolbuttons as $enrolbutton) {
$enrolbuttonsout .= $enrolrenderer->render($enrolbutton);
}
echo $OUTPUT->render_participants_tertiary_nav($course, html_writer::div($enrolbuttonsout, '', [
'data-region' => 'wrapper',
'data-table-uniqueid' => $participanttable->uniqueid,
]));
echo $OUTPUT->heading(get_string('participants'));
$filterset = new \core_user\table\participants_filterset();
$filterset->add_filter(new integer_filter('courseid', filter::JOINTYPE_DEFAULT, [(int)$course->id]));
$participanttable = new \core_user\table\participants("user-index-participants-{$course->id}");
$canaccessallgroups = has_capability('moodle/site:accessallgroups', $context);
$filtergroupids = $urlgroupid ? [$urlgroupid] : [];
@ -155,20 +170,6 @@ if ($roleid) {
}
}
// Manage enrolments.
$manager = new course_enrolment_manager($PAGE, $course);
$enrolbuttons = $manager->get_manual_enrol_buttons();
$enrolrenderer = $PAGE->get_renderer('core_enrol');
$enrolbuttonsout = '';
foreach ($enrolbuttons as $enrolbutton) {
$enrolbuttonsout .= $enrolrenderer->render($enrolbutton);
}
echo html_writer::div($enrolbuttonsout, 'd-flex justify-content-end', [
'data-region' => 'wrapper',
'data-table-uniqueid' => $participanttable->uniqueid,
]);
// Render the user filters.
$userrenderer = $PAGE->get_renderer('core_user');
echo $userrenderer->participants_filter($context, $participanttable->uniqueid);

View File

@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2021120300.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2021120300.01; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.
$release = '4.0dev+ (Build: 20211203)'; // Human-friendly version name