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
This commit is contained in:
moodler
2004-02-09 07:31:04 +00:00
parent e138523ff3
commit b3153e4b7d
7 changed files with 24 additions and 11 deletions
+4
View File
@@ -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;
}
+1
View File
@@ -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`),
+4
View File
@@ -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;
}
+1
View File
@@ -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'
);
+4 -1
View File
@@ -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
+9 -9
View File
@@ -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 "<form target=\"$CFG->framename\" method=\"get\" action=\"$CFG->wwwroot/course/group.php\">".
"<input type=\"hidden\" name=\"id\" value=\"$courseid\" />".
"<input type=\"hidden\" name=\"edit\" value=\"$edit\" />".
"<input type=\"hidden\" name=\"group\" value=\"$groupid\" />".
"<input type=\"hidden\" name=\"edit\" value=\"on\" />".
"<input type=\"submit\" value=\"$string\" /></form>";
}
}
+1 -1
View File
@@ -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