Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

(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...
commit 7d5258795cd96385eef4871efff6ba43e97da4bc 1 parent 9704c86
authored November 08, 2005

Showing 1 changed file with 21 additions and 1 deletion. Show diff stats Hide diff stats

  1. 22  course/import/activities/mod.html
22  course/import/activities/mod.html
@@ -9,8 +9,23 @@
9 9
     }
10 10
 
11 11
     $strimport = get_string("importdata");
  12
+ 
  13
+    $tcourseids = '';
  14
+  	 
  15
+    if ($teachers = get_records_select('user_teachers', "userid = $USER->id AND editall = 1",'','id,course')) {
  16
+        foreach ($teachers as $teacher) {
  17
+            if ($teacher->course != $course->id && $teacher->course != $site->id){
  18
+                $tcourseids .= $teacher->course.',';
  19
+            }
  20
+        }
  21
+    }
  22
+
  23
+    $taught_courses = array();
  24
+  	if (!empty($tcourseids)) {
  25
+        $tcourseids = substr($tcourseids,0,-1);
  26
+        $taught_courses = get_records_list('course', 'id', $tcourseids);
  27
+    }
12 28
 
13  
-    $taught_courses = get_my_courses($USER->id,"visible DESC,sortorder ASC",0,1);
14 29
     if (!empty($creator)) {
15 30
         $cat_courses = get_courses($course->category);
16 31
     } else {
@@ -26,6 +41,11 @@
26 41
         }
27 42
     }
28 43
 
  44
+    if (empty($options) && empty($creator)) {
  45
+        notify(get_string('courseimportnotaught'));
  46
+        return; // yay , this will pass control back to the file that included or required us.
  47
+    }
  48
+
29 49
     $fm = '<form method="post" action="'.$CFG->wwwroot.'/course/import/activities/index.php"><input type="hidden" name="id" value="'.$course->id.'" />';
30 50
     $submit = '<input type="submit" value="'.get_string('usethiscourse').'" /></form>';
31 51
 

0 notes on commit 7d52587

Please sign in to comment.
Something went wrong with that request. Please try again.