mirror of
https://github.com/moodle/moodle.git
synced 2025-04-25 10:26:17 +02:00
Merge branch 'MDL-82500-main' of https://github.com/sarjona/moodle
This commit is contained in:
commit
42c1828295
blocks/myoverview
lang/en
my
theme
@ -503,83 +503,70 @@ class main implements renderable, templatable {
|
||||
|
||||
$nocoursesimg = $output->image_url('courses', 'block_myoverview');
|
||||
|
||||
$buttons = [];
|
||||
$coursecat = \core_course_category::user_top();
|
||||
if ($coursecat) {
|
||||
// Request a course button.
|
||||
$category = \core_course_category::get_nearest_editable_subcategory($coursecat, ['moodle/course:request']);
|
||||
if ($category && $category->can_request_course()) {
|
||||
// Add Request a course button.
|
||||
$button = new \single_button(
|
||||
$requestbutton = new \single_button(
|
||||
new \moodle_url('/course/request.php', ['category' => $category->id]),
|
||||
get_string('requestcourse'),
|
||||
'post',
|
||||
\single_button::BUTTON_PRIMARY
|
||||
);
|
||||
$buttons[] = $requestbutton->export_for_template($output);
|
||||
return $this->generate_zero_state_data(
|
||||
$nocoursesimg,
|
||||
[$button->export_for_template($output)],
|
||||
['title' => 'zero_request_title', 'intro' => 'zero_request_intro']
|
||||
$buttons,
|
||||
[
|
||||
'title' => 'zero_request_title',
|
||||
'intro' => ($CFG->coursecreationguide ? 'zero_request_intro' : 'zero_nocourses_intro'),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
$totalcourses = $DB->count_records_select('course', 'category > 0');
|
||||
if (!$totalcourses && ($category = \core_course_category::get_nearest_editable_subcategory($coursecat, ['create']))) {
|
||||
// Add Quickstart guide and Create course buttons.
|
||||
$quickstarturl = $CFG->coursecreationguide;
|
||||
if ($quickstarturl) {
|
||||
$quickstartbutton = new \single_button(
|
||||
new \moodle_url($quickstarturl, ['lang' => current_language()]),
|
||||
get_string('viewquickstart', 'block_myoverview'),
|
||||
'get',
|
||||
);
|
||||
$buttons = [$quickstartbutton->export_for_template($output)];
|
||||
if ($coursecat) {
|
||||
// Manage courses or categories button.
|
||||
$managebuttonname = get_string('managecategories');
|
||||
if ($totalcourses) {
|
||||
$managebuttonname = get_string('managecourses');
|
||||
}
|
||||
if ($categorytomanage = \core_course_category::get_nearest_editable_subcategory($coursecat, ['manage'])) {
|
||||
$managebutton = new \single_button(
|
||||
new \moodle_url('/course/management.php', ['category' => $categorytomanage->id]),
|
||||
$managebuttonname,
|
||||
);
|
||||
$buttons[] = $managebutton->export_for_template($output);
|
||||
}
|
||||
}
|
||||
|
||||
// Create course button.
|
||||
if ($category = \core_course_category::get_nearest_editable_subcategory($coursecat, ['create'])) {
|
||||
$createbutton = new \single_button(
|
||||
new \moodle_url('/course/edit.php', ['category' => $category->id]),
|
||||
get_string('createcourse', 'block_myoverview'),
|
||||
'post',
|
||||
\single_button::BUTTON_PRIMARY
|
||||
\single_button::BUTTON_PRIMARY,
|
||||
);
|
||||
$buttons[] = $createbutton->export_for_template($output);
|
||||
|
||||
$title = $totalcourses ? 'zero_default_title' : 'zero_nocourses_title';
|
||||
$intro = $totalcourses ? 'zero_default_intro' :
|
||||
($CFG->coursecreationguide ? 'zero_request_intro' : 'zero_nocourses_intro');
|
||||
return $this->generate_zero_state_data(
|
||||
$nocoursesimg,
|
||||
$buttons,
|
||||
['title' => 'zero_nocourses_title', 'intro' => 'zero_nocourses_intro']
|
||||
['title' => $title, 'intro' => $intro],
|
||||
);
|
||||
}
|
||||
|
||||
if ($categorytocreate = \core_course_category::get_nearest_editable_subcategory($coursecat, ['create'])) {
|
||||
$createbutton = new \single_button(
|
||||
new \moodle_url('/course/edit.php', ['category' => $categorytocreate->id]),
|
||||
get_string('createcourse', 'block_myoverview'),
|
||||
'post',
|
||||
\single_button::BUTTON_PRIMARY
|
||||
);
|
||||
$buttons = [$createbutton->export_for_template($output)];
|
||||
if ($categorytomanage = \core_course_category::get_nearest_editable_subcategory($coursecat, ['manage'])) {
|
||||
// Add a Manage course button.
|
||||
$managebutton = new \single_button(
|
||||
new \moodle_url('/course/management.php', ['category' => $categorytomanage->id]),
|
||||
get_string('managecourses')
|
||||
);
|
||||
$buttons[] = $managebutton->export_for_template($output);
|
||||
return $this->generate_zero_state_data(
|
||||
$nocoursesimg,
|
||||
array_reverse($buttons),
|
||||
['title' => 'zero_default_title', 'intro' => 'zero_default_intro']
|
||||
);
|
||||
}
|
||||
return $this->generate_zero_state_data(
|
||||
$nocoursesimg,
|
||||
$buttons,
|
||||
['title' => 'zero_default_title', 'intro' => 'zero_default_intro']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->generate_zero_state_data(
|
||||
$nocoursesimg,
|
||||
[],
|
||||
$buttons,
|
||||
['title' => 'zero_default_title', 'intro' => 'zero_default_intro']
|
||||
);
|
||||
}
|
||||
@ -596,15 +583,20 @@ class main implements renderable, templatable {
|
||||
global $CFG;
|
||||
// Documentation data.
|
||||
$dochref = new \moodle_url($CFG->docroot, ['lang' => current_language()]);
|
||||
$quickstart = new \moodle_url($CFG->coursecreationguide, ['lang' => current_language()]);
|
||||
$docparams = [
|
||||
'quickhref' => $quickstart->out(),
|
||||
'quicktitle' => get_string('viewquickstart', 'block_myoverview'),
|
||||
'quicktarget' => '_blank',
|
||||
'dochref' => $dochref->out(),
|
||||
'doctitle' => get_string('documentation'),
|
||||
'doctarget' => $CFG->doctonewwindow ? '_blank' : '_self',
|
||||
];
|
||||
if ($CFG->coursecreationguide) {
|
||||
// Add quickstart guide link.
|
||||
$quickstart = new \moodle_url($CFG->coursecreationguide, ['lang' => current_language()]);
|
||||
$docparams = [
|
||||
'quickhref' => $quickstart->out(),
|
||||
'quicktitle' => get_string('viewquickstart', 'block_myoverview'),
|
||||
'quicktarget' => '_blank',
|
||||
];
|
||||
}
|
||||
return [
|
||||
'nocoursesimg' => $imageurl->out(),
|
||||
'title' => ($strings['title']) ? get_string($strings['title'], 'block_myoverview') : '',
|
||||
|
@ -90,7 +90,7 @@ $string['privacy:request:preference:set'] = 'The value of the setting \'{$a->nam
|
||||
$string['viewquickstart'] = 'View Quickstart guide';
|
||||
$string['zero_default_title'] = 'You\'re not enrolled in any course';
|
||||
$string['zero_default_intro'] = 'Once you\'re enrolled in a course, it will appear here.';
|
||||
$string['zero_nocourses_intro'] = 'Need help getting started? Check out the <a href="{$a->dochref}" title="{$a->doctitle}" target="{$a->doctarget}">Moodle documentation</a>.';
|
||||
$string['zero_nocourses_title'] = 'Create your first course';
|
||||
$string['zero_request_title'] = 'Request your first course';
|
||||
$string['zero_request_intro'] = 'Need help getting started? Check out the <a href="{$a->dochref}" title="{$a->doctitle}" target="{$a->doctarget}">Moodle documentation</a> or take your first steps with our <a href="{$a->quickhref}" title="{$a->quicktitle}" target="{$a->quicktarget}">Quickstart guide</a>.';
|
||||
$string['zero_nocourses_title'] = 'Create your first course';
|
||||
$string['zero_nocourses_intro'] = 'Need help getting started? Check out the <a href="{$a->dochref}" title="{$a->doctitle}" target="{$a->doctarget}">Moodle documentation</a> or take your first steps with our Quickstart guide.';
|
||||
|
@ -1,4 +1,4 @@
|
||||
@block @block_myoverview @javascript
|
||||
@block @block_myoverview
|
||||
Feature: Zero state on my overview block
|
||||
In order to know what should be the next step
|
||||
As a user
|
||||
@ -31,15 +31,29 @@ Feature: Zero state on my overview block
|
||||
And "Request a course" "button" should exist
|
||||
And I click on "Request a course" "button"
|
||||
And I should see "Details of the course"
|
||||
# Quickstart guide link should not be displayed when $CFG->coursecreationguide is empty.
|
||||
But the following config values are set as admin:
|
||||
| coursecreationguide | |
|
||||
And I am on the "My courses" page
|
||||
And "Moodle documentation" "link" should exist
|
||||
And "Quickstart guide" "link" should not exist
|
||||
|
||||
Scenario: Users with permissions to create a course when there is no course created
|
||||
Given I am on the "My courses" page logged in as "manager"
|
||||
When I should see "Create your first course"
|
||||
Then "Moodle documentation" "link" should exist
|
||||
And "View Quickstart guide" "button" should exist
|
||||
And "Quickstart guide" "link" should exist
|
||||
And "Manage courses" "button" should not exist
|
||||
And "Manage course categories" "button" should exist
|
||||
And "Create course" "button" should exist
|
||||
And I click on "Create course" "button"
|
||||
And I should see "Add a new course"
|
||||
# Quickstart guide link should not be displayed when $CFG->coursecreationguide is empty.
|
||||
But the following config values are set as admin:
|
||||
| coursecreationguide | |
|
||||
And I am on the "My courses" page
|
||||
And "Moodle documentation" "link" should exist
|
||||
And "Quickstart guide" "link" should not exist
|
||||
|
||||
Scenario: Users with permissions to create a course but is not enrolled in any existing course
|
||||
Given the following "course" exists:
|
||||
@ -71,7 +85,7 @@ Feature: Zero state on my overview block
|
||||
And I click on "Create course" "button"
|
||||
And I should see "Add a new course"
|
||||
|
||||
@accessibility
|
||||
@javascript @accessibility
|
||||
Scenario: Evaluate the accessibility of the My courses (zero state)
|
||||
When I am on the "My courses" page logged in as "manager"
|
||||
Then the page should meet accessibility standards
|
||||
|
@ -129,3 +129,4 @@ newpasswordtext,core
|
||||
cannotsetpassword,core_error
|
||||
registerwithmoodleorginfoapp,core_hub
|
||||
registration_help,core_admin
|
||||
coursemanagementoptions,core_my
|
||||
|
@ -22,7 +22,6 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['coursemanagementoptions'] = 'Course management options';
|
||||
$string['error:dashboardisdisabled'] = 'The Dashboard has been disabled by an administrator.';
|
||||
$string['mymoodle'] = 'Dashboard';
|
||||
$string['nocourses'] = 'No course information to show.';
|
||||
@ -42,3 +41,6 @@ $string['reseteveryonesprofile'] = 'Reset profile for all users';
|
||||
$string['resetpage'] = 'Reset page to default';
|
||||
$string['reseterror'] = 'There was an error resetting your page';
|
||||
$string['privacy:metadata:core_my:preference:user_home_page_preference'] = 'The user home page preference.';
|
||||
|
||||
// Deprecated since Moodle 4.5.
|
||||
$string['coursemanagementoptions'] = 'Course management options';
|
||||
|
@ -71,19 +71,21 @@ $PAGE->theme->addblockposition = BLOCK_ADDBLOCK_POSITION_CUSTOM;
|
||||
// Add course management if the user has the capabilities for it.
|
||||
$coursecat = core_course_category::user_top();
|
||||
$coursemanagemenu = [];
|
||||
if ($coursecat && ($category = core_course_category::get_nearest_editable_subcategory($coursecat, ['create']))) {
|
||||
// The user has the capability to create course.
|
||||
$coursemanagemenu['newcourseurl'] = new moodle_url('/course/edit.php', ['category' => $category->id]);
|
||||
}
|
||||
if ($coursecat && ($category = core_course_category::get_nearest_editable_subcategory($coursecat, ['manage']))) {
|
||||
// The user has the capability to manage the course category.
|
||||
$coursemanagemenu['manageurl'] = new moodle_url('/course/management.php', ['categoryid' => $category->id]);
|
||||
}
|
||||
if ($coursecat) {
|
||||
$category = core_course_category::get_nearest_editable_subcategory($coursecat, ['moodle/course:request']);
|
||||
if ($category && $category->can_request_course()) {
|
||||
$coursemanagemenu['courserequesturl'] = new moodle_url('/course/request.php', ['categoryid' => $category->id]);
|
||||
|
||||
// Only display the action menu if the user has courses (otherwise, the buttons will be displayed in the zero state).
|
||||
if (count(enrol_get_all_users_courses($USER->id, true)) > 0) {
|
||||
if ($coursecat && ($category = core_course_category::get_nearest_editable_subcategory($coursecat, ['create']))) {
|
||||
// The user has the capability to create course.
|
||||
$coursemanagemenu['newcourseurl'] = new moodle_url('/course/edit.php', ['category' => $category->id]);
|
||||
}
|
||||
if ($coursecat && ($category = core_course_category::get_nearest_editable_subcategory($coursecat, ['manage']))) {
|
||||
// The user has the capability to manage the course category.
|
||||
$coursemanagemenu['manageurl'] = new moodle_url('/course/management.php', ['categoryid' => $category->id]);
|
||||
}
|
||||
if ($coursecat) {
|
||||
$category = core_course_category::get_nearest_editable_subcategory($coursecat, ['moodle/course:request']);
|
||||
if ($category && $category->can_request_course()) {
|
||||
$coursemanagemenu['courserequesturl'] = new moodle_url('/course/request.php', ['categoryid' => $category->id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($coursemanagemenu)) {
|
||||
|
@ -15,9 +15,9 @@
|
||||
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
}}
|
||||
{{!
|
||||
@template my/dropdown
|
||||
@template core_my/dropdown
|
||||
|
||||
Simple dropdown for the my/courses page
|
||||
Simple dropdown for the my/courses page.
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
@ -27,19 +27,21 @@
|
||||
}
|
||||
}}
|
||||
<div class="btn-group{{#manageurl}} course-manage{{/manageurl}}{{#courserequesturl}} course-request{{/courserequesturl}}">
|
||||
<!-- Set as a link to appease BrowserKit behat. -->
|
||||
<a href="#" class="btn btn-link btn-icon icon-size-3 rounded-circle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="{{#str}}coursemanagementoptions, my{{/str}}">
|
||||
<i class="fa fa-ellipsis-v text-dark py-2" aria-hidden="true"></i>
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
{{#newcourseurl}}
|
||||
<a class="dropdown-item" href="{{newcourseurl}}">{{#str}}newcourse, core{{/str}}</a>
|
||||
{{/newcourseurl}}
|
||||
<div class="my-action-buttons my-action-buttons-right">
|
||||
{{#manageurl}}
|
||||
<a class="dropdown-item" href="{{manageurl}}">{{#str}}managecourses, core{{/str}}</a>
|
||||
<form action="{{manageurl}}" method="post" id="managecoursesform">
|
||||
<button type="submit" class="btn btn-outline-primary m-1 w-100">{{#str}} managecourses {{/str}}</button>
|
||||
</form>
|
||||
{{/manageurl}}
|
||||
{{#newcourseurl}}
|
||||
<form action="{{newcourseurl}}" method="post" id="newcourseform">
|
||||
<button type="submit" class="btn btn-primary m-1 w-100">{{#str}} createcourse, block_myoverview {{/str}}</button>
|
||||
</form>
|
||||
{{/newcourseurl}}
|
||||
{{#courserequesturl}}
|
||||
<a class="dropdown-item" href="{{courserequesturl}}">{{#str}}requestcourse, core{{/str}}</a>
|
||||
<form action="{{courserequesturl}}" method="post" id="courserequestform">
|
||||
<button type="submit" class="btn btn-primary m-1 w-100">{{#str}} requestcourse {{/str}}</button>
|
||||
</form>
|
||||
{{/courserequesturl}}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
@core @core_my
|
||||
Feature: Run tests over my courses.
|
||||
@core @core_my @block_myoverview
|
||||
Feature: Run tests over my courses page
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
@ -17,25 +17,69 @@ Feature: Run tests over my courses.
|
||||
|
||||
Scenario: Admin can add new courses or manage them from my courses
|
||||
Given I am on the "My courses" page logged in as "admin"
|
||||
And I click on "Course management options" "link"
|
||||
And I click on "New course" "link"
|
||||
And I wait to be redirected
|
||||
And "Create course" "button" should not exist in the "page-header" "region"
|
||||
And "Manage courses" "button" should not exist in the "page-header" "region"
|
||||
When I click on "Create course" "button" in the "page-content" "region"
|
||||
Then I should see "Add a new course"
|
||||
And I am on the "My courses" page
|
||||
And I click on "Course management options" "link"
|
||||
And I click on "Manage courses" "link"
|
||||
And I click on "Manage course categories" "button" in the "page-content" "region"
|
||||
And I should see "Manage course categories and courses"
|
||||
# Check that the expected buttons are displayed in the header when the user is enrolled in a course.
|
||||
But the following "course" exists:
|
||||
| fullname | Course 1 |
|
||||
| shortname | C1 |
|
||||
| format | topics |
|
||||
And the following "course enrolment" exists:
|
||||
| user | admin |
|
||||
| course | C1 |
|
||||
| role | student |
|
||||
And I am on the "My courses" page
|
||||
And "Create course" "button" should exist in the "page-header" "region"
|
||||
And "Manage courses" "button" should exist in the "page-header" "region"
|
||||
And "Create course" "button" should not exist in the "page-content" "region"
|
||||
And "Manage courses" "button" should not exist in the "page-content" "region"
|
||||
And "Manage course categories" "button" should not exist in the "page-content" "region"
|
||||
|
||||
Scenario: User without creating a course and managing category permissions cannot see any link
|
||||
Given I am on the "My courses" page logged in as "user1"
|
||||
Then "Course management options" "link" should not exist
|
||||
When I am on the "My courses" page logged in as "user1"
|
||||
Then "Create course" "button" should not exist
|
||||
And "Manage courses" "button" should not exist
|
||||
And "Manage course categories" "button" should not exist
|
||||
# Check that the same buttons are displayed in the header when the user is enrolled in a course.
|
||||
But the following "course" exists:
|
||||
| fullname | Course 1 |
|
||||
| shortname | C1 |
|
||||
| format | topics |
|
||||
And the following "course enrolment" exists:
|
||||
| user | user1 |
|
||||
| course | C1 |
|
||||
| role | student |
|
||||
And I am on the "My courses" page
|
||||
And "Create course" "button" should not exist
|
||||
And "Manage courses" "button" should not exist
|
||||
And "Manage course categories" "button" should not exist
|
||||
|
||||
Scenario: User without capability to browse courses cannot see any link
|
||||
Given the following "permission overrides" exist:
|
||||
| capability | permission | role | contextlevel | reference |
|
||||
| moodle/category:viewcourselist | Prevent | user | System | |
|
||||
Given I am on the "My courses" page logged in as "user1"
|
||||
Then "Course management options" "link" should not exist
|
||||
When I am on the "My courses" page logged in as "user1"
|
||||
Then "Create course" "button" should not exist
|
||||
And "Manage courses" "button" should not exist
|
||||
And "Manage course categories" "button" should not exist
|
||||
# Check that the same buttons are displayed in the header when the user is enrolled in a course.
|
||||
But the following "course" exists:
|
||||
| fullname | Course 1 |
|
||||
| shortname | C1 |
|
||||
| format | topics |
|
||||
And the following "course enrolment" exists:
|
||||
| user | user1 |
|
||||
| course | C1 |
|
||||
| role | student |
|
||||
And I am on the "My courses" page
|
||||
And "Create course" "button" should not exist
|
||||
And "Manage courses" "button" should not exist
|
||||
And "Manage course categories" "button" should not exist
|
||||
|
||||
@javascript
|
||||
Scenario: User with creating a course permission can see the Create course link only
|
||||
@ -43,28 +87,48 @@ Feature: Run tests over my courses.
|
||||
| capability | permission | role | contextlevel | reference |
|
||||
| moodle/course:create | Allow | role1 | Category | cata |
|
||||
When I am on the "My courses" page logged in as "user1"
|
||||
Then "Course management options" "link" should exist
|
||||
And I click on "Course management options" "link"
|
||||
And I should see "New course"
|
||||
And I should not see "Manage courses"
|
||||
And I click on "New course" "link"
|
||||
And I wait to be redirected
|
||||
Then "Create course" "button" should exist in the "page-content" "region"
|
||||
But "Manage course categories" "button" should not exist
|
||||
And "Create course" "button" should not exist in the "page-header" "region"
|
||||
And I click on "Create course" "button"
|
||||
And I should see "Add a new course"
|
||||
And "CatA" "autocomplete_selection" should exist
|
||||
# Check that the same buttons are displayed in the header when the user is enrolled in a course.
|
||||
But the following "course" exists:
|
||||
| fullname | Course 1 |
|
||||
| shortname | C1 |
|
||||
| format | topics |
|
||||
And the following "course enrolment" exists:
|
||||
| user | user1 |
|
||||
| course | C1 |
|
||||
| role | student |
|
||||
And I am on the "My courses" page
|
||||
And "Create course" "button" should exist in the "page-header" "region"
|
||||
And "Manage courses" "button" should not exist
|
||||
And "Create course" "button" should not exist in the "page-content" "region"
|
||||
|
||||
@javascript
|
||||
Scenario: User with managing a category permission can see the Manage course link only
|
||||
Given the following "permission overrides" exist:
|
||||
| capability | permission | role | contextlevel | reference |
|
||||
| moodle/category:manage | Allow | role1 | Category | cata |
|
||||
When I am on the "My courses" page logged in as "user1"
|
||||
Then "Course management options" "link" should exist
|
||||
And I click on "Course management options" "link"
|
||||
And I should not see "New course"
|
||||
And I should see "Manage courses"
|
||||
And I click on "Manage courses" "link"
|
||||
And I wait to be redirected
|
||||
Then "Manage course categories" "button" should exist in the "page-content" "region"
|
||||
And "Create course" "button" should not exist
|
||||
And I click on "Manage course categories" "button" in the "page-content" "region"
|
||||
And I should see "Manage course categories and courses"
|
||||
# Check that the same buttons are displayed in the header when the user is enrolled in a course.
|
||||
But the following "course" exists:
|
||||
| fullname | Course 1 |
|
||||
| shortname | C1 |
|
||||
| format | topics |
|
||||
And the following "course enrolment" exists:
|
||||
| user | user1 |
|
||||
| course | C1 |
|
||||
| role | student |
|
||||
And I am on the "My courses" page
|
||||
And "Manage courses" "button" should exist in the "page-header" "region"
|
||||
And "Create course" "button" should not exist
|
||||
And "Manage courses" "button" should not exist in the "page-content" "region"
|
||||
|
||||
@javascript
|
||||
Scenario: User with both creating a course and managing a category permission can see both links
|
||||
@ -73,19 +137,30 @@ Feature: Run tests over my courses.
|
||||
| moodle/course:create | Allow | role1 | Category | cata |
|
||||
| moodle/category:manage | Allow | role1 | Category | cata |
|
||||
When I am on the "My courses" page logged in as "user1"
|
||||
Then "Course management options" "link" should exist
|
||||
And I click on "Course management options" "link"
|
||||
And I should see "New course"
|
||||
And I should see "Manage courses"
|
||||
And I click on "New course" "link"
|
||||
And I wait to be redirected
|
||||
Then "Create course" "button" should exist in the "page-content" "region"
|
||||
And "Manage course categories" "button" should exist in the "page-content" "region"
|
||||
And "Create course" "button" should not exist in the "page-header" "region"
|
||||
And "Manage courses" "button" should not exist in the "page-header" "region"
|
||||
And I click on "Create course" "button"
|
||||
And I should see "Add a new course"
|
||||
And "CatA" "autocomplete_selection" should exist
|
||||
And I am on the "My courses" page
|
||||
And I click on "Course management options" "link"
|
||||
And I click on "Manage courses" "link"
|
||||
And I wait to be redirected
|
||||
And I click on "Manage course categories" "button"
|
||||
And I should see "Manage course categories and courses"
|
||||
# Check that the same buttons are displayed in the header when the user is enrolled in a course.
|
||||
But the following "course" exists:
|
||||
| fullname | Course 1 |
|
||||
| shortname | C1 |
|
||||
| format | topics |
|
||||
And the following "course enrolment" exists:
|
||||
| user | user1 |
|
||||
| course | C1 |
|
||||
| role | student |
|
||||
And I am on the "My courses" page
|
||||
And "Create course" "button" should exist in the "page-header" "region"
|
||||
And "Manage courses" "button" should exist in the "page-header" "region"
|
||||
And "Create course" "button" should not exist in the "page-content" "region"
|
||||
And "Manage courses" "button" should not exist in the "page-content" "region"
|
||||
|
||||
@javascript
|
||||
Scenario: Admin can see relevant blocks but not add or move them
|
||||
@ -111,30 +186,73 @@ Feature: Run tests over my courses.
|
||||
And "Move Course overview block" "menuitem" should not exist in the "Course overview" "block"
|
||||
And "Actions menu" "icon" in the "Course overview" "block" should not be visible
|
||||
|
||||
@javascript
|
||||
Scenario: User with creating a course permission can't see the Request course link
|
||||
Given the following "permission overrides" exist:
|
||||
| capability | permission | role | contextlevel | reference |
|
||||
| moodle/course:request | Allow | user | System | |
|
||||
When I am on the "My courses" page logged in as "admin"
|
||||
And I click on "Course management options" "link"
|
||||
And I should see "New course"
|
||||
Then I should not see "Request a course"
|
||||
Then "Create course" "button" should exist in the "page-content" "region"
|
||||
And "Request a course" "button" should not exist
|
||||
And "Create course" "button" should not exist in the "page-header" "region"
|
||||
# Check that the same buttons are displayed in the header when the user is enrolled in a course.
|
||||
But the following "course" exists:
|
||||
| fullname | Course 1 |
|
||||
| shortname | C1 |
|
||||
| format | topics |
|
||||
And the following "course enrolment" exists:
|
||||
| user | admin |
|
||||
| course | C1 |
|
||||
| role | student |
|
||||
And I am on the "My courses" page
|
||||
And "Create course" "button" should exist in the "page-header" "region"
|
||||
And "Request a course" "button" should not exist
|
||||
And "Create course" "button" should not exist in the "page-content" "region"
|
||||
|
||||
@javascript
|
||||
Scenario: User without creating a course but with course request permission could see the Request course link
|
||||
Given the following "permission overrides" exist:
|
||||
| capability | permission | role | contextlevel | reference |
|
||||
| moodle/course:request | Allow | user | System | |
|
||||
When I am on the "My courses" page logged in as "user1"
|
||||
And I click on "Course management options" "link"
|
||||
And I should not see "New course"
|
||||
Then I should see "Request a course"
|
||||
Then "Request a course" "button" should exist in the "page-content" "region"
|
||||
And "Create course" "button" should not exist in the "page-content" "region"
|
||||
And "Create course" "button" should not exist in the "page-header" "region"
|
||||
And "Request a course" "button" should not exist in the "page-header" "region"
|
||||
# Check the request a course button is not displayed when this feature is disabled.
|
||||
And the following config values are set as admin:
|
||||
| enablecourserequests | 0 |
|
||||
And I am on the "My courses" page logged in as "user1"
|
||||
And "Course management options" "link" should not exist
|
||||
And "Request a course" "button" should not exist
|
||||
# Check that the same buttons are displayed in the header when the user is enrolled in a course.
|
||||
But the following "course" exists:
|
||||
| fullname | Course 1 |
|
||||
| shortname | C1 |
|
||||
| format | topics |
|
||||
And the following "course enrolment" exists:
|
||||
| user | user1 |
|
||||
| course | C1 |
|
||||
| role | student |
|
||||
And the following config values are set as admin:
|
||||
| enablecourserequests | 1 |
|
||||
And I am on the "My courses" page
|
||||
And "Request a course" "button" should exist in the "page-header" "region"
|
||||
And "Create course" "button" should not exist
|
||||
And "Request a course" "button" should not exist in the "page-content" "region"
|
||||
|
||||
Scenario: User without creating nor course request permission shouldn't see any Request course link
|
||||
Given I am on the "My courses" page logged in as "user1"
|
||||
Then "Course management options" "link" should not exist
|
||||
Then "Request a course" "button" should not exist in the "page-content" "region"
|
||||
And "Create course" "button" should not exist in the "page-content" "region"
|
||||
And "Manage courses" "button" should not exist in the "page-content" "region"
|
||||
# Check that the same buttons are displayed in the header when the user is enrolled in a course.
|
||||
But the following "course" exists:
|
||||
| fullname | Course 1 |
|
||||
| shortname | C1 |
|
||||
| format | topics |
|
||||
And the following "course enrolment" exists:
|
||||
| user | user1 |
|
||||
| course | C1 |
|
||||
| role | student |
|
||||
And I am on the "My courses" page
|
||||
And "Create course" "button" should not exist
|
||||
And "Request a course" "button" should not exist
|
||||
And "Manage courses" "button" should not exist
|
||||
|
@ -2939,6 +2939,13 @@ body.dragging {
|
||||
}
|
||||
}
|
||||
|
||||
#page-my-index .my-action-buttons {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.dropdown-toggle::after {
|
||||
@extend .fa-solid;
|
||||
content: fa-content($fa-var-chevron-down);
|
||||
|
@ -25917,6 +25917,13 @@ body.dragging .dragging {
|
||||
padding-right: 0 !important; /* stylelint-disable-line declaration-no-important */
|
||||
}
|
||||
|
||||
#page-my-index .my-action-buttons {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.dropdown-toggle::after {
|
||||
content: "\f078";
|
||||
margin-right: 0;
|
||||
|
@ -25917,6 +25917,13 @@ body.dragging .dragging {
|
||||
padding-right: 0 !important; /* stylelint-disable-line declaration-no-important */
|
||||
}
|
||||
|
||||
#page-my-index .my-action-buttons {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.dropdown-toggle::after {
|
||||
content: "\f078";
|
||||
margin-right: 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user