diff --git a/admin/index.php b/admin/index.php
index 4eeb9585313..f5a1f09255e 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -360,7 +360,6 @@
$table->data[0][0] .= "
dbtype/frame.php\">".get_string("managedatabase")."
";
}
$table->data[0][1] = "".get_string("coursemanagement")."
".
- "".get_string("addnewcourse")."
";
$table->data[0][1] .= "id\">".get_string("courserestore")."
";
if ($CFG->auth == "email" || $CFG->auth == "none" || $CFG->auth == "manual") {
$table->data[0][2] = "".get_string("addnewuser")."
";
diff --git a/course/category.php b/course/category.php
index 791d2806733..0554ee1e7f6 100644
--- a/course/category.php
+++ b/course/category.php
@@ -54,13 +54,12 @@
$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",
"admin/index.php\">$stradministration -> ".
- "$strcoursemanagement -> $category->name",
+ "$strcategories -> $category->name",
"", "", true, $updatebutton);
} else {
print_header("$site->shortname: $category->name", "$site->fullname",
@@ -90,18 +89,30 @@
/// 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);
}
}
@@ -187,7 +198,7 @@
} 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");
@@ -205,12 +216,13 @@
}
+ echo "";
echo "
";
}
+
if ($adminediting) {
- /// First print form to rename the category
- $strrename= get_string("rename");
- print_simple_box_start("center");
echo "";
+
+ /// Print link to create a new course
+ unset($options);
+ $option["category"] = $category->id;
+ print_single_button("edit.php", $options, get_string("addnewcourse"), "get");
+ echo "
";
+
+ /// Print form to rename the category
+ $strrename= get_string("rename");
echo "";
echo "";
- print_simple_box_end();
echo "
";
}
diff --git a/course/delete.php b/course/delete.php
index 19c3340f50b..d0cee3315b5 100644
--- a/course/delete.php
+++ b/course/delete.php
@@ -3,7 +3,7 @@
require_once("../config.php");
- optional_variable($id); // course id
+ require_variable($id); // course id
optional_variable($delete); // delete confirmation
require_login();
@@ -18,37 +18,23 @@
$strdeletecourse = get_string("deletecourse");
$stradministration = get_string("administration");
- $strcoursemanagement = get_string("coursemanagement");
-
- if (!$id) {
- print_header("$site->shortname: $strdeletecourse", $site->fullname,
- "admin/index.php\">$stradministration -> $strdeletecourse");
-
- if ($courses = get_courses()) {
- print_heading(get_string("choosecourse"));
- print_simple_box_start("CENTER");
- foreach ($courses as $course) {
- echo "id\">$course->fullname ($course->shortname)
";
- }
- 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,
"admin/index.php\">$stradministration -> ".
- "category\">$strcoursemanagement -> ".
+ "$strcategories -> ".
+ "category\">$category->name -> ".
"$strdeletecheck");
notice_yesno("$strdeletecoursecheck
$course->fullname ($course->shortname)",
@@ -66,7 +52,8 @@
print_header("$site->shortname: $strdeletingcourse", $site->fullname,
"admin/index.php\">$stradministration -> ".
- "category\">$strcoursemanagement -> ".
+ "$strcategories -> ".
+ "category\">$category->name -> ".
"$strdeletingcourse");
print_heading($strdeletingcourse);
diff --git a/course/edit.php b/course/edit.php
index 3fee94c5c6d..d2e3be879a5 100644
--- a/course/edit.php
+++ b/course/edit.php
@@ -5,6 +5,7 @@
require_once("lib.php");
optional_variable($id, 0); // course id
+ optional_variable($category, 0); // category id
require_login();
@@ -116,7 +117,7 @@
$form->numsections = 10;
$form->newsitems = 5;
$form->showrecent = 1;
- $form->category = 0;
+ $form->category = $category;
$form->id = "";
$form->visible = 1;
}
@@ -137,15 +138,16 @@
$streditcoursesettings = get_string("editcoursesettings");
$straddnewcourse = get_string("addnewcourse");
$stradministration = get_string("administration");
+ $strcategories = get_string("categories");
if (!empty($course)) {
print_header($streditcoursesettings, "$course->fullname",
- "wwwroot/course/view.php?id=$course->id\">$course->shortname
+ "wwwroot/course/view.php?id=$course->id\">$course->shortname
-> $streditcoursesettings", $focus);
} else {
print_header("$site->shortname: $straddnewcourse", "$site->fullname",
- "admin/index.php\">$stradministration
- -> $straddnewcourse", $focus);
+ "admin/index.php\">$stradministration -> ".
+ "$strcategories -> $straddnewcourse", $focus);
}
print_heading($streditcoursesettings);
diff --git a/course/index.php b/course/index.php
index 17fe8e45ca6..73cb0c5f036 100644
--- a/course/index.php
+++ b/course/index.php
@@ -59,14 +59,13 @@
$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",
- "admin/index.php\">$stradministration -> $strcoursemanagement",
+ "admin/index.php\">$stradministration -> $strcategories",
"addform.addcategory", "", true, update_categories_button());
print_heading($strcategories);
@@ -221,14 +220,12 @@
/// Print form for creating new categories
- print_simple_box_start("center");
echo "";
echo "";
echo "";
- print_simple_box_end();
echo "
";
@@ -255,7 +252,15 @@
print_category_edit(NULL, $displaylist, $parentlist);
echo "";
+ echo "
";
+ echo "";
+ /// Print link to create a new course
+ unset($options);
+ $option["category"] = $category->id;
+ print_single_button("edit.php", $options, get_string("addnewcourse"), "get");
+ echo "
";
+ echo "";
print_footer();
diff --git a/course/lib.php b/course/lib.php
index 264911d8860..f6982eb7031 100644
--- a/course/lib.php
+++ b/course/lib.php
@@ -715,8 +715,6 @@ function print_admin_links ($siteid, $width=180) {
if (iscreator()) {
$moddata[]="wwwroot/course/index.php?edit=on\">".get_string("coursemanagement")."";
$modicon[]=$icon;
- $moddata[]="wwwroot/course/edit.php\">".get_string("addnewcourse")."";
- $modicon[]=$icon;
$fulladmin = "";
}
if (isadmin()) {
diff --git a/lang/en/moodle.php b/lang/en/moodle.php
index c82c1f59889..dabb3eccf43 100644
--- a/lang/en/moodle.php
+++ b/lang/en/moodle.php
@@ -125,6 +125,8 @@ $string['course'] = "Course";
$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";
@@ -461,11 +463,12 @@ $string['move'] = "Move";
$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";