From 43d00a697f77dc346406f52b243eb0982d7524b6 Mon Sep 17 00:00:00 2001 From: Sara Arjona Date: Thu, 24 Jul 2025 16:38:36 +0200 Subject: [PATCH] [docs] Update information for mod/pluginname/index.php --- docs/apis/plugintypes/mod/_files/index-php.mdx | 2 ++ docs/apis/plugintypes/mod/_files/index-php.tsx | 15 ++------------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/docs/apis/plugintypes/mod/_files/index-php.mdx b/docs/apis/plugintypes/mod/_files/index-php.mdx index 1ab22546c..b65d23bcb 100644 --- a/docs/apis/plugintypes/mod/_files/index-php.mdx +++ b/docs/apis/plugintypes/mod/_files/index-php.mdx @@ -1,2 +1,4 @@ The `index.php` should be used to list all instances of an activity that the current user has access to in the specified course. + +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. diff --git a/docs/apis/plugintypes/mod/_files/index-php.tsx b/docs/apis/plugintypes/mod/_files/index-php.tsx index caebf44fb..16c5a8746 100644 --- a/docs/apis/plugintypes/mod/_files/index-php.tsx +++ b/docs/apis/plugintypes/mod/_files/index-php.tsx @@ -21,20 +21,9 @@ import DefaultDescription from './index-php.mdx'; const defaultExample = `require_once('../../config.php'); -// The \`id\` parameter is the course id. -$id = required_param('id', PARAM_INT); +$courseid = required_param('id', PARAM_INT); -// Fetch the requested course. -$course = $DB->get_record('course', ['id'=> $id], '*', MUST_EXIST); - -// Require that the user is logged into the course. -require_course_login($course); - -$modinfo = get_fast_modinfo($course); - -foreach ($modinfo->get_instances_of('[modinfo]') as $instanceid => $cm) { - // Display information about your activity. -} +\core_courseformat\activityoverviewbase::redirect_to_overview_page($courseid, '[modname]'); `; export default (initialProps: Props): ComponentFileSummary => (