From b2a0cb86d06ce778139463701684a3f95287f87a Mon Sep 17 00:00:00 2001 From: jamiesensei Date: Tue, 14 Nov 2006 06:01:11 +0000 Subject: [PATCH] migrated journal/mod.html to formslib --- mod/journal/mod.html | 107 --------------------------------------- mod/journal/mod_form.php | 58 +++++++++++++++++++++ 2 files changed, 58 insertions(+), 107 deletions(-) delete mode 100644 mod/journal/mod.html create mode 100644 mod/journal/mod_form.php diff --git a/mod/journal/mod.html b/mod/journal/mod.html deleted file mode 100644 index 270e098b83..0000000000 --- a/mod/journal/mod.html +++ /dev/null @@ -1,107 +0,0 @@ -name)) { - $form->name = ''; - } - if (!isset($form->intro)) { - $form->intro = ''; - } - if (!isset($form->assessed)) { - $form->assessed = '0'; - } - if (!isset($form->days)) { - if ($course->format == 'weeks') { - $form->days = '7'; - } else { - $form->days = '0'; - } - } -?> - -
- - - - - - - - - - - - - - - - - - - - - -
: - -
: - '; - helpbutton('writing', get_string('helpwriting'), 'moodle', true, true); - echo '
'; - helpbutton('questions', get_string('helpquestions'), 'moodle', true, true); - echo '
'; - if ($usehtmleditor) { - helpbutton('richtext', get_string('helprichtext'), 'moodle', true, true); - } else { - emoticonhelpbutton('form', 'intro'); - } - echo '
'; - ?> -
- intro); - - if ($usehtmleditor) { - echo ''; - } else { - echo '

'; - helpbutton('textformat', get_string('formattexttype')); - print_string('formattexttype'); - echo ': '; - if (!$form->introformat) { - $form->introformat = $defaultformat; - } - choose_from_menu(format_text_menu(), 'introformat', $form->introformat, ''); - echo "

"; - } - ?> -
: - id, 'assessed', "$form->assessed"); - ?> -
: - days"); - ?> -
-
- - - - - - - - - - -
-
diff --git a/mod/journal/mod_form.php b/mod/journal/mod_form.php new file mode 100644 index 0000000000..3d67966db0 --- /dev/null +++ b/mod/journal/mod_form.php @@ -0,0 +1,58 @@ +libdir.'/formslib.php'); +class journal_mod_form extends moodleform_mod { + + function definition() { + + global $CFG, $COURSE; + $mform =& $this->_form; + $renderer =& $mform->defaultRenderer(); + +//------------------------------------------------------------------------------- + $mform->addElement('header', 'general', get_string('general', 'form')); + + $mform->addElement('text', 'name', get_string('journalname', 'journal')); + $mform->setType('name', PARAM_TEXT); + $mform->addRule('name', null, 'required', null, 'client'); + + $mform->addElement('htmleditor', 'intro', get_string('journalquestion', 'journal')); + $mform->setType('intro', PARAM_RAW); + $mform->addRule('intro', get_string('required'), 'required', null, 'client'); + + $mform->addElement('format', 'format', get_string('format')); + + $mform->addElement('modgrade', 'assessed', get_string('grade'), false); + $mform->setDefault('assessed', 0); + + $options = array(); + $options[0] = get_string('alwaysopen', 'journal'); + for ($i=1;$i<=13;$i++) { + $options[$i] = get_string('numdays', '', $i); + } + for ($i=2;$i<=16;$i++) { + $days = $i * 7; + $options[$days] = get_string('numweeks', '', $i); + } + $options[365] = get_string('numweeks', '', 52); + $mform->addElement('select', 'days', get_string('daysavailable', 'journal'), $options); + if ($COURSE->format == 'weeks') { + $mform->setDefault('days', '7'); + } else { + $mform->setDefault('days', '0'); + } + +//------------------------------------------------------------------------------- + $this->standard_coursemodule_elements(); +//------------------------------------------------------------------------------- + + $buttonarray=array(); + $buttonarray[] = &MoodleQuickForm::createElement('submit', 'submit', get_string('savechanges')); + $buttonarray[] = &MoodleQuickForm::createElement('submit', 'cancel', get_string('cancel')); + $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false); + $renderer->addStopFieldsetElements('buttonar'); + } + + + +} +?> \ No newline at end of file -- 2.39.5