how to convert a set of TEXTAREAs to HTMLAREAs

how to convert a set of TEXTAREAs to HTMLAREAs

by Jaime Alamo -
Number of replies: 4
I'd like to know how to convert a set of TEXTAREAs to HTMLAREAs

The report page of the journal module is using an array of TEXT_AREAs to hold all teachers' comments that are then submitted one by one according to the index.

I need to find the way to change every TEXTAREAs into HTMLAREAs, if possilbe.

Thanks.

Average of ratings: -
In reply to Jaime Alamo

Re: how to convert a set of TEXTAREAs to HTMLAREAs

by Janne Mikkonen -
Hi Jaime.

Sorry for my delayed answer (had to sleep for a while).

Okay, you must do some changes to journal module's lib.php and report.php.

First changes to lib.php's journal_print_user_entry -function:

First write this line just underneath the global CFG; line:
$usehtmleditor = can_use_html_editor();

Find the TEXTAREA (somewhere around lines 467 - 469) field and  (or just comment those tree lines out) and replace it with this:

print_textarea($usehtmleditor, 20, 60, 680, 400, "c$entry->id", $entry->comment);

Then write a new line in report.php just before the print_footer() function, so that last lines in report.php looks like this:

if ($usehtmleditor = can_use_html_editor()) {
        use_html_editor();
}
print_footer($course);


?>

That should do it! Hope this helps...

- Janne -
In reply to Janne Mikkonen

Re: how to convert a set of TEXTAREAs to HTMLAREAs

by Jaime Alamo -
Thank you Janne,

Please, no need for apologies. People in several places in the Globe need to sleep at different times, when they can ..., when they want ...big grin

Your answer has been precise and patched files do the work. Tank you very much.

I'm finishing a new module Essay adding new functionalities to the Journal and some moodlers asked for the teachers' need to comment (feedback) student's essays with the same "weapon" (htmlarea instead of textarea) in the report page.

Certainly, I have to write chemical formulas or add an image and many times copy and paste a portion of formatted student text . Now many of us will be happy.

Thanks again
In reply to Janne Mikkonen

Re: how to convert a set of TEXTAREAs to HTMLAREAs

by Saiful Anwar -

Hi Janne..

I've install essay type quiz. But i got no HTMLArea works in all my text fields.

With your advice to Jaime, i can make one of the editor changed into HTML editor.

add this line in lib.php

$usehtmleditor = can_use_html_editor();

make the Question Editor works as HTML editor but cant make the feedback and the student answer box work.

Have any suggestion?

Attachment HTML_area.GIF
In reply to Saiful Anwar

Re: how to convert a set of TEXTAREAs to HTMLAREAs

by Janne Mikkonen -
How did you make the call for use_html_editor() -function? This function must be called as low (page bottom) as you can like:

if ($usehtmleditor) {
    use_html_editor();
}
// Print page footer
print_footer($course);


And in your case you musn't use name argument with use_html_editor call.