Put in buttons so that course creators can create courses! :-I

Also, category fix_sorting is done better now when a course is added.
This commit is contained in:
moodler
2003-08-22 12:15:35 +00:00
parent fcd0e8edc7
commit c432fd3213
3 changed files with 19 additions and 11 deletions
+7 -7
View File
@@ -353,31 +353,31 @@
}
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();
+2 -2
View File
@@ -45,11 +45,10 @@
$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
+10 -2
View File
@@ -41,7 +41,15 @@
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;
}
@@ -255,8 +263,8 @@
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");