From d8b2e5e63d2deca054b41fdcbb1a073d3b883bad Mon Sep 17 00:00:00 2001 From: stronk7 Date: Sun, 13 Apr 2008 23:29:07 +0000 Subject: [PATCH] Minor fixes in the restore form when restoring from within SITEID. Merged from 19_STABLE --- backup/restore_form.html | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/backup/restore_form.html b/backup/restore_form.html index 187d6d01c7..aeb7651fbc 100644 --- a/backup/restore_form.html +++ b/backup/restore_form.html @@ -193,7 +193,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) { // permission should have been checked already /** - * if user has manageactivities in any course, we show + * if user has manageactivities in any course and we are not restoring from within SITEID * existingcoursedeleting * existingcourseadding * else we show @@ -209,14 +209,13 @@ function selectItemInCheckboxByName(formId, checkName, checked ) { } else { $accessinfo = get_user_access_sitewide($USER->id); } - + $mycourses = get_user_courses_bycap($USER->id, 'moodle/site:restore', $accessinfo, true); - // if the user can manage 2 or more courses, - // or if the only course the user can manage is not the current course + + // if the user can manage 2 or more courses and we are not restoring from within SITEID, // we show options for existing courses - - if (count($mycourses) > 1) { - // if user can manage more than 1 course, or if user can restore to a single different course + + if (count($mycourses) > 1 && $id != SITEID) { $restore_restoreto_options[0] = get_string("existingcoursedeleting"); $restore_restoreto_options[1] = get_string("existingcourseadding"); // else if the user can write to current course @@ -243,8 +242,14 @@ function selectItemInCheckboxByName(formId, checkName, checked ) { echo ''; echo ""; echo ""; - make_categories_list($categories, $parents); - choose_from_menu($categories, "restore_restorecatto", $course_header->category->id, ""); + // Category selection isn't alowed if restoring from within SITEID course + if ($id != SITEID) { + make_categories_list($categories, $parents); + choose_from_menu($categories, "restore_restorecatto", $course_header->category->id, ""); + } else { + print_string('notavailable'); + echo ''; + } echo ""; echo ""; @@ -274,13 +279,13 @@ function selectItemInCheckboxByName(formId, checkName, checked ) { /// from 0 produces crazy dates. MDL-10125 if ($form1->startdate) { print_date_selector("startday", "startmonth", "startyear", $form1->startdate); + helpbutton("coursestartdate", get_string("startdate")); } else { print_string('notavailable'); echo ''; echo ''; echo ''; } - helpbutton("coursestartdate", get_string("startdate")); echo ""; } //Line -- 2.39.5