Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1441 ariadna 1
<?php
2
// This file is part of Moodle - https://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <https://www.gnu.org/licenses/>.
16
 
17
/**
18
 * Prints an instance of mod_subsection.
19
 *
20
 * @package     mod_subsection
21
 * @copyright   2023 Amaia Anabitarte <amaia@moodle.com>
22
 * @license     https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 */
24
 
25
use mod_subsection\manager;
26
use core_courseformat\formatactions;
27
 
28
require(__DIR__.'/../../config.php');
29
require_once(__DIR__.'/lib.php');
30
 
31
// Course module id.
32
$id = required_param('id', PARAM_INT);
33
$cm = get_coursemodule_from_id('subsection', $id, 0, false, MUST_EXIST);
34
$manager = manager::create_from_coursemodule($cm);
35
$course = $DB->get_record('course', ['id' => $cm->course], '*', MUST_EXIST);
36
$moduleinstance = $manager->get_instance();
37
 
38
require_login($course, true, $cm);
39
 
40
$modulecontext = $manager->get_context();
41
$manager->set_module_viewed($course);
42
$delegatesection = $manager->get_delegated_section_info();
43
 
44
redirect(new moodle_url('/course/section.php', ['id' => $delegatesection->id]));