Files

56 lines
2.1 KiB
PHP

<?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/>.
/**
* List all MeetLet instances in a course.
*
* @package mod_meetletacbfree
* @copyright 2026 MeetLet
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../../config.php');
$id = required_param('id', PARAM_INT);
$course = $DB->get_record('course', ['id' => $id], '*', MUST_EXIST);
require_course_login($course);
\mod_meetletacbfree\registration\manager::require_registered();
$PAGE->set_url('/mod/meetletacbfree/index.php', ['id' => $id]);
$PAGE->set_title(get_string('modulenameplural', 'meetletacbfree'));
$PAGE->set_heading($course->fullname);
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('modulenameplural', 'meetletacbfree'));
if (!$instances = get_all_instances_in_course('meetletacbfree', $course)) {
notice(get_string('thereareno', 'moodle', get_string('modulenameplural', 'meetletacbfree')),
new moodle_url('/course/view.php', ['id' => $course->id]));
echo $OUTPUT->footer();
die();
}
$table = new html_table();
$table->head = [get_string('meetingname', 'meetletacbfree'), get_string('starttime', 'meetletacbfree')];
foreach ($instances as $instance) {
$url = new moodle_url('/mod/meetletacbfree/view.php', ['id' => $instance->coursemodule]);
$table->data[] = [
html_writer::link($url, format_string($instance->name)),
$instance->starttime ? userdate($instance->starttime) : '-',
];
}
echo html_writer::table($table);
echo $OUTPUT->footer();