2 require_once ($CFG->dirroot
.'/course/moodleform_mod.php');
4 class mod_journal_mod_form
extends moodleform_mod
{
6 function definition() {
9 $mform =& $this->_form
;
11 //-------------------------------------------------------------------------------
12 $mform->addElement('header', 'general', get_string('general', 'form'));
14 $mform->addElement('text', 'name', get_string('journalname', 'journal'), array('size'=>'64'));
15 $mform->setType('name', PARAM_TEXT
);
16 $mform->addRule('name', null, 'required', null, 'client');
18 $mform->addElement('htmleditor', 'intro', get_string('journalquestion', 'journal'));
19 $mform->setType('intro', PARAM_RAW
);
20 $mform->addRule('intro', get_string('required'), 'required', null, 'client');
21 $mform->setHelpButton('intro', array('writing', 'questions', 'richtext'), false, 'editorhelpbutton');
23 $mform->addElement('format', 'format', get_string('format'));
25 $mform->addElement('modgrade', 'assessed', get_string('grade'), false);
26 $mform->setDefault('assessed', 0);
29 $options[0] = get_string('alwaysopen', 'journal');
30 for ($i=1;$i<=13;$i++
) {
31 $options[$i] = get_string('numdays', '', $i);
33 for ($i=2;$i<=16;$i++
) {
35 $options[$days] = get_string('numweeks', '', $i);
37 $options[365] = get_string('numweeks', '', 52);
38 $mform->addElement('select', 'days', get_string('daysavailable', 'journal'), $options);
39 if ($COURSE->format
== 'weeks') {
40 $mform->setDefault('days', '7');
42 $mform->setDefault('days', '0');
45 //-------------------------------------------------------------------------------
46 $this->standard_coursemodule_elements();
47 //-------------------------------------------------------------------------------
49 $this->add_action_buttons();