MDL-83887 blocks: Remove activity_modules block

This commit is contained in:
Sara Arjona
2025-08-08 08:00:54 +02:00
parent 621c6e1048
commit 4885314a19
40 changed files with 77 additions and 583 deletions
@@ -0,0 +1,5 @@
issueNumber: MDL-83887
notes:
core_block:
- message: Removed block_activity_modules from Moodle 5.1.
type: removed
+4 -4
View File
@@ -286,17 +286,17 @@ $CFG->admin = 'admin';
//
// These variables define DEFAULT block variables for new courses
// If this one is set it overrides all others and is the only one used.
// $CFG->defaultblocks_override = 'activity_modules,search_forums,course_list:news_items,calendar_upcoming,recent_activity';
// $CFG->defaultblocks_override = 'search_forums,course_list:news_items,calendar_upcoming,recent_activity';
//
// These variables define the specific settings for defined course formats.
// They override any settings defined in the formats own config file.
// $CFG->defaultblocks_site = 'site_main_menu,course_list:course_summary,calendar_month';
// $CFG->defaultblocks_social = 'search_forums,calendar_month,calendar_upcoming,social_activities,recent_activity,course_list';
// $CFG->defaultblocks_topics = 'activity_modules,search_forums,course_list:news_items,calendar_upcoming,recent_activity';
// $CFG->defaultblocks_weeks = 'activity_modules,search_forums,course_list:news_items,calendar_upcoming,recent_activity';
// $CFG->defaultblocks_topics = 'search_forums,course_list:news_items,calendar_upcoming,recent_activity';
// $CFG->defaultblocks_weeks = 'search_forums,course_list:news_items,calendar_upcoming,recent_activity';
//
// These blocks are used when no other default setting is found.
// $CFG->defaultblocks = 'activity_modules,search_forums,course_list:news_items,calendar_upcoming,recent_activity';
// $CFG->defaultblocks = 'search_forums,course_list:news_items,calendar_upcoming,recent_activity';
//
// You can specify a different class to be created for the $PAGE global, and to
// compute which blocks appear on each page. However, I cannot think of any good
+1 -1
View File
@@ -45,7 +45,6 @@
],
"block": [
"accessreview",
"activity_modules",
"activity_results",
"admin_bookmarks",
"badges",
@@ -585,6 +584,7 @@
"radius"
],
"block": [
"activity_modules",
"community",
"course_overview",
"messages",
+2 -4
View File
@@ -204,12 +204,11 @@ class helper {
static::add_plugin($presetid, 'availability', 'grouping', false);
static::add_plugin($presetid, 'availability', 'profile', false);
// Blocks: Hide Activities, Blog menu, Blog tags, Comments, Course completion status, Courses, Flickr,
// Blocks: Hide Blog menu, Blog tags, Comments, Course completion status, Courses, Flickr,
// Global search, Latest badges, Learning plans, Logged in user, Login, Main menu, Mentees, Online users,
// Private files, Recent blog entries, Recently accessed courses, Search forums, Section links, Social activities,
// Starred courses, Tags, YouTube.
// Hidden by default: Course/site summary, RSS feeds, Self completion, Feedback.
static::add_plugin($presetid, 'block', 'activity_modules', false);
static::add_plugin($presetid, 'block', 'blog_menu', false);
static::add_plugin($presetid, 'block', 'blog_tags', false);
static::add_plugin($presetid, 'block', 'comments', false);
@@ -307,12 +306,11 @@ class helper {
static::add_plugin($presetid, 'availability', 'grouping', true);
static::add_plugin($presetid, 'availability', 'profile', true);
// Blocks: Enable Activities, Blog menu, Blog tags, Comments, Course completion status, Courses, Flickr,
// Blocks: Enable Blog menu, Blog tags, Comments, Course completion status, Courses, Flickr,
// Global search, Latest badges, Learning plans, Logged in user, Login, Main menu, Mentees, Online users,
// Private files, Recent blog entries, Recently accessed courses, Search forums, Section links, Social activities,
// Starred courses, Tags, YouTube.
// Hidden by default: Course/site summary, RSS feeds, Self completion, Feedback.
static::add_plugin($presetid, 'block', 'activity_modules', true);
static::add_plugin($presetid, 'block', 'blog_menu', true);
static::add_plugin($presetid, 'block', 'blog_tags', true);
static::add_plugin($presetid, 'block', 'comments', true);
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<PRESET>
<NAME>Imported preset</NAME>
<COMMENTS>&lt;p dir="ltr" style="text-align:left;"&gt;Porfolios enabled, Emojipicker enabled, Lesson media width set to 900 and maxanswers set to 2 and disabled advanced. Plugins: disabled block_html, mod_database and mod_page plugins and enabled atto_html, block_activity_modules and mod_lesson.&lt;/p&gt;</COMMENTS>
<COMMENTS>&lt;p dir="ltr" style="text-align:left;"&gt;Porfolios enabled, Emojipicker enabled, Lesson media width set to 900 and maxanswers set to 2 and disabled advanced. Plugins: disabled block_html, mod_database and mod_page plugins and enabled atto_html, block_comments and mod_lesson.&lt;/p&gt;</COMMENTS>
<PRESET_DATE>1631615985</PRESET_DATE>
<SITE_URL>http://demo.moodle</SITE_URL>
<AUTHOR>Ada Lovelace</AUTHOR>
@@ -27,7 +27,7 @@
</ATTO>
<BLOCK>
<HTML>0</HTML>
<ACTIVITY_MODULES>1</ACTIVITY_MODULES>
<COMMENTS>1</COMMENTS>
</BLOCK>
<MOD>
<PAGE>0</PAGE>
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<PRESET>
<NAME>Starter</NAME>
<COMMENTS>&lt;p dir="ltr" style="text-align:left;"&gt;Badges disabled, Emojipicker enabled, Lesson media width set to 900 and maxanswers set to 2 and disabled advanced. Plugins: disabled block_html, mod_database and mod_page plugins and enabled atto_html and block_activity_modules.&lt;/p&gt;</COMMENTS>
<COMMENTS>&lt;p dir="ltr" style="text-align:left;"&gt;Badges disabled, Emojipicker enabled, Lesson media width set to 900 and maxanswers set to 2 and disabled advanced. Plugins: disabled block_html, mod_database and mod_page plugins and enabled atto_html and block_comments.&lt;/p&gt;</COMMENTS>
<PRESET_DATE>1631615985</PRESET_DATE>
<SITE_URL>http://demo.moodle</SITE_URL>
<AUTHOR>Ada Lovelace</AUTHOR>
@@ -27,7 +27,7 @@
</ATTO>
<BLOCK>
<HTML>0</HTML>
<ACTIVITY_MODULES>1</ACTIVITY_MODULES>
<COMMENTS>1</COMMENTS>
</BLOCK>
<MOD>
<PAGE>0</PAGE>
+1 -1
View File
@@ -506,7 +506,7 @@ final class manager_test extends \advanced_testcase {
],
'block' => [
'html' => 0,
'activity_modules' => 1,
'comments' => 1,
],
'mod' => [
'page' => 0,
@@ -25,12 +25,12 @@ Feature: An administrator can manage Block plugins
Then I should see "Latest badges block instances are protected."
And "Protect instances of Latest badges" "link" should not exist
But "Unprotect instances of Latest badges" "link" should exist
And "Protect instances of Activities" "link" should exist
And "Protect instances of Comments" "link" should exist
When I click on "Unprotect instances of Latest badges" "link"
Then I should see "Latest badges block instances are unprotected."
And "Unprotect instances of Activities" "link" should not exist
And "Unprotect instances of Comments" "link" should not exist
But "Protect instances of Latest badges" "link" should exist
And "Protect instances of Activities" "link" should exist
And "Protect instances of Comments" "link" should exist
Scenario: An administrator can control the protected state of block plugins without JavaScript
Given I am logged in as "admin"
@@ -39,9 +39,9 @@ Feature: An administrator can manage Block plugins
Then I should see "Latest badges block instances are protected."
And "Protect instances of Latest badges" "link" should not exist
But "Unprotect instances of Latest badges" "link" should exist
And "Protect instances of Activities" "link" should exist
And "Protect instances of Comments" "link" should exist
When I click on "Unprotect instances of Latest badges" "link"
Then I should see "Latest badges block instances are unprotected."
And "Unprotect instances of Activities" "link" should not exist
And "Unprotect instances of Comments" "link" should not exist
But "Protect instances of Latest badges" "link" should exist
And "Protect instances of Activities" "link" should exist
And "Protect instances of Comments" "link" should exist
@@ -10,7 +10,7 @@ Feature: I can apply presets
Then I should not see "Setting changes"
Scenario: Applying Starter Moodle preset changes status and settings
# Checking the settings before applying Full Moodle preset (we're only testing one of each type).
# Checking the settings before applying Starter Moodle preset (we're only testing one of each type).
Given I navigate to "Plugins > Activity modules > Manage activities" in site administration
And I should see "Disable Database"
And I navigate to "Plugins > Availability restrictions > Manage restrictions" in site administration
@@ -24,10 +24,9 @@ Feature: I can apply presets
And I navigate to "Plugins > Question types > Manage question types" in site administration
And "Enabled" "icon" should exist in the "Calculated multichoice" "table_row"
When I navigate to "Site admin presets" in site administration
And I press "Review settings and apply" action in the "Starter" report row
And I press "Review settings and apply" action in the "Moodle with all of the most popular features" report row
And I should see "Setting changes"
# Checking all the settings to be applied for the Starter (if will help to identify possible regressions).
And I should see "Activities" in the "Setting changes" "table"
And I should see "Adaptive mode (no penalties)" in the "Setting changes" "table"
And I should see "Blog menu" in the "Setting changes" "table"
And I should see "Blog tags" in the "Setting changes" "table"
@@ -117,11 +116,11 @@ Feature: I can apply presets
Scenario: Re-applying Starter Moodle preset does not display setting changes
# Apply Starter preset.
Given I navigate to "Site admin presets" in site administration
When I press "Review settings and apply" action in the "Starter" report row
When I press "Review settings and apply" action in the "Moodle with all of the most popular features" report row
And I click on "Apply" "button"
And I click on "Continue" "button"
# When the Starter preset it's applied again, no changes should be displayed.
And I press "Review settings and apply" action in the "Starter" report row
And I press "Review settings and apply" action in the "Moodle with all of the most popular features" report row
Then I should not see "Setting changes"
Scenario: Applied exported settings
@@ -155,7 +155,7 @@ final class import_test extends \advanced_testcase {
],
'block' => [
'html' => 0,
'activity_modules' => 1,
'comments' => 1,
],
'mod' => [
'page' => 0,
-1
View File
@@ -525,7 +525,6 @@ class api {
$availableblocks = core_plugin_manager::instance()->get_plugins_of_type('block');
$courseblocks = array();
$appsupportedblocks = array(
'activity_modules' => 'CoreBlockDelegate_AddonBlockActivityModules',
'activity_results' => 'CoreBlockDelegate_AddonBlockActivityResults',
'site_main_menu' => 'CoreBlockDelegate_AddonBlockSiteMainMenu',
'myoverview' => 'CoreBlockDelegate_AddonBlockMyOverview',
+1 -1
View File
@@ -384,7 +384,7 @@ class cc2moodle {
if (isset($CFG->defaultblocks)) {
$blocknames = $CFG->defaultblocks;
} else {
$blocknames = 'activity_modules,search_forums,course_list:news_items,calendar_upcoming,recent_activity';
$blocknames = 'search_forums,course_list:news_items,calendar_upcoming,recent_activity';
}
}
@@ -1365,20 +1365,6 @@
<ROLES_ASSIGNMENTS>
</ROLES_ASSIGNMENTS>
</BLOCK>
<BLOCK>
<ID>8</ID>
<NAME>activity_modules</NAME>
<PAGEID>2</PAGEID>
<PAGETYPE>course-view</PAGETYPE>
<POSITION>l</POSITION>
<WEIGHT>1</WEIGHT>
<VISIBLE>1</VISIBLE>
<CONFIGDATA>Tjs=</CONFIGDATA>
<ROLES_OVERRIDES>
</ROLES_OVERRIDES>
<ROLES_ASSIGNMENTS>
</ROLES_ASSIGNMENTS>
</BLOCK>
<BLOCK>
<ID>9</ID>
<NAME>search_forums</NAME>
@@ -101,20 +101,6 @@
<ROLES_ASSIGNMENTS>
</ROLES_ASSIGNMENTS>
</BLOCK>
<BLOCK>
<ID>315</ID>
<NAME>activity_modules</NAME>
<PAGEID>33</PAGEID>
<PAGETYPE>course-view</PAGETYPE>
<POSITION>l</POSITION>
<WEIGHT>1</WEIGHT>
<VISIBLE>1</VISIBLE>
<CONFIGDATA>Tjs=</CONFIGDATA>
<ROLES_OVERRIDES>
</ROLES_OVERRIDES>
<ROLES_ASSIGNMENTS>
</ROLES_ASSIGNMENTS>
</BLOCK>
<BLOCK>
<ID>316</ID>
<NAME>search_forums</NAME>
@@ -109,20 +109,6 @@
<ROLES_ASSIGNMENTS>
</ROLES_ASSIGNMENTS>
</BLOCK>
<BLOCK>
<ID>40</ID>
<NAME>activity_modules</NAME>
<PAGEID>6</PAGEID>
<PAGETYPE>course-view</PAGETYPE>
<POSITION>l</POSITION>
<WEIGHT>1</WEIGHT>
<VISIBLE>1</VISIBLE>
<CONFIGDATA>Tjs=</CONFIGDATA>
<ROLES_OVERRIDES>
</ROLES_OVERRIDES>
<ROLES_ASSIGNMENTS>
</ROLES_ASSIGNMENTS>
</BLOCK>
<BLOCK>
<ID>41</ID>
<NAME>search_forums</NAME>
@@ -21,9 +21,9 @@ Feature: Restore Moodle 2 course backups
| forum | C5 | 0005 | Test forum name | | 1 | |
| url | C5 | url5 | Test URL name | Test URL description | 3 | http://www.moodle.org |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| activity_modules | Course | C1 | course-view-* | side-pre |
| activity_modules | Course | C5 | course-view-* | side-pre |
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| comments | Course | C1 | course-view-* | side-pre |
| comments | Course | C5 | course-view-* | side-pre |
And the following config values are set as admin:
| enableasyncbackup | 0 |
And I log in as "admin"
@@ -35,7 +35,7 @@ Feature: Restore Moodle 2 course backups
| Confirmation | Filename | test_backup.mbz |
And I restore "test_backup.mbz" backup into "Course 2" course using this options:
Then I should see "Course 2"
And I should see "Activities" in the "Activities" "block"
And I should see "Comments" in the "Comments" "block"
And I should see "Test forum name"
@javascript
@@ -45,7 +45,7 @@ Feature: Restore Moodle 2 course backups
And I restore "test_backup.mbz" backup into a new course using this options:
| Schema | Course name | Course 1 restored in a new course |
Then I should see "Course 1 restored in a new course"
And I should see "Activities" in the "Activities" "block"
And I should see "Comments" in the "Comments" "block"
And I should see "Test forum name"
And I should see "Section 15"
And I should not see "Section 16"
@@ -80,7 +80,7 @@ Feature: Restore Moodle 2 course backups
Then I should see "Course 1"
And I should not see "Section 3"
And I should not see "Test forum post backup name"
And I should see "Activities" in the "Activities" "block"
And I should see "Comments" in the "Comments" "block"
And I should see "Test forum name"
@javascript
@@ -1,106 +0,0 @@
<?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/>.
/**
* This file contains the Activity modules block.
*
* @package block_activity_modules
* @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir . '/filelib.php');
class block_activity_modules extends block_list {
function init() {
$this->title = get_string('pluginname', 'block_activity_modules');
}
function get_content() {
global $CFG, $DB, $OUTPUT;
if($this->content !== NULL) {
return $this->content;
}
$this->content = new stdClass;
$this->content->items = array();
$this->content->icons = array();
$this->content->footer = '';
$course = $this->page->course;
require_once($CFG->dirroot.'/course/lib.php');
$modinfo = get_fast_modinfo($course);
$modfullnames = array();
$archetypes = array();
foreach($modinfo->cms as $cm) {
// Exclude activities that aren't visible or have no view link (e.g. label). Account for folder being displayed inline.
if (!$cm->uservisible || (!$cm->has_view() && strcmp($cm->modname, 'folder') !== 0)) {
continue;
}
if (array_key_exists($cm->modname, $modfullnames)) {
continue;
}
if (!array_key_exists($cm->modname, $archetypes)) {
$archetypes[$cm->modname] = plugin_supports('mod', $cm->modname, FEATURE_MOD_ARCHETYPE, MOD_ARCHETYPE_OTHER);
}
if ($archetypes[$cm->modname] == MOD_ARCHETYPE_RESOURCE) {
if (!array_key_exists('resources', $modfullnames)) {
$modfullnames['resources'] = get_string('resources');
}
} else {
$modfullnames[$cm->modname] = $cm->modplural;
}
}
core_collator::asort($modfullnames);
foreach ($modfullnames as $modname => $modfullname) {
if ($modname === 'resources') {
$icon = $OUTPUT->pix_icon('monologo', '', 'mod_page', array('class' => 'icon'));
$this->content->items[] = '<a href="'.$CFG->wwwroot.'/course/resources.php?id='.$course->id.'">'.$icon.$modfullname.'</a>';
} else {
$icon = $OUTPUT->image_icon('monologo', get_string('pluginname', $modname), $modname);
$this->content->items[] = '<a href="'.$CFG->wwwroot.'/mod/'.$modname.'/index.php?id='.$course->id.'">'.$icon.$modfullname.'</a>';
}
}
return $this->content;
}
/**
* Returns the role that best describes this blocks contents.
*
* This returns 'navigation' as the blocks contents is a list of links to activities and resources.
*
* @return string 'navigation'
*/
public function get_aria_role() {
return 'navigation';
}
function applicable_formats() {
return array('all' => true, 'mod' => false, 'my' => false, 'admin' => false,
'tag' => false);
}
}
@@ -1,46 +0,0 @@
<?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/>.
/**
* Privacy Subsystem implementation for block_activity_modules.
*
* @package block_activity_modules
* @copyright 2018 Zig Tan <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace block_activity_modules\privacy;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for block_activity_modules implementing null_provider.
*
* @copyright 2018 Zig Tan <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason(): string {
return 'privacy:metadata';
}
}
@@ -1,41 +0,0 @@
<?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/>.
/**
* Activity modules block caps.
*
* @package block_activity_modules
* @copyright Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$capabilities = array(
'block/activity_modules:addinstance' => array(
'riskbitmask' => RISK_SPAM | RISK_XSS,
'captype' => 'write',
'contextlevel' => CONTEXT_BLOCK,
'archetypes' => array(
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/site:manageblocks'
),
);
@@ -1,27 +0,0 @@
<?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/>.
/**
* Strings for component 'block_activity_modules', language 'en', branch 'MOODLE_20_STABLE'
*
* @package block_activity_modules
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['activity_modules:addinstance'] = 'Add a new activities block';
$string['pluginname'] = 'Activities';
$string['privacy:metadata'] = 'The Activities block only shows data stored in other locations.';
@@ -1,149 +0,0 @@
@block @block_activity_modules
Feature: Block activity modules
In order to overview activity modules in a course
As a manager
I can add activities block in a course or on the frontpage
Scenario: Add activities block on the frontpage
Given the following "activities" exist:
| activity | name | intro | course | idnumber |
| assign | Frontpage assignment name | Frontpage assignment description | Acceptance test site | assign0 |
| book | Frontpage book name | Frontpage book description | Acceptance test site | book0 |
| choice | Frontpage choice name | Frontpage choice description | Acceptance test site | choice0 |
| data | Frontpage database name | Frontpage database description | Acceptance test site | data0 |
| feedback | Frontpage feedback name | Frontpage feedback description | Acceptance test site | feedback0 |
| forum | Frontpage forum name | Frontpage forum description | Acceptance test site | forum0 |
| label | Frontpage label name | Frontpage label description | Acceptance test site | label0 |
| lti | Frontpage lti name | Frontpage lti description | Acceptance test site | lti0 |
| page | Frontpage page name | Frontpage page description | Acceptance test site | page0 |
| quiz | Frontpage quiz name | Frontpage quiz description | Acceptance test site | quiz0 |
| resource | Frontpage resource name | Frontpage resource description | Acceptance test site | resource0 |
| imscp | Frontpage imscp name | Frontpage imscp description | Acceptance test site | imscp0 |
| folder | Frontpage folder name | Frontpage folder description | Acceptance test site | folder0 |
| glossary | Frontpage glossary name | Frontpage glossary description | Acceptance test site | glossary0 |
| scorm | Frontpage scorm name | Frontpage scorm description | Acceptance test site | scorm0 |
| lesson | Frontpage lesson name | Frontpage lesson description | Acceptance test site | lesson0 |
| url | Frontpage url name | Frontpage url description | Acceptance test site | url0 |
| wiki | Frontpage wiki name | Frontpage wiki description | Acceptance test site | wiki0 |
| workshop | Frontpage workshop name | Frontpage workshop description | Acceptance test site | workshop0 |
When I log in as "admin"
And I am on site homepage
And I turn editing mode on
And I add the "Activities" block
And I click on "Assignments" "link" in the "Activities" "block"
Then I should see "Frontpage assignment name"
And I am on site homepage
And I click on "Choices" "link" in the "Activities" "block"
And I should see "Frontpage choice name"
And I am on site homepage
And I click on "Databases" "link" in the "Activities" "block"
And I should see "Frontpage database name"
And I am on site homepage
And I click on "Feedback" "link" in the "Activities" "block"
And I should see "Frontpage feedback name"
And I am on site homepage
And I click on "Forums" "link" in the "Activities" "block"
And I should see "Frontpage forum name"
And I am on site homepage
And I click on "External tools" "link" in the "Activities" "block"
And I should see "Frontpage lti name"
And I am on site homepage
And I click on "Quizzes" "link" in the "Activities" "block"
And I should see "Frontpage quiz name"
And I am on site homepage
And I click on "Glossaries" "link" in the "Activities" "block"
And I should see "Frontpage glossary name"
And I am on site homepage
And I click on "SCORM packages" "link" in the "Activities" "block"
And I should see "Frontpage scorm name"
And I am on site homepage
And I click on "Lessons" "link" in the "Activities" "block"
And I should see "Frontpage lesson name"
And I am on site homepage
And I click on "Wikis" "link" in the "Activities" "block"
And I should see "Frontpage wiki name"
And I am on site homepage
And I click on "Workshop" "link" in the "Activities" "block"
And I should see "Frontpage workshop name"
And I am on site homepage
And I click on "Resources" "link" in the "Activities" "block"
And I should see "Frontpage book name"
And I should see "Frontpage page name"
And I should see "Frontpage resource name"
And I should see "Frontpage imscp name"
And I should see "Frontpage folder name"
And I should see "Frontpage url name"
Scenario: Add activities block in a course
Given the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
And the following "activities" exist:
| activity | name | intro | course | idnumber |
| assign | Test assignment name | Test assignment description | C1 | assign1 |
| book | Test book name | Test book description | C1 | book1 |
| choice | Test choice name | Test choice description | C1 | choice1 |
| data | Test database name | Test database description | C1 | data1 |
| feedback | Test feedback name | Test feedback description | C1 | feedback1 |
| folder | Test folder name | Test folder description | C1 | folder1 |
| forum | Test forum name | Test forum description | C1 | forum1 |
| glossary | Test glossary name | Test glossary description | C1 | glossary1 |
| imscp | Test imscp name | Test imscp description | C1 | imscp1 |
| label | Test label name | Test label description | C1 | label1 |
| lesson | Test lesson name | Test lesson description | C1 | lesson1 |
| lti | Test lti name | Test lti description | C1 | lti1 |
| page | Test page name | Test page description | C1 | page1 |
| quiz | Test quiz name | Test quiz description | C1 | quiz1 |
| resource | Test resource name | Test resource description | C1 | resource1 |
| scorm | Test scorm name | Test scorm description | C1 | scorm1 |
| url | Test url name | Test url description | C1 | url1 |
| wiki | Test wiki name | Test wiki description | C1 | wiki1 |
| workshop | Test workshop name | Test workshop description | C1 | workshop1 |
When I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add the "Activities" block
And I click on "Assignments" "link" in the "Activities" "block"
Then I should see "Test assignment name"
And I am on "Course 1" course homepage
And I click on "Choices" "link" in the "Activities" "block"
And I should see "Test choice name"
And I am on "Course 1" course homepage
And I click on "Databases" "link" in the "Activities" "block"
And I should see "Test database name"
And I am on "Course 1" course homepage
And I click on "Feedback" "link" in the "Activities" "block"
And I should see "Test feedback name"
And I am on "Course 1" course homepage
And I click on "Forums" "link" in the "Activities" "block"
And I should see "Test forum name"
And I am on "Course 1" course homepage
And I click on "External tools" "link" in the "Activities" "block"
And I should see "Test lti name"
And I am on "Course 1" course homepage
And I click on "Quizzes" "link" in the "Activities" "block"
And I should see "Test quiz name"
And I am on "Course 1" course homepage
And I click on "Glossaries" "link" in the "Activities" "block"
And I should see "Test glossary name"
And I am on "Course 1" course homepage
And I click on "SCORM packages" "link" in the "Activities" "block"
And I should see "Test scorm name"
And I am on "Course 1" course homepage
And I click on "Lessons" "link" in the "Activities" "block"
And I should see "Test lesson name"
And I am on "Course 1" course homepage
And I click on "Wikis" "link" in the "Activities" "block"
And I should see "Test wiki name"
And I am on "Course 1" course homepage
And I click on "Workshop" "link" in the "Activities" "block"
And I should see "Test workshop name"
And I am on "Course 1" course homepage
And I click on "Resources" "link" in the "Activities" "block"
And I should see "Test book name"
And I should see "Test page name"
And I should see "Test resource name"
And I should see "Test imscp name"
And I should see "Test folder name"
And I should see "Test url name"
@@ -1,29 +0,0 @@
<?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/>.
/**
* Version details
*
* @package block_activity_modules
* @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2025041400; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2025040800; // Requires this Moodle version.
$plugin->component = 'block_activity_modules'; // Full name of the plugin (used for diagnostics)
@@ -19,14 +19,14 @@ Feature: Allowed blocks controls
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
When I add the "Course completion status" block
And I add the "Activities" block
Then I should see "Activities" in the "Activities" "block"
And I add the "Comments" block
Then I should see "Comments" in the "Comments" "block"
And I should see "Course completion status" in the "Course completion status" "block"
Scenario: Blocks can not be added when the admin restricts the permissions
Given the following "role capability" exists:
| role | editingteacher |
| block/activity_modules:addinstance | prohibit |
| block/comments:addinstance | prohibit |
And I log in as "admin"
And I am on the "Course 1" "permissions" page
And I override the system permissions of "Teacher" role with:
@@ -34,5 +34,5 @@ Feature: Allowed blocks controls
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
Then the add block selector should not contain "Activities" block
Then the add block selector should not contain "Comments" block
And the add block selector should not contain "Course completion status" block
@@ -15,7 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Privacy Subsystem implementation for block_activity_modules.
* Privacy Subsystem implementation for calendartype_gregorian.
*
* @package calendartype_gregorian
* @copyright 2018 Andrew Nicols <[email protected]>
@@ -59,7 +59,7 @@ class get_overview_information extends external_api {
* @param int $courseid The course ID.
* @param string $modname The module name.
* @return stdClass The overview information.
* @throws \moodle_exception if the course ID is invalid or the module name is not found.
* @throws \moodle_exception if the course ID is invalid or home site, or the module name is not found.
*/
public static function execute(int $courseid, string $modname): stdClass {
[
@@ -71,6 +71,9 @@ class get_overview_information extends external_api {
]);
// Validate course ID.
if ($courseid == SITEID) {
throw new \moodle_exception('The site home course overview page is not supported.');
}
$course = get_course($courseid);
if (!$course) {
throw new \moodle_exception('invalidcourseid', 'error', '', $courseid);
@@ -126,6 +126,18 @@ final class get_overview_information_test extends \externallib_advanced_testcase
}
}
/**
* Test that the overview information returns an exception for the site home course.
*/
public function test_get_overview_information_site(): void {
$this->resetAfterTest();
$this->expectException(\moodle_exception::class);
$this->expectExceptionMessage('The site home course overview page is not supported.');
get_overview_information::execute(SITEID, 'assign');
}
/**
* Helper function to find an item by its key in an array of items.
*
+4
View File
@@ -35,6 +35,10 @@ $PAGE->set_url('/course/overview.php', ['id' => $courseid]);
$course = get_course($courseid);
if ($course->id == SITEID) {
// As site home is not a real course, we do not support the overview page.
throw new moodle_exception('The site home course overview page is not supported.');
}
$context = context_course::instance($course->id, MUST_EXIST);
require_login($course);
+13
View File
@@ -1996,5 +1996,18 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2025073100.01);
}
if ($oldversion < 2025080700.01) {
// Remove activity_modules block.
if (!file_exists($CFG->dirroot . "/blocks/activity_modules/version.php")) {
uninstall_plugin('block', 'activity_modules');
// Delete all the admin preset plugin references to activity_modules.
$DB->delete_records('adminpresets_plug', ['plugin' => 'block', 'name' => 'activity_modules']);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2025080700.01);
}
return true;
}
+1 -1
View File
@@ -738,7 +738,7 @@ EOF;
'Null' => [null, false],
'Not set' => [false, false],
'Fake' => ['_fake', true],
'Real block' => ['activity_modules', false],
'Real block' => ['comments', false],
];
}
@@ -290,14 +290,9 @@ Feature: Group assignment submissions
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student's first submission |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| activity_modules | Course | C1 | course-view-* | side-pre |
And I am on the "C1" Course page logged in as student1
And I click on "Assignments" "link" in the "Activities" "block"
And I am on the "C1" "course > activities > assign" page logged in as "student1"
And I should see "Submitted for grading"
And I am on the "C1" Course page logged in as student2
And I click on "Assignments" "link" in the "Activities" "block"
And I am on the "C1" "course > activities > assign" page logged in as "student2"
And I should see "Submitted for grading"
And I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "Submissions" in current page administration
@@ -174,14 +174,3 @@ Feature: Testing overview integration in mod_assign
And I should see "-" in the "Date assign" "table_row"
And I should see "-" in the "No submissions" "table_row"
And I should see "50.00" in the "Pending grades" "table_row"
Scenario: The assign index redirect to the activities overview
When I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add the "Activities" block
And I click on "Assignments" "link" in the "Activities" "block"
Then I should see "An overview of all activities in the course"
And I should see "Name" in the "assign_overview_collapsible" "region"
And I should see "Due date" in the "assign_overview_collapsible" "region"
And I should see "Submissions" in the "assign_overview_collapsible" "region"
And I should see "Actions" in the "assign_overview_collapsible" "region"
@@ -83,12 +83,3 @@ Feature: Testing overview integration in mod_choice
And I should not see "Allow more than one choice to be selected"
And I should see "Option Z: 0"
And I press the escape key
Scenario: The choice index redirect to the activities overview
When I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add the "Activities" block
And I click on "Choices" "link" in the "Activities" "block"
Then I should see "An overview of all activities in the course"
And I should see "Name" in the "choice_overview_collapsible" "region"
And I should see "Due date" in the "choice_overview_collapsible" "region"
@@ -121,13 +121,3 @@ Feature: Testing overview integration in database activity
# Check the Approve link.
And I click on "Approve" "link" in the "data_overview_collapsible" "region"
And I should see "Pending approval"
Scenario: The database activity index redirect to the activities overview
When I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add the "Activities" block
And I click on "Database" "link" in the "Activities" "block"
Then I should see "An overview of all activities in the course"
And I should see "Name" in the "data_overview_collapsible" "region"
And I should see "Due date" in the "data_overview_collapsible" "region"
And I should see "Actions" in the "data_overview_collapsible" "region"
@@ -105,13 +105,3 @@ Feature: Testing overview integration in mod_forum
And I click on "input[data-type=forum-track-toggle]" "css_element" in the "Unread posts" "table_row"
And I follow "Unread posts"
And I navigate to "Don't track unread posts" in current page administration
Scenario: The forum index redirect to the activities overview
When I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add the "Activities" block
And I click on "Forums" "link" in the "Activities" "block"
Then I should see "An overview of all activities in the course"
And I should see "Name" in the "forum_overview_collapsible" "region"
And I should see "Discussions" in the "forum_overview_collapsible" "region"
And I should see "Posts" in the "forum_overview_collapsible" "region"
@@ -80,14 +80,3 @@ Feature: Testing overview integration in mod_glossary
And I click on "Get these logs" "button"
Then I should see "Course activities overview page viewed"
And I should see "viewed the instance list for the module 'glossary'"
Scenario: The glossary index redirect to the activities overview
Given the following "activity" exists:
| activity | glossary |
| course | Acceptance test site |
| name | Home glossary |
And I log in as "admin"
When I visit "/mod/glossary/index.php?id=1"
Then the following should exist in the "Table listing all Glossary activities" table:
| Name | Entries | Actions |
| Home glossary | 0 | View |
@@ -94,13 +94,3 @@ Feature: Testing overview integration in H5P activity
# Check the View link.
And I click on "View" "link" in the "H5P activity" "table_row"
And I should see "Attempts (5)"
Scenario: The H5P activity index redirect to the activities overview
Given I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add the "Activities" block
When I click on "H5P" "link" in the "Activities" "block"
Then I should see "An overview of all activities in the course"
And I should see "Name" in the "h5pactivity_overview_collapsible" "region"
And I should see "H5P type" in the "h5pactivity_overview_collapsible" "region"
And I should see "Actions" in the "h5pactivity_overview_collapsible" "region"
@@ -82,17 +82,6 @@ Feature: Testing overview_report in mod_lesson
| Lesson 1 | Tomorrow |
| Lesson 2 | - |
Scenario: The lesson index redirect to the activities overview
When I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add the "Activities" block
And I click on "Lessons" "link" in the "Activities" "block"
Then I should see "An overview of all activities in the course, with dates and other information."
And I should see "Name" in the "lesson_overview_collapsible" "region"
And I should see "Students who attempted" in the "lesson_overview_collapsible" "region"
And I should see "Total attempts" in the "lesson_overview_collapsible" "region"
And I should see "Actions" in the "lesson_overview_collapsible" "region"
Scenario: The lesson overview report should generate log events
Given I am on the "Course 1" "course > activities > lesson" page logged in as "teacher1"
When I am on the "Course 1" "course" page logged in as "teacher1"
@@ -79,14 +79,3 @@ Feature: Testing overview integration in mod_wiki
And I am on the "Course 1" "course > activities > wiki" page
And I click on "View" "link" in the "Collaborative wiki empty" "table_row"
And I should not see "Page list"
Scenario: The wiki index redirect to the activities overview
When I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add the "Activities" block
And I click on "Wikis" "link" in the "Activities" "block"
Then I should see "An overview of all activities in the course"
And I should see "Name" in the "wiki_overview_collapsible" "region"
And I should see "Wiki mode" in the "wiki_overview_collapsible" "region"
And I should see "Entries" in the "wiki_overview_collapsible" "region"
And I should see "Actions" in the "wiki_overview_collapsible" "region"
@@ -131,14 +131,3 @@ In order to summarize the workshops
And I am on the "Course 1" "course > activities > workshop" page
And I click on "View" "link" in the "Activity 2" "table_row"
And I should see "Workshop submissions report"
Scenario: The workshop index redirect to the activities overview
Given the following "activity" exists:
| activity | workshop |
| course | Acceptance test site |
| name | Home workshop |
And I log in as "admin"
When I visit "/mod/workshop/index.php?id=1"
Then the following should exist in the "Table listing all Workshop activities" table:
| Name | Phase | Submissions | Assessments | Actions |
| Home workshop | Setup phase | - | - | View |
+1 -1
View File
@@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2025080700.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2025080700.01; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.
$release = '5.1dev (Build: 20250807)'; // Human-friendly version name