| Línea 27... |
Línea 27... |
| 27 |
require_once("lib.php");
|
27 |
require_once("lib.php");
|
| Línea 28... |
Línea 28... |
| 28 |
|
28 |
|
| 29 |
$sectionreturn = optional_param('sr', null, PARAM_INT);
|
29 |
$sectionreturn = optional_param('sr', null, PARAM_INT);
|
| 30 |
$add = optional_param('add', '', PARAM_ALPHANUM);
|
30 |
$add = optional_param('add', '', PARAM_ALPHANUM);
|
| 31 |
$type = optional_param('type', '', PARAM_ALPHA);
|
31 |
$type = optional_param('type', '', PARAM_ALPHA);
|
| 32 |
$indent = optional_param('indent', 0, PARAM_INT);
|
32 |
$indent = optional_param('indent', 0, PARAM_INT); // TODO remove this param as part of MDL-83530.
|
| 33 |
$update = optional_param('update', 0, PARAM_INT);
|
33 |
$update = optional_param('update', 0, PARAM_INT);
|
| 34 |
$duplicate = optional_param('duplicate', 0, PARAM_INT);
|
34 |
$duplicate = optional_param('duplicate', 0, PARAM_INT); // TODO remove this param as part of MDL-83530.
|
| 35 |
$hide = optional_param('hide', 0, PARAM_INT);
|
35 |
$hide = optional_param('hide', 0, PARAM_INT); // TODO remove this param as part of MDL-83530.
|
| 36 |
$stealth = optional_param('stealth', 0, PARAM_INT);
|
36 |
$stealth = optional_param('stealth', 0, PARAM_INT); // TODO remove this param as part of MDL-83530.
|
| 37 |
$show = optional_param('show', 0, PARAM_INT);
|
37 |
$show = optional_param('show', 0, PARAM_INT); // TODO remove this param as part of MDL-83530.
|
| 38 |
$copy = optional_param('copy', 0, PARAM_INT);
|
38 |
$copy = optional_param('copy', 0, PARAM_INT); // TODO remove this param as part of MDL-83530.
|
| 39 |
$moveto = optional_param('moveto', 0, PARAM_INT);
|
39 |
$moveto = optional_param('moveto', 0, PARAM_INT); // TODO remove this param as part of MDL-83530.
|
| 40 |
$movetosection = optional_param('movetosection', 0, PARAM_INT);
|
40 |
$movetosection = optional_param('movetosection', 0, PARAM_INT); // TODO remove this param as part of MDL-83530.
|
| 41 |
$delete = optional_param('delete', 0, PARAM_INT);
|
41 |
$delete = optional_param('delete', 0, PARAM_INT); // TODO remove this param as part of MDL-83530.
|
| 42 |
$course = optional_param('course', 0, PARAM_INT);
|
42 |
$course = optional_param('course', 0, PARAM_INT);
|
| 43 |
$groupmode = optional_param('groupmode', -1, PARAM_INT);
|
43 |
$groupmode = optional_param('groupmode', -1, PARAM_INT); // TODO remove this param as part of MDL-83530.
|
| 44 |
$cancelcopy = optional_param('cancelcopy', 0, PARAM_BOOL);
|
44 |
$cancelcopy = optional_param('cancelcopy', 0, PARAM_BOOL); // TODO remove this param as part of MDL-83530.
|
| Línea 45... |
Línea 45... |
| 45 |
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
45 |
$confirm = optional_param('confirm', 0, PARAM_BOOL); // TODO remove this param as part of MDL-83530.
|
| 46 |
|
46 |
|
| 47 |
// This page should always redirect
|
47 |
// This page should always redirect
|
| 48 |
$url = new moodle_url('/course/mod.php');
|
48 |
$url = new moodle_url('/course/mod.php');
|
| Línea 116... |
Línea 116... |
| 116 |
'/course/modedit.php',
|
116 |
'/course/modedit.php',
|
| 117 |
$params,
|
117 |
$params,
|
| 118 |
)
|
118 |
)
|
| 119 |
);
|
119 |
);
|
| 120 |
} else if (!empty($duplicate) and confirm_sesskey()) {
|
120 |
} else if (!empty($duplicate) and confirm_sesskey()) {
|
| - |
|
121 |
// TODO remove this else if as part of MDL-83530.
|
| - |
|
122 |
debugging(
|
| - |
|
123 |
'The duplicate param is deprecated. Please use action cm_duplicate in course/format/update.php instead.',
|
| - |
|
124 |
DEBUG_DEVELOPER
|
| - |
|
125 |
);
|
| 121 |
$cm = get_coursemodule_from_id('', $duplicate, 0, true, MUST_EXIST);
|
126 |
$cm = get_coursemodule_from_id('', $duplicate, 0, true, MUST_EXIST);
|
| 122 |
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
|
127 |
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
|
| Línea 123... |
Línea 128... |
| 123 |
|
128 |
|
| 124 |
require_login($course, false, $cm);
|
129 |
require_login($course, false, $cm);
|
| 125 |
$modcontext = context_module::instance($cm->id);
|
130 |
$coursecontext = context_course::instance($course->id);
|
| Línea 126... |
Línea 131... |
| 126 |
require_capability('moodle/course:manageactivities', $modcontext);
|
131 |
require_all_capabilities(['moodle/backup:backuptargetimport', 'moodle/restore:restoretargetimport'], $coursecontext);
|
| 127 |
|
132 |
|
| 128 |
// Duplicate the module.
|
133 |
// Duplicate the module.
|
| Línea 129... |
Línea 134... |
| 129 |
$newcm = duplicate_module($course, $cm);
|
134 |
$newcm = duplicate_module($course, $cm);
|
| - |
|
135 |
redirect(course_get_url($course, $cm->sectionnum, $urloptions));
|
| - |
|
136 |
|
| - |
|
137 |
} else if (!empty($delete)) {
|
| - |
|
138 |
// TODO remove this else if as part of MDL-83530.
|
| - |
|
139 |
debugging(
|
| 130 |
redirect(course_get_url($course, $cm->sectionnum, $urloptions));
|
140 |
'The delete param is deprecated. Please use action cm_delete in course/format/update.php instead.',
|
| 131 |
|
141 |
DEBUG_DEVELOPER
|
| Línea 132... |
Línea 142... |
| 132 |
} else if (!empty($delete)) {
|
142 |
);
|
| 133 |
$cm = get_coursemodule_from_id('', $delete, 0, true, MUST_EXIST);
|
143 |
$cm = get_coursemodule_from_id('', $delete, 0, true, MUST_EXIST);
|
| 134 |
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
|
144 |
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
|
| Línea -... |
Línea 145... |
| - |
|
145 |
|
| - |
|
146 |
require_login($course, false, $cm);
|
| - |
|
147 |
$modcontext = context_module::instance($cm->id);
|
| 135 |
|
148 |
require_capability('moodle/course:manageactivities', $modcontext);
|
| - |
|
149 |
|
| Línea 136... |
Línea 150... |
| 136 |
require_login($course, false, $cm);
|
150 |
if (plugin_supports('mod', $cm->modname, FEATURE_PUBLISHES_QUESTIONS)) {
|
| 137 |
$modcontext = context_module::instance($cm->id);
|
151 |
$return = \core_question\local\bank\question_bank_helper::get_url_for_qbank_list($course->id);
|
| Línea 138... |
Línea 152... |
| 138 |
require_capability('moodle/course:manageactivities', $modcontext);
|
152 |
} else {
|
| Línea 176... |
Línea 190... |
| 176 |
redirect($return);
|
190 |
redirect($return);
|
| 177 |
}
|
191 |
}
|
| Línea 178... |
Línea 192... |
| 178 |
|
192 |
|
| - |
|
193 |
|
| - |
|
194 |
if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
|
| - |
|
195 |
// TODO remove this if as part of MDL-83530.
|
| - |
|
196 |
debugging(
|
| - |
|
197 |
'The moveto param is deprecated. Please use the standard move modal instead.',
|
| 179 |
|
198 |
DEBUG_DEVELOPER
|
| 180 |
if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
|
199 |
);
|
| Línea 181... |
Línea 200... |
| 181 |
$cm = get_coursemodule_from_id('', $USER->activitycopy, 0, true, MUST_EXIST);
|
200 |
$cm = get_coursemodule_from_id('', $USER->activitycopy, 0, true, MUST_EXIST);
|
| 182 |
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
|
201 |
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
|
| Línea 214... |
Línea 233... |
| 214 |
unset($USER->activitycopysectionreturn);
|
233 |
unset($USER->activitycopysectionreturn);
|
| Línea 215... |
Línea 234... |
| 215 |
|
234 |
|
| Línea 216... |
Línea 235... |
| 216 |
redirect(course_get_url($course, $section->section, $urloptions));
|
235 |
redirect(course_get_url($course, $section->section, $urloptions));
|
| - |
|
236 |
|
| - |
|
237 |
} else if (!empty($indent) and confirm_sesskey()) {
|
| - |
|
238 |
// TODO remove this else if as part of MDL-83530.
|
| - |
|
239 |
debugging(
|
| - |
|
240 |
'The indent param deprecated. Please use action cm_moveleft and cm_moveright in course/format/update.php instead.',
|
| 217 |
|
241 |
DEBUG_DEVELOPER
|
| Línea 218... |
Línea 242... |
| 218 |
} else if (!empty($indent) and confirm_sesskey()) {
|
242 |
);
|
| 219 |
$id = required_param('id', PARAM_INT);
|
243 |
$id = required_param('id', PARAM_INT);
|
| Línea 239... |
Línea 263... |
| 239 |
rebuild_course_cache($cm->course, false, true);
|
263 |
rebuild_course_cache($cm->course, false, true);
|
| Línea 240... |
Línea 264... |
| 240 |
|
264 |
|
| Línea 241... |
Línea 265... |
| 241 |
redirect(course_get_url($course, $cm->sectionnum, $urloptions));
|
265 |
redirect(course_get_url($course, $cm->sectionnum, $urloptions));
|
| - |
|
266 |
|
| - |
|
267 |
} else if (!empty($hide) and confirm_sesskey()) {
|
| - |
|
268 |
// TODO remove this else if as part of MDL-83530.
|
| - |
|
269 |
debugging(
|
| - |
|
270 |
'The hide param deprecated. Please use action cm_hide in course/format/update.php instead.',
|
| 242 |
|
271 |
DEBUG_DEVELOPER
|
| 243 |
} else if (!empty($hide) and confirm_sesskey()) {
|
272 |
);
|
| Línea 244... |
Línea 273... |
| 244 |
$cm = get_coursemodule_from_id('', $hide, 0, true, MUST_EXIST);
|
273 |
$cm = get_coursemodule_from_id('', $hide, 0, true, MUST_EXIST);
|
| 245 |
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
|
274 |
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
|
| Línea 253... |
Línea 282... |
| 253 |
\core\event\course_module_updated::create_from_cm($cm, $modcontext)->trigger();
|
282 |
\core\event\course_module_updated::create_from_cm($cm, $modcontext)->trigger();
|
| 254 |
}
|
283 |
}
|
| 255 |
redirect(course_get_url($course, $cm->sectionnum, $urloptions));
|
284 |
redirect(course_get_url($course, $cm->sectionnum, $urloptions));
|
| Línea 256... |
Línea 285... |
| 256 |
|
285 |
|
| - |
|
286 |
} else if (!empty($stealth) and confirm_sesskey()) {
|
| - |
|
287 |
// TODO remove this else if as part of MDL-83530.
|
| - |
|
288 |
debugging(
|
| - |
|
289 |
'The stealth param deprecated. Please use action cm_stealth in course/format/update.php instead.',
|
| - |
|
290 |
DEBUG_DEVELOPER
|
| 257 |
} else if (!empty($stealth) and confirm_sesskey()) {
|
291 |
);
|
| 258 |
list($course, $cm) = get_course_and_cm_from_cmid($stealth);
|
292 |
list($course, $cm) = get_course_and_cm_from_cmid($stealth);
|
| 259 |
require_login($course, false, $cm);
|
293 |
require_login($course, false, $cm);
|
| Línea 260... |
Línea 294... |
| 260 |
require_capability('moodle/course:activityvisibility', $cm->context);
|
294 |
require_capability('moodle/course:activityvisibility', $cm->context);
|
| 261 |
|
295 |
|
| 262 |
if (set_coursemodule_visible($cm->id, 1, 0)) {
|
296 |
if (set_coursemodule_visible($cm->id, 1, 0)) {
|
| 263 |
\core\event\course_module_updated::create_from_cm($cm)->trigger();
|
297 |
\core\event\course_module_updated::create_from_cm($cm)->trigger();
|
| Línea 264... |
Línea 298... |
| 264 |
}
|
298 |
}
|
| - |
|
299 |
redirect(course_get_url($course, $cm->sectionnum, array('sr' => $sectionreturn)));
|
| - |
|
300 |
|
| - |
|
301 |
} else if (!empty($show) and confirm_sesskey()) {
|
| - |
|
302 |
// TODO remove this else if as part of MDL-83530.
|
| - |
|
303 |
debugging(
|
| 265 |
redirect(course_get_url($course, $cm->sectionnum, array('sr' => $sectionreturn)));
|
304 |
'The show param deprecated. Please use action cm_show in course/format/update.php instead.',
|
| 266 |
|
305 |
DEBUG_DEVELOPER
|
| 267 |
} else if (!empty($show) and confirm_sesskey()) {
|
306 |
);
|
| 268 |
list($course, $cm) = get_course_and_cm_from_cmid($show);
|
307 |
list($course, $cm) = get_course_and_cm_from_cmid($show);
|
| Línea 274... |
Línea 313... |
| 274 |
\core\event\course_module_updated::create_from_cm($cm)->trigger();
|
313 |
\core\event\course_module_updated::create_from_cm($cm)->trigger();
|
| 275 |
}
|
314 |
}
|
| 276 |
redirect(course_get_url($course, $section->section, $urloptions));
|
315 |
redirect(course_get_url($course, $section->section, $urloptions));
|
| Línea 277... |
Línea 316... |
| 277 |
|
316 |
|
| - |
|
317 |
} else if ($groupmode > -1 and confirm_sesskey()) {
|
| - |
|
318 |
// TODO remove this else if as part of MDL-83530.
|
| - |
|
319 |
debugging(
|
| - |
|
320 |
'The groupmode param deprecated. Please use the group mode actions in course/format/update.php instead.',
|
| - |
|
321 |
DEBUG_DEVELOPER
|
| 278 |
} else if ($groupmode > -1 and confirm_sesskey()) {
|
322 |
);
|
| Línea 279... |
Línea 323... |
| 279 |
$id = required_param('id', PARAM_INT);
|
323 |
$id = required_param('id', PARAM_INT);
|
| 280 |
|
324 |
|
| Línea 289... |
Línea 333... |
| 289 |
set_coursemodule_groupmode($cm->id, $groupmode);
|
333 |
set_coursemodule_groupmode($cm->id, $groupmode);
|
| 290 |
\core\event\course_module_updated::create_from_cm($cm, $modcontext)->trigger();
|
334 |
\core\event\course_module_updated::create_from_cm($cm, $modcontext)->trigger();
|
| 291 |
redirect(course_get_url($course, $cm->sectionnum, $urloptions));
|
335 |
redirect(course_get_url($course, $cm->sectionnum, $urloptions));
|
| Línea 292... |
Línea 336... |
| 292 |
|
336 |
|
| - |
|
337 |
} else if (!empty($copy) and confirm_sesskey()) { // value = course module
|
| - |
|
338 |
// TODO remove this else if as part of MDL-83530.
|
| - |
|
339 |
debugging(
|
| - |
|
340 |
'The copy param is deprecated. Please use the standard move modal instead.',
|
| - |
|
341 |
DEBUG_DEVELOPER
|
| 293 |
} else if (!empty($copy) and confirm_sesskey()) { // value = course module
|
342 |
);
|
| 294 |
$cm = get_coursemodule_from_id('', $copy, 0, true, MUST_EXIST);
|
343 |
$cm = get_coursemodule_from_id('', $copy, 0, true, MUST_EXIST);
|
| Línea 295... |
Línea 344... |
| 295 |
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
|
344 |
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
|
| 296 |
|
345 |
|
| Línea 307... |
Línea 356... |
| 307 |
$USER->activitycopysectionreturn = $sectionreturn;
|
356 |
$USER->activitycopysectionreturn = $sectionreturn;
|
| Línea 308... |
Línea 357... |
| 308 |
|
357 |
|
| Línea 309... |
Línea 358... |
| 309 |
redirect(course_get_url($course, $section->section, $urloptions));
|
358 |
redirect(course_get_url($course, $section->section, $urloptions));
|
| - |
|
359 |
|
| - |
|
360 |
} else if (!empty($cancelcopy) and confirm_sesskey()) { // value = course module
|
| - |
|
361 |
// TODO remove this else if as part of MDL-83530.
|
| - |
|
362 |
debugging(
|
| 310 |
|
363 |
'The copy param is deprecated. Please use the standard move modal instead.',
|
| 311 |
} else if (!empty($cancelcopy) and confirm_sesskey()) { // value = course module
|
364 |
DEBUG_DEVELOPER
|
| 312 |
|
365 |
);
|
| Línea 313... |
Línea 366... |
| 313 |
$courseid = $USER->activitycopycourse;
|
366 |
$courseid = $USER->activitycopycourse;
|
| 314 |
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
|
367 |
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
|