This commit is contained in:
Andrew Nicols
2021-11-17 12:41:32 +08:00
47 changed files with 589 additions and 137 deletions
@@ -71,9 +71,9 @@ Feature: Use core page resolvers for the I am on the page steps
Then I should see "<shouldsee>"
Examples:
| description | identifier | shouldsee |
| Admin page | "Admin notifications" | Check for available updates |
| Home page | Homepage | Course overview |
| description | identifier | shouldsee |
| Admin page | "Admin notifications" | Check for available updates |
| Home page | Homepage | Calendar |
Scenario Outline: When I am on a named page logged in as
When I am on the <identifier> page logged in as admin
@@ -82,4 +82,4 @@ Feature: Use core page resolvers for the I am on the page steps
Examples:
| description | identifier | shouldsee |
| Admin page | "Admin notifications" | Check for available updates |
| Home page | Homepage | Course overview |
| Home page | Homepage | Calendar |
@@ -36,7 +36,7 @@ Feature: Viewing acceptances reports and accepting on behalf of other users
And I press "Next"
And I set the field "I agree to the This site policy" to "1"
And I press "Next"
And I should see "Course overview"
And I should see "Calendar"
And I log out
And I log in as "manager"
And I press "Next"
@@ -82,7 +82,7 @@ Feature: Viewing acceptances reports and accepting on behalf of other users
And I press "Next"
And I set the field "I agree to the This site policy" to "1"
And I press "Next"
And I should see "Course overview"
And I should see "Calendar"
And I navigate to "Users > Privacy and policies > Manage policies" in site administration
And I click on "1 of 4 (25%)" "link" in the "This site policy" "table_row"
And I click on "Accept This site policy" "link" in the "User One" "table_row"
@@ -111,7 +111,7 @@ Feature: Viewing acceptances reports and accepting on behalf of other users
And I set the field "I agree to the This site policy" to "1"
And I set the field "I agree to the This privacy policy" to "1"
And I press "Next"
And I should see "Course overview"
And I should see "Calendar"
And I log out
And I log in as "manager"
And I press "Next"
@@ -300,7 +300,7 @@ Feature: Viewing acceptances reports and accepting on behalf of other users
And I press "Next"
And I set the field "I agree to the This site policy" to "1"
And I press "Next"
And I should see "Course overview"
And I should see "Calendar"
And I log out
And I log in as "admin"
And I navigate to "Users > Privacy and policies > Manage policies" in site administration
@@ -311,4 +311,4 @@ Feature: Viewing acceptances reports and accepting on behalf of other users
And I press "Continue"
And I log out
When I log in as "user1"
Then I should see "Course overview"
Then I should see "Calendar"
@@ -20,7 +20,7 @@ Feature: Add a new user tour
| Display in middle of page | Welcome | Welcome to your personal learning space. We'd like to give you a quick tour to show you some of the areas you may find helpful |
And I add steps to the "First tour" tour:
| targettype | targetvalue_block | Title | Content |
| Block | Course overview | Course overview | This area shows you what's happening in some of your courses |
| Block | Timeline | Timeline | This is the Timeline. All of your upcoming activities can be found here |
| Block | Calendar | Calendar | This is the Calendar. All of your assignments and due dates can be found here |
And I add steps to the "First tour" tour:
| targettype | targetvalue_selector | Title | Content |
@@ -28,7 +28,7 @@ Feature: Add a new user tour
When I am on homepage
Then I should see "Welcome to your personal learning space. We'd like to give you a quick tour to show you some of the areas you may find helpful"
And I click on "Next" "button" in the "[data-role='flexitour-step']" "css_element"
And I should see "This area shows you what's happening in some of your courses"
And I should see "This is the Timeline. All of your upcoming activities can be found here"
And I should not see "This is the Calendar. All of your assignments and due dates can be found here"
And I click on "Next" "button" in the "[data-role='flexitour-step']" "css_element"
And I should see "This is the Calendar. All of your assignments and due dates can be found here"
@@ -95,7 +95,7 @@ Feature: Add a new user tour
| Display in middle of page | Welcome | First step of the Tour |
And I add steps to the "Steps tour" tour:
| targettype | targetvalue_block | Title | Content |
| Block | Course overview | Course overview | Second step of the Tour |
| Block | Timeline | Timeline | Second step of the Tour |
| Block | Calendar | Calendar | Third step of the Tour |
When I am on homepage
Then I should see "First step of the Tour"
@@ -129,7 +129,7 @@ Feature: Add a new user tour
| Display in middle of page | Welcome | First step of the Tour |
And I add steps to the "Steps tour" tour:
| targettype | targetvalue_block | Title | Content |
| Block | Course overview | Course overview | Second step of the Tour |
| Block | Timeline | Timeline | Second step of the Tour |
| Block | Calendar | Calendar | Third step of the Tour |
When I am on homepage
Then I should see "First step of the Tour"
@@ -53,14 +53,14 @@ Feature: Steps can be navigated within a tour
| Display in middle of page | Welcome | Welcome to your personal learning space. We'd like to give you a quick tour to show you some of the areas you may find helpful |
And I add steps to the "First tour" tour:
| targettype | targetvalue_block | Title | Content |
| Block | Course overview | Course overview | This area shows you what's happening in some of your courses |
| Block | Timeline | Timeline | This is the Timeline. All of your upcoming activities can be found here |
| Block | Calendar | Calendar | This is the Calendar. All of your assignments and due dates can be found here |
When I am on homepage
Then I should see "Skip tour"
And I should see "Next (1/3)"
And I click on "Next (1/3)" "button" in the "Welcome" "dialogue"
And I should see "Skip tour"
And I click on "Next (2/3)" "button" in the "Course overview" "dialogue"
And I click on "Next (2/3)" "button" in the "Timeline" "dialogue"
And I should see "End tour"
@javascript
+10 -1
View File
@@ -249,7 +249,7 @@ class block_base {
$this->arialabel = $bc->arialabel;
}
if ($this->page->user_is_editing()) {
if ($this->page->user_is_editing() && $this->instance_can_be_edited()) {
$bc->controls = $this->page->blocks->edit_controls($this);
} else {
// we must not use is_empty on hidden blocks
@@ -692,6 +692,15 @@ class block_base {
return true;
}
/**
* If overridden and set to false by the block it will not be editable.
*
* @return bool
*/
public function instance_can_be_edited() {
return true;
}
/** @callback callback functions for comments api */
public static function comment_template($options) {
$ret = <<<EOD
+13
View File
@@ -113,5 +113,18 @@ class block_myoverview extends block_base {
'plugin' => $configs,
];
}
/**
* Disable block editing on the my courses page.
*
* @return boolean
*/
public function instance_can_be_edited() {
if ($this->page->blocks->is_known_region(BLOCK_POS_LEFT) || $this->page->blocks->is_known_region(BLOCK_POS_RIGHT)) {
return true;
} else {
return false;
}
}
}
+74
View File
@@ -25,6 +25,8 @@
defined('MOODLE_INTERNAL') || die();
require_once($CFG->dirroot . '/my/lib.php');
/**
* Upgrade code for the MyOverview block.
*
@@ -81,5 +83,77 @@ function xmldb_block_myoverview_upgrade($oldversion) {
// Automatically generated Moodle v3.9.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2021052504) {
/**
* Small helper function for this version upgrade to delete instances of this block.
*
* @param stdClass $instance DB record of a block that we need to delete within Moodle.
*/
function delete_block_instance(stdClass $instance) {
global $DB;
if ($instance) {
list($sql, $params) = $DB->get_in_or_equal($instance->id, SQL_PARAMS_NAMED);
$params['contextlevel'] = CONTEXT_BLOCK;
$DB->delete_records_select('context', "contextlevel=:contextlevel AND instanceid " . $sql, $params);
$DB->delete_records('block_positions', ['blockinstanceid' => $instance->id]);
$DB->delete_records('block_instances', ['id' => $instance->id]);
$DB->delete_records_list('user_preferences', 'name',
['block' . $instance->id . 'hidden', 'docked_block_instance_' . $instance->id]);
}
}
// Delete the default indexsys version of the block.
$mysubpagepattern = $DB->get_record(
'my_pages',
['userid' => null, 'name' => MY_PAGE_DEFAULT, 'private' => MY_PAGE_PRIVATE],
'id',
IGNORE_MULTIPLE
)->id;
$instances = $DB->get_records('block_instances', ['blockname' => 'myoverview',
'pagetypepattern' => 'my-index', 'subpagepattern' => $mysubpagepattern]);
foreach ($instances as $instance) {
delete_block_instance($instance);
}
// Begin looking for any and all instances of course overview in customised /my pages.
$pageselect = 'name = :name and private = :private and userid IS NOT NULL';
$pageparams['name'] = MY_PAGE_DEFAULT;
$pageparams['private'] = MY_PAGE_PRIVATE;
$pages = $DB->get_recordset_select('my_pages', $pageselect, $pageparams);
foreach ($pages as $page) {
$blocksql = 'blockname = :blockname and pagetypepattern = :pagetypepattern and subpagepattern = :subpagepattern';
$blockparams['blockname'] = 'myoverview';
$blockparams['pagetypepattern'] = 'my-index';
$blockparams['subpagepattern'] = $page->id;
$instances = $DB->get_records_select('block_instances', $blocksql, $blockparams);
foreach ($instances as $instance) {
delete_block_instance($instance);
}
}
$pages->close();
// Add new instance to the /my/courses.php page.
$subpagepattern = $DB->get_record(
'my_pages',
['userid' => null, 'name' => MY_PAGE_COURSES, 'private' => MY_PAGE_PUBLIC],
'id',
IGNORE_MULTIPLE
)->id;
// See if this block already somehow exists, it should not but who knows.
if (!$DB->get_record('block_instances', ['blockname' => 'myoverview',
'pagetypepattern' => 'my-index', 'subpagepattern' => $subpagepattern])) {
$page = new moodle_page();
$systemcontext = context_system::instance();
$page->set_context($systemcontext);
// Add the block to the default /my/courses.
$page->blocks->add_region('content');
$page->blocks->add_block('myoverview', 'content', 0, false, 'my-index', $subpagepattern);
}
upgrade_block_savepoint(true, 2021052504, 'myoverview', false);
}
return true;
}
+1 -1
View File
@@ -101,7 +101,7 @@ function block_myoverview_user_preferences() {
$preferences['block_myoverview_user_sort_preference'] = array(
'null' => NULL_NOT_ALLOWED,
'default' => BLOCK_MYOVERVIEW_SORTING_TITLE,
'default' => BLOCK_MYOVERVIEW_SORTING_LASTACCESSED,
'type' => PARAM_ALPHA,
'choices' => array(
BLOCK_MYOVERVIEW_SORTING_TITLE,
@@ -32,7 +32,7 @@ Feature: The my overview block allows admins to easily configure the students' c
And I set the field "All" to "1"
And I press "Save"
And I log out
Then I log in as "student1"
Then I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
# We have to check for the data attribute instead of the list element text as we would get false positives from the "All (except removed from view)" element otherwise
Then "[data-value='allincludinghidden']" "css_element" should exist in the ".block_myoverview .dropdown-menu" "css_element"
@@ -43,7 +43,7 @@ Feature: The my overview block allows admins to easily configure the students' c
And I set the field "All" to "0"
And I press "Save"
And I log out
Then I log in as "student1"
Then I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
# We have to check for the data attribute instead of the list element text as we would get false negatives "All (except removed from view)" element otherwise
Then "[data-value='allincludinghidden']" "css_element" should not exist in the ".block_myoverview .dropdown-menu" "css_element"
@@ -54,7 +54,7 @@ Feature: The my overview block allows admins to easily configure the students' c
And I set the field "All (except removed from view)" to "1"
And I press "Save"
And I log out
Then I log in as "student1"
Then I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
Then "All (except removed from view)" "list_item" should exist in the ".block_myoverview .dropdown-menu" "css_element"
@@ -64,7 +64,7 @@ Feature: The my overview block allows admins to easily configure the students' c
And I set the field "All (except removed from view)" to "0"
And I press "Save"
And I log out
Then I log in as "student1"
Then I am on the "My courses" page logged in as "student1"
# 'All (except removed from view)' option has been disabled, so the button is falling back to the 'In progress' option which is the next enabled option.
And I click on "In progress" "button" in the "Course overview" "block"
Then "All (except removed from view)" "list_item" should not exist in the ".block_myoverview .dropdown-menu" "css_element"
@@ -75,7 +75,7 @@ Feature: The my overview block allows admins to easily configure the students' c
And I set the field "In progress" to "1"
And I press "Save"
And I log out
Then I log in as "student1"
Then I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
Then "In progress" "list_item" should exist in the ".block_myoverview .dropdown-menu" "css_element"
@@ -85,7 +85,7 @@ Feature: The my overview block allows admins to easily configure the students' c
And I set the field "In progress" to "0"
And I press "Save"
And I log out
Then I log in as "student1"
Then I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
Then "In progress" "list_item" should not exist in the ".block_myoverview .dropdown-menu" "css_element"
@@ -95,7 +95,7 @@ Feature: The my overview block allows admins to easily configure the students' c
And I set the field "Future" to "1"
And I press "Save"
And I log out
Then I log in as "student1"
Then I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
Then "Future" "list_item" should exist in the ".block_myoverview .dropdown-menu" "css_element"
@@ -105,7 +105,7 @@ Feature: The my overview block allows admins to easily configure the students' c
And I set the field "Future" to "0"
And I press "Save"
And I log out
Then I log in as "student1"
Then I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
Then "Future" "list_item" should not exist in the ".block_myoverview .dropdown-menu" "css_element"
@@ -115,7 +115,7 @@ Feature: The my overview block allows admins to easily configure the students' c
And I set the field "Past" to "1"
And I press "Save"
And I log out
Then I log in as "student1"
Then I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
Then "Past" "list_item" should exist in the ".block_myoverview .dropdown-menu" "css_element"
@@ -125,7 +125,7 @@ Feature: The my overview block allows admins to easily configure the students' c
And I set the field "Past" to "0"
And I press "Save"
And I log out
Then I log in as "student1"
Then I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
Then "Past" "list_item" should not exist in the ".block_myoverview .dropdown-menu" "css_element"
@@ -135,7 +135,7 @@ Feature: The my overview block allows admins to easily configure the students' c
And I set the field "Starred" to "1"
And I press "Save"
And I log out
Then I log in as "student1"
Then I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
Then "Starred" "list_item" should exist in the ".block_myoverview .dropdown-menu" "css_element"
@@ -145,7 +145,7 @@ Feature: The my overview block allows admins to easily configure the students' c
And I set the field "Starred" to "0"
And I press "Save"
And I log out
Then I log in as "student1"
Then I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
Then "Starred" "list_item" should not exist in the ".block_myoverview .dropdown-menu" "css_element"
@@ -155,7 +155,7 @@ Feature: The my overview block allows admins to easily configure the students' c
And I set the field "Removed from view" to "1"
And I press "Save"
And I log out
Then I log in as "student1"
Then I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
Then "Removed from view" "list_item" should exist in the ".block_myoverview .dropdown-menu" "css_element"
@@ -165,7 +165,7 @@ Feature: The my overview block allows admins to easily configure the students' c
And I set the field "Removed from view" to "0"
And I press "Save"
And I log out
Then I log in as "student1"
Then I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
Then "Removed from view" "list_item" should not exist in the ".block_myoverview .dropdown-menu" "css_element"
@@ -181,7 +181,7 @@ Feature: The my overview block allows admins to easily configure the students' c
And I set the field "Removed from view" to "0"
And I press "Save"
And I log out
And I log in as "student1"
And I am on the "My courses" page logged in as "student1"
Then "button#groupingdropdown" "css_element" should not exist in the ".block_myoverview" "css_element"
And I should see "Course 1" in the "Course overview" "block"
And I should see "Course 2" in the "Course overview" "block"
@@ -201,7 +201,7 @@ Feature: The my overview block allows admins to easily configure the students' c
And I set the field "Removed from view" to "0"
And I press "Save"
And I log out
And I log in as "student1"
And I am on the "My courses" page logged in as "student1"
Then "button#groupingdropdown" "css_element" should not exist in the ".block_myoverview" "css_element"
And I should see "Course 2" in the "Course overview" "block"
And I should see "Course 3" in the "Course overview" "block"
@@ -35,7 +35,7 @@ Feature: The my overview block allows users to group courses by custom fields
Given the following config values are set as admin:
| displaygroupingcustomfield | 1 | block_myoverview |
| customfiltergrouping | checkboxfield | block_myoverview |
And I log in as "student1"
And I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "Checkbox field: Yes" "link" in the "Course overview" "block"
Then I should see "Course 1" in the "Course overview" "block"
@@ -48,7 +48,7 @@ Feature: The my overview block allows users to group courses by custom fields
Given the following config values are set as admin:
| displaygroupingcustomfield | 1 | block_myoverview |
| customfiltergrouping | checkboxfield | block_myoverview |
And I log in as "student1"
And I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "Checkbox field: No" "link" in the "Course overview" "block"
Then I should not see "Course 1" in the "Course overview" "block"
@@ -61,7 +61,7 @@ Feature: The my overview block allows users to group courses by custom fields
Given the following config values are set as admin:
| displaygroupingcustomfield | 1 | block_myoverview |
| customfiltergrouping | datefield | block_myoverview |
And I log in as "student1"
And I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "1 February 2001" "link" in the "Course overview" "block"
Then I should see "Course 1" in the "Course overview" "block"
@@ -74,7 +74,7 @@ Feature: The my overview block allows users to group courses by custom fields
Given the following config values are set as admin:
| displaygroupingcustomfield | 1 | block_myoverview |
| customfiltergrouping | datefield | block_myoverview |
And I log in as "student1"
And I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "6 August 1980" "link" in the "Course overview" "block"
Then I should not see "Course 1" in the "Course overview" "block"
@@ -87,7 +87,7 @@ Feature: The my overview block allows users to group courses by custom fields
Given the following config values are set as admin:
| displaygroupingcustomfield | 1 | block_myoverview |
| customfiltergrouping | datefield | block_myoverview |
And I log in as "student1"
And I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "No Date field" "link" in the "Course overview" "block"
Then I should not see "Course 1" in the "Course overview" "block"
@@ -100,7 +100,7 @@ Feature: The my overview block allows users to group courses by custom fields
Given the following config values are set as admin:
| displaygroupingcustomfield | 1 | block_myoverview |
| customfiltergrouping | selectfield | block_myoverview |
And I log in as "student1"
And I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
And I should not see "Option 4" in the "Course overview" "block"
When I click on "Option 1" "link" in the "Course overview" "block"
@@ -114,7 +114,7 @@ Feature: The my overview block allows users to group courses by custom fields
Given the following config values are set as admin:
| displaygroupingcustomfield | 1 | block_myoverview |
| customfiltergrouping | selectfield | block_myoverview |
And I log in as "student1"
And I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "Option 2" "link" in the "Course overview" "block"
Then I should not see "Course 1" in the "Course overview" "block"
@@ -127,7 +127,7 @@ Feature: The my overview block allows users to group courses by custom fields
Given the following config values are set as admin:
| displaygroupingcustomfield | 1 | block_myoverview |
| customfiltergrouping | selectfield | block_myoverview |
And I log in as "student1"
And I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "No Select field" "link" in the "Course overview" "block"
Then I should not see "Course 1" in the "Course overview" "block"
@@ -140,7 +140,7 @@ Feature: The my overview block allows users to group courses by custom fields
Given the following config values are set as admin:
| displaygroupingcustomfield | 1 | block_myoverview |
| customfiltergrouping | textfield | block_myoverview |
And I log in as "student1"
And I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "fish" "link" in the "Course overview" "block"
Then I should see "Course 1" in the "Course overview" "block"
@@ -153,7 +153,7 @@ Feature: The my overview block allows users to group courses by custom fields
Given the following config values are set as admin:
| displaygroupingcustomfield | 1 | block_myoverview |
| customfiltergrouping | textfield | block_myoverview |
And I log in as "student1"
And I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "dog" "link" in the "Course overview" "block"
Then I should not see "Course 1" in the "Course overview" "block"
@@ -166,7 +166,7 @@ Feature: The my overview block allows users to group courses by custom fields
Given the following config values are set as admin:
| displaygroupingcustomfield | 1 | block_myoverview |
| customfiltergrouping | textfield | block_myoverview |
And I log in as "student1"
And I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "No Text field" "link" in the "Course overview" "block"
Then I should not see "Course 1" in the "Course overview" "block"
@@ -191,7 +191,7 @@ Feature: The my overview block allows users to group courses by custom fields
And I set the field "Visible to" to "Nobody"
And I press "Save changes"
And I log out
When I log in as "student1"
When I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
Then I should not see "penguin" in the "Course overview" "block"
Then I should not see "No text field" in the "Course overview" "block"
@@ -27,7 +27,7 @@ Feature: The my overview block allows users to easily access their courses
| student1 | C5 | student |
Scenario: View past courses
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "Past" "link" in the "Course overview" "block"
Then I should see "Course 1" in the "Course overview" "block"
@@ -37,7 +37,7 @@ Feature: The my overview block allows users to easily access their courses
And I should not see "Course 5" in the "Course overview" "block"
Scenario: View future courses
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "Future" "link" in the "Course overview" "block"
Then I should see "Course 5" in the "Course overview" "block"
@@ -47,7 +47,7 @@ Feature: The my overview block allows users to easily access their courses
And I should not see "Course 4" in the "Course overview" "block"
Scenario: View inprogress courses
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "In progress" "link" in the "Course overview" "block"
Then I should see "Course 2" in the "Course overview" "block"
@@ -57,7 +57,7 @@ Feature: The my overview block allows users to easily access their courses
And I should not see "Course 5" in the "Course overview" "block"
Scenario: View all (except removed) courses
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "All (except removed from view)" "link" in the "Course overview" "block"
Then I should see "Course 1" in the "Course overview" "block"
@@ -70,7 +70,7 @@ Feature: The my overview block allows users to easily access their courses
Given the following config values are set as admin:
| config | value | plugin |
| displaygroupingallincludinghidden | 1 | block_myoverview |
And I log in as "student1"
And I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
# We have to click on the data attribute instead of the button element text as we might risk to click on the false positive "All (except removed from view)" element instead
When I click on "[data-value='allincludinghidden']" "css_element" in the "Course overview" "block"
@@ -81,7 +81,7 @@ Feature: The my overview block allows users to easily access their courses
Then I should see "Course 5" in the "Course overview" "block"
Scenario: View inprogress courses - test persistence
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
And I click on "In progress" "link" in the "Course overview" "block"
And I reload the page
@@ -93,7 +93,7 @@ Feature: The my overview block allows users to easily access their courses
And I should not see "Course 5" in the "Course overview" "block"
Scenario: View all (except removed) courses - w/ persistence
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "All (except removed from view)" "link" in the "Course overview" "block"
And I reload the page
@@ -105,7 +105,7 @@ Feature: The my overview block allows users to easily access their courses
Then I should see "Course 5" in the "Course overview" "block"
Scenario: View past courses - w/ persistence
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "Past" "link" in the "Course overview" "block"
And I reload the page
@@ -117,7 +117,7 @@ Feature: The my overview block allows users to easily access their courses
And I should not see "Course 5" in the "Course overview" "block"
Scenario: View future courses - w/ persistence
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "Future" "link" in the "Course overview" "block"
And I reload the page
@@ -129,7 +129,7 @@ Feature: The my overview block allows users to easily access their courses
And I should not see "Course 4" in the "Course overview" "block"
Scenario: View favourite courses - w/ persistence
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
And I click on "Star this course" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
@@ -143,7 +143,7 @@ Feature: The my overview block allows users to easily access their courses
And I should not see "Course 5" in the "Course overview" "block"
Scenario: List display persistence
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
And I click on "Display drop-down menu" "button" in the "Course overview" "block"
And I click on "List" "link" in the "Course overview" "block"
And I reload the page
@@ -151,7 +151,7 @@ Feature: The my overview block allows users to easily access their courses
And "[data-display='list']" "css_element" in the "Course overview" "block" should be visible
Scenario: Cards display persistence
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
And I click on "Display drop-down menu" "button" in the "Course overview" "block"
And I click on "Card" "link" in the "Course overview" "block"
And I reload the page
@@ -159,7 +159,7 @@ Feature: The my overview block allows users to easily access their courses
And "[data-display='card']" "css_element" in the "Course overview" "block" should be visible
Scenario: Summary display persistence
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
And I click on "Display drop-down menu" "button" in the "Course overview" "block"
And I click on "Summary" "link" in the "Course overview" "block"
And I reload the page
@@ -167,7 +167,7 @@ Feature: The my overview block allows users to easily access their courses
And "[data-display='summary']" "css_element" in the "Course overview" "block" should be visible
Scenario: Course name sort persistence
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
And I click on "sortingdropdown" "button" in the "Course overview" "block"
And I click on "Course name" "link" in the "Course overview" "block"
And I reload the page
@@ -175,7 +175,7 @@ Feature: The my overview block allows users to easily access their courses
And "[data-sort='fullname']" "css_element" in the "Course overview" "block" should be visible
Scenario: Last accessed sort persistence
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
And I click on "sortingdropdown" "button" in the "Course overview" "block"
And I click on "Last accessed" "link" in the "Course overview" "block"
And I reload the page
@@ -183,7 +183,7 @@ Feature: The my overview block allows users to easily access their courses
And "[data-sort='ul.timeaccess desc']" "css_element" in the "Course overview" "block" should be visible
Scenario: Short name sort persistence
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
When I click on "sortingdropdown" "button" in the "Course overview" "block"
Then I should not see "Short name" in the "Course overview" "block"
When the following config values are set as admin:
@@ -197,7 +197,7 @@ Feature: The my overview block allows users to easily access their courses
And "[data-sort='shortname']" "css_element" in the "Course overview" "block" should be visible
Scenario: View inprogress courses with hide persistent functionality
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "In progress" "link" in the "Course overview" "block"
And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
@@ -210,7 +210,7 @@ Feature: The my overview block allows users to easily access their courses
And I should not see "Course 5" in the "Course overview" "block"
Scenario: View past courses with hide persistent functionality
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "Past" "link" in the "Course overview" "block"
And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 1')]" "xpath_element"
@@ -223,7 +223,7 @@ Feature: The my overview block allows users to easily access their courses
And I should not see "Course 5" in the "Course overview" "block"
Scenario: View future courses with hide persistent functionality
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "Future" "link" in the "Course overview" "block"
And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
@@ -236,7 +236,7 @@ Feature: The my overview block allows users to easily access their courses
And I should not see "Course 4" in the "Course overview" "block"
Scenario: View all (except hidden) courses with hide persistent functionality
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "All (except removed from view)" "link" in the "Course overview" "block"
And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
@@ -252,7 +252,7 @@ Feature: The my overview block allows users to easily access their courses
Given the following config values are set as admin:
| config | value | plugin |
| displaygroupingallincludinghidden | 1 | block_myoverview |
And I log in as "student1"
And I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
# We have to click on the data attribute instead of the button element text as we might risk to click on the false positive "All (except removed from view)" element instead
When I click on "[data-value='allincludinghidden']" "css_element" in the "Course overview" "block"
@@ -268,7 +268,7 @@ Feature: The my overview block allows users to easily access their courses
Scenario: Show course category in cards display
Given the following config values are set as admin:
| displaycategories | 1 | block_myoverview |
And I log in as "student1"
And I am on the "My courses" page logged in as "student1"
And I click on "Display drop-down menu" "button" in the "Course overview" "block"
When I click on "Card" "link" in the "Course overview" "block"
Then I should see "Category 1" in the "Course overview" "block"
@@ -276,7 +276,7 @@ Feature: The my overview block allows users to easily access their courses
Scenario: Show course category in list display
Given the following config values are set as admin:
| displaycategories | 1 | block_myoverview |
And I log in as "student1"
And I am on the "My courses" page logged in as "student1"
And I click on "Display drop-down menu" "button" in the "Course overview" "block"
When I click on "List" "link" in the "Course overview" "block"
Then I should see "Category 1" in the "Course overview" "block"
@@ -284,7 +284,7 @@ Feature: The my overview block allows users to easily access their courses
Scenario: Show course category in summary display
Given the following config values are set as admin:
| displaycategories | 1 | block_myoverview |
And I log in as "student1"
And I am on the "My courses" page logged in as "student1"
And I click on "Display drop-down menu" "button" in the "Course overview" "block"
When I click on "Summary" "link" in the "Course overview" "block"
Then I should see "Category 1" in the "Course overview" "block"
@@ -292,7 +292,7 @@ Feature: The my overview block allows users to easily access their courses
Scenario: Hide course category in cards display
Given the following config values are set as admin:
| displaycategories | 0 | block_myoverview |
And I log in as "student1"
And I am on the "My courses" page logged in as "student1"
And I click on "Display drop-down menu" "button" in the "Course overview" "block"
When I click on "Card" "link" in the "Course overview" "block"
Then I should not see "Category 1" in the "Course overview" "block"
@@ -300,7 +300,7 @@ Feature: The my overview block allows users to easily access their courses
Scenario: Hide course category in list display
Given the following config values are set as admin:
| displaycategories | 0 | block_myoverview |
And I log in as "student1"
And I am on the "My courses" page logged in as "student1"
And I click on "Display drop-down menu" "button" in the "Course overview" "block"
When I click on "List" "link" in the "Course overview" "block"
Then I should not see "Category 1" in the "Course overview" "block"
@@ -308,12 +308,12 @@ Feature: The my overview block allows users to easily access their courses
Scenario: Show course category in summary display
Given the following config values are set as admin:
| displaycategories | 0 | block_myoverview |
And I log in as "student1"
And I am on the "My courses" page logged in as "student1"
And I click on "Display drop-down menu" "button" in the "Course overview" "block"
When I click on "Summary" "link" in the "Course overview" "block"
Then I should not see "Category 1" in the "Course overview" "block"
@accessibility
Scenario: The dashboard page must have sufficient colour contrast
When I log in as "student1"
When I am on the "My courses" page logged in as "student1"
Then the page should meet "wcag143" accessibility standards
@@ -24,7 +24,7 @@ Feature: The my overview block allows users to favourite their courses
| student1 | C5 | student |
Scenario: Favourite a course on a course card
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
When I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
And I click on "Star this course" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
And I reload the page
@@ -34,7 +34,7 @@ Feature: The my overview block allows users to favourite their courses
And "//div[@class='card dashboard-card' and contains(.,'Course 3')]//span[@data-region='is-favourite' and @aria-hidden='true']" "xpath_element" should exist
Scenario: Star a course and switch display to list
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
When I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
And I click on "Star this course" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
And I reload the page
@@ -47,7 +47,7 @@ Feature: The my overview block allows users to favourite their courses
And "//li[contains(concat(' ', normalize-space(@class), ' '), 'list-group-item') and contains(.,'Course 3')]//span[@data-region='is-favourite' and @aria-hidden='true']" "xpath_element" should exist
Scenario: Star a course and switch display to summary
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
When I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
And I click on "Star this course" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
And I reload the page
@@ -24,7 +24,7 @@ Feature: The my overview block allows users to hide their courses
| student1 | C5 | student |
Scenario: Test hide toggle functionality
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "All (except removed from view)" "link" in the "Course overview" "block"
And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
@@ -33,7 +33,7 @@ Feature: The my overview block allows users to hide their courses
Then I should not see "Course 2" in the "Course overview" "block"
Scenario: Test hide toggle functionality w/ favorites
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "All (except removed from view)" "link" in the "Course overview" "block"
And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
@@ -50,7 +50,7 @@ Feature: The my overview block allows users to hide their courses
Then I should see "Course 2" in the "Course overview" "block"
Scenario: Test show toggle functionality
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "All (except removed from view)" "link" in the "Course overview" "block"
And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
@@ -65,7 +65,7 @@ Feature: The my overview block allows users to hide their courses
Then I should see "Course 2" in the "Course overview" "block"
Scenario: Test show toggle functionality w/ favorites
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "All (except removed from view)" "link" in the "Course overview" "block"
And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
@@ -87,7 +87,7 @@ Feature: The my overview block allows users to hide their courses
Then I should see "Course 2" in the "Course overview" "block"
Scenario: Test a course is hidden directly with "All (except removed from view)" courses
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "All (except removed from view)" "link" in the "Course overview" "block"
And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
@@ -98,7 +98,7 @@ Feature: The my overview block allows users to hide their courses
Given the following config values are set as admin:
| config | value | plugin |
| displaygroupingallincludinghidden | 1 | block_myoverview |
And I log in as "student1"
And I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
# We have to click on the data attribute instead of the button element text as we might risk to click on the false positive "All (except hidden)" element instead
When I click on "[data-value='allincludinghidden']" "css_element" in the "Course overview" "block"
@@ -37,7 +37,7 @@ Feature: The my overview block allows users to persistence of their page limits
| student1 | C13 | student |
Scenario: Toggle the page limit between page reloads
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
When I click on "[data-action='limit-toggle']" "css_element" in the "Course overview" "block"
And I click on "All" "link" in the ".dropdown-menu.show" "css_element"
Then I should see "Course 13"
@@ -46,7 +46,7 @@ Feature: The my overview block allows users to persistence of their page limits
And I should see "All" in the "[data-action='limit-toggle']" "css_element"
Scenario: Toggle the page limit between grouping changes
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
When I click on "[data-action='limit-toggle']" "css_element" in the "Course overview" "block"
And I click on "All" "link" in the ".dropdown-menu.show" "css_element"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
@@ -34,7 +34,7 @@ Feature: My overview block pagination
| Course 25 | C25 | 0 |
Scenario: The pagination controls should be hidden if I am not enrolled in any courses
When I log in as "student1"
When I am on the "My courses" page logged in as "student1"
Then I should see "No courses" in the "Course overview" "block"
And I should not see "Show" in the "Course overview" "block"
And ".block_myoverview .dropdown-menu.show" "css_element" should not be visible
@@ -57,7 +57,7 @@ Feature: My overview block pagination
| student1 | C10 | student |
| student1 | C11 | student |
| student1 | C12 | student |
When I log in as "student1"
When I am on the "My courses" page logged in as "student1"
Then I should not see "Show" in the "Course overview" "block"
And ".block_myoverview .dropdown-menu.show" "css_element" should not be visible
And ".block_myoverview [data-control='next']" "css_element" should not be visible
@@ -80,7 +80,7 @@ Feature: My overview block pagination
| student1 | C11 | student |
| student1 | C12 | student |
| student1 | C13 | student |
When I log in as "student1"
When I am on the "My courses" page logged in as "student1"
Then I should see "12" in the "[data-action='limit-toggle']" "css_element"
And I log out
@@ -100,7 +100,7 @@ Feature: My overview block pagination
| student1 | C11 | student |
| student1 | C12 | student |
| student1 | C13 | student |
And I log in as "student1"
And I am on the "My courses" page logged in as "student1"
When I click on "[data-action='limit-toggle']" "css_element" in the "Course overview" "block"
Then I should see "All" in the ".dropdown-menu.show" "css_element"
And I should see "12" in the ".dropdown-menu.show" "css_element"
@@ -125,7 +125,7 @@ Feature: My overview block pagination
| student1 | C11 | student |
| student1 | C12 | student |
| student1 | C13 | student |
When I log in as "student1"
When I am on the "My courses" page logged in as "student1"
Then the "class" attribute of ".block_myoverview [data-control='previous']" "css_element" should contain "disabled"
And I log out
@@ -145,7 +145,7 @@ Feature: My overview block pagination
| student1 | C11 | student |
| student1 | C12 | student |
| student1 | C13 | student |
When I log in as "student1"
When I am on the "My courses" page logged in as "student1"
And I click on "[data-control='next']" "css_element" in the "Course overview" "block"
Then the "class" attribute of ".block_myoverview [data-control='next']" "css_element" should contain "disabled"
And I log out
@@ -178,7 +178,8 @@ Feature: My overview block pagination
| student1 | C23 | student |
| student1 | C24 | student |
| student1 | C25 | student |
When I log in as "student1"
When I am on the "My courses" page logged in as "student1"
And I wait until ".block_myoverview [data-control='next']" "css_element" exists
And I click on "[data-control='next']" "css_element" in the "Course overview" "block"
Then the "class" attribute of ".block_myoverview [data-control='next']" "css_element" should not contain "disabled"
And the "class" attribute of ".block_myoverview [data-control='previous']" "css_element" should not contain "disabled"
@@ -21,7 +21,7 @@ Feature: Course overview block show users their progress on courses
| student1 | C1 | student |
Scenario: Course progress percentage should not be displayed if completion is not enabled
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "All (except removed from view)" "link" in the "Course overview" "block"
Then I should not see "0%" in the "Course overview" "block"
@@ -34,12 +34,11 @@ Feature: Course overview block show users their progress on courses
| id_completionview | 1 |
And I press "Save and return to course"
And I log out
When I log in as "student1"
When I am on the "My courses" page logged in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
Then I should see "Course 1" in the "Course overview" "block"
And I should see "0%" in the "Course overview" "block"
And I am on the "Test choice 1" "choice activity" page
And I follow "Dashboard" in the user menu
And I am on the "My courses" page
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
And I should see "100%" in the "Course overview" "block"
@@ -39,21 +39,21 @@ Feature: My overview block searching
| student1 | C13 | student |
Scenario: The search should return no courses if I am not enrolled in any
When I log in as "student2"
When I am on the "My courses" page logged in as "student1"
Then I should see "No courses" in the "Course overview" "block"
And I set the field "Search courses" to "Fake example"
And I should see "No courses" in the "Course overview" "block"
And I log out
Scenario: Single page search
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
And I set the field "Search courses" to "Course 0"
Then I should see "Course 01" in the "Course overview" "block"
And I should not see "Course 13" in the "Course overview" "block"
And I log out
Scenario: Paginated search
Given I log in as "student1"
Given I am on the "My courses" page logged in as "student1"
And I set the field "Search courses" to "Course"
And I should see "Course 01" in the "Course overview" "block"
And I should not see "Course 13" in the "Course overview" "block"
+3 -3
View File
@@ -66,15 +66,15 @@ class block_myoverview_testcase extends advanced_testcase {
$this->setUser($user);
$context = context_user::instance($user->id);
if (!$currentpage = my_get_page($user->id, MY_PAGE_PRIVATE)) {
if (!$currentpage = my_get_page($user->id, MY_PAGE_PUBLIC, MY_PAGE_COURSES)) {
throw new moodle_exception('mymoodlesetup');
}
$PAGE->set_url('/my/index.php'); // Need this because some internal API calls require the $PAGE url to be set.
$PAGE->set_url('/my/courses.php'); // Need this because some internal API calls require the $PAGE url to be set.
$PAGE->set_context($context);
$PAGE->set_pagelayout('mydashboard');
$PAGE->set_pagetype('my-index');
$PAGE->blocks->add_region('content'); // Need to add this special regition to retrieve the central blocks.
$PAGE->blocks->add_region('content'); // Need to add this special region to retrieve the central blocks.
$PAGE->set_subpage($currentpage->id);
// Load the block instances for all the regions.
+1 -1
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2021052503; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2021052504; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'block_myoverview'; // Full name of the plugin (used for diagnostics).
@@ -70,4 +70,4 @@ Feature: Add and configure blocks throughout the site
| Text block title | Foo " onload="document.getElementsByTagName('body')[0].remove()" alt=" |
| Content | Example |
When I press "Save changes"
Then I should see "Course overview"
Then I should see "Example"
+20 -4
View File
@@ -327,9 +327,14 @@ class core_block_externallib_testcase extends externallib_advanced_testcase {
// Force a setting change to check the returned blocks settings.
set_config('displaycategories', 0, 'block_myoverview');
$systempage = $DB->get_record('my_pages', array('userid' => null, 'name' => MY_PAGE_DEFAULT, 'private' => true));
// Get the expected default blocks.
$alldefaultblocksordered = $DB->get_records_menu('block_instances',
array('pagetypepattern' => 'my-index'), 'defaultregion, defaultweight ASC', 'id, blockname');
$alldefaultblocksordered = $DB->get_records_menu(
'block_instances',
array('pagetypepattern' => 'my-index', 'subpagepattern' => $systempage->id),
'defaultregion, defaultweight ASC',
'id, blockname'
);
$this->setUser($user);
@@ -368,8 +373,13 @@ class core_block_externallib_testcase extends externallib_advanced_testcase {
$user = $this->getDataGenerator()->create_user();
$PAGE->set_url('/my/index.php'); // Need this because some internal API calls require the $PAGE url to be set.
$systempage = $DB->get_record('my_pages', array('userid' => null, 'name' => MY_PAGE_DEFAULT, 'private' => true));
// Get the expected default blocks.
$alldefaultblocks = $DB->get_records_menu('block_instances', array('pagetypepattern' => 'my-index'), '', 'id, blockname');
$alldefaultblocks = $DB->get_records_menu(
'block_instances', array('pagetypepattern' => 'my-index', 'subpagepattern' => $systempage->id),
'',
'id, blockname'
);
// Now, add a sticky block.
$page = new moodle_page();
@@ -411,8 +421,14 @@ class core_block_externallib_testcase extends externallib_advanced_testcase {
$user = $this->getDataGenerator()->create_user();
$PAGE->set_url('/my/index.php'); // Need this because some internal API calls require the $PAGE url to be set.
$systempage = $DB->get_record('my_pages', array('userid' => null, 'name' => MY_PAGE_DEFAULT, 'private' => true));
// Get the expected default blocks.
$alldefaultblocks = $DB->get_records_menu('block_instances', array('pagetypepattern' => 'my-index'), '', 'id, blockname');
$alldefaultblocks = $DB->get_records_menu(
'block_instances',
array('pagetypepattern' => 'my-index', 'subpagepattern' => $systempage->id),
'',
'id, blockname'
);
// Add a custom block.
$page = new moodle_page();
@@ -38,7 +38,6 @@ Feature: We can change what we are viewing on the grader report
And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment name 1"
And I give the grade "90.00" to the user "Student 1" for the grade item "Test assignment name 2"
And I press "Save changes"
And I turn editing mode off
@javascript
Scenario: View and minimise the grader report containing hidden activities
+1
View File
@@ -858,6 +858,7 @@ $string['modsettings'] = 'Manage activities';
$string['modulesecurity'] = 'Module security';
$string['multilangforceold'] = 'Force old multilang syntax: &lt;span&gt; without the class="multilang" and &lt;lang&gt;';
$string['mustenablestats'] = 'Statistics have not yet been enabled on this site.';
$string['mycourses'] = 'My courses';
$string['mycoursesperpage'] = 'Number of courses';
$string['mydashboard'] = 'System default dashboard';
$string['mymoodle'] = 'Dashboard';
+1
View File
@@ -22,6 +22,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['coursemanagementoptions'] = 'Course management options';
$string['mymoodle'] = 'Dashboard';
$string['nocourses'] = 'No course information to show.';
$string['noguest'] = 'The Dashboard page is not available to guest users';
+1
View File
@@ -60,6 +60,7 @@ $PAGE->blocks->add_custom_regions_for_pagetype($pagetype);
$pagetype = explode('-', $pagetype);
switch ($pagetype[0]) {
case 'my':
case 'mycourses':
$PAGE->set_blocks_editing_capability('moodle/my:manageblocks');
break;
case 'user':
+26 -3
View File
@@ -2647,7 +2647,30 @@ function blocks_add_default_system_blocks() {
$subpagepattern = null;
}
$newblocks = array('timeline', 'private_files', 'badges', 'calendar_month');
$newcontent = array('myoverview');
$page->blocks->add_blocks(array(BLOCK_POS_RIGHT => $newblocks, 'content' => $newcontent), 'my-index', $subpagepattern);
if ($defaultmycoursespage = $DB->get_record('my_pages', array('userid' => null, 'name' => '__courses', 'private' => 0))) {
$mycoursesubpagepattern = $defaultmycoursespage->id;
} else {
$mycoursesubpagepattern = null;
}
$page->blocks->add_blocks([
BLOCK_POS_RIGHT => [
'private_files',
'badges',
],
'content' => [
'timeline',
'calendar_month',
]],
'my-index',
$subpagepattern
);
$page->blocks->add_blocks([
'content' => [
'myoverview'
]],
'my-index',
$mycoursesubpagepattern
);
}
+58
View File
@@ -0,0 +1,58 @@
<?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\event;
/**
* My courses viewed event class.
*
* Class for event to be triggered when a user views their My courses page.
*
* @package core
* @copyright 2021 Mathew May <mathew.solutions>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class mycourses_viewed extends base {
/**
* Init method.
*
* @return void
*/
protected function init(): void {
$this->data['crud'] = 'r';
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description(): string {
return "The user with id '$this->userid' has viewed their my courses page";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name(): string {
return get_string('eventmycoursesviewed', 'core');
}
}
+2 -2
View File
@@ -57,8 +57,8 @@ class primary extends view {
}
}
// Add a dummy mycourse link to a mycourses page.
$this->add(get_string('mycourses'), new \moodle_url('/course/index.php'), self::TYPE_ROOTNODE, null, 'courses');
// Add the mycourses link.
$this->add(get_string('mycourses'), new \moodle_url('/my/courses.php'), self::TYPE_ROOTNODE, null, 'courses');
// Add the site admin node. We are using the settingsnav so as to avoid rechecking permissions again.
$settingsnav = $this->page->settingsnav;
+7
View File
@@ -310,6 +310,13 @@ function xmldb_main_install() {
$mypage->private = 1;
$DB->insert_record('my_pages', $mypage);
$mycoursespage = new stdClass();
$mycoursespage->userid = null;
$mycoursespage->name = '__courses';
$mycoursespage->private = 0;
$mycoursespage->sortorder = 0;
$DB->insert_record('my_pages', $mycoursespage);
// Set a sensible default sort order for the most-used question types.
set_config('multichoice_sortorder', 1, 'question');
set_config('truefalse_sortorder', 2, 'question');
+11
View File
@@ -3145,5 +3145,16 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2021110800.03);
}
if ($oldversion < 2021111700.00) {
$mycoursespage = new stdClass();
$mycoursespage->userid = null;
$mycoursespage->name = '__courses';
$mycoursespage->private = 0;
$mycoursespage->sortorder = 0;
$DB->insert_record('my_pages', $mycoursespage);
upgrade_main_savepoint(true, 2021111700.00);
}
return true;
}
+12 -2
View File
@@ -1328,7 +1328,14 @@ class global_navigation extends navigation_node {
$this->rootnodes['site'] = $this->add_course($SITE);
$this->rootnodes['myprofile'] = $this->add(get_string('profile'), null, self::TYPE_USER, null, 'myprofile');
$this->rootnodes['currentcourse'] = $this->add(get_string('currentcourse'), null, self::TYPE_ROOTNODE, null, 'currentcourse');
$this->rootnodes['mycourses'] = $this->add(get_string('mycourses'), null, self::TYPE_ROOTNODE, null, 'mycourses', new pix_icon('i/course', ''));
$this->rootnodes['mycourses'] = $this->add(
get_string('mycourses'),
new moodle_url('/my/courses.php'),
self::TYPE_ROOTNODE,
null,
'mycourses',
new pix_icon('i/course', '')
);
$this->rootnodes['courses'] = $this->add(get_string('courses'), new moodle_url('/course/index.php'), self::TYPE_ROOTNODE, null, 'courses');
if (!core_course_category::user_top()) {
$this->rootnodes['courses']->hide();
@@ -1521,7 +1528,7 @@ class global_navigation extends navigation_node {
foreach ($this->rootnodes as $node) {
// Dont remove the home node
/** @var navigation_node $node */
if (!in_array($node->key, ['home', 'myhome']) && !$node->has_children() && !$node->isactive) {
if (!in_array($node->key, ['home', 'mycourses', 'myhome']) && !$node->has_children() && !$node->isactive) {
$node->remove();
}
}
@@ -2880,6 +2887,9 @@ class global_navigation extends navigation_node {
// This required as there are not other guaranteed nodes that may be loaded.
$coursenode->add('frontpageloaded', null, self::TYPE_CUSTOM, null, 'frontpageloaded')->display = false;
// Add My courses to the site pages within the navigation structure so the block can read it.
$coursenode->add(get_string('mycourses'), new moodle_url('/my/courses.php'), self::TYPE_CUSTOM, null, 'mycourses');
// Participants.
if ($navoptions->participants) {
$coursenode->add(get_string('participants'), new moodle_url('/user/index.php?id='.$course->id), self::TYPE_CUSTOM, get_string('participants'), 'participants');
+2 -1
View File
@@ -4372,7 +4372,8 @@ EOD;
$pagetype = $this->page->pagetype;
$homepage = get_home_page();
$homepagetype = null;
if ($homepage == HOMEPAGE_MY) {
// Add a special case since /my/courses is a part of the /my subsystem.
if ($homepage == HOMEPAGE_MY && $this->page->title !== get_string('mycourses')) {
$homepagetype = 'my-index';
} else if ($homepage == HOMEPAGE_SITE) {
$homepagetype = 'site-index';
+3
View File
@@ -717,6 +717,9 @@ class behat_navigation extends behat_base {
case 'Homepage':
return new moodle_url('/');
case 'My courses':
return new moodle_url('/my/courses.php');
case 'Admin notifications':
return new moodle_url('/admin/');
+86
View File
@@ -0,0 +1,86 @@
<?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/>.
/**
* My Courses.
*
* - each user can currently have their own page (cloned from system and then customised)
* - only the user can see their own dashboard
* - users can add any blocks they want
*
* @package core
* @subpackage my
* @copyright 2021 Mathew May <mathew.solutions>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(__DIR__ . '/../config.php');
require_once($CFG->dirroot . '/my/lib.php');
redirect_if_major_upgrade_required();
require_login();
$hassiteconfig = has_capability('moodle/site:config', context_system::instance());
if ($hassiteconfig && moodle_needs_upgrading()) {
redirect(new moodle_url('/admin/index.php'));
}
$context = context_system::instance();
// Get the My Moodle page info. Should always return something unless the database is broken.
if (!$currentpage = my_get_page(null, MY_PAGE_PUBLIC, MY_PAGE_COURSES)) {
throw new Exception('mymoodlesetup');
}
// Start setting up the page.
$PAGE->set_context($context);
$PAGE->set_url('/my/courses.php');
$PAGE->add_body_classes(['limitedwidth', 'page-mycourses']);
$PAGE->set_pagelayout('mycourses');
$PAGE->has_secondary_navigation_setter(false);
$PAGE->set_pagetype('my-index');
$PAGE->set_subpage($currentpage->id);
$PAGE->set_title(get_string('mycourses'));
$PAGE->set_heading(get_string('mycourses'));
// Force the add block out of the default area.
$PAGE->theme->addblockposition = BLOCK_ADDBLOCK_POSITION_CUSTOM;
// Add course management if the user has the capabilities for it.
$coursecat = core_course_category::user_top();
if ($coursecat->can_create_course() || $coursecat->has_manage_capability()) {
$data = [
'newcourseurl' => new moodle_url('/course/edit.php', ['category' => $coursecat->id]),
'manageurl' => new moodle_url('/course/management.php', ['categoryid' => $coursecat->id]),
];
$PAGE->add_header_action($OUTPUT->render_from_template('my/dropdown', $data));
}
echo $OUTPUT->header();
if (core_userfeedback::should_display_reminder()) {
core_userfeedback::print_reminder_block();
}
echo $OUTPUT->custom_block_region('content');
echo $OUTPUT->footer();
// Trigger dashboard has been viewed event.
$eventparams = array('context' => $context);
$event = \core\event\mycourses_viewed::create($eventparams);
$event->trigger();
+64 -16
View File
@@ -29,41 +29,70 @@
define('MY_PAGE_PUBLIC', 0);
define('MY_PAGE_PRIVATE', 1);
define('MY_PAGE_DEFAULT', '__default');
define('MY_PAGE_COURSES', '__courses');
require_once("$CFG->libdir/blocklib.php");
/*
/**
* For a given user, this returns the $page information for their My Moodle page
*
* @param int|null $userid the id of the user whose page should be retrieved
* @param int|null $private either MY_PAGE_PRIVATE or MY_PAGE_PUBLIC
* @param string|null $pagename Differentiate between standard /my or /courses pages.
*/
function my_get_page($userid, $private=MY_PAGE_PRIVATE) {
function my_get_page(?int $userid, int $private = MY_PAGE_PRIVATE, string $pagename = MY_PAGE_DEFAULT) {
global $DB, $CFG;
if (empty($CFG->forcedefaultmymoodle) && $userid) { // Ignore custom My Moodle pages if admin has forced them
// Does the user have their own page defined? If so, return it.
if ($customised = $DB->get_record('my_pages', array('userid' => $userid, 'private' => $private))) {
if ($customised = $DB->get_record(
'my_pages',
array('userid' => $userid, 'private' => $private, 'name' => $pagename),
'*',
IGNORE_MULTIPLE
)) {
return $customised;
}
}
// Otherwise return the system default page
return $DB->get_record('my_pages', array('userid' => null, 'name' => '__default', 'private' => $private));
return $DB->get_record('my_pages', array('userid' => null, 'name' => $pagename, 'private' => $private), '*', IGNORE_MULTIPLE);
}
/*
/**
* This copies a system default page to the current user
*
* @param int $userid the id of the user whose page should be reset
* @param int $private either MY_PAGE_PRIVATE or MY_PAGE_PUBLIC
* @param string $pagetype either my-index or user-profile
* @param string $pagename Differentiate between standard /my or /courses pages.
*/
function my_copy_page($userid, $private=MY_PAGE_PRIVATE, $pagetype='my-index') {
function my_copy_page(
int $userid,
int $private = MY_PAGE_PRIVATE,
string $pagetype = 'my-index',
string $pagename = MY_PAGE_DEFAULT
) {
global $DB;
if ($customised = $DB->get_record('my_pages', array('userid' => $userid, 'private' => $private))) {
if ($customised = $DB->get_record(
'my_pages',
array('userid' => $userid, 'name' => $pagename, 'private' => $private),
'*',
IGNORE_MULTIPLE
)) {
return $customised; // We're done!
}
// Get the system default page
if (!$systempage = $DB->get_record('my_pages', array('userid' => null, 'name' => '__default', 'private' => $private))) {
if (!$systempage = $DB->get_record(
'my_pages',
array('userid' => null, 'name' => $pagename, 'private' => $private),
'*',
IGNORE_MULTIPLE
)) {
return false; // error
}
@@ -117,18 +146,24 @@ function my_copy_page($userid, $private=MY_PAGE_PRIVATE, $pagetype='my-index') {
return $page;
}
/*
/**
* For a given user, this deletes their My Moodle page and returns them to the system default.
*
* @param int $userid the id of the user whose page should be reset
* @param int $private either MY_PAGE_PRIVATE or MY_PAGE_PUBLIC
* @param string $pagetype either my-index or user-profile
* @param string $pagename Differentiate between standard /my or /courses pages.
* @return mixed system page, or false on error
*/
function my_reset_page($userid, $private=MY_PAGE_PRIVATE, $pagetype='my-index') {
function my_reset_page(
int $userid,
int $private = MY_PAGE_PRIVATE,
string $pagetype='my-index',
string $pagename = MY_PAGE_DEFAULT
) {
global $DB, $CFG;
$page = my_get_page($userid, $private);
$page = my_get_page($userid, $private, $pagename);
if ($page->userid == $userid) {
$context = context_user::instance($userid);
if ($blocks = $DB->get_records('block_instances', array('parentcontextid' => $context->id,
@@ -140,11 +175,16 @@ function my_reset_page($userid, $private=MY_PAGE_PRIVATE, $pagetype='my-index')
}
}
$DB->delete_records('block_positions', ['subpage' => $page->id, 'pagetype' => $pagetype, 'contextid' => $context->id]);
$DB->delete_records('my_pages', array('id' => $page->id));
$DB->delete_records('my_pages', array('id' => $page->id, 'name' => $pagename));
}
// Get the system default page
if (!$systempage = $DB->get_record('my_pages', array('userid' => null, 'name' => '__default', 'private' => $private))) {
if (!$systempage = $DB->get_record(
'my_pages',
array('userid' => null, 'name' => $pagename, 'private' => $private),
'*',
IGNORE_MULTIPLE
)) {
return false; // error
}
@@ -166,10 +206,16 @@ function my_reset_page($userid, $private=MY_PAGE_PRIVATE, $pagetype='my-index')
*
* @param int $private Either MY_PAGE_PRIVATE or MY_PAGE_PUBLIC.
* @param string $pagetype Either my-index or user-profile.
* @param progress_bar $progressbar A progress bar to update.
* @param progress_bar|null $progressbar A progress bar to update.
* @param string $pagename Differentiate between standard /my or /courses pages.
* @return void
*/
function my_reset_page_for_all_users($private = MY_PAGE_PRIVATE, $pagetype = 'my-index', $progressbar = null) {
function my_reset_page_for_all_users(
int $private = MY_PAGE_PRIVATE,
string $pagetype = 'my-index',
?progress_bar $progressbar = null,
string $pagename = MY_PAGE_DEFAULT
) {
global $DB;
// This may take a while. Raise the execution time limit.
@@ -199,12 +245,14 @@ function my_reset_page_for_all_users($private = MY_PAGE_PRIVATE, $pagetype = 'my
AND bi.pagetypepattern = :pagetypepattern
AND (bi.subpagepattern IS NULL OR bi.subpagepattern = " . $DB->sql_concat("''", 'p.id') . ")
WHERE p.private = :private
AND p.name = :name
AND p.userid $infragment";
$params = array_merge([
'private' => $private,
'usercontextlevel' => CONTEXT_USER,
'pagetypepattern' => $pagetype
'pagetypepattern' => $pagetype,
'name' => $pagename
], $inparams);
$blockids = $DB->get_fieldset_sql($sql, $params);
+37
View File
@@ -0,0 +1,37 @@
{{!
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 my/dropdown
Simple dropdown for the my/courses page
Example context (json):
{
"newcourseurl": "https://moodle.test/course/edit.php?category=1",
"manageurl": "https://moodle.test/course/management.php?categoryid=1"
}
}}
<div class="btn-group">
<!-- Set as a link to appease Goutte behat. -->
<a href="#" class="btn btn-link btn-icon icon-size-3" 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">
<a class="dropdown-item" href="{{newcourseurl}}">{{#str}}newcourse, core{{/str}}</a>
<a class="dropdown-item" href="{{manageurl}}">{{#str}}managecourses, core{{/str}}</a>
</div>
</div>
+13
View File
@@ -0,0 +1,13 @@
@core @core_my
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
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 should see "Course and category management"
+4
View File
@@ -0,0 +1,4 @@
This files describes changes in the my system.
=== 4.0 ===
* Introduce a new /courses page
* Tighten up the typing within the lib file
+2 -3
View File
@@ -64,10 +64,9 @@ class boostnavbar implements \renderable {
// Set the designated one path for courses.
$mycoursesnode = $this->get_item('mycourses');
if (!is_null($mycoursesnode)) {
// TODO: Once MDL-70801 lands point this to the new page.
$url = new \moodle_url('/course/');
$url = new \moodle_url('/my/courses.php');
$mycoursesnode->action = $url;
$mycoursesnode->text = get_string('courses');
$mycoursesnode->text = get_string('mycourses');
}
$this->remove_no_link_items();
+6
View File
@@ -78,6 +78,12 @@ $THEME->layouts = [
'regions' => array('side-pre'),
'defaultregion' => 'side-pre',
),
// My courses page.
'mycourses' => array(
'file' => 'columns2.php',
'regions' => array('content'),
'defaultregion' => 'content',
),
// My dashboard page.
'mydashboard' => array(
'file' => 'columns2.php',
+1
View File
@@ -49,6 +49,7 @@ $string['rawscss_desc'] = 'Use this field to provide SCSS or CSS code which will
$string['rawscsspre'] = 'Raw initial SCSS';
$string['rawscsspre_desc'] = 'In this field you can provide initialising SCSS code, it will be injected before everything else. Most of the time you will use this setting to define variables.';
$string['region-side-pre'] = 'Right';
$string['region-content'] = 'Content';
$string['showfooter'] = 'Show footer';
$string['privacy:metadata:preference:draweropennav'] = 'The user\'s preference for hiding or showing the drawer menu navigation.';
$string['privacy:drawernavclosed'] = 'The current preference for the navigation drawer is closed.';
+10
View File
@@ -2875,3 +2875,13 @@ body.dragging {
}
}
}
.page-mycourses {
#region-main {
padding: 0;
}
#region-main,
.block_myoverview {
border: 0;
}
}
+7
View File
@@ -12211,6 +12211,13 @@ body.dragging .dragging {
.collapse-list .collapse-list-item-content .collapse-list-item {
padding-left: calc(1rem * 3); }
.page-mycourses #region-main {
padding: 0; }
.page-mycourses #region-main,
.page-mycourses .block_myoverview {
border: 0; }
.icon {
font-size: 16px;
width: 16px;
+6
View File
@@ -72,6 +72,12 @@ $THEME->layouts = [
'regions' => array('side-pre'),
'defaultregion' => 'side-pre',
),
// My courses page.
'mycourses' => array(
'file' => 'columns.php',
'regions' => array('content'),
'defaultregion' => 'content',
),
// My dashboard page.
'mydashboard' => array(
'file' => 'columns.php',
+7
View File
@@ -12211,6 +12211,13 @@ body.dragging .dragging {
.collapse-list .collapse-list-item-content .collapse-list-item {
padding-left: calc(1rem * 3); }
.page-mycourses #region-main {
padding: 0; }
.page-mycourses #region-main,
.page-mycourses .block_myoverview {
border: 0; }
.icon {
font-size: 16px;
width: 16px;
@@ -43,7 +43,8 @@ class behat_theme_classic_behat_course extends behat_course {
public function i_navigate_to_course_participants() {
$coursestr = behat_context_helper::escape(get_string('courses'));
$mycoursestr = behat_context_helper::escape(get_string('mycourses'));
$xpath = "//div[contains(@class,'block')]//li[p/*[string(.)=$coursestr or string(.)=$mycoursestr]]";
$xpath = "//div[contains(@class,'block')]//li[contains(@class,'contains_branch')]" .
"[p/*[string(.)=$coursestr or string(.)=$mycoursestr]]";
$this->execute('behat_general::i_click_on_in_the', [get_string('participants'), 'link', $xpath, 'xpath_element']);
}
+1 -1
View File
@@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2021111600.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2021111700.00; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.
$release = '4.0dev+ (Build: 20211116)'; // Human-friendly version name