From b3153e4b7d4a0d22a90a0b8baa2958e513aeb43b Mon Sep 17 00:00:00 2001 From: moodler Date: Mon, 9 Feb 2004 07:31:04 +0000 Subject: [PATCH] Small hack to force a particular language within a course. No interface on course/edit.php ... I want to try this on moodle.org for a while to try and stop the encoding problems --- lib/db/mysql.php | 4 ++++ lib/db/mysql.sql | 1 + lib/db/postgres7.php | 4 ++++ lib/db/postgres7.sql | 1 + lib/moodlelib.php | 5 ++++- lib/weblib.php | 18 +++++++++--------- version.php | 2 +- 7 files changed, 24 insertions(+), 11 deletions(-) diff --git a/lib/db/mysql.php b/lib/db/mysql.php index 821ec443be..0dcdba842e 100644 --- a/lib/db/mysql.php +++ b/lib/db/mysql.php @@ -639,6 +639,10 @@ function main_upgrade($oldversion=0) { set_config("upgrade", "logs"); } + if ($oldversion < 2004020900) { + table_column("course", "", "lang", "varchar", "5", "", "", "", "groupmodeforce"); + } + return $result; } diff --git a/lib/db/mysql.sql b/lib/db/mysql.sql index e484452981..c6c8f31625 100644 --- a/lib/db/mysql.sql +++ b/lib/db/mysql.sql @@ -53,6 +53,7 @@ CREATE TABLE `prefix_course` ( `visible` int(10) unsigned NOT NULL default '1', `groupmode` int(4) unsigned NOT NULL default '0', `groupmodeforce` int(4) unsigned NOT NULL default '0', + `lang` varchar(5) NOT NULL default '', `timecreated` int(10) unsigned NOT NULL default '0', `timemodified` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`id`), diff --git a/lib/db/postgres7.php b/lib/db/postgres7.php index 2f33b51605..ca4e8ef14b 100644 --- a/lib/db/postgres7.php +++ b/lib/db/postgres7.php @@ -385,6 +385,10 @@ function main_upgrade($oldversion=0) { set_config("upgrade", "logs"); } + if ($oldversion < 2004020900) { + table_column("course", "", "lang", "varchar", "5", "", "", "", "groupmodeforce"); + } + return $result; } diff --git a/lib/db/postgres7.sql b/lib/db/postgres7.sql index 00833233cc..99692a9c67 100644 --- a/lib/db/postgres7.sql +++ b/lib/db/postgres7.sql @@ -31,6 +31,7 @@ CREATE TABLE prefix_course ( visible integer NOT NULL default '1', groupmode integer NOT NULL default '0', groupmodeforce integer NOT NULL default '0', + lang varchar(5) NOT NULL default '', timecreated integer NOT NULL default '0', timemodified integer NOT NULL default '0' ); diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 93695947a7..bdc2024a04 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -1531,7 +1531,10 @@ function current_language() { /// Returns the code for the current language global $CFG, $USER, $SESSION; - if (isset($SESSION->lang)) { // Session language can override other settings + if (isset($CFG->courselang)) { // Course language can override all other settings for this page + return $CFG->courselang; + + } else if (isset($SESSION->lang)) { // Session language can override other settings return $SESSION->lang; } else if (isset($USER->lang)) { // User language can override site language diff --git a/lib/weblib.php b/lib/weblib.php index e5bad487f2..f42d6c1953 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -805,6 +805,11 @@ function print_header ($title="", $heading="", $navigation="", $focus="", $meta= // $usexml - use XML for this page global $USER, $CFG, $THEME, $SESSION; + global $course; // This is a bit of an ugly hack to be gotten rid of later + if (!empty($course->lang)) { + $CFG->courselang = $course->lang; + } + if (file_exists("$CFG->dirroot/theme/$CFG->theme/styles.php")) { $styles = $CFG->stylesheet; } else { @@ -1598,21 +1603,16 @@ function update_categories_button() { } } -function update_group_button($courseid) { +function update_group_button($courseid, $groupid) { // Prints the editing button on group page global $CFG, $USER; if (isteacheredit($courseid)) { - if (!empty($USER->groupediting)) { - $string = get_string("turneditingoff"); - $edit = "off"; - } else { - $string = get_string("turneditingon"); - $edit = "on"; - } + $string = get_string('editgroupprofile'); return "
framename\" method=\"get\" action=\"$CFG->wwwroot/course/group.php\">". "". - "". + "". + "". "
"; } } diff --git a/version.php b/version.php index 93d77281ad..fff4621716 100644 --- a/version.php +++ b/version.php @@ -5,7 +5,7 @@ // database to determine whether upgrades should // be performed (see lib/db/*.php) -$version = 2004020300; // The current version is a date (YYYYMMDDXX) +$version = 2004020900; // The current version is a date (YYYYMMDDXX) $release = "1.2 development"; // User-friendly version number -- 2.39.5