$table->data[0][0] .= "<p><a href=\"$CFG->dbtype/frame.php\">".get_string("managedatabase")."</a></p>";
}
$table->data[0][1] = "<p><a href=\"../course/index.php?edit=on\">".get_string("coursemanagement")."</a></p>".
- "<p><a href=\"../course/edit.php\">".get_string("addnewcourse")."</a></p>";
$table->data[0][1] .= "<p><a href=\"../files/index.php?id=$site->id\">".get_string("courserestore")."</a></p>";
if ($CFG->auth == "email" || $CFG->auth == "none" || $CFG->auth == "manual") {
$table->data[0][2] = "<p><a href=\"user.php?newuser=true\">".get_string("addnewuser")."</a></p>";
$strcategories = get_string("categories");
$strcategory = get_string("category");
$strcourses = get_string("courses");
- $strcoursemanagement = get_string("coursemanagement");
if ($creatorediting) {
if ($adminediting) {
print_header("$site->shortname: $category->name", "$site->fullname",
"<a href=\"../$CFG->admin/index.php\">$stradministration</a> -> ".
- "<a href=\"index.php\">$strcoursemanagement</a> -> $category->name",
+ "<a href=\"index.php\">$strcategories</a> -> $category->name",
"", "", true, $updatebutton);
} else {
print_header("$site->shortname: $category->name", "$site->fullname",
/// Move a specified course to a new category
- if (isset($move) and isset($moveto)) {
- if (! $course = get_record("course", "id", $move)) {
- notify("Error finding the course");
- } else if (! $destcategory = get_record("course_categories", "id", $moveto)) {
- notify("Error finding the category");
- } else {
- if (!set_field("course", "category", $destcategory->id, "id", $course->id)) {
- notify("An error occurred - course not moved!");
+ if ($data = data_submitted()) { // Some courses are being moved
+
+ 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);
+ }
}
- fix_course_sortorder($destcategory->id);
- fix_course_sortorder($category->id);
- $category = get_record("course_categories", "id", $category->id);
}
}
} else {
$strcourses = get_string("courses");
- $strmovecourseto = get_string("movecourseto");
+ $strmove = get_string("move");
$stredit = get_string("edit");
$strdelete = get_string("delete");
$strbackup = get_string("backup");
}
+ echo "<form action=category.php method=post>";
echo "<table align=\"center\" border=0 cellspacing=2 cellpadding=4 class=\"generalbox\"><tr>";
echo "<th>$strcourses</th>";
if ($creatorediting) {
echo "<th>$stredit</th>";
if ($adminediting) {
- echo "<th>$strmovecourseto</th>";
+ echo "<th>$strmove</th>";
}
}
echo "</tr>";
$numcourses = count($courses);
$count = 0;
+ $abletomovecourses = false; // for now
foreach ($courses as $course) {
$count++;
}
echo "</td>";
- echo "<td>";
- popup_form ("category.php?id=$category->id&move=$course->id&moveto=", $displaylist,
- "moveform$course->id", "$course->category", "", "", "", false);
+ echo "<td align=\"center\">";
+ echo "<input type=\"checkbox\" name=\"c$course->id\">";
+ $abletomovecourses = true;
+
} else if (isteacher($course->id)) {
+ echo "<td>";
echo "<a title=\"$strassignteachers\" href=\"$CFG->wwwroot/$CFG->admin/teacher.php?id=$course->id\"><img".
" src=\"$pixpath/t/user.gif\" height=11 width=11 border=0></a> ";
}
- echo "</td>";
+ echo "</td>";
}
echo "</tr>";
}
+
+ if ($abletomovecourses) {
+ echo "<tr><td colspan=3 align=right>";
+ echo "<br />";
+ choose_from_menu ($displaylist, "moveto", "", get_string("moveselectedcoursesto"), "");
+ echo "<input type=\"hidden\" name=\"id\" value=\"$category->id\">";
+ echo "<input type=\"submit\" value=\"".get_string("move")."\">";
+ echo "</td></tr>";
+ }
echo "</table>";
+ echo "</form>";
echo "<br />";
}
+
if ($adminediting) {
- /// First print form to rename the category
- $strrename= get_string("rename");
- print_simple_box_start("center");
echo "<center>";
+
+ /// Print link to create a new course
+ unset($options);
+ $option["category"] = $category->id;
+ print_single_button("edit.php", $options, get_string("addnewcourse"), "get");
+ echo "<br />";
+
+ /// 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>";
- print_simple_box_end();
echo "<br />";
}
require_once("../config.php");
- optional_variable($id); // course id
+ require_variable($id); // course id
optional_variable($delete); // delete confirmation
require_login();
$strdeletecourse = get_string("deletecourse");
$stradministration = get_string("administration");
- $strcoursemanagement = get_string("coursemanagement");
-
- if (!$id) {
- print_header("$site->shortname: $strdeletecourse", $site->fullname,
- "<A HREF=\"../$CFG->admin/index.php\">$stradministration</A> -> $strdeletecourse");
-
- if ($courses = get_courses()) {
- print_heading(get_string("choosecourse"));
- print_simple_box_start("CENTER");
- foreach ($courses as $course) {
- echo "<A HREF=\"delete.php?id=$course->id\">$course->fullname ($course->shortname)</A><BR>";
- }
- print_simple_box_end();
- } else {
- print_heading(get_string("nocoursesyet"));
- print_continue("../$CFG->admin/index.php");
- }
- print_footer();
- exit;
- }
+ $strcategories = get_string("categories");
if (! $course = get_record("course", "id", $id)) {
error("Course ID was incorrect (can't find it)");
}
+ $category = get_record("course_categories", "id", $course->category);
+
if (! $delete) {
$strdeletecheck = get_string("deletecheck", "", $course->shortname);
$strdeletecoursecheck = get_string("deletecoursecheck");
+
+
print_header("$site->shortname: $strdeletecheck", $site->fullname,
"<a href=\"../$CFG->admin/index.php\">$stradministration</a> -> ".
- "<a href=\"category.php?id=$course->category\">$strcoursemanagement</a> -> ".
+ "<a href=\"index.php\">$strcategories</a> -> ".
+ "<a href=\"category.php?id=$course->category\">$category->name</a> -> ".
"$strdeletecheck");
notice_yesno("$strdeletecoursecheck<BR><BR>$course->fullname ($course->shortname)",
print_header("$site->shortname: $strdeletingcourse", $site->fullname,
"<a href=\"../$CFG->admin/index.php\">$stradministration</a> -> ".
- "<a href=\"category.php?id=$course->category\">$strcoursemanagement</a> -> ".
+ "<a href=\"index.php\">$strcategories</a> -> ".
+ "<a href=\"category.php?id=$course->category\">$category->name</a> -> ".
"$strdeletingcourse");
print_heading($strdeletingcourse);
require_once("lib.php");
optional_variable($id, 0); // course id
+ optional_variable($category, 0); // category id
require_login();
$form->numsections = 10;
$form->newsitems = 5;
$form->showrecent = 1;
- $form->category = 0;
+ $form->category = $category;
$form->id = "";
$form->visible = 1;
}
$streditcoursesettings = get_string("editcoursesettings");
$straddnewcourse = get_string("addnewcourse");
$stradministration = get_string("administration");
+ $strcategories = get_string("categories");
if (!empty($course)) {
print_header($streditcoursesettings, "$course->fullname",
- "<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A>
+ "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a>
-> $streditcoursesettings", $focus);
} else {
print_header("$site->shortname: $straddnewcourse", "$site->fullname",
- "<A HREF=\"../$CFG->admin/index.php\">$stradministration</A>
- -> $straddnewcourse", $focus);
+ "<a href=\"../$CFG->admin/index.php\">$stradministration</a> -> ".
+ "<a href=\"index.php\">$strcategories</a> -> $straddnewcourse", $focus);
}
print_heading($streditcoursesettings);
$strcategories = get_string("categories");
$strcategory = get_string("category");
$strcourses = get_string("courses");
- $strcoursemanagement = get_string("coursemanagement");
$stredit = get_string("edit");
$strdelete = get_string("delete");
$straction = get_string("action");
$straddnewcategory = get_string("addnewcategory");
print_header("$site->shortname: $strcategories", "$site->fullname",
- "<a href=\"../$CFG->admin/index.php\">$stradministration</a> -> $strcoursemanagement",
+ "<a href=\"../$CFG->admin/index.php\">$stradministration</a> -> $strcategories",
"addform.addcategory", "", true, update_categories_button());
print_heading($strcategories);
/// Print form for creating new categories
- print_simple_box_start("center");
echo "<center>";
echo "<form name=\"addform\" action=\"index.php\" method=\"post\">";
echo "<input type=\"text\" size=30 name=\"addcategory\">";
echo "<input type=\"submit\" value=\"$straddnewcategory\">";
echo "</form>";
echo "</center>";
- print_simple_box_end();
echo "<br />";
print_category_edit(NULL, $displaylist, $parentlist);
echo "</table>";
+ echo "<br />";
+ echo "<center>";
+ /// Print link to create a new course
+ unset($options);
+ $option["category"] = $category->id;
+ print_single_button("edit.php", $options, get_string("addnewcourse"), "get");
+ echo "<br />";
+ echo "</center>";
print_footer();
if (iscreator()) {
$moddata[]="<a href=\"$CFG->wwwroot/course/index.php?edit=on\">".get_string("coursemanagement")."</a>";
$modicon[]=$icon;
- $moddata[]="<a href=\"$CFG->wwwroot/course/edit.php\">".get_string("addnewcourse")."</a>";
- $modicon[]=$icon;
$fulladmin = "";
}
if (isadmin()) {
$string['courseavailable'] = "This course is available to students";
$string['courseavailablenot'] = "This course is not available to students";
$string['coursebackup'] = "Course backup";
+$string['coursecategories'] = "Course categories";
+$string['coursecategory'] = "Course category";
$string['coursecreators'] = "Course creators";
$string['courseinfo'] = "Course info";
$string['coursefiles'] = "Course files";
$string['movecategoryto'] = "Move category to:";
$string['movecourseto'] = "Move course to:";
$string['movedown'] = "Move down";
+$string['movefilestohere'] = "Move files to here";
$string['movefull'] = "Move \$a to this location";
$string['movehere'] = "Move to here";
-$string['moveup'] = "Move up";
+$string['moveselectedcoursesto'] = "Move selected courses to...";
$string['movetoanotherfolder'] = "Move to another folder";
-$string['movefilestohere'] = "Move files to here";
+$string['moveup'] = "Move up";
$string['mustconfirm'] = "You need to confirm your login";
$string['mycourses'] = "My courses";
$string['name'] = "Name";