$data->password = $data->enrolpassword; // we need some other name for password field MDL-9929 /// process data if submitted //preprocess data if ($data->enrolstartdisabled) { $data->enrolstartdate = 0; } if ($data->enrolenddisabled) { $data->enrolenddate = 0; } $data->timemodified = time(); if (empty($course)) { if (!($course = create_course($data))) { print_error('coursenotcreated'); } if (!addQSCourse($course)) { // Added: JAM 12.30.2010 - sends ws call to create a course in quota system // id is required to create course in WS admin_webservicefailed_email($USER, 'addCourse', $course); } if (!addVLCourse($course)) { // Added: JAM 02.23.2012 - sends ws call to create a course in virtualLabs deleteQSCourse($course); admin_webservicefailed_email($USER, 'addCourse', $course); } $context = get_context_instance(CONTEXT_COURSE, $course->id); // assign default role to creator if not already having permission to manage course assignments if (!has_capability('moodle/course:view', $context) or !has_capability('moodle/role:assign', $context)) { role_assign($CFG->creatornewroleid, $USER->id, 0, $context->id); } // ensure we can use the course right after creating it
print_error('confirmsesskeybad', 'error'); } // OK checks done, delete the course now. add_to_log(SITEID, "course", "delete", "view.php?id={$course->id}", "{$course->fullname} (ID {$course->id})"); $strdeletingcourse = get_string("deletingcourse", "", format_string($course->shortname)); $navlinks[] = array('name' => $stradministration, 'link' => "../{$CFG->admin}/index.php", 'type' => 'misc'); $navlinks[] = array('name' => $strcategories, 'link' => "index.php", 'type' => 'misc'); $navlinks[] = array('name' => $category->name, 'link' => "category.php?id={$course->category}", 'type' => 'misc'); $navlinks[] = array('name' => $strdeletingcourse, 'link' => null, 'type' => 'misc'); $navigation = build_navigation($navlinks); print_header("{$site->shortname}: {$strdeletingcourse}", $site->fullname, $navigation); print_heading($strdeletingcourse); // Added: JAM 12.30.2010 - sends ws call to delete a course in quota system if (deleteQSCourse($course)) { if (deleteVLCourse($course)) { // Added: JAM 02.23.2012 - sends ws call to delete a course in virtualLabs delete_course($course); fix_course_sortorder(); //update course count in catagories print_heading(get_string("deletedcourse", "", format_string($course->shortname))); print_continue("category.php?id={$course->category}"); print_footer(); } else { addQSCourse($course); admin_webservicefailed_email($USER, 'deleteCourse', $course); error('Course could not be deleted'); } } else { admin_webservicefailed_email($USER, 'deleteCourse', $course); error('Course could not be deleted'); }