id)) { if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $course->id))) { if (empty($to)) { error("You need to be a teacher or admin user to use this page_1.", "$CFG->wwwroot/login/index.php"); } else { if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $to))) { error("You need to be a teacher or admin user to use this page_2.", "$CFG->wwwroot/login/index.php"); } } } } else { if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM, SITEID))) { error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php"); } } $backupprefs = new StdClass; $count = 0; backup_fetch_prefs_from_request($backupprefs,$count,$course); //Check site if (!$site = get_site()) { error("Site not found!"); } if ($count == 0) { notice("No backupable modules are installed!"); } ?>