fck editor
From MoodleDocs
The print_textarea function to replace the one currently in weblib.php to implement fck editor.
Make sure fck editor is unzipped to "Moodle/lib/editor" in a folder "fck"
/* test FCKeditor implementation*/
function print_textarea($usehtmleditor, $rows, $cols, $width, $height, $name, $value=, $courseid=0) {
/// $width and height are legacy fields and no longer used as pixels like they used to be.
/// However, you can set them to zero to override the mincols and minrows values below.
global $CFG, $course; static $scriptcount; // For loading the htmlarea script only once.
if (empty($courseid)) {
if (!empty($course->id)) { // search for it in global context
$courseid = $course->id;
}
}
if (empty($scriptcount)) {
$scriptcount = 0;
}
if ($usehtmleditor) {
if (!empty($courseid) and isteacher($courseid)) {
echo ($scriptcount < 1) ? '<script type="text/javascript" src="'. $CFG->wwwroot .'/lib/editor/fckeditor/fckeditor.js"></script>' . "\n" : ;
} else {
echo ($scriptcount < 1) ? '<script type="text/javascript" src="'. $CFG->wwwroot .'/lib/editor/fckeditor/fckeditor.js"></script>'."\n" : ;
}
echo '<script type="text/javascript" src="'. $CFG->wwwroot .'/lib/editor/fckeditor/fckeditor.js"></script>
<script type="text/javascript"> window.onload = function() { var oFCKeditor = new FCKeditor("MyTextarea") ; oFCKeditor.BasePath = "'. $CFG->wwwroot .'/lib/editor/fckeditor/" ; oFCKeditor.Height = 400 ; oFCKeditor.Width = 700 ; oFCKeditor.ReplaceTextarea() ; } </script>';
$scriptcount++;
if ($height) { // Usually with legacy calls
if ($rows < $minrows) {
$rows = $minrows;
}
}
if ($width) { // Usually with legacy calls
if ($cols < $mincols) {
$cols = $mincols;
}
}
}
echo '<textarea id= "MyTextarea" name="'. $name .'" rows="'. $rows .'" cols="'. $cols .'">';
p($value);
echo '</textarea>'."\n";
}