removed a slow call from restore code, this is a trouble maker if you have a lot of courses.

This commit is contained in:
toyomoyo 2007-09-20 08:58:12 +00:00
parent eedae98ef2
commit 3c13c1eacc

View file

@ -194,12 +194,13 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
* newcourse * newcourse
*/ */
$mycourses = get_capability_courses('moodle/site:restore'); //$mycourses = get_capability_courses('moodle/site:restore');
// if the user can manage 2 or more courses, // if the user can manage 2 or more courses,
// or if the only course the user can manage is not the current course // or if the only course the user can manage is not the current course
// we show options for existing courses // we show options for existing courses
if (count($mycourses) > 1 || !in_array($id, $mycourses)) { if (user_can_create_courses()) { // this is not entirely accurate but much faster
//if (count($mycourses) > 1 || !in_array($id, $mycourses)) {
// if user can manage more than 1 course, or if user can restore to a single different course // if user can manage more than 1 course, or if user can restore to a single different course
$restore_restoreto_options[0] = get_string("existingcoursedeleting"); $restore_restoreto_options[0] = get_string("existingcoursedeleting");
$restore_restoreto_options[1] = get_string("existingcourseadding"); $restore_restoreto_options[1] = get_string("existingcourseadding");