} else { if (!update_course($data)) { print_error('coursenotupdated'); } redirect($CFG->wwwroot . "/course/view.php?id={$course->id}"); } } } /// Print the form $site = get_site(); $streditcoursesettings = get_string("editcoursesettings"); $straddnewcourse = get_string("addnewcourse"); $stradministration = get_string("administration"); $strcategories = get_string("categories"); $navlinks = array(); if (!empty($course)) { $navlinks[] = array('name' => $streditcoursesettings, 'link' => null, 'type' => 'misc'); $title = $streditcoursesettings; $fullname = $course->fullname; } else { $navlinks[] = array('name' => $stradministration, 'link' => "{$CFG->wwwroot}/{$CFG->admin}/index.php", 'type' => 'misc'); $navlinks[] = array('name' => $strcategories, 'link' => 'index.php', 'type' => 'misc'); $navlinks[] = array('name' => $straddnewcourse, 'link' => null, 'type' => 'misc'); $title = "{$site->shortname}: {$straddnewcourse}"; $fullname = $site->fullname; } $navigation = build_navigation($navlinks); print_header($title, $fullname, $navigation, $editform->focus()); print_heading($streditcoursesettings); $editform->display(); print_footer($course);
role_assign($CFG->creatornewroleid, $USER->id, 0, $context->id); } if ($data->metacourse and has_capability('moodle/course:managemetacourse', $context)) { // Redirect users with metacourse capability to student import redirect($CFG->wwwroot . "/course/importstudents.php?id={$course->id}"); } else { // Redirect to roles assignment redirect($CFG->wwwroot . "/{$CFG->admin}/roles/assign.php?contextid={$context->id}"); } } else { if (!update_course($data)) { print_error('coursenotupdated'); } redirect($CFG->wwwroot . "/course/view.php?id={$course->id}"); } } } /// Print the form $site = get_site(); $streditcoursesettings = get_string("editcoursesettings"); $straddnewcourse = get_string("addnewcourse"); $stradministration = get_string("administration"); $strcategories = get_string("categories"); if (!empty($course)) { print_header($streditcoursesettings, $course->fullname, "<a href=\"{$CFG->wwwroot}/course/view.php?id={$course->id}\">{$course->shortname}</a>\n -> {$streditcoursesettings}", $editform->focus()); } else { print_header("{$site->shortname}: {$straddnewcourse}", $site->fullname, "<a href=\"{$CFG->wwwroot}/{$CFG->admin}/index.php\">{$stradministration}</a> -> " . "<a href=\"index.php\">{$strcategories}</a> -> {$straddnewcourse}", $editform->focus()); } print_heading($streditcoursesettings); $editform->display(); print_footer($course);