2003-07-30 13:02:45 +00:00
|
|
|
<?PHP // $Id$
|
2003-08-07 16:01:31 +00:00
|
|
|
// Displays the top level category or all courses
|
|
|
|
// In editing mode, allows the admin to edit a category,
|
|
|
|
// and rearrange courses
|
2003-07-30 13:02:45 +00:00
|
|
|
|
|
|
|
require_once("../config.php");
|
|
|
|
require_once("lib.php");
|
|
|
|
|
|
|
|
require_variable($id); // Category id
|
2003-08-21 09:33:07 +00:00
|
|
|
optional_variable($page, "0"); // which page to show
|
|
|
|
optional_variable($perpage, "20"); // how many per page
|
2003-07-30 13:02:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
if (!$site = get_site()) {
|
|
|
|
error("Site isn't defined!");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!$category = get_record("course_categories", "id", $id)) {
|
|
|
|
error("Category not known!");
|
|
|
|
}
|
|
|
|
|
2003-08-07 16:01:31 +00:00
|
|
|
if (iscreator()) {
|
|
|
|
if (isset($_GET['edit'])) {
|
|
|
|
if ($edit == "on") {
|
2003-12-30 17:18:06 +00:00
|
|
|
$USER->categoryediting = true;
|
2003-08-07 16:01:31 +00:00
|
|
|
} else if ($edit == "off") {
|
2003-12-30 17:18:06 +00:00
|
|
|
$USER->categoryediting = false;
|
2003-08-07 16:01:31 +00:00
|
|
|
}
|
|
|
|
}
|
2003-08-21 16:24:29 +00:00
|
|
|
$navbaritem = update_category_button($category->id);
|
2003-07-30 13:02:45 +00:00
|
|
|
|
2003-12-30 17:18:06 +00:00
|
|
|
$creatorediting = !empty($USER->categoryediting);
|
2003-08-07 16:01:31 +00:00
|
|
|
$adminediting = (isadmin() and $creatorediting);
|
2003-07-30 13:02:45 +00:00
|
|
|
|
2003-08-07 16:01:31 +00:00
|
|
|
} else {
|
2004-03-20 12:21:08 +00:00
|
|
|
if (!$category->visible) {
|
|
|
|
error(get_string('notavailable', 'error'));
|
|
|
|
}
|
2003-08-21 16:24:29 +00:00
|
|
|
$navbaritem = print_course_search("", true, "navbar");
|
2003-08-07 16:01:31 +00:00
|
|
|
$adminediting = false;
|
2003-08-29 11:48:34 +00:00
|
|
|
$creatorediting = false;
|
2003-08-07 16:01:31 +00:00
|
|
|
}
|
2003-07-30 13:02:45 +00:00
|
|
|
|
|
|
|
|
2003-08-11 07:48:03 +00:00
|
|
|
if (isadmin()) {
|
|
|
|
/// Rename the category if requested
|
|
|
|
if (!empty($_POST['rename'])) {
|
|
|
|
$category->name = $_POST['rename'];
|
|
|
|
if (! set_field("course_categories", "name", $category->name, "id", $category->id)) {
|
|
|
|
notify("An error occurred while renaming the category");
|
|
|
|
}
|
2003-07-30 13:02:45 +00:00
|
|
|
}
|
|
|
|
|
2003-08-11 07:48:03 +00:00
|
|
|
/// Resort the category if requested
|
2003-08-11 05:24:48 +00:00
|
|
|
|
2003-08-11 07:48:03 +00:00
|
|
|
if (!empty($_GET['resort'])) {
|
|
|
|
fix_course_sortorder($category->id, "fullname ASC");
|
|
|
|
}
|
2003-08-11 05:24:48 +00:00
|
|
|
}
|
|
|
|
|
2003-08-07 16:01:31 +00:00
|
|
|
|
|
|
|
/// Print headings
|
|
|
|
|
|
|
|
$numcategories = count_records("course_categories");
|
|
|
|
|
|
|
|
$stradministration = get_string("administration");
|
|
|
|
$strcategories = get_string("categories");
|
|
|
|
$strcategory = get_string("category");
|
|
|
|
$strcourses = get_string("courses");
|
|
|
|
|
|
|
|
if ($creatorediting) {
|
|
|
|
if ($adminediting) {
|
2004-02-20 12:59:12 +00:00
|
|
|
print_header("$site->shortname: $category->name", "$site->fullname: $strcourses",
|
2003-08-07 16:01:31 +00:00
|
|
|
"<a href=\"../$CFG->admin/index.php\">$stradministration</a> -> ".
|
2003-08-09 16:53:30 +00:00
|
|
|
"<a href=\"index.php\">$strcategories</a> -> $category->name",
|
2003-08-22 12:26:36 +00:00
|
|
|
"", "", true, $navbaritem);
|
2003-08-07 16:01:31 +00:00
|
|
|
} else {
|
2004-02-20 12:59:12 +00:00
|
|
|
print_header("$site->shortname: $category->name", "$site->fullname: $strcourses",
|
2004-02-20 12:56:17 +00:00
|
|
|
"<a href=\"index.php\">$strcategories</a> -> $category->name", "", "", true, $navbaritem);
|
2003-08-07 16:01:31 +00:00
|
|
|
}
|
|
|
|
} else {
|
2004-02-20 12:59:12 +00:00
|
|
|
print_header("$site->shortname: $category->name", "$site->fullname: $strcourses",
|
2004-02-20 12:56:17 +00:00
|
|
|
"<a href=\"index.php\">$strcategories</a> -> $category->name", "", "", true, $navbaritem);
|
2003-08-07 16:01:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-07-30 13:02:45 +00:00
|
|
|
/// Print the category selector
|
|
|
|
|
|
|
|
$displaylist = array();
|
|
|
|
$parentlist = array();
|
|
|
|
|
|
|
|
make_categories_list($displaylist, $parentlist, "");
|
|
|
|
|
2004-02-20 12:56:17 +00:00
|
|
|
echo "<table align=center><tr><td align=\"right\">";
|
|
|
|
echo "<p>$strcategories:</p>";
|
|
|
|
echo "</td><td>";
|
2003-07-30 13:02:45 +00:00
|
|
|
popup_form("category.php?id=", $displaylist, "switchcategory", "$category->id", "", "", "", false);
|
|
|
|
echo "</td></tr></table><br />";
|
|
|
|
|
|
|
|
|
2003-08-07 16:01:31 +00:00
|
|
|
/// Editing functions
|
2003-07-30 13:02:45 +00:00
|
|
|
|
2003-08-07 16:01:31 +00:00
|
|
|
if ($adminediting) {
|
2003-07-30 13:02:45 +00:00
|
|
|
|
2003-08-07 16:01:31 +00:00
|
|
|
/// Move a specified course to a new category
|
2003-07-30 13:02:45 +00:00
|
|
|
|
2003-08-11 02:07:17 +00:00
|
|
|
if (isset($moveto) and $data = data_submitted()) { // Some courses are being moved
|
2003-08-09 16:53:30 +00:00
|
|
|
|
|
|
|
if (! $destcategory = get_record("course_categories", "id", $data->moveto)) {
|
|
|
|
error("Error finding the category");
|
|
|
|
}
|
|
|
|
|
|
|
|
unset($data->moveto);
|
|
|
|
unset($data->id);
|
|
|
|
|
|
|
|
if ($data) {
|
|
|
|
foreach ($data as $code => $junk) {
|
|
|
|
$courseid = substr($code, 1);
|
|
|
|
|
|
|
|
if (! $course = get_record("course", "id", $courseid)) {
|
|
|
|
notify("Error finding course $courseid");
|
|
|
|
} else {
|
|
|
|
if (!set_field("course", "category", $destcategory->id, "id", $course->id)) {
|
|
|
|
notify("An error occurred - course not moved!");
|
|
|
|
}
|
|
|
|
fix_course_sortorder($destcategory->id);
|
|
|
|
fix_course_sortorder($category->id);
|
|
|
|
$category = get_record("course_categories", "id", $category->id);
|
|
|
|
}
|
2003-08-07 16:01:31 +00:00
|
|
|
}
|
2003-07-30 13:02:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-08-07 16:01:31 +00:00
|
|
|
/// Hide or show a course
|
|
|
|
|
|
|
|
if (isset($hide) or isset($show)) {
|
|
|
|
if (isset($hide)) {
|
|
|
|
$course = get_record("course", "id", $hide);
|
|
|
|
$visible = 0;
|
|
|
|
} else {
|
|
|
|
$course = get_record("course", "id", $show);
|
|
|
|
$visible = 1;
|
|
|
|
}
|
|
|
|
if ($course) {
|
|
|
|
if (! set_field("course", "visible", $visible, "id", $course->id)) {
|
|
|
|
notify("Could not update that course!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-07-30 13:02:45 +00:00
|
|
|
|
|
|
|
|
2003-08-07 16:01:31 +00:00
|
|
|
/// Move a course up or down
|
2003-07-30 13:02:45 +00:00
|
|
|
|
2003-08-07 16:01:31 +00:00
|
|
|
if (isset($moveup) or isset($movedown)) {
|
2003-07-30 13:02:45 +00:00
|
|
|
|
2003-08-07 16:01:31 +00:00
|
|
|
$movecourse = NULL;
|
|
|
|
$swapcourse = NULL;
|
2003-07-30 13:02:45 +00:00
|
|
|
|
2003-08-07 16:01:31 +00:00
|
|
|
$courses = get_courses($category->id);
|
2003-07-30 13:02:45 +00:00
|
|
|
|
|
|
|
if (isset($moveup)) {
|
2003-08-07 16:01:31 +00:00
|
|
|
if ($movecourse = get_record("course", "id", $moveup)) {
|
|
|
|
foreach ($courses as $course) {
|
|
|
|
if ($course->id == $movecourse->id) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
$swapcourse = $course;
|
|
|
|
}
|
|
|
|
}
|
2003-07-30 13:02:45 +00:00
|
|
|
}
|
2003-08-07 16:01:31 +00:00
|
|
|
if (isset($movedown)) {
|
|
|
|
if ($movecourse = get_record("course", "id", $movedown)) {
|
|
|
|
$choosenext = false;
|
|
|
|
foreach ($courses as $course) {
|
|
|
|
if ($choosenext) {
|
|
|
|
$swapcourse = $course;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if ($course->id == $movecourse->id) {
|
|
|
|
$choosenext = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($swapcourse and $movecourse) { // Renumber everything for robustness
|
|
|
|
$count=0;
|
|
|
|
foreach ($courses as $course) {
|
|
|
|
$count++;
|
|
|
|
if ($course->id == $swapcourse->id) {
|
|
|
|
$course = $movecourse;
|
|
|
|
} else if ($course->id == $movecourse->id) {
|
|
|
|
$course = $swapcourse;
|
|
|
|
}
|
|
|
|
if (! set_field("course", "sortorder", $count, "id", $course->id)) {
|
|
|
|
notify("Could not update that course!");
|
|
|
|
}
|
|
|
|
}
|
2003-07-30 13:02:45 +00:00
|
|
|
}
|
|
|
|
}
|
2003-08-07 16:01:31 +00:00
|
|
|
|
|
|
|
fix_course_sortorder($category->id);
|
|
|
|
|
|
|
|
} // End of editing stuff
|
2003-07-30 13:02:45 +00:00
|
|
|
|
2003-08-11 13:02:45 +00:00
|
|
|
/// Print out all the sub-categories
|
|
|
|
|
|
|
|
if ($subcategories = get_records("course_categories", "parent", $category->id)) {
|
2004-03-20 12:21:08 +00:00
|
|
|
$firstentry = true;
|
2003-08-11 13:02:45 +00:00
|
|
|
foreach ($subcategories as $subcategory) {
|
2004-03-20 12:21:08 +00:00
|
|
|
if ($subcategory->visible or iscreator()) {
|
|
|
|
if ($firstentry) {
|
|
|
|
echo "<table align=\"center\" border=0 cellspacing=2 cellpadding=4 class=\"generalbox\">";
|
|
|
|
echo "<tr><th>".get_string("subcategories")."</th></tr>";
|
|
|
|
echo "<tr><td nowrap>";
|
|
|
|
$firstentry = false;
|
|
|
|
}
|
|
|
|
$catlinkcss = $subcategory->visible ? "" : " class=\"dimmed\" ";
|
|
|
|
echo "<a $catlinkcss href=\"category.php?id=$subcategory->id\">$subcategory->name</a><br />";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!$firstentry) {
|
|
|
|
echo "</td></tr></table>";
|
|
|
|
echo "<br />";
|
2003-08-11 13:02:45 +00:00
|
|
|
}
|
|
|
|
}
|
2003-07-30 13:02:45 +00:00
|
|
|
|
2003-08-11 13:02:45 +00:00
|
|
|
|
2003-08-07 16:01:31 +00:00
|
|
|
/// Print out all the courses
|
2003-09-03 14:05:31 +00:00
|
|
|
$courses = get_courses_page($category->id, "c.sortorder ASC", "c.*", $totalcount, $page*$perpage, $perpage);
|
|
|
|
$numcourses = count($courses);
|
2003-07-30 13:02:45 +00:00
|
|
|
|
2003-09-10 17:36:15 +00:00
|
|
|
if (!$courses) {
|
2003-07-30 13:02:45 +00:00
|
|
|
print_heading(get_string("nocoursesyet"));
|
|
|
|
|
2003-10-07 03:29:44 +00:00
|
|
|
} else if ($numcourses <= COURSE_MAX_SUMMARIES_PER_PAGE and !$page and !$creatorediting) {
|
2003-09-03 14:05:31 +00:00
|
|
|
print_courses($category, "80%");
|
2003-07-30 13:02:45 +00:00
|
|
|
|
2003-09-03 14:05:31 +00:00
|
|
|
} else {
|
2003-08-21 09:33:07 +00:00
|
|
|
print_paging_bar($totalcount, $page, $perpage, "category.php?id=$category->id&perpage=$perpage&");
|
|
|
|
|
2003-08-07 16:01:31 +00:00
|
|
|
$strcourses = get_string("courses");
|
2003-08-11 05:38:28 +00:00
|
|
|
$strselect = get_string("select");
|
2003-08-07 16:01:31 +00:00
|
|
|
$stredit = get_string("edit");
|
2003-07-30 13:02:45 +00:00
|
|
|
$strdelete = get_string("delete");
|
2003-08-07 16:01:31 +00:00
|
|
|
$strbackup = get_string("backup");
|
2003-08-15 08:50:35 +00:00
|
|
|
$strrestore = get_string("restore");
|
2003-07-30 13:02:45 +00:00
|
|
|
$strmoveup = get_string("moveup");
|
|
|
|
$strmovedown = get_string("movedown");
|
|
|
|
$strupdate = get_string("update");
|
|
|
|
$strhide = get_string("hide");
|
|
|
|
$strshow = get_string("show");
|
2003-08-29 11:48:34 +00:00
|
|
|
$strsummary = get_string("summary");
|
2003-08-07 16:01:31 +00:00
|
|
|
$strassignteachers = get_string("assignteachers");
|
2003-08-11 05:38:28 +00:00
|
|
|
$strallowguests = get_string("allowguests");
|
|
|
|
$strrequireskey = get_string("requireskey");
|
2003-07-30 13:02:45 +00:00
|
|
|
|
|
|
|
if (empty($THEME->custompix)) {
|
|
|
|
$pixpath = "$CFG->wwwroot/pix";
|
|
|
|
} else {
|
|
|
|
$pixpath = "$CFG->wwwroot/theme/$CFG->theme/pix";
|
|
|
|
}
|
2003-08-07 16:01:31 +00:00
|
|
|
|
2003-08-10 02:53:49 +00:00
|
|
|
echo "<form name=\"movecourses\" action=\"category.php\" method=\"post\">";
|
2003-08-07 16:01:31 +00:00
|
|
|
echo "<table align=\"center\" border=0 cellspacing=2 cellpadding=4 class=\"generalbox\"><tr>";
|
2003-07-30 13:02:45 +00:00
|
|
|
echo "<th>$strcourses</th>";
|
2003-08-07 16:01:31 +00:00
|
|
|
if ($creatorediting) {
|
|
|
|
echo "<th>$stredit</th>";
|
|
|
|
if ($adminediting) {
|
2003-08-11 05:38:28 +00:00
|
|
|
echo "<th>$strselect</th>";
|
2003-08-07 16:01:31 +00:00
|
|
|
}
|
2003-08-11 05:38:28 +00:00
|
|
|
} else {
|
|
|
|
echo "<th> </th>";
|
2003-08-07 16:01:31 +00:00
|
|
|
}
|
|
|
|
echo "</tr>";
|
|
|
|
|
2003-07-30 13:02:45 +00:00
|
|
|
|
|
|
|
$count = 0;
|
2003-08-09 16:53:30 +00:00
|
|
|
$abletomovecourses = false; // for now
|
2003-07-30 13:02:45 +00:00
|
|
|
|
2004-02-21 03:26:04 +00:00
|
|
|
foreach ($courses as $acourse) {
|
2003-07-30 13:02:45 +00:00
|
|
|
$count++;
|
|
|
|
$up = ($count == 1) ? false : true;
|
|
|
|
$down = ($count == $numcourses) ? false : true;
|
|
|
|
|
2004-02-21 03:26:04 +00:00
|
|
|
$linkcss = $acourse->visible ? "" : " class=\"dimmed\" ";
|
2003-07-30 13:02:45 +00:00
|
|
|
echo "<tr>";
|
2004-02-21 03:26:04 +00:00
|
|
|
echo "<td><a $linkcss href=\"view.php?id=$acourse->id\">$acourse->fullname</a></td>";
|
2003-08-07 16:01:31 +00:00
|
|
|
if ($creatorediting) {
|
|
|
|
if ($adminediting) {
|
2003-08-22 12:26:36 +00:00
|
|
|
echo "<td>";
|
2004-02-21 03:26:04 +00:00
|
|
|
echo "<a title=\"$strassignteachers\" href=\"$CFG->wwwroot/course/teacher.php?id=$acourse->id\"><img".
|
2003-08-09 02:24:27 +00:00
|
|
|
" src=\"$pixpath/t/user.gif\" height=11 width=11 border=0></a> ";
|
2004-02-21 03:26:04 +00:00
|
|
|
echo "<a title=\"$strdelete\" href=\"delete.php?id=$acourse->id\"><img".
|
2003-08-07 16:01:31 +00:00
|
|
|
" src=\"$pixpath/t/delete.gif\" height=11 width=11 border=0></a> ";
|
2004-02-21 03:26:04 +00:00
|
|
|
if (!empty($acourse->visible)) {
|
|
|
|
echo "<a title=\"$strhide\" href=\"category.php?id=$category->id&hide=$acourse->id\"><img".
|
2003-08-07 16:01:31 +00:00
|
|
|
" src=\"$pixpath/t/hide.gif\" height=11 width=11 border=0></a> ";
|
|
|
|
} else {
|
2004-02-21 03:26:04 +00:00
|
|
|
echo "<a title=\"$strshow\" href=\"category.php?id=$category->id&show=$acourse->id\"><img".
|
2003-08-07 16:01:31 +00:00
|
|
|
" src=\"$pixpath/t/show.gif\" height=11 width=11 border=0></a> ";
|
|
|
|
}
|
2003-07-30 13:02:45 +00:00
|
|
|
|
2004-02-21 03:26:04 +00:00
|
|
|
echo "<a title=\"$strbackup\" href=\"../backup/backup.php?id=$acourse->id\"><img".
|
2003-08-07 16:01:31 +00:00
|
|
|
" src=\"$pixpath/t/backup.gif\" height=11 width=11 border=0></a> ";
|
2003-08-15 08:50:35 +00:00
|
|
|
|
2004-02-21 03:26:04 +00:00
|
|
|
echo "<a title=\"$strrestore\" href=\"../files/index.php?id=$acourse->id&wdir=/backupdata\"><img".
|
2003-08-15 08:50:35 +00:00
|
|
|
" src=\"$pixpath/t/restore.gif\" height=11 width=11 border=0></a> ";
|
2003-08-07 16:01:31 +00:00
|
|
|
|
|
|
|
if ($up) {
|
2004-02-21 03:26:04 +00:00
|
|
|
echo "<a title=\"$strmoveup\" href=\"category.php?id=$category->id&moveup=$acourse->id\"><img".
|
2003-08-07 16:01:31 +00:00
|
|
|
" src=\"$pixpath/t/up.gif\" height=11 width=11 border=0></a> ";
|
2003-08-15 10:11:22 +00:00
|
|
|
} else {
|
|
|
|
echo "<img src=\"$CFG->wwwroot/pix/spacer.gif\" height=11 width=11 border=0></a> ";
|
2003-08-07 16:01:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($down) {
|
2004-02-21 03:26:04 +00:00
|
|
|
echo "<a title=\"$strmovedown\" href=\"category.php?id=$category->id&movedown=$acourse->id\"><img".
|
2003-08-07 16:01:31 +00:00
|
|
|
" src=\"$pixpath/t/down.gif\" height=11 width=11 border=0></a> ";
|
2003-08-15 10:11:22 +00:00
|
|
|
} else {
|
|
|
|
echo "<img src=\"$CFG->wwwroot/pix/spacer.gif\" height=11 width=11 border=0></a> ";
|
2003-08-07 16:01:31 +00:00
|
|
|
}
|
|
|
|
|
2003-08-09 02:24:27 +00:00
|
|
|
echo "</td>";
|
2003-08-09 16:53:30 +00:00
|
|
|
echo "<td align=\"center\">";
|
2004-02-21 03:26:04 +00:00
|
|
|
echo "<input type=\"checkbox\" name=\"c$acourse->id\">";
|
2003-08-09 16:53:30 +00:00
|
|
|
$abletomovecourses = true;
|
|
|
|
|
2004-02-21 03:26:04 +00:00
|
|
|
} else if (isteacheredit($acourse->id)) {
|
2003-08-09 16:53:30 +00:00
|
|
|
echo "<td>";
|
2004-02-21 03:26:04 +00:00
|
|
|
echo "<a title=\"$strassignteachers\" href=\"$CFG->wwwroot/course/teacher.php?id=$acourse->id\"><img".
|
2003-08-09 02:24:27 +00:00
|
|
|
" src=\"$pixpath/t/user.gif\" height=11 width=11 border=0></a> ";
|
2003-08-11 05:38:28 +00:00
|
|
|
}
|
|
|
|
echo "</td>";
|
|
|
|
} else {
|
2003-09-03 14:05:31 +00:00
|
|
|
echo "<td align=\"right\">";
|
2004-02-21 03:26:04 +00:00
|
|
|
if ($acourse->guest ) {
|
|
|
|
echo "<a href=\"view.php?id=$acourse->id\"><img hspace=2 title=\"$strallowguests\" alt=\"\" height=16 width=16 border=0 src=\"$pixpath/i/user.gif\"></a>";
|
2003-08-11 05:38:28 +00:00
|
|
|
}
|
2004-02-21 03:26:04 +00:00
|
|
|
if ($acourse->password) {
|
|
|
|
echo "<a href=\"view.php?id=$acourse->id\"><img hspace=2 title=\"$strrequireskey\" alt=\"\" height=16 width=16 border=0 src=\"$pixpath/i/key.gif\"></a>";
|
2003-09-03 14:05:31 +00:00
|
|
|
}
|
2004-02-21 03:26:04 +00:00
|
|
|
if ($acourse->summary) {
|
|
|
|
link_to_popup_window ("/course/info.php?id=$acourse->id", "courseinfo",
|
2003-09-03 14:05:31 +00:00
|
|
|
"<img hspace=2 alt=\"info\" height=16 width=16 border=0 src=\"$pixpath/i/info.gif\">",
|
|
|
|
400, 500, $strsummary);
|
2003-08-11 05:38:28 +00:00
|
|
|
}
|
|
|
|
echo "</td>";
|
2003-07-30 13:02:45 +00:00
|
|
|
}
|
|
|
|
echo "</tr>";
|
|
|
|
}
|
2003-08-09 16:53:30 +00:00
|
|
|
|
|
|
|
if ($abletomovecourses) {
|
|
|
|
echo "<tr><td colspan=3 align=right>";
|
|
|
|
echo "<br />";
|
2003-08-09 17:31:33 +00:00
|
|
|
unset($displaylist[$category->id]);
|
2003-08-10 02:53:49 +00:00
|
|
|
choose_from_menu ($displaylist, "moveto", "", get_string("moveselectedcoursesto"), "javascript:document.movecourses.submit()");
|
2003-08-09 16:53:30 +00:00
|
|
|
echo "<input type=\"hidden\" name=\"id\" value=\"$category->id\">";
|
|
|
|
echo "</td></tr>";
|
|
|
|
}
|
2003-07-30 13:02:45 +00:00
|
|
|
|
|
|
|
echo "</table>";
|
2003-08-09 16:53:30 +00:00
|
|
|
echo "</form>";
|
2003-07-30 13:02:45 +00:00
|
|
|
echo "<br />";
|
|
|
|
}
|
|
|
|
|
2003-08-09 16:53:30 +00:00
|
|
|
|
2003-08-22 12:15:35 +00:00
|
|
|
echo "<center>";
|
2003-08-25 01:04:11 +00:00
|
|
|
if (isadmin() and $numcourses > 1) { /// Print button to re-sort courses by name
|
2003-08-11 05:24:48 +00:00
|
|
|
unset($options);
|
|
|
|
$options["id"] = $category->id;
|
|
|
|
$options["resort"] = "name";
|
|
|
|
print_single_button("category.php", $options, get_string("resortcoursesbyname"), "get");
|
2003-08-22 12:15:35 +00:00
|
|
|
}
|
2003-08-11 05:24:48 +00:00
|
|
|
|
2003-08-22 12:15:35 +00:00
|
|
|
if (iscreator()) { /// Print button to create a new course
|
2003-08-09 16:53:30 +00:00
|
|
|
unset($options);
|
2003-08-11 05:24:48 +00:00
|
|
|
$options["category"] = $category->id;
|
2003-08-09 16:53:30 +00:00
|
|
|
print_single_button("edit.php", $options, get_string("addnewcourse"), "get");
|
|
|
|
echo "<br />";
|
2003-08-22 12:15:35 +00:00
|
|
|
}
|
2003-08-09 16:53:30 +00:00
|
|
|
|
2003-08-22 12:15:35 +00:00
|
|
|
if (isadmin()) { /// Print form to rename the category
|
2003-08-09 16:53:30 +00:00
|
|
|
$strrename= get_string("rename");
|
2003-08-07 16:01:31 +00:00
|
|
|
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 "<br />";
|
|
|
|
}
|
2003-08-22 12:15:35 +00:00
|
|
|
echo "</center>";
|
2003-08-07 16:01:31 +00:00
|
|
|
|
2003-07-30 13:02:45 +00:00
|
|
|
print_footer();
|
|
|
|
|
|
|
|
?>
|