From e5dfd0f31f7fe31ffd64a42ca3c4d9bfb47fd6ff Mon Sep 17 00:00:00 2001 From: moodler Date: Mon, 21 Oct 2002 03:00:40 +0000 Subject: [PATCH] Improvements to help, and addition of new "Activity modules" help for teachers adding new modules. --- course/lib.php | 59 +++++++++++------------------------- course/social.php | 2 +- course/topics.php | 2 +- course/weeks.php | 2 +- help.php | 2 ++ lang/en/help/mods.html | 69 ++++++++++++++++++++++++++++++++++++++++++ lang/en/moodle.php | 1 + lib/moodlelib.php | 2 +- lib/weblib.php | 12 ++++++-- 9 files changed, 102 insertions(+), 49 deletions(-) create mode 100644 lang/en/help/mods.html diff --git a/course/lib.php b/course/lib.php index 9af095e641..b064802456 100644 --- a/course/lib.php +++ b/course/lib.php @@ -628,60 +628,35 @@ function print_log_graph($course, $userid=0, $type="course.png", $date=0) { function add_course_module($mod) { GLOBAL $db; - $timenow = time(); - - if (!$rs = $db->Execute("INSERT into course_modules - SET course = '$mod->course', - module = '$mod->module', - instance = '$mod->instance', - section = '$mod->section', - added = '$timenow' ")) { - return 0; - } - - // Get it out again - this is the most compatible way to determine the ID - if ($rs = $db->Execute("SELECT id FROM course_modules - WHERE module = $mod->module AND added = $timenow")) { - return $rs->fields[0]; - } else { - return 0; - } + $mod->added = time(); + return insert_record("course_modules", $mod); } function add_mod_to_section($mod) { // Returns the course_sections ID where the mod is inserted GLOBAL $db; - if ($cw = get_record_sql("SELECT * FROM course_sections - WHERE course = '$mod->course' AND section = '$mod->section'") ) { + if ($section = get_record_sql("SELECT * FROM course_sections + WHERE course = '$mod->course' AND section = '$mod->section'") ) { - if ($cw->sequence) { - $newsequence = "$cw->sequence,$mod->coursemodule"; + if ($section->sequence) { + $newsequence = "$section->sequence,$mod->coursemodule"; } else { $newsequence = "$mod->coursemodule"; } - if (!$rs = $db->Execute("UPDATE course_sections SET sequence = '$newsequence' WHERE id = '$cw->id'")) { - return 0; + if (set_field("course_sections", "sequence", $newsequence, "id", $section->id)) { + return $section->id; // Return course_sections ID that was used. } else { - return $cw->id; // Return course_sections ID that was used. + return 0; } } else { // Insert a new record - if (!$rs = $db->Execute("INSERT into course_sections - SET course = '$mod->course', - section = '$mod->section', - summary = '', - sequence = '$mod->coursemodule' ")) { - return 0; - } - // Get it out again - this is the most compatible way to determine the ID - if ($rs = $db->Execute("SELECT id FROM course_sections - WHERE course = '$mod->course' AND section = '$mod->section'")) { - return $rs->fields[0]; - } else { - return 0; - } + $section->course = $mod->course; + $section->section = $mod->section; + $section->summary = ""; + $section->sequence = $mod->coursemodule; + return insert_record("course_sections", $section); } } @@ -692,14 +667,14 @@ function delete_course_module($mod) { function delete_mod_from_section($mod, $section) { GLOBAL $db; - if ($cw = get_record("course_sections", "id", "$section") ) { + if ($section = get_record("course_sections", "id", "$section") ) { - $modarray = explode(",", $cw->sequence); + $modarray = explode(",", $section->sequence); if ($key = array_keys ($modarray, $mod)) { array_splice($modarray, $key[0], 1); $newsequence = implode(",", $modarray); - return set_field("course_sections", "sequence", $newsequence, "id", $cw->id); + return set_field("course_sections", "sequence", $newsequence, "id", $section->id); } else { return false; } diff --git a/course/social.php b/course/social.php index b984549537..19f7299622 100644 --- a/course/social.php +++ b/course/social.php @@ -32,7 +32,7 @@ if (isediting($site->id)) { echo "
"; popup_form("$CFG->wwwroot/course/mod.php?id=$course->id§ion=0&add=", - $modnames, "section0", "", get_string("add")."..."); + $modnames, "section0", "", get_string("add")."...", "mods", get_string("activities")); echo "
"; } diff --git a/course/topics.php b/course/topics.php index b291a7876f..bfb9164ff6 100644 --- a/course/topics.php +++ b/course/topics.php @@ -141,7 +141,7 @@ if (isediting($course->id)) { echo "
"; popup_form("$CFG->wwwroot/course/mod.php?id=$course->id§ion=$section&add=", - $modnames, "section$section", "", "$stradd..."); + $modnames, "section$section", "", "$stradd...", "mods", get_string("activities")); echo "
"; } diff --git a/course/weeks.php b/course/weeks.php index 55118ec653..d8a2ac6df0 100644 --- a/course/weeks.php +++ b/course/weeks.php @@ -136,7 +136,7 @@ if (isediting($course->id)) { echo "
"; popup_form("$CFG->wwwroot/course/mod.php?id=$course->id§ion=$week&add=", - $modnames, "section$week", "", "$stradd..."); + $modnames, "section$week", "", "$stradd...", "mods", get_string("activities")); echo "
"; } diff --git a/help.php b/help.php index 97a04aa6f4..18e95bcbc0 100644 --- a/help.php +++ b/help.php @@ -47,6 +47,8 @@ echo $text; echo "

"; } + + close_window_button(); ?> diff --git a/lang/en/help/mods.html b/lang/en/help/mods.html new file mode 100644 index 0000000000..0d0ceb0ac1 --- /dev/null +++ b/lang/en/help/mods.html @@ -0,0 +1,69 @@ +

Activity Modules

+ +

Moodle contains a wide range of activity modules that can be used to + build up any type of course.

+ +

 Forums

+ + +

 Journals

+ + +

 Resources

+ + +

 Assignments

+ + +

 Quizzes

+ + +

 Choices

+ + +

 Surveys

+ + + diff --git a/lang/en/moodle.php b/lang/en/moodle.php index dd891b7817..4e81133a3f 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -48,6 +48,7 @@ $string['chooselogs'] = "Choose which logs you want to see"; $string['choosetheme'] = "Choose theme"; $string['chooseuser'] = "Choose a user"; $string['city'] = "City/town"; +$string['closewindow'] = "Close this window"; $string['comparelanguage'] = "Compare and edit current language"; $string['configauth'] = "Choose the authentication module you want to use. The default is 'email' and has the best security. The method 'none' has no checking whatsoever - be careful using it unless you really know what you are doing."; $string['configgdversion'] = "Indicate the version of GD that is installed. The version shown by default is the one that has been auto-detected. Don't change this unless you really know what you're doing."; diff --git a/lib/moodlelib.php b/lib/moodlelib.php index ac7dcc33a2..d7b81a847a 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -602,7 +602,7 @@ function helpbutton ($page, $title="", $module="moodle", $image=true, $text="") $module = "moodle"; } if ($image) { - $linkobject = "\"$title\"wwwroot/pix/help.gif\">"; + $linkobject = "\"$title\"wwwroot/pix/help.gif\">"; } else { $linkobject = $title; } diff --git a/lib/weblib.php b/lib/weblib.php index 57c7ac37ee..a390e5066f 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -229,7 +229,7 @@ function close_window_button() { /// Prints a simple button to close a window echo "
"; - echo ""; + echo ""; echo "
"; } @@ -273,13 +273,15 @@ function choose_from_menu ($options, $name, $selected="", $nothing="choose", $sc } } -function popup_form ($common, $options, $formname, $selected="", $nothing="choose") { +function popup_form ($common, $options, $formname, $selected="", $nothing="choose", $help="", $helptext="") { /// Implements a complete little popup form /// $common = the URL up to the point of the variable that changes /// $options = A list of value-label pairs for the popup list /// $formname = name must be unique on the page /// $selected = the option that is already selected /// $nothing = The label for the "no choice" option +/// $help = The name of a help page if help is required +/// $helptext = The name of the label for the help button if ($nothing == "choose") { $nothing = get_string("choose")."..."; @@ -303,7 +305,11 @@ function popup_form ($common, $options, $formname, $selected="", $nothing="choos echo ">$value\n"; } } - echo "\n"; + echo ""; + if ($help) { + helpbutton($help, $helptext); + } + echo "\n"; } -- 2.39.5