(delayed) merge from HEAD: fixing bug#4199
This commit is contained in:
+25
-2
@@ -51,13 +51,29 @@ optional_variable($filename,0);
|
||||
|
||||
print_header("$course->fullname: $strimport", "$course->fullname: $strimport", "$course->shortname");
|
||||
|
||||
$taught_courses = get_my_courses($USER->id,"visible DESC,sortorder ASC",0,1);
|
||||
print_heading(get_string("importdatafrom"));
|
||||
|
||||
$tcourseids = '';
|
||||
|
||||
if ($teachers = get_records_select('user_teachers', "userid = $USER->id AND editall = 1",'','id,course')) {
|
||||
foreach ($teachers as $teacher) {
|
||||
if ($teacher->course != $course->id && $teacher->course != $site->id){
|
||||
$tcourseids .= $teacher->course.',';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$taught_courses = array();
|
||||
if (!empty($tcourseids)) {
|
||||
$tcourseids = substr($tcourseids,0,-1);
|
||||
$taught_courses = get_records_list('course', 'id', $tcourseids);
|
||||
}
|
||||
|
||||
if (!empty($creator)) {
|
||||
$cat_courses = get_courses($course->category);
|
||||
} else {
|
||||
$cat_courses = array();
|
||||
}
|
||||
print_heading(get_string("importdatafrom"));
|
||||
|
||||
$options = array();
|
||||
foreach ($taught_courses as $tcourse) {
|
||||
@@ -66,6 +82,13 @@ optional_variable($filename,0);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($options) && empty($creator)) {
|
||||
error(get_string('courseimportnotaught'),$CFG->wwwroot.'/course/view.php?id='.$course->id);
|
||||
print_footer();
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
$fm = '<form method="post" action="'.$CFG->wwwroot.'/course/import.php"><input type="hidden" name="id" value="'.$course->id.'" />';
|
||||
$submit = '<input type="submit" value="'.get_string('usethiscourse').'" /></form>';
|
||||
|
||||
|
||||
@@ -206,6 +206,7 @@ $string['coursefiles'] = 'Course files';
|
||||
$string['courseformats'] = 'Course formats';
|
||||
$string['coursegrades'] = 'Course grades';
|
||||
$string['courseinfo'] = 'Course info';
|
||||
$string['courseimportnotaught'] = 'You don\'t seem to be an editing teacher in any other courses, there are no courses for you to import from.';
|
||||
$string['coursenotaccessible'] = 'This course does not allow public access';
|
||||
$string['courserestore'] = 'Course restore';
|
||||
$string['courses'] = 'Courses';
|
||||
|
||||
Reference in New Issue
Block a user