]> git.mjollnir.org Git - moodle.git/commitdiff
My Courses is now shown in the course side block if the user is not
authormoodler <moodler>
Sat, 9 Aug 2003 17:17:21 +0000 (17:17 +0000)
committermoodler <moodler>
Sat, 9 Aug 2003 17:17:21 +0000 (17:17 +0000)
an admin.

Also, this block now appears on course main pages (under admin).

course/format/social.php
course/format/topics.php
course/format/weeks.php
course/lib.php

index 7188f7e6ca36e0e15309e2849041d048c92d9e1e..a62297d0739431e7b1448e890cfb7adb056b4399 100644 (file)
@@ -48,6 +48,9 @@
 /// Admin links and controls
       print_course_admin_links($course);
 
+/// My courses
+      print_courses_sideblock(0, "$leftwidth");
+
       echo "</td>";
 
       echo "<td width=\"*\" valign=\"top\">";
index 5709bab198bf3e1c02e34928f8c3b0aca17b6f59..d2c5df4a90817d6c2920aded5df1806455a04e75 100644 (file)
@@ -84,6 +84,9 @@
 /// Admin links and controls
     print_course_admin_links($course);
 
+/// My courses
+    print_courses_sideblock(0, "180");
+
 /// Start main column
     echo "</td><td width=\"*\">";
 
index b94ed727236085b180315ba362aa3d7637edee6b..686a56fa84a8caf5c7372f44685f3e6db0ec6a18 100644 (file)
@@ -73,6 +73,8 @@
 /// Admin links and controls
     print_course_admin_links($course);
 
+/// My courses
+    print_courses_sideblock(0, "180");
 
 /// Start main column
     echo "</td><td width=\"*\">";
index f6982eb70317fcb5b31f465341777d88e1cafe5c..c5ee595a4ec311b604cbb8ca0b4b9d6a3759d178 100644 (file)
@@ -944,7 +944,7 @@ function print_category_info($category, $depth) {
 }
 
 function print_courses_sideblock($category=0, $width="100%") {
-    global $CFG, $THEME;
+    global $CFG, $THEME, $USER;
 
     if (empty($THEME->custompix)) {
         $icon  = "<img src=\"$CFG->wwwroot/pix/i/course.gif\"".
@@ -954,6 +954,19 @@ function print_courses_sideblock($category=0, $width="100%") {
                  " height=\"16\" width=\"16\" alt=\"".get_string("course")."\">";
     }
 
+    if (isset($USER->id) and !isadmin()) {    // Just print My Courses
+        if ($courses = get_my_courses($USER->id)) {
+            foreach ($courses as $course) {
+                $moddata[]="<a $linkcss title=\"$course->shortname\" ".
+                           "href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->fullname</a>";
+                $modicon[]=$icon;
+            }
+            $fulllist = "<p><a href=\"$CFG->wwwroot/course/\">".get_string("fulllistofcourses")."</a>...";
+            print_side_block( get_string("mycourses"), "", $moddata, $modicon, $fulllist, $width);
+            return;
+        }
+    }
+
     $categories = get_categories(0);  // Parent = 0   ie top-level categories only
     if (count($categories) > 1) {     // Just print top level category links
         foreach ($categories as $category) {
@@ -980,7 +993,7 @@ function print_courses_sideblock($category=0, $width="100%") {
         }
     }
 
-    print_side_block(get_string("courses"), "", $moddata, $modicon, $fulllist, $width);
+    print_side_block( get_string("courses"), "", $moddata, $modicon, $fulllist, $width);
 }