foreach ($assignments as $assignment) {
$cm = get_coursemodule_from_id('assignment', $assignment->id);
- $event = NULL;
+ $event = new object();
$event->name = $assignment->name;
$event->description = format_module_intro('assignment', $assignment, $cm->id);
$event->timestart = $assignment->timedue;
$event = NULL;
$event->name = $chat->name;
- $event->description = $chat->intro;
+ $event->description = format_module_intro('chat', $chat, $chat->coursemodule);
$event->courseid = $chat->course;
$event->groupid = 0;
$event->userid = 0;
if ($event->id = $DB->get_field('event', 'id', array('modulename'=>'chat', 'instance'=>$chat->id))) {
$event->name = $chat->name;
- $event->description = $chat->intro;
+ $event->description = format_module_intro('chat', $chat, $chat->coursemodule);
$event->timestart = $chat->chattime;
update_event($event);
$moduleid = $DB->get_field('modules', 'id', array('name'=>'chat'));
foreach ($chats as $chat) {
- $event = NULL;
+ $cm = get_coursemodule_from_id('chat', $chat->id);
+ $event = new object();
$event->name = $chat->name;
- $event->description = $chat->intro;
+ $event->description = format_module_intro('chat', $chat, $cm->id);
$event->timestart = $chat->chattime;
if ($event->id = $DB->get_field('event', 'id', array('modulename'=>'chat', 'instance'=>$chat->id))) {
}
foreach ($chats as $chat) {
- unset($chat->name);
- unset($chat->intro);
switch ($chat->schedule) {
case 1: // Single event - turn off schedule and disable
$chat->chattime = 0;
class mod_chat_mod_form extends moodleform_mod {
function definition() {
- global $CFG, $DB;
- $mform =& $this->_form;
+ $mform = $this->_form;
//-------------------------------------------------------------------------------
$mform->addElement('header', 'general', get_string('general', 'form'));
}
$mform->addRule('name', null, 'required', null, 'client');
- $mform->addElement('htmleditor', 'intro', get_string('chatintro', 'chat'));
- $mform->setType('intro', PARAM_RAW);
- $mform->setHelpButton('intro', array('writing', 'questions', 'richtext2'), false, 'editorhelpbutton');
- $mform->addRule('intro', get_string('required'), 'required', null, 'client');
+ $this->add_intro_editor(true, get_string('chatintro', 'chat'));
$mform->addElement('date_time_selector', 'chattime', get_string('chattime', 'chat'));
$this->add_action_buttons();
}
}
-?>
}
if ($chat->intro) {
- $options = (object)array('noclean'=>true);
- print_box(format_text($chat->intro, $chat->introformat, $options), 'generalbox', 'intro');
+ print_box(format_module_intro('chat', $chat, $cm->id), 'generalbox', 'intro');
}
chat_delete_old_users();
}
$mform->addRule('name', null, 'required', null, 'client');
- $mform->addElement('htmleditor', 'intro', get_string('choicetext', 'choice'));
- $mform->setType('intro', PARAM_RAW);
- $mform->addRule('intro', null, 'required', null, 'client');
- $mform->setHelpButton('intro', array('writing', 'questions', 'richtext2'), false, 'editorhelpbutton');
-
- $mform->addElement('format', 'introformat', get_string('format'));
+ $this->add_intro_editor(true, get_string('chatintro', 'chat'));
//-------------------------------------------------------------------------------
- $repeatarray=array();
+ $repeatarray = array();
$repeatarray[] = &MoodleQuickForm::createElement('header', '', get_string('option','choice').' {no}');
$repeatarray[] = &MoodleQuickForm::createElement('text', 'option', get_string('option','choice'));
$repeatarray[] = &MoodleQuickForm::createElement('text', 'limit', get_string('limit','choice'));
$repeatarray[] = &MoodleQuickForm::createElement('hidden', 'optionid', 0);
- $menuoptions=array();
+ $menuoptions = array();
$menuoptions[0] = get_string('disable');
$menuoptions[1] = get_string('enable');
$mform->addElement('header', 'timerestricthdr', get_string('limit', 'choice'));
echo '<div class="clearer"></div>';
if ($choice->intro) {
- $options = (object)array('noclean'=>true);
- print_box(format_text($choice->intro, $choice->introformat, $options), 'generalbox', 'intro');
+ print_box(format_module_intro('choice', $choice, $cm->id), 'generalbox', 'intro');
}
$current = false; // Initialise for later