|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 class profile_field_textarea extends profile_field_base { 00004 00005 function edit_field_add(&$mform) { 00006 $cols = $this->field->param1; 00007 $rows = $this->field->param2; 00008 00010 $mform->addElement('editor', $this->inputname, format_string($this->field->name), null, null); 00011 $mform->setType($this->inputname, PARAM_RAW); // we MUST clean this before display! 00012 } 00013 00016 function is_user_object_data() { 00017 return false; 00018 } 00019 00020 function edit_save_data_preprocess($data, &$datarecord) { 00021 if (is_array($data)) { 00022 $datarecord->dataformat = $data['format']; 00023 $data = $data['text']; 00024 } 00025 return $data; 00026 } 00027 00028 function edit_load_user_data(&$user) { 00029 if ($this->data !== NULL) { 00030 $this->data = clean_text($this->data, $this->dataformat); 00031 $user->{$this->inputname} = array('text'=>$this->data, 'format'=>$this->dataformat); 00032 } 00033 } 00034 00038 function display_data() { 00039 return format_text($this->data, $this->dataformat, array('overflowdiv'=>true)); 00040 } 00041 00042 } 00043 00044