Skip to content

Commit 839cb63

Browse files
authored
Merge pull request #1408 from sarjona/activity-index
[MDL-83887] Update information for mod/pluginname/index.php
2 parents c1d8ab5 + 43d00a6 commit 839cb63

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
<!-- markdownlint-disable first-line-heading -->
22
The `index.php` should be used to list all instances of an activity that the current user has access to in the specified course.
3+
4+
The [`activityoverviewbase`](../courseoverview.md) class provides a static method to redirect the `mod/PLUGINNAME/index.php` page to the **Activities** page. This method should be called in the `index.php` file of the activity plugin.

docs/apis/plugintypes/mod/_files/index-php.tsx

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,9 @@ import DefaultDescription from './index-php.mdx';
2121

2222
const defaultExample = `require_once('../../config.php');
2323
24-
// The \`id\` parameter is the course id.
25-
$id = required_param('id', PARAM_INT);
24+
$courseid = required_param('id', PARAM_INT);
2625
27-
// Fetch the requested course.
28-
$course = $DB->get_record('course', ['id'=> $id], '*', MUST_EXIST);
29-
30-
// Require that the user is logged into the course.
31-
require_course_login($course);
32-
33-
$modinfo = get_fast_modinfo($course);
34-
35-
foreach ($modinfo->get_instances_of('[modinfo]') as $instanceid => $cm) {
36-
// Display information about your activity.
37-
}
26+
\core_courseformat\activityoverviewbase::redirect_to_overview_page($courseid, '[modname]');
3827
`;
3928

4029
export default (initialProps: Props): ComponentFileSummary => (

0 commit comments

Comments
 (0)