MDL-50225 core: replace usages of print_textarea()

This commit is contained in:
Mark Nelson 2018-07-24 16:28:01 +08:00
parent dc4dea0e40
commit 4d67fe6161
4 changed files with 20 additions and 15 deletions

View File

@ -88,21 +88,17 @@ class MoodleQuickForm_htmleditor extends MoodleQuickForm_textarea{
*
* @return string
*/
function toHtml(){
public function toHtml() {
global $OUTPUT;
if ($this->_flagFrozen) {
return $this->getFrozenHtml();
} else {
$value = preg_replace("/(\r\n|\n|\r)/", '
', $this->getValue());
return $this->_getTabs() .
print_textarea(true,
$this->_options['rows'],
$this->_options['cols'],
$this->_options['width'],
$this->_options['height'],
$this->getName(),
preg_replace("/(\r\n|\n|\r)/", '
',$this->getValue()),
0, // unused anymore
true,
$this->getAttribute('id'));
$OUTPUT->print_textarea($this->getName(), $this->getAttribute('id'), $value, $this->_options['rows'],
$this->_options['cols']);
}
}

View File

@ -31,7 +31,7 @@ require_once($CFG->libdir.'/tablelib.php');
////////////////////////////////////////////////////////
$id = required_param('id', PARAM_INT);
$subject = optional_param('subject', '', PARAM_CLEANHTML);
$message = optional_param('message', '', PARAM_CLEANHTML);
$message = optional_param_array('message', '', PARAM_CLEANHTML);
$format = optional_param('format', FORMAT_MOODLE, PARAM_INT);
$messageuser = optional_param_array('messageuser', false, PARAM_INT);
$action = optional_param('action', '', PARAM_ALPHA);
@ -44,6 +44,10 @@ $current_tab = 'nonrespondents';
//get the objects
////////////////////////////////////////////////////////
if ($message) {
$message = $message['text'];
}
list ($course, $cm) = get_course_and_cm_from_cmid($id, 'feedback');
if (! $feedback = $DB->get_record("feedback", array("id"=>$cm->instance))) {
print_error('invalidcoursemodule');
@ -275,7 +279,7 @@ if (empty($students)) {
echo '<label for="feedback_subject">'.get_string('subject', 'feedback').'&nbsp;</label>';
echo '<input type="text" id="feedback_subject" size="50" maxlength="255" name="subject" value="'.s($subject).'" />';
echo '</div>';
print_textarea(true, 15, 25, 30, 10, "message", $message);
echo $OUTPUT->print_textarea('message', 'edit-message', $message, 15, 25);
print_string('formathtml');
echo '<input type="hidden" name="format" value="'.FORMAT_HTML.'" />';
echo '<br /><div class="buttons">';

View File

@ -75,7 +75,8 @@ function wiki_print_editor_wiki($pageid, $content, $editor, $version = -1, $sect
echo $OUTPUT->container_start();
echo '<form method="post" id="mform1" action="' . $action . '">';
echo $OUTPUT->container(print_textarea(false, 20, 60, 0, 0, "newcontent", $content, 0, true), false, 'wiki_editor');
$textarea = $OUTPUT->print_textarea('newcontent', 'edit-newcontent', $content, 20, 60);
echo $OUTPUT->container($textarea, false, 'wiki_editor');
echo $OUTPUT->container_start();
wiki_print_edit_form_default_fields($editor, $pageid, $version, $upload, $deleteuploads);
echo $OUTPUT->container_end();

View File

@ -41,9 +41,13 @@ $pageid = required_param('pageid', PARAM_TEXT);
$action = optional_param('action', '', PARAM_ALPHANUMEXT);
$id = optional_param('id', 0, PARAM_INT);
$commentid = optional_param('commentid', 0, PARAM_INT);
$newcontent = optional_param('newcontent', '', PARAM_CLEANHTML);
$newcontent = optional_param_array('newcontent', '', PARAM_CLEANHTML);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
if ($newcontent) {
$newcontent = $newcontent['text'];
}
if (!$page = wiki_get_page($pageid)) {
print_error('incorrectpageid', 'wiki');
}