// 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
} 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
echo '<label for="menurestore_restorecatto">'.get_string ('category').'</label>';
echo "</td>";
echo "<td>";
- 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 '<input type="hidden" name="restore_restorecatto" id="menurestore_restorecatto" value="0" />';
+ }
echo "</td>";
echo "</tr>";
/// 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 '<input type="hidden" name="startyear" value="0" />';
echo '<input type="hidden" name="startmonth" value="0" />';
echo '<input type="hidden" name="startday" value="0" />';
}
- helpbutton("coursestartdate", get_string("startdate"));
echo "</td></tr>";
}
//Line