]> git.mjollnir.org Git - moodle.git/commitdiff
Put in buttons so that course creators can create courses! :-I
authormoodler <moodler>
Fri, 22 Aug 2003 12:15:35 +0000 (12:15 +0000)
committermoodler <moodler>
Fri, 22 Aug 2003 12:15:35 +0000 (12:15 +0000)
Also, category fix_sorting is done better now when a course is added.

course/category.php
course/edit.php
course/index.php

index 65e070173689f8a08614d5c102f3bcc3c76a8231..db2fe1525e8b2d90e6d4d38da94407bc0eedd28b 100644 (file)
     }
 
 
-    if (isadmin()) {
-        echo "<center>";
-
-    /// Print button to re-sort courses by name
+    echo "<center>";
+    if (isadmin()) {           /// Print button to re-sort courses by name
         unset($options);
         $options["id"] = $category->id;
         $options["resort"] = "name";
         print_single_button("category.php", $options, get_string("resortcoursesbyname"), "get");
+    }
 
-    /// Print button to create a new course
+    if (iscreator()) {         /// Print button to create a new course
         unset($options);
         $options["category"] = $category->id;
         print_single_button("edit.php", $options, get_string("addnewcourse"), "get");
         echo "<br />";
+    }
 
-    /// Print form to rename the category
+    if (isadmin()) {           /// Print form to rename the category
         $strrename= get_string("rename");
         echo "<form name=\"renameform\" action=\"category.php\" method=\"post\">";
         echo "<input type=\"hidden\" name=\"id\" value=\"$category->id\">";
         echo "<input type=\"text\" size=30 name=\"rename\" value=\"$category->name\">";
         echo "<input type=\"submit\" value=\"$strrename\">";
         echo "</form>";
-        echo "</center>";
         echo "<br />";
     }
+    echo "</center>";
     
     print_footer();
 
index e751f3d8f6db084b9e25b81335a17518c9343d7b..6b2da9b826fea621f7115b1cf9acdf884ff0b3cc 100644 (file)
 
             $form->timemodified = time();
 
-            fix_course_sortorder($form->category);
-
             if (!empty($course)) {
                 if (update_record("course", $form)) {
                     add_to_log($course->id, "course", "update", "edit.php?id=$id", "");
+                    fix_course_sortorder($form->category);
                            redirect("view.php?id=$course->id", get_string("changessaved"));
                 } else {
                     error("Serious Error! Could not update the course record! (id = $form->id)");
@@ -63,6 +62,7 @@
                     $section->section = 0;
                     $section->id = insert_record("course_sections", $section);
 
+                    fix_course_sortorder($form->category);
                     add_to_log($newcourseid, "course", "new", "view.php?id=$newcourseid", "");
 
                     if (isadmin()) { // Redirect admin to add teachers
index 995d4d0ecb212b358f05e1ee6d6d931c30287919..06c831771c20d5186cb81ab2852b488fb49d5086 100644 (file)
             print_header("$site->shortname: $strfulllistofcourses", $strfulllistofcourses, $strfulllistofcourses);
             print_courses(0, "80%");
         }
-    
+
+        if (iscreator()) {       // Print link to create a new course
+            echo "<center><p>";
+            unset($options);
+            $option["category"] = $category->id;
+            print_single_button("edit.php", $options, get_string("addnewcourse"), "get");
+            echo "</p></center>";
+        }
+            
         print_footer();
         exit;
     }
     echo "</table>";
     echo "<br />";
 
-    echo "<center>";
     /// Print link to create a new course
+    echo "<center>";
     unset($options);
     $option["category"] = $category->id;
     print_single_button("edit.php", $options, get_string("addnewcourse"), "get");