Esempio n. 1
0
require_login($course);
add_to_log($course->id, 'course', 'move', "move.php?id={$course->id}&move={$move}", "{$course->id}");
$PAGE->set_pagelayout('incourse');
$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;
 public function test_subpage_get_course_subpages()
 {
     // setup a course and some modules
     $course = $this->get_new_course();
     $coursesection = $this->get_new_course_section($course->id);
     $subpage1 = $this->get_new_subpage($course->id, "subpage1");
     $cm1 = $this->get_new_course_module($course->id, $subpage1->id, $coursesection->id);
     $subpage2 = $this->get_new_subpage($course->id, "subpage2");
     $cm2 = $this->get_new_course_module($course->id, $subpage2->id, $coursesection->id);
     $subpage3 = $this->get_new_subpage($course->id, "subpage3");
     $cm3 = $this->get_new_course_module($course->id, $subpage3->id, $coursesection->id);
     $allsubpages = mod_subpage::get_course_subpages($course);
     $this->assertIsA($allsubpages, 'array');
     $this->assertIsA($allsubpages[1], 'mod_subpage');
     $this->assertEqual($allsubpages[1]->get_name(), 'subpage1');
     $this->assertEqual($allsubpages[2]->get_name(), 'subpage2');
     $this->assertEqual($allsubpages[3]->get_name(), 'subpage3');
     $subpage = $allsubpages[1];
     $section = $subpage->add_section('section1', 'section1');
     $sectionid = $section['sectionid'];
 }