<TABLE name="user_coursecreators" />
<TABLE name="course">
<FIELDS>
+ <FIELD name="currency" method="NO_CONV" type="char" length="3" />
+ <FIELD name="enrol" method="NO_CONV" type="varchar" length="20" />
<FIELD name="password" method="PHP_FUNCTION" type="varchar" length="50">
<PHP_FUNCTION>
migrate2utf8_course_password(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;
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)
<FIELD name="tolerance" method="NO_CONV" type="varchar" length="255" default="0.0" />
</FIELDS>
</TABLE>
- <TABLE name="question_sessions" />
+ <TABLE name="question_sessions">
+ <FIELDS>
+ <FIELD name="comment" method="PLAIN_SQL_UPDATE" type="text" length="0">
+ <SQL_DETECT_USER>
+ SELECT qa.userid
+ FROM {$CFG->prefix}question_sessions qs,
+ {$CFG->prefix}quiz_attempts qa
+ WHERE qa.id = qs.attemptid
+ AND qs.id = RECORDID
+ </SQL_DETECT_USER>
+ <SQL_DETECT_COURSE>
+ SELECT q.course
+ FROM {$CFG->prefix}quiz q,
+ {$CFG->prefix}question_sessions qs,
+ {$CFG->prefix}quiz_attempts qa
+ WHERE q.id = qa.quiz
+ AND qa.id = qs.attemptid
+ AND qs.id = RECORDID
+ </SQL_DETECT_COURSE>
+ </FIELD>
+ </FIELDS>
+ </TABLE>
<TABLE name="question_multichoice">
<FIELDS>
<FIELD name="answers" method="NO_CONV" type="varchar" length="255" />
migrate2utf8_question_qtype(RECORDID)
</PHP_FUNCTION>
</FIELD>
+ <FIELD name="version" method="NO_CONV" type="varchar" length="255" />
<FIELD name="questiontext" method="PHP_FUNCTION" type="text" length="0">
<PHP_FUNCTION>
migrate2utf8_question_questiontext(RECORDID)