Proyectos de Subversion Moodle

Rev

Rev 1 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1220
Línea 22... Línea 22...
22
 * @package core_course
22
 * @package core_course
23
 */
23
 */
Línea 24... Línea 24...
24
 
24
 
25
require_once('../config.php');
25
require_once('../config.php');
26
require_once('lib.php');
26
require_once('lib.php');
Línea 27... Línea 27...
27
require_once($CFG->libdir.'/completionlib.php');
27
require_once($CFG->libdir . '/completionlib.php');
Línea 28... Línea 28...
28
 
28
 
29
redirect_if_major_upgrade_required();
29
redirect_if_major_upgrade_required();
Línea 37... Línea 37...
37
$idnumber = optional_param('idnumber', '', PARAM_RAW);
37
$idnumber = optional_param('idnumber', '', PARAM_RAW);
38
$sectionid = optional_param('sectionid', 0, PARAM_INT);
38
$sectionid = optional_param('sectionid', 0, PARAM_INT);
39
$section = optional_param('section', null, PARAM_INT);
39
$section = optional_param('section', null, PARAM_INT);
40
$expandsection = optional_param('expandsection', -1, PARAM_INT);
40
$expandsection = optional_param('expandsection', -1, PARAM_INT);
41
$move = optional_param('move', 0, PARAM_INT);
41
$move = optional_param('move', 0, PARAM_INT);
42
$marker = optional_param('marker', -1 , PARAM_INT);
42
$marker = optional_param('marker', -1, PARAM_INT);
43
$switchrole = optional_param('switchrole', -1, PARAM_INT); // Deprecated, use course/switchrole.php instead.
43
$switchrole = optional_param('switchrole', -1, PARAM_INT); // Deprecated, use course/switchrole.php instead.
44
$return = optional_param('return', 0, PARAM_LOCALURL);
44
$return = optional_param('return', 0, PARAM_LOCALURL);
Línea 45... Línea 45...
45
 
45
 
46
$params = [];
46
$params = [];
Línea 84... Línea 84...
84
 
84
 
Línea 85... Línea 85...
85
require_login($course);
85
require_login($course);
86
 
86
 
-
 
87
// Switchrole - sanity check in cost-order...
87
// Switchrole - sanity check in cost-order...
88
$resetuserallowedediting = false;
88
$resetuserallowedediting = false;
89
if (
-
 
90
    $switchrole > 0 && confirm_sesskey() &&
89
if ($switchrole > 0 && confirm_sesskey() &&
91
    has_capability('moodle/role:switchroles', $context)
90
    has_capability('moodle/role:switchroles', $context)) {
92
) {
91
    // Is this role assignable in this context?
93
    // Is this role assignable in this context?
92
    // Inquiring minds want to know.
94
    // Inquiring minds want to know.
93
    $aroles = get_switchable_roles($context);
95
    $aroles = get_switchable_roles($context);
Línea 114... Línea 116...
114
            redirect($externurl);
116
            redirect($externurl);
115
        }
117
        }
116
    }
118
    }
117
}
119
}
Línea 118... Línea 120...
118
 
120
 
Línea 119... Línea 121...
119
require_once($CFG->dirroot.'/calendar/lib.php'); // This is after login because it needs $USER.
121
require_once($CFG->dirroot . '/calendar/lib.php'); // This is after login because it needs $USER.
120
 
122
 
121
// Must set layout before gettting section info. See MDL-47555.
123
// Must set layout before gettting section info. See MDL-47555.
Línea 172... Línea 174...
172
    $USER->editing = 0;
174
    $USER->editing = 0;
173
}
175
}
174
if ($PAGE->user_allowed_editing()) {
176
if ($PAGE->user_allowed_editing()) {
175
    if (($edit == 1) && confirm_sesskey()) {
177
    if (($edit == 1) && confirm_sesskey()) {
176
        $USER->editing = 1;
178
        $USER->editing = 1;
-
 
179
 
177
        // Redirect to site root if Editing is toggled on frontpage.
180
        // Redirect to site root if Editing is toggled on frontpage.
178
        if ($course->id == SITEID) {
181
        if ($course->id == SITEID) {
179
            redirect($CFG->wwwroot .'/?redirect=0');
182
            //redirect($CFG->wwwroot .'/?redirect=0');
-
 
183
            $url = new moodle_url($PAGE->url, ['notifyeditingon' => 1]);
-
 
184
            redirect($url);
180
        } else if (!empty($return)) {
185
        } else if (!empty($return)) {
181
            redirect($CFG->wwwroot . $return);
186
            redirect($CFG->wwwroot . $return);
182
        } else {
187
        } else {
183
            $url = new moodle_url($PAGE->url, ['notifyeditingon' => 1]);
188
            $url = new moodle_url($PAGE->url, ['notifyeditingon' => 1]);
184
            redirect($url);
189
            redirect($url);
Línea 189... Línea 194...
189
            $USER->activitycopy = false;
194
            $USER->activitycopy = false;
190
            $USER->activitycopycourse = null;
195
            $USER->activitycopycourse = null;
191
        }
196
        }
192
        // Redirect to site root if Editing is toggled on frontpage.
197
        // Redirect to site root if Editing is toggled on frontpage.
193
        if ($course->id == SITEID) {
198
        if ($course->id == SITEID) {
194
            redirect($CFG->wwwroot .'/?redirect=0');
199
            redirect($CFG->wwwroot . '/?redirect=0');
195
        } else if (!empty($return)) {
200
        } else if (!empty($return)) {
196
            redirect($CFG->wwwroot . $return);
201
            redirect($CFG->wwwroot . $return);
197
        } else {
202
        } else {
198
            redirect($PAGE->url);
203
            redirect($PAGE->url);
199
        }
204
        }
Línea 234... Línea 239...
234
    ) {
239
    ) {
235
        $newsection = $format->duplicate_section($coursesections);
240
        $newsection = $format->duplicate_section($coursesections);
236
        redirect(course_get_url($course, $newsection->section));
241
        redirect(course_get_url($course, $newsection->section));
237
    }
242
    }
Línea -... Línea 243...
-
 
243
 
238
 
244
    if (
239
    if (!empty($section) && !empty($move) &&
245
        !empty($section) && !empty($move) &&
-
 
246
        has_capability('moodle/course:movesections', $context) && confirm_sesskey()
240
            has_capability('moodle/course:movesections', $context) && confirm_sesskey()) {
247
    ) {
241
        $destsection = $section + $move;
248
        $destsection = $section + $move;
242
        if (move_section_to($course, $section, $destsection)) {
249
        if (move_section_to($course, $section, $destsection)) {
243
            if ($course->id == SITEID) {
250
            if ($course->id == SITEID) {
244
                redirect($CFG->wwwroot . '/?redirect=0');
251
                redirect($CFG->wwwroot . '/?redirect=0');
Línea 260... Línea 267...
260
$SESSION->fromdiscussion = $PAGE->url->out(false);
267
$SESSION->fromdiscussion = $PAGE->url->out(false);
Línea 261... Línea 268...
261
 
268
 
262
 
269
 
263
if ($course->id == SITEID) {
270
if ($course->id == SITEID) {
264
    // This course is not a real course.
271
    // This course is not a real course.
Línea 265... Línea 272...
265
    redirect($CFG->wwwroot .'/?redirect=0');
272
    redirect($CFG->wwwroot . '/?redirect=0');
266
}
273
}
Línea 343... Línea 350...
343
 
350
 
344
// Include course AJAX.
351
// Include course AJAX.
Línea 345... Línea 352...
345
include_course_ajax($course, $modnamesused);
352
include_course_ajax($course, $modnamesused);
346
 
353
 
347
// Include the actual course format.
354
// Include the actual course format.
Línea 348... Línea 355...
348
require($CFG->dirroot .'/course/format/'. $course->format .'/format.php');
355
require($CFG->dirroot . '/course/format/' . $course->format . '/format.php');
Línea 349... Línea 356...
349
// Content wrapper end.
356
// Content wrapper end.