require("../config.php");
require("lib.php");
+ if (isset($cancel)) {
+ if ($SESSION->returnpage) {
+ $return = $SESSION->returnpage;
+ unset($SESSION->returnpage);
+ save_session("SESSION");
+ redirect($return);
+ } else {
+ redirect("view.php?id=$mod->course");
+ }
+ }
+
+
if (isset($course) && isset($HTTP_POST_VARS)) { // add or update form submitted
if (isset($SESSION->modform)) { // Variables are stored in the session
exit;
}
- if (isset($return)) {
- $SESSION->returnpage = $HTTP_REFERER;
- save_session("SESSION");
- }
if (isset($move)) {
error("This course section doesn't exist");
}
+ if (isset($return)) {
+ $SESSION->returnpage = "$CFG->wwwroot/mod/$module->name/view.php?id=$cm->id";
+ save_session("SESSION");
+ }
+
$form->coursemodule = $cm->id;
$form->section = $cm->section; // The section ID
$form->course = $course->id;
$string['updatethiscourse'] = "Update this course";
$string['updatinga'] = "Updating a \$a";
$string['updatingain'] = "Updating a \$a->what in \$a->in";
+$string['updatethis'] = "Update this \$a";
$string['upload'] = "Upload";
$string['uploadafile'] = "Upload a file";
$string['uploadthisfile'] = "Upload this file";
$string = get_string("turneditingon");
$edit = "on";
}
- return "<FORM TARGET=_parent METHOD=GET ACTION=\"$CFG->wwwroot/course/view.php\">
- <INPUT TYPE=hidden NAME=id VALUE=\"$courseid\">
- <INPUT TYPE=hidden NAME=edit VALUE=\"$edit\">
- <INPUT TYPE=submit VALUE=\"$string\"></FORM>";
+ return "<FORM TARGET=_parent METHOD=GET ACTION=\"$CFG->wwwroot/course/view.php\">".
+ "<INPUT TYPE=hidden NAME=id VALUE=\"$courseid\">".
+ "<INPUT TYPE=hidden NAME=edit VALUE=\"$edit\">".
+ "<INPUT TYPE=submit VALUE=\"$string\"></FORM>";
}
}
-function update_module_icon($moduleid, $courseid) {
-// Used to be an icon, but it's now a simple form button
+function update_module_button($moduleid, $courseid, $string) {
+// Prints the editing button on a module "view" page
global $CFG;
if (isteacher($courseid)) {
- return "<FORM TARGET=_parent METHOD=GET ACTION=\"$CFG->wwwroot/course/mod.php\">
- <INPUT TYPE=hidden NAME=update VALUE=\"$moduleid\">
- <INPUT TYPE=hidden NAME=return VALUE=\"true\">
- <INPUT TYPE=submit VALUE=\"".get_string("editthisactivity")."\"></FORM>";
+ $string = get_string("updatethis", "", $string);
+ return "<FORM TARGET=_parent METHOD=GET ACTION=\"$CFG->wwwroot/course/mod.php\">".
+ "<INPUT TYPE=hidden NAME=update VALUE=\"$moduleid\">".
+ "<INPUT TYPE=hidden NAME=return VALUE=\"true\">".
+ "<INPUT TYPE=submit VALUE=\"$string\"></FORM>";
}
}
function can_use_richtext_editor() {
global $USER, $CFG;
- return (check_browser_version("MSIE", 5.5) and $USER->htmleditor and $CFG->htmleditor);
+ if ($USER->htmleditor and $CFG->htmleditor) {
+ return check_browser_version("MSIE", 5.5);
+ }
+ return false;
}