Kumi
87e610d313
Introduced the foundational elements for the exp360 module, including: - Added access control capabilities - Implemented index page for course instances - Created add, update, and delete functions for instances - Updated plugin version These changes establish the module's core functionality and prepare it for further development and integration.
33 lines
1,019 B
PHP
33 lines
1,019 B
PHP
<?php
|
|
|
|
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
|
|
require_once(dirname(__FILE__) . '/lib.php');
|
|
|
|
$id = optional_param('id', 0, PARAM_INT);
|
|
|
|
if ($id) {
|
|
$course = $DB->get_record('course', array('id' => $id), '*', MUST_EXIST);
|
|
} else {
|
|
print_error('You must specify a course ID');
|
|
}
|
|
|
|
require_login($course);
|
|
|
|
$PAGE->set_url('/mod/exp360/index.php', array('id' => $id));
|
|
$PAGE->set_title($course->shortname);
|
|
$PAGE->set_heading($course->fullname);
|
|
$PAGE->set_context(context_course::instance($course->id));
|
|
|
|
echo $OUTPUT->header();
|
|
echo $OUTPUT->heading(get_string('modulenameplural', 'exp360'));
|
|
|
|
if (!$exp360s = get_all_instances_in_course('exp360', $course)) {
|
|
notice(get_string('noexp360s', 'exp360'), new moodle_url('/course/view.php', array('id' => $course->id)));
|
|
}
|
|
|
|
foreach ($exp360s as $exp360) {
|
|
$url = new moodle_url('/mod/exp360/view.php', array('id' => $exp360->coursemodule));
|
|
echo html_writer::link($url, format_string($exp360->name));
|
|
}
|
|
|
|
echo $OUTPUT->footer();
|