Permalink
Browse files

(re)fixing bug #4199: import course activities offering non taught co…

…urses to import from. got lost in the course import rewrite
  • Loading branch information...
1 parent 9704c86 commit 7d5258795cd96385eef4871efff6ba43e97da4bc mjollnir_ committed Nov 8, 2005
Showing with 21 additions and 1 deletion.
  1. +21 −1 course/import/activities/mod.html
View
22 course/import/activities/mod.html
@@ -9,8 +9,23 @@
}
$strimport = get_string("importdata");
+
+ $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);
+ }
- $taught_courses = get_my_courses($USER->id,"visible DESC,sortorder ASC",0,1);
if (!empty($creator)) {
$cat_courses = get_courses($course->category);
} else {
@@ -26,6 +41,11 @@
}
}
+ if (empty($options) && empty($creator)) {
+ notify(get_string('courseimportnotaught'));
+ return; // yay , this will pass control back to the file that included or required us.
+ }
+
$fm = '<form method="post" action="'.$CFG->wwwroot.'/course/import/activities/index.php"><input type="hidden" name="id" value="'.$course->id.'" />';
$submit = '<input type="submit" value="'.get_string('usethiscourse').'" /></form>';

0 comments on commit 7d52587

Please sign in to comment.