Also, category fix_sorting is done better now when a course is added.
}
- 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();
$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)");
$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
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");