+2002-09-09 Monday 00:13 martin
+
+ * lib/weblib.php:
+
+ Added height and width to smiley icons, to make emails look better
+ in circumstances where external images are blocked (eg some webmail
+ programs like squirrelmail).
+
+2002-09-09 Monday 00:04 martin
+
+ * mod/forum/lib.php:
+
+ Added an "unsubscribe" link to emails
+
+2002-09-08 Sunday 23:39 martin
+
+ * mod/forum/lib.php:
+
+ Fixed a bug. When replying to an email copy, you would be
+ forwarded to the login screen to login first. However, this was
+ being saved as the place to go back to after replying.
+
+ I added a check for this so now it behaves as you'd expect.
+
+2002-09-08 Sunday 17:47 martin
+
+ * mod/choice/mod.html:
+
+ Text window a bit bigger
+
+2002-09-08 Sunday 17:42 martin
+
+ * lang/en/choice.php, mod/choice/lib.php, mod/choice/mod.html,
+ mod/choice/report.php, mod/choice/version.php,
+ mod/choice/view.html, mod/choice/view.php:
+
+ Choices now support up to 6 choices. Backward compatible to
+ 2-choice format.
+
+2002-09-08 Sunday 17:41 martin
+
+ * course/: social.php, topics.php, weeks.php:
+
+ Tip over 'Edit profile' is the user's name
+
+2002-09-08 Sunday 17:22 martin
+
+ * lang/en/help/choice/options.html:
+
+ Help for choices
+
+2002-09-08 Sunday 13:29 martin
+
+ * course/: social.php, topics.php, weeks.php:
+
+ Clarified the "participants" link ...
+
+2002-09-08 Sunday 13:23 martin
+
+ * course/view.php:
+
+ Link at bottom now goes to site home, not this page
+
+2002-09-08 Sunday 13:15 martin
+
+ * course/teachers.php, lang/en/help/teachers.html:
+
+ Added documentation to the teachers page.
+
+2002-09-08 Sunday 13:15 martin
+
+ * lib/moodlelib.php:
+
+ Improved print_table() a bit (can now specify column widths)
+
+2002-09-08 Sunday 11:34 martin
+
+ * course/teachers.php:
+
+ Need this file to go with the previous changes!
+
+2002-09-08 Sunday 11:34 martin
+
+ * lang/en/moodle.php, user/index.php, user/lib.php:
+
+ Changes to improve display of teachers
+
+2002-09-08 Sunday 11:24 martin
+
+ * version.php, course/edit.html, course/edit.php, course/lib.php,
+ course/social.php, course/topics.php, course/weeks.php,
+ lang/en/moodle.php, lib/moodlelib.php, lib/db/mysql.sql,
+ user/index.php:
+
+ Changes to allow much better control over what "teachers" are
+ called in a course. Firstly, the course settings page now allows
+ the teachers to specify the word they want to use in place of
+ "teachers" and "students" as well as "teacher" and "student".
+ Secondly, a new teacher admin tool allows any teacher to modify the
+ order and displayed role of teachers in that course. This affects
+ the display on the course listings, the participants page and so
+ on.
+
+2002-09-07 Saturday 22:57 martin
+
+ * admin/lang.php, lang/en/moodle.php, lib/moodlelib.php:
+
+ Improvements to the language checker. As well as checking for
+ missing strings, you can now see the current language compared
+ side-by-side with English.
+
+2002-09-07 Saturday 22:56 martin
+
+ * admin/index.php:
+
+ Add a link if a "manage database" directory exists
+
+2002-09-07 Saturday 13:01 martin
+
+ * mod/newmodule_template.zip:
+
+ Slight update to README
+
+2002-09-07 Saturday 11:54 martin
+
+ * mod/newmodule_template.zip:
+
+ Added a README that explains the process
+
+2002-09-07 Saturday 11:31 martin
+
+ * mod/: README, newmodule_template.zip:
+
+ Added a template for new modules that contains the bare
+ necessities.
+
+2002-09-06 Friday 23:17 martin
+
+ * version.php:
+
+ Checking in the current release number for CVS users
+
+2002-09-06 Friday 23:10 martin
+
+ * user/view.php:
+
+ Don't try and print the last access date if it doesn't exist
+
+2002-09-06 Friday 22:06 martin
+
+ * version.php, admin/index.php, lib/moodlelib.php:
+
+ Added a new $release variable that shows the user-friendly version
+ number
+
+2002-09-06 Friday 22:05 martin
+
+ * lib/setup.php:
+
+ Cleaned up a bit
+
+2002-09-06 Friday 01:31 martin
+
+ * user/edit.php:
+
+ Fixed bug in password checking for new admin user ...
+
+2002-09-05 Thursday 20:29 martin
+
+ * UPGRADING.txt:
+
+ Updated the info to mention that the upgrading only works if you
+ are logged in as the *administrator* and visit the site home page.
+
+2002-09-05 Thursday 20:25 martin
+
+ * CHANGES:
+
+ CHANGES UP TO 1.0.3.1
+
2002-09-05 Thursday 20:24 martin
* version.php:
}
$table->data[0][1] = "<P><A HREF=\"../course/edit.php\">".get_string("addnewcourse")."</A></P>".
"<P><A HREF=\"../course/teacher.php\">".get_string("assignteachers")."</A></P>".
- "<P><A HREF=\"../course/delete.php\">".get_string("deletecourse")."</A></P>";
+ "<P><A HREF=\"../course/delete.php\">".get_string("deletecourse")."</A></P>".
+ "<P><A HREF=\"../course/categories.php\">".get_string("categories")."</A></P>";
$table->data[0][2] = "<P><A HREF=\"user.php?newuser=true\">".get_string("addnewuser")."</A></P>".
"<P><A HREF=\"user.php\">".get_string("edituser")."</A></P>";
if ($form->id) {
if (update_record("course", $form)) {
- redirect("$CFG->wwwroot/admin/index.php", "Changes saved");
+ redirect("$CFG->wwwroot/admin/index.php", get_string("changessaved"));
} else {
error("Serious Error! Could not update the site record! (id = $form->id)");
}
} else {
if ($newid = insert_record("course", $form)) {
- $cat->name = "General";
+ $cat->name = get_string("miscellaneous");
if (insert_record("course_categories", $cat)) {
- redirect("$CFG->wwwroot/admin/index.php", "Changes saved", "1");
+ redirect("$CFG->wwwroot/admin/index.php", get_string("changessaved"), "1");
} else {
- error("Serious Error! Could not set up the default categories!");
+ error("Serious Error! Could not set up a default course category!");
}
} else {
error("Serious Error! Could not set up the site!");
--- /dev/null
+<?PHP // $Id$
+ // Allows the admin to create, delete and rename course categories
+
+ require("../config.php");
+ require("lib.php");
+
+ if (!isadmin()) {
+ error("Only administrators can use this course!");
+ }
+
+ if (!$site = get_site()) {
+ error("Site isn't defined!");
+ }
+
+
+/// Print headings
+
+ $stradministration = get_string("administration");
+ $strcategories = get_string("categories");
+ $strcategory = get_string("category");
+ $strcourses = get_string("courses");
+ $stredit = get_string("edit");
+ $strdelete = get_string("delete");
+ $stradd = get_string("add");
+
+ print_header("$site->fullname: $strcategories", "$site->fullname",
+ "<A HREF=\"$CFG->wwwroot/admin\">$stradministration</A> -> $strcategories");
+
+ print_heading($strcategories);
+
+/// If data submitted, then process and store.
+
+ if (match_referer() && isset($HTTP_POST_VARS)) {
+
+ $categories = array();
+
+ // Peel out all the data from variable names.
+ foreach ($HTTP_POST_VARS as $key => $val) {
+ if ($key == "new" and $val != "") {
+ $cat->name = $val;
+ if (!insert_record("course_categories", $cat)) {
+ error("Could not insert the new category '$val'");
+ } else {
+ notify(get_string("categoryadded", "", $val));
+ }
+
+ } else {
+ $cat->id = substr($key,1);
+ $cat->name = $val;
+ if (!update_record("course_categories", $cat)) {
+ error("Could not update the category '$val'");
+ }
+ }
+ }
+ }
+
+
+/// Get the existing categories
+ if (!$categories = get_all_categories()) {
+ // Try and make one
+ $cat->name = get_string("miscellaneous");
+ if ($cat->id = insert_record("course_categories", $cat)) {
+ $categories[$cat->id] = $cat;
+ } else {
+ error("Serious error: Could not create a default category!");
+ }
+ }
+
+/// Delete category if the user wants to delete it
+ if (isset($delete)) {
+ if (delete_records("course_categories", "id", $delete)) {
+ notify(get_string("categorydeleted", "", $categories[$delete]->name));
+ unset($categories[$delete]);
+ } else {
+ error("An error occurred while trying to delete a category");
+ }
+ }
+
+/// Find lowest ID category - this is the default category
+ $default = 99999;
+ foreach ($categories as $category) {
+ if ($category->id < $default) {
+ $default = $category->id;
+ }
+ }
+
+/// Find any orphan courses that don't yet have a valid category and set to default
+ if ($courses = get_records_sql("SELECT * FROM course WHERE category > 0")) {
+ foreach ($courses as $course) {
+ if (!isset( $categories[$course->category] )) {
+ set_field("course", "category", $default, "id", $course->id);
+ }
+ }
+ }
+
+
+/// Print the table of all categories
+ $table->head = array ($strcategory, $strcourses, $strdelete);
+ $table->align = array ("LEFT", "CENTER", "CENTER");
+ $table->size = array ("50", "20", "20");
+ $table->width = 100;
+
+ echo "<FORM ACTION=categories.php METHOD=post>";
+ foreach ($categories as $category) {
+ $count = count_records("course", "category", $category->id);
+ if ($category->id == $default) {
+ $delete = ""; // Can't delete default category
+ } else {
+ $delete = "<A HREF=\"categories.php?delete=$category->id\">$strdelete</A>";
+ }
+ $table->data[] = array ("<INPUT TYPE=text NAME=\"c$category->id\" VALUE=\"$category->name\" SIZE=30>",
+ "$count", $delete);
+ }
+ $table->data[] = array ("<INPUT TYPE=text NAME=\"new\" VALUE=\"\" SIZE=30>", "", "$stradd");
+ print_table($table);
+ echo "<CENTER><BR><INPUT TYPE=submit VALUE=\"".get_string("savechanges")."\"> ";
+ echo "</CENTER>";
+ echo "</FORM>";
+
+ print_footer();
+
+?>
require("../config.php");
require("lib.php");
- $title = get_string("courses");
-
- print_header($title, $title, $title, "");
-
- optional_variable($cat, 1);
-
- echo "<TABLE WIDTH=80% ALIGN=CENTER><TR><TD>";
-
- print_all_courses($cat);
+ optional_variable($category, 0);
+
+ $strcourses = get_string("courses");
+
+ if (!$categories = get_all_categories()) {
+ error("Could not find any course categories!");
+ }
+
+ if (isset($categories[$category])) {
+ $thiscatname = $categories[$category]->name;
+ $navigation = "<A HREF=\"index.php\">$strcourses</A> -> $thiscatname";
+ } else {
+ $navigation = $strcourses;
+ }
+ print_header($strcourses, $strcourses, $navigation);
+
+ $showcategories = (count($categories) > 1);
+ if ($showcategories) {
+ echo "<TABLE WIDTH=\"100%\" CELLPADDING=10 BORDER=0>";
+ echo "<TR><TD WIDTH=180 VALIGN=TOP>";
+ print_simple_box(get_string("categories"), "CENTER", 180, $THEME->cellheading);
+ print_course_categories($categories, $category, 180);
+ echo "</TD><TD WIDTH=\"100%\" VALIGN=TOP>";
+ } else {
+ echo "<TABLE WIDTH=80% ALIGN=CENTER><TR><TD VALIGN=top>";
+ $category="all";
+ }
+
+ if ($category) {
+ if ($category != "all") {
+ print_simple_box($categories[$category]->name, "CENTER", "100%", $THEME->cellheading);
+ echo "<BR>";
+ }
+ print_all_courses($category);
+ }
echo "</TD></TR></TABLE>";
}
-function print_all_courses($cat=1, $style="full", $maxcount=999) {
+function print_all_courses($category="all", $style="full", $maxcount=999) {
global $CFG;
- if ($courses = get_records("course", "category", $cat, "fullname ASC")) {
+ if ($category == "all") {
+ $courses = get_records_sql("SELECT * FROM course WHERE category > 0 ORDER BY fullname ASC");
+ } else {
+ $courses = get_records("course", "category", $category, "fullname ASC");
+ }
+
+ if ($courses) {
if ($style == "minimal") {
$count = 0;
$icon = "<IMG SRC=\"pix/i/course.gif\" HEIGHT=16 WIDTH=16 ALT=\"".get_string("course")."\">";
ORDER BY section");
}
+function get_all_categories() {
+ return get_records_sql("SELECT * FROM course_categories ORDER by name");
+}
+
function print_section($courseid, $section, $mods, $modnamesused, $absolute=false, $width="100%") {
global $CFG;
$modicon[]=$icon;
$moddata[]="<A HREF=\"$CFG->wwwroot/course/edit.php\">".get_string("addnewcourse")."</A>";
$modicon[]=$icon;
+ $moddata[]="<A HREF=\"$CFG->wwwroot/course/categories.php\">".get_string("categories")."</A>";
+ $modicon[]=$icon;
$moddata[]="<A HREF=\"$CFG->wwwroot/course/teacher.php\">".get_string("assignteachers")."</A>";
$modicon[]=$icon;
$moddata[]="<A HREF=\"$CFG->wwwroot/course/delete.php\">".get_string("deletecourse")."</A>";
print_side_block("", $admindata, "", $adminicon, $width);
}
+function print_course_categories($categories, $selected="none", $width=180) {
+ global $CFG, $THEME;
+
+ foreach ($categories as $cat) {
+ $caticon[]="<IMG SRC=\"$CFG->wwwroot/pix/i/course.gif\" HEIGHT=16 WIDTH=16>";
+ if ($cat->id == $selected) {
+ $catdata[]="$cat->name";
+ } else {
+ $catdata[]="<A HREF=\"$CFG->wwwroot/course/index.php?category=$cat->id\">$cat->name</A>";
+ }
+ }
+ $showall = "<P><A HREF=\"$CFG->wwwroot/course/index.php?category=all\">".get_string("fulllistofcourses")."</A>...";
+ print_side_block("", $catdata, $showall, $caticon, $width);
+}
function print_log_graph($course, $userid=0, $type="course.png", $date=0) {
global $CFG;
}
if ($site->newsitems > 0 ) {
- print_simple_box(get_string("courses"), "CENTER", $side, "$THEME->cellheading");
- print_all_courses($cat=1, "minimal", 10);
+ $categories = get_all_categories();
+ if (count($categories) > 1) {
+ print_simple_box(get_string("categories"), "CENTER", $side, "$THEME->cellheading");
+ print_course_categories($categories, "none", $side);
+ } else {
+ print_simple_box(get_string("courses"), "CENTER", $side, "$THEME->cellheading");
+ $category = array_shift($categories);
+ print_all_courses($category->id, "minimal", 10);
+ }
}
print_spacer(1,$side);
}
if ($site->newsitems == 0 ) {
print_simple_box(get_string("availablecourses"), "CENTER", "100%", "$THEME->cellheading");
print_spacer(8,1);
- print_all_courses();
+ print_all_courses("all");
} else {
if (! $newsforum = forum_get_course_forum($site->id, "news")) {
$string[assignteachers] = "Assign teachers";
$string[availablecourses] = "Available Courses";
$string[cancel] = "Cancel";
+$string[categories] = "Course categories";
$string[category] = "Category";
+$string[categoryadded] = "The category '\$a' was added";
+$string[categorydeleted] = "The category '\$a' was deleted";
$string[changepassword] = "Change password";
$string[changedpassword] = "Changed password";
$string[changessaved] = "Changes saved";
$string[formatweeks] = "Weekly format";
$string[frontpagedescription] = "Front page description";
$string[frontpageformat] = "Front page format";
-$string[fulllistofcourses] = "Full list of courses";
+$string[fulllistofcourses] = "Show all courses";
$string[fullprofile] = "Full profile";
$string[fullname] = "Full name";
$string[fullsitename] = "Full site name";
$string[maximumchars] = "Maximum of \$a characters";
$string[maximumgrade] = "Maximum grade";
$string[maxsize] = "Max size: \$a";
+$string[miscellaneous] = "Miscellaneous"; // Default course category
$string[missingcategory] = "You need to choose a category";
$string[missingcity] = "Missing city/town";
$string[missingcountry] = "Missing country";
$string[showonlyweek] = "Show only week \$a";
$string[showtheselogs] = "Show these logs";
$string[socialheadline] = "Social forum - latest topics";
+$string[showallcourses] = "Show all courses";
$string[site] = "Site";
$string[sites] = "Sites";
$string[sitelogs] = "Site logs";
// If there's something it cannot do itself, it
// will tell you what you need to do.
-$version = 2002090800; // The current version is a date (YYYYMMDDXX) where
+$version = 2002090900; // The current version is a date (YYYYMMDDXX) where
// XX is a number that increments during the day
-$release = "1.0.4 beta"; // For humans only, not used for the upgrade process
+$release = "1.0.4"; // For humans only, not used for the upgrade process
function upgrade_moodle($oldversion=0) {