Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/apis/plugintypes/mod/_files/index-php.mdx
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
<!-- markdownlint-disable first-line-heading -->
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.
15 changes: 2 additions & 13 deletions docs/apis/plugintypes/mod/_files/index-php.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 => (
Expand Down