Esempio n. 1
0
$PAGE->set_other_editing_capability('moodle/course:manageactivities');
if ($course->id == SITEID) {
    // This course is not a real course.
    redirect($CFG->wwwroot . '/');
}
$PAGE->set_title(strip_tags($course->fullname . ': ' . format_string($subpage->get_name())));
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add(format_string($subpage->get_name()), new moodle_url('/mod/subpage/view.php', array('id' => $cmid)));
$PAGE->navbar->add(get_string('moveitems', 'mod_subpage'));
// general information
$modinfo =& get_fast_modinfo($course);
$coursesections = get_all_sections($course->id);
$allsubpages = mod_subpage::get_course_subpages($course);
// options specifically for moving
$moveableitems = mod_subpage::moveable_modules($subpage, $allsubpages, $coursesections, $modinfo, $move);
$options = mod_subpage::destination_options($subpage, $allsubpages, $coursesections, $modinfo, $move);
if (empty($moveableitems)) {
    echo $OUTPUT->header();
    // Course wrapper start.
    echo html_writer::start_tag('div', array('class' => 'course-content'));
    echo $OUTPUT->notification(get_string('nomodules', 'mod_subpage'));
    echo $OUTPUT->continue_button("{$CFG->wwwroot}/mod/subpage/view.php?id={$cmid}");
    echo html_writer::end_tag('div');
    echo $OUTPUT->footer();
    exit;
}
$data = array();
$data['id'] = $cmid;
$data['moveable'] = $moveableitems;
$data['options'] = $options;
$data['move'] = $move;