mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
fix for 5209
This commit is contained in:
parent
98ae4e63da
commit
8f23f49004
4 changed files with 70 additions and 1 deletions
|
@ -328,6 +328,46 @@ function migrate2utf8_data_rsstemplate($recordid){
|
|||
return $result;
|
||||
}
|
||||
|
||||
|
||||
function migrate2utf8_data_csstemplate($recordid){
|
||||
global $CFG, $globallang;
|
||||
|
||||
/// Some trivial checks
|
||||
if (empty($recordid)) {
|
||||
log_the_problem_somewhere();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$data = get_record('data','id',$recordid)) {
|
||||
log_the_problem_somewhere();
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($globallang) {
|
||||
$fromenc = $globallang;
|
||||
} else {
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = get_course_lang($data->course); //Non existing!
|
||||
$userlang = get_main_teacher_lang($data->course); //N.E.!!
|
||||
$fromenc = get_original_encoding($sitelang, $courselang, $userlang);
|
||||
}
|
||||
|
||||
/// We are going to use textlib facilities
|
||||
|
||||
/// Convert the text
|
||||
if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
|
||||
$result = utfconvert($data->csstemplate, $fromenc);
|
||||
|
||||
$newdata= new object;
|
||||
$newdata->id = $recordid;
|
||||
$newdata->csstemplate = $result;
|
||||
migrate2utf8_update_record('data',$newdata);
|
||||
}
|
||||
/// And finally, just return the converted field
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
function migrate2utf8_data_listtemplateheader($recordid){
|
||||
global $CFG, $globallang;
|
||||
|
||||
|
|
|
@ -148,6 +148,11 @@
|
|||
migrate2utf_data_listtemplate(RECORDID)
|
||||
</PHP_FUNCTION>
|
||||
</FIELD>
|
||||
<FIELD name="csstemplate" method="PHP_FUNCTION" type="text" length="0">
|
||||
<PHP_FUNCTION>
|
||||
migrate2utf_data_csstemplate(RECORDID)
|
||||
</PHP_FUNCTION>
|
||||
</FIELD>
|
||||
<FIELD name="addtemplate" method="PHP_FUNCTION" type="text" length="0">
|
||||
<PHP_FUNCTION>
|
||||
migrate2utf_data_addtemplate(RECORDID)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue