| 1 | efrain | 1 | <?php
 | 
        
           |  |  | 2 |   | 
        
           |  |  | 3 | // This file is part of Moodle - http://moodle.org/
 | 
        
           |  |  | 4 | //
 | 
        
           |  |  | 5 | // Moodle is free software: you can redistribute it and/or modify
 | 
        
           |  |  | 6 | // it under the terms of the GNU General Public License as published by
 | 
        
           |  |  | 7 | // the Free Software Foundation, either version 3 of the License, or
 | 
        
           |  |  | 8 | // (at your option) any later version.
 | 
        
           |  |  | 9 | //
 | 
        
           |  |  | 10 | // Moodle is distributed in the hope that it will be useful,
 | 
        
           |  |  | 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
        
           |  |  | 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
        
           |  |  | 13 | // GNU General Public License for more details.
 | 
        
           |  |  | 14 | //
 | 
        
           |  |  | 15 | // You should have received a copy of the GNU General Public License
 | 
        
           |  |  | 16 | // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 | 
        
           |  |  | 17 |   | 
        
           |  |  | 18 | /**
 | 
        
           |  |  | 19 |  * Moves, adds, updates, duplicates or deletes modules in a course
 | 
        
           |  |  | 20 |  *
 | 
        
           |  |  | 21 |  * @copyright 1999 Martin Dougiamas  http://dougiamas.com
 | 
        
           |  |  | 22 |  * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 | 
        
           |  |  | 23 |  * @package course
 | 
        
           |  |  | 24 |  */
 | 
        
           |  |  | 25 |   | 
        
           |  |  | 26 | require("../config.php");
 | 
        
           |  |  | 27 | require_once("lib.php");
 | 
        
           |  |  | 28 |   | 
        
           |  |  | 29 | $sectionreturn = optional_param('sr', null, PARAM_INT);
 | 
        
           |  |  | 30 | $add           = optional_param('add', '', PARAM_ALPHANUM);
 | 
        
           |  |  | 31 | $type          = optional_param('type', '', PARAM_ALPHA);
 | 
        
           |  |  | 32 | $indent        = optional_param('indent', 0, PARAM_INT);
 | 
        
           |  |  | 33 | $update        = optional_param('update', 0, PARAM_INT);
 | 
        
           |  |  | 34 | $duplicate     = optional_param('duplicate', 0, PARAM_INT);
 | 
        
           |  |  | 35 | $hide          = optional_param('hide', 0, PARAM_INT);
 | 
        
           |  |  | 36 | $stealth       = optional_param('stealth', 0, PARAM_INT);
 | 
        
           |  |  | 37 | $show          = optional_param('show', 0, PARAM_INT);
 | 
        
           |  |  | 38 | $copy          = optional_param('copy', 0, PARAM_INT);
 | 
        
           |  |  | 39 | $moveto        = optional_param('moveto', 0, PARAM_INT);
 | 
        
           |  |  | 40 | $movetosection = optional_param('movetosection', 0, PARAM_INT);
 | 
        
           |  |  | 41 | $delete        = optional_param('delete', 0, PARAM_INT);
 | 
        
           |  |  | 42 | $course        = optional_param('course', 0, PARAM_INT);
 | 
        
           |  |  | 43 | $groupmode     = optional_param('groupmode', -1, PARAM_INT);
 | 
        
           |  |  | 44 | $cancelcopy    = optional_param('cancelcopy', 0, PARAM_BOOL);
 | 
        
           |  |  | 45 | $confirm       = optional_param('confirm', 0, PARAM_BOOL);
 | 
        
           |  |  | 46 |   | 
        
           |  |  | 47 | // This page should always redirect
 | 
        
           |  |  | 48 | $url = new moodle_url('/course/mod.php');
 | 
        
           |  |  | 49 | foreach (compact('indent','update','hide','show','copy','moveto','movetosection','delete','course','cancelcopy','confirm') as $key=>$value) {
 | 
        
           |  |  | 50 |     if ($value !== 0) {
 | 
        
           |  |  | 51 |         $url->param($key, $value);
 | 
        
           |  |  | 52 |     }
 | 
        
           |  |  | 53 | }
 | 
        
           |  |  | 54 | // Force it to be null if it's not a valid section number.
 | 
        
           |  |  | 55 | if ($sectionreturn < 0) {
 | 
        
           |  |  | 56 |     $sectionreturn = null;
 | 
        
           |  |  | 57 | }
 | 
        
           |  |  | 58 | $urloptions = [];
 | 
        
           |  |  | 59 | if (!is_null($sectionreturn)) {
 | 
        
           |  |  | 60 |     $url->param('sr', $sectionreturn);
 | 
        
           |  |  | 61 |     $urloptions['sr'] = $sectionreturn;
 | 
        
           |  |  | 62 | }
 | 
        
           |  |  | 63 | if ($add !== '') {
 | 
        
           |  |  | 64 |     $url->param('add', $add);
 | 
        
           |  |  | 65 | }
 | 
        
           |  |  | 66 | if ($type !== '') {
 | 
        
           |  |  | 67 |     $url->param('type', $type);
 | 
        
           |  |  | 68 | }
 | 
        
           |  |  | 69 | if ($groupmode !== '') {
 | 
        
           |  |  | 70 |     $url->param('groupmode', $groupmode);
 | 
        
           |  |  | 71 | }
 | 
        
           |  |  | 72 | $PAGE->set_url($url);
 | 
        
           |  |  | 73 |   | 
        
           |  |  | 74 | require_login();
 | 
        
           |  |  | 75 |   | 
        
           |  |  | 76 | //check if we are adding / editing a module that has new forms using formslib
 | 
        
           |  |  | 77 | if (!empty($add)) {
 | 
        
           |  |  | 78 |     $id          = required_param('id', PARAM_INT);
 | 
        
           |  |  | 79 |     $section     = required_param('section', PARAM_INT);
 | 
        
           |  |  | 80 |     $type        = optional_param('type', '', PARAM_ALPHA);
 | 
        
           |  |  | 81 |     $returntomod = optional_param('return', 0, PARAM_BOOL);
 | 
        
           |  |  | 82 |     $beforemod   = optional_param('beforemod', 0, PARAM_INT);
 | 
        
           |  |  | 83 |   | 
        
           |  |  | 84 |     $params = [
 | 
        
           |  |  | 85 |         'add' => $add,
 | 
        
           |  |  | 86 |         'type' => $type,
 | 
        
           |  |  | 87 |         'course' => $id,
 | 
        
           |  |  | 88 |         'section' => $section,
 | 
        
           |  |  | 89 |         'return' => $returntomod,
 | 
        
           |  |  | 90 |         'beforemod' => $beforemod,
 | 
        
           |  |  | 91 |     ];
 | 
        
           |  |  | 92 |     if (!is_null($sectionreturn)) {
 | 
        
           |  |  | 93 |         $params['sr'] = $sectionreturn;
 | 
        
           |  |  | 94 |     }
 | 
        
           |  |  | 95 |   | 
        
           |  |  | 96 |     redirect(
 | 
        
           |  |  | 97 |         new moodle_url(
 | 
        
           |  |  | 98 |             '/course/modedit.php',
 | 
        
           |  |  | 99 |             $params,
 | 
        
           |  |  | 100 |         )
 | 
        
           |  |  | 101 |     );
 | 
        
           |  |  | 102 |   | 
        
           |  |  | 103 | } else if (!empty($update)) {
 | 
        
           |  |  | 104 |     $cm = get_coursemodule_from_id('', $update, 0, true, MUST_EXIST);
 | 
        
           |  |  | 105 |     $returntomod = optional_param('return', 0, PARAM_BOOL);
 | 
        
           |  |  | 106 |   | 
        
           |  |  | 107 |     $params = [
 | 
        
           |  |  | 108 |         'update' => $update,
 | 
        
           |  |  | 109 |         'return' => $returntomod,
 | 
        
           |  |  | 110 |     ];
 | 
        
           |  |  | 111 |     if (!is_null($sectionreturn)) {
 | 
        
           |  |  | 112 |         $params['sr'] = $sectionreturn;
 | 
        
           |  |  | 113 |     }
 | 
        
           |  |  | 114 |     redirect(
 | 
        
           |  |  | 115 |         new moodle_url(
 | 
        
           |  |  | 116 |             '/course/modedit.php',
 | 
        
           |  |  | 117 |             $params,
 | 
        
           |  |  | 118 |         )
 | 
        
           |  |  | 119 |     );
 | 
        
           |  |  | 120 | } else if (!empty($duplicate) and confirm_sesskey()) {
 | 
        
           |  |  | 121 |      $cm     = get_coursemodule_from_id('', $duplicate, 0, true, MUST_EXIST);
 | 
        
           |  |  | 122 |      $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
 | 
        
           |  |  | 123 |   | 
        
           |  |  | 124 |     require_login($course, false, $cm);
 | 
        
           |  |  | 125 |     $modcontext = context_module::instance($cm->id);
 | 
        
           |  |  | 126 |     require_capability('moodle/course:manageactivities', $modcontext);
 | 
        
           |  |  | 127 |   | 
        
           |  |  | 128 |     // Duplicate the module.
 | 
        
           |  |  | 129 |     $newcm = duplicate_module($course, $cm);
 | 
        
           |  |  | 130 |     redirect(course_get_url($course, $cm->sectionnum, $urloptions));
 | 
        
           |  |  | 131 |   | 
        
           |  |  | 132 | } else if (!empty($delete)) {
 | 
        
           |  |  | 133 |     $cm     = get_coursemodule_from_id('', $delete, 0, true, MUST_EXIST);
 | 
        
           |  |  | 134 |     $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
 | 
        
           |  |  | 135 |   | 
        
           |  |  | 136 |     require_login($course, false, $cm);
 | 
        
           |  |  | 137 |     $modcontext = context_module::instance($cm->id);
 | 
        
           |  |  | 138 |     require_capability('moodle/course:manageactivities', $modcontext);
 | 
        
           |  |  | 139 |   | 
        
           |  |  | 140 |     $return = course_get_url($course, $cm->sectionnum, $urloptions);
 | 
        
           |  |  | 141 |   | 
        
           |  |  | 142 |     if (!$confirm or !confirm_sesskey()) {
 | 
        
           |  |  | 143 |         $fullmodulename = get_string('modulename', $cm->modname);
 | 
        
           |  |  | 144 |   | 
        
           |  |  | 145 |         $optionsyes = [
 | 
        
           |  |  | 146 |             'confirm' => 1,
 | 
        
           |  |  | 147 |             'delete' => $cm->id,
 | 
        
           |  |  | 148 |             'sesskey' => sesskey(),
 | 
        
           |  |  | 149 |         ];
 | 
        
           |  |  | 150 |         if (!is_null($sectionreturn)) {
 | 
        
           |  |  | 151 |             $optionsyes['sr'] = $sectionreturn;
 | 
        
           |  |  | 152 |         }
 | 
        
           |  |  | 153 |         $strdeletecheck = get_string('deletecheck', '', $fullmodulename);
 | 
        
           |  |  | 154 |         $strparams = (object)array('type' => $fullmodulename, 'name' => $cm->name);
 | 
        
           |  |  | 155 |         $strdeletechecktypename = get_string('deletechecktypename', '', $strparams);
 | 
        
           |  |  | 156 |   | 
        
           |  |  | 157 |         $PAGE->set_pagetype('mod-' . $cm->modname . '-delete');
 | 
        
           |  |  | 158 |         $PAGE->set_title($strdeletecheck);
 | 
        
           |  |  | 159 |         $PAGE->set_heading($course->fullname);
 | 
        
           |  |  | 160 |         $PAGE->navbar->add($strdeletecheck);
 | 
        
           |  |  | 161 |   | 
        
           |  |  | 162 |         echo $OUTPUT->header();
 | 
        
           |  |  | 163 |         echo $OUTPUT->box_start('noticebox');
 | 
        
           |  |  | 164 |         $formcontinue = new single_button(new moodle_url("$CFG->wwwroot/course/mod.php", $optionsyes), get_string('yes'));
 | 
        
           |  |  | 165 |         $formcancel = new single_button($return, get_string('no'), 'get');
 | 
        
           |  |  | 166 |         echo $OUTPUT->confirm($strdeletechecktypename, $formcontinue, $formcancel);
 | 
        
           |  |  | 167 |         echo $OUTPUT->box_end();
 | 
        
           |  |  | 168 |         echo $OUTPUT->footer();
 | 
        
           |  |  | 169 |   | 
        
           |  |  | 170 |         exit;
 | 
        
           |  |  | 171 |     }
 | 
        
           |  |  | 172 |   | 
        
           |  |  | 173 |     // Delete the module.
 | 
        
           |  |  | 174 |     course_delete_module($cm->id);
 | 
        
           |  |  | 175 |   | 
        
           |  |  | 176 |     redirect($return);
 | 
        
           |  |  | 177 | }
 | 
        
           |  |  | 178 |   | 
        
           |  |  | 179 |   | 
        
           |  |  | 180 | if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
 | 
        
           |  |  | 181 |     $cm     = get_coursemodule_from_id('', $USER->activitycopy, 0, true, MUST_EXIST);
 | 
        
           |  |  | 182 |     $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
 | 
        
           |  |  | 183 |   | 
        
           |  |  | 184 |     require_login($course, false, $cm);
 | 
        
           |  |  | 185 |     $coursecontext = context_course::instance($course->id);
 | 
        
           |  |  | 186 |     $modcontext = context_module::instance($cm->id);
 | 
        
           |  |  | 187 |     require_capability('moodle/course:manageactivities', $modcontext);
 | 
        
           |  |  | 188 |   | 
        
           |  |  | 189 |     if (!empty($movetosection)) {
 | 
        
           |  |  | 190 |         if (!$section = $DB->get_record('course_sections', array('id'=>$movetosection, 'course'=>$cm->course))) {
 | 
        
           |  |  | 191 |             throw new \moodle_exception('sectionnotexist');
 | 
        
           |  |  | 192 |         }
 | 
        
           |  |  | 193 |         $beforecm = NULL;
 | 
        
           |  |  | 194 |   | 
        
           |  |  | 195 |     } else {                      // normal moveto
 | 
        
           |  |  | 196 |         if (!$beforecm = get_coursemodule_from_id('', $moveto, $cm->course, true)) {
 | 
        
           |  |  | 197 |             throw new \moodle_exception('invalidcoursemodule');
 | 
        
           |  |  | 198 |         }
 | 
        
           |  |  | 199 |         if (!$section = $DB->get_record('course_sections', array('id'=>$beforecm->section, 'course'=>$cm->course))) {
 | 
        
           |  |  | 200 |             throw new \moodle_exception('sectionnotexist');
 | 
        
           |  |  | 201 |         }
 | 
        
           |  |  | 202 |     }
 | 
        
           |  |  | 203 |   | 
        
           |  |  | 204 |     if (!ismoving($section->course)) {
 | 
        
           |  |  | 205 |         throw new \moodle_exception('needcopy', '', "view.php?id=$section->course");
 | 
        
           |  |  | 206 |     }
 | 
        
           |  |  | 207 |   | 
        
           |  |  | 208 |     moveto_module($cm, $section, $beforecm);
 | 
        
           |  |  | 209 |   | 
        
           |  |  | 210 |     $sectionreturn = $USER->activitycopysectionreturn;
 | 
        
           |  |  | 211 |     unset($USER->activitycopy);
 | 
        
           |  |  | 212 |     unset($USER->activitycopycourse);
 | 
        
           |  |  | 213 |     unset($USER->activitycopyname);
 | 
        
           |  |  | 214 |     unset($USER->activitycopysectionreturn);
 | 
        
           |  |  | 215 |   | 
        
           |  |  | 216 |     redirect(course_get_url($course, $section->section, $urloptions));
 | 
        
           |  |  | 217 |   | 
        
           |  |  | 218 | } else if (!empty($indent) and confirm_sesskey()) {
 | 
        
           |  |  | 219 |     $id = required_param('id', PARAM_INT);
 | 
        
           |  |  | 220 |   | 
        
           |  |  | 221 |     $cm     = get_coursemodule_from_id('', $id, 0, true, MUST_EXIST);
 | 
        
           |  |  | 222 |     $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
 | 
        
           |  |  | 223 |   | 
        
           |  |  | 224 |     require_login($course, false, $cm);
 | 
        
           |  |  | 225 |     $coursecontext = context_course::instance($course->id);
 | 
        
           |  |  | 226 |     $modcontext = context_module::instance($cm->id);
 | 
        
           |  |  | 227 |     require_capability('moodle/course:manageactivities', $modcontext);
 | 
        
           |  |  | 228 |   | 
        
           |  |  | 229 |     $cm->indent += $indent;
 | 
        
           |  |  | 230 |   | 
        
           |  |  | 231 |     if ($cm->indent < 0) {
 | 
        
           |  |  | 232 |         $cm->indent = 0;
 | 
        
           |  |  | 233 |     }
 | 
        
           |  |  | 234 |   | 
        
           |  |  | 235 |     $DB->set_field('course_modules', 'indent', $cm->indent, array('id'=>$cm->id));
 | 
        
           |  |  | 236 |   | 
        
           |  |  | 237 |     \course_modinfo::purge_course_module_cache($cm->course, $cm->id);
 | 
        
           |  |  | 238 |     // Rebuild invalidated module cache.
 | 
        
           |  |  | 239 |     rebuild_course_cache($cm->course, false, true);
 | 
        
           |  |  | 240 |   | 
        
           |  |  | 241 |     redirect(course_get_url($course, $cm->sectionnum, $urloptions));
 | 
        
           |  |  | 242 |   | 
        
           |  |  | 243 | } else if (!empty($hide) and confirm_sesskey()) {
 | 
        
           |  |  | 244 |     $cm     = get_coursemodule_from_id('', $hide, 0, true, MUST_EXIST);
 | 
        
           |  |  | 245 |     $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
 | 
        
           |  |  | 246 |   | 
        
           |  |  | 247 |     require_login($course, false, $cm);
 | 
        
           |  |  | 248 |     $coursecontext = context_course::instance($course->id);
 | 
        
           |  |  | 249 |     $modcontext = context_module::instance($cm->id);
 | 
        
           |  |  | 250 |     require_capability('moodle/course:activityvisibility', $modcontext);
 | 
        
           |  |  | 251 |   | 
        
           |  |  | 252 |     if (set_coursemodule_visible($cm->id, 0)) {
 | 
        
           |  |  | 253 |         \core\event\course_module_updated::create_from_cm($cm, $modcontext)->trigger();
 | 
        
           |  |  | 254 |     }
 | 
        
           |  |  | 255 |     redirect(course_get_url($course, $cm->sectionnum, $urloptions));
 | 
        
           |  |  | 256 |   | 
        
           |  |  | 257 | } else if (!empty($stealth) and confirm_sesskey()) {
 | 
        
           |  |  | 258 |     list($course, $cm) = get_course_and_cm_from_cmid($stealth);
 | 
        
           |  |  | 259 |     require_login($course, false, $cm);
 | 
        
           |  |  | 260 |     require_capability('moodle/course:activityvisibility', $cm->context);
 | 
        
           |  |  | 261 |   | 
        
           |  |  | 262 |     if (set_coursemodule_visible($cm->id, 1, 0)) {
 | 
        
           |  |  | 263 |         \core\event\course_module_updated::create_from_cm($cm)->trigger();
 | 
        
           |  |  | 264 |     }
 | 
        
           |  |  | 265 |     redirect(course_get_url($course, $cm->sectionnum, array('sr' => $sectionreturn)));
 | 
        
           |  |  | 266 |   | 
        
           |  |  | 267 | } else if (!empty($show) and confirm_sesskey()) {
 | 
        
           |  |  | 268 |     list($course, $cm) = get_course_and_cm_from_cmid($show);
 | 
        
           |  |  | 269 |     require_login($course, false, $cm);
 | 
        
           |  |  | 270 |     require_capability('moodle/course:activityvisibility', $cm->context);
 | 
        
           |  |  | 271 |     $section = $cm->get_section_info();
 | 
        
           |  |  | 272 |   | 
        
           |  |  | 273 |     if (set_coursemodule_visible($cm->id, 1)) {
 | 
        
           |  |  | 274 |         \core\event\course_module_updated::create_from_cm($cm)->trigger();
 | 
        
           |  |  | 275 |     }
 | 
        
           |  |  | 276 |     redirect(course_get_url($course, $section->section, $urloptions));
 | 
        
           |  |  | 277 |   | 
        
           |  |  | 278 | } else if ($groupmode > -1 and confirm_sesskey()) {
 | 
        
           |  |  | 279 |     $id = required_param('id', PARAM_INT);
 | 
        
           |  |  | 280 |   | 
        
           |  |  | 281 |     $cm     = get_coursemodule_from_id('', $id, 0, true, MUST_EXIST);
 | 
        
           |  |  | 282 |     $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
 | 
        
           |  |  | 283 |   | 
        
           |  |  | 284 |     require_login($course, false, $cm);
 | 
        
           |  |  | 285 |     $coursecontext = context_course::instance($course->id);
 | 
        
           |  |  | 286 |     $modcontext = context_module::instance($cm->id);
 | 
        
           |  |  | 287 |     require_capability('moodle/course:manageactivities', $modcontext);
 | 
        
           |  |  | 288 |   | 
        
           |  |  | 289 |     set_coursemodule_groupmode($cm->id, $groupmode);
 | 
        
           |  |  | 290 |     \core\event\course_module_updated::create_from_cm($cm, $modcontext)->trigger();
 | 
        
           |  |  | 291 |     redirect(course_get_url($course, $cm->sectionnum, $urloptions));
 | 
        
           |  |  | 292 |   | 
        
           |  |  | 293 | } else if (!empty($copy) and confirm_sesskey()) { // value = course module
 | 
        
           |  |  | 294 |     $cm     = get_coursemodule_from_id('', $copy, 0, true, MUST_EXIST);
 | 
        
           |  |  | 295 |     $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
 | 
        
           |  |  | 296 |   | 
        
           |  |  | 297 |     require_login($course, false, $cm);
 | 
        
           |  |  | 298 |     $coursecontext = context_course::instance($course->id);
 | 
        
           |  |  | 299 |     $modcontext = context_module::instance($cm->id);
 | 
        
           |  |  | 300 |     require_capability('moodle/course:manageactivities', $modcontext);
 | 
        
           |  |  | 301 |   | 
        
           |  |  | 302 |     $section = $DB->get_record('course_sections', array('id'=>$cm->section), '*', MUST_EXIST);
 | 
        
           |  |  | 303 |   | 
        
           |  |  | 304 |     $USER->activitycopy              = $copy;
 | 
        
           |  |  | 305 |     $USER->activitycopycourse        = $cm->course;
 | 
        
           |  |  | 306 |     $USER->activitycopyname          = $cm->name;
 | 
        
           |  |  | 307 |     $USER->activitycopysectionreturn = $sectionreturn;
 | 
        
           |  |  | 308 |   | 
        
           |  |  | 309 |     redirect(course_get_url($course, $section->section, $urloptions));
 | 
        
           |  |  | 310 |   | 
        
           |  |  | 311 | } else if (!empty($cancelcopy) and confirm_sesskey()) { // value = course module
 | 
        
           |  |  | 312 |   | 
        
           |  |  | 313 |     $courseid = $USER->activitycopycourse;
 | 
        
           |  |  | 314 |     $course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
 | 
        
           |  |  | 315 |   | 
        
           |  |  | 316 |     $cm     = get_coursemodule_from_id('', $USER->activitycopy, 0, true, IGNORE_MISSING);
 | 
        
           |  |  | 317 |     $sectionreturn = $USER->activitycopysectionreturn;
 | 
        
           |  |  | 318 |     unset($USER->activitycopy);
 | 
        
           |  |  | 319 |     unset($USER->activitycopycourse);
 | 
        
           |  |  | 320 |     unset($USER->activitycopyname);
 | 
        
           |  |  | 321 |     unset($USER->activitycopysectionreturn);
 | 
        
           |  |  | 322 |     redirect(course_get_url($course, $cm->sectionnum, $urloptions));
 | 
        
           |  |  | 323 | } else {
 | 
        
           |  |  | 324 |     throw new \moodle_exception('unknowaction');
 | 
        
           |  |  | 325 | }
 |