[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/mod/journal/ -> mod_form.php (source)

   1  <?php
   2  require_once ($CFG->dirroot.'/course/moodleform_mod.php');
   3  
   4  class mod_journal_mod_form extends moodleform_mod {
   5  
   6      function definition() {
   7  
   8          global $CFG, $COURSE;
   9          $mform    =& $this->_form;
  10  
  11  //-------------------------------------------------------------------------------
  12          $mform->addElement('header', 'general', get_string('general', 'form'));
  13  
  14          $mform->addElement('text', 'name', get_string('journalname', 'journal'), array('size'=>'64'));
  15          if (!empty($CFG->formatstringstriptags)) {
  16              $mform->setType('name', PARAM_TEXT);
  17          } else {
  18              $mform->setType('name', PARAM_CLEAN);
  19          }
  20          $mform->addRule('name', null, 'required', null, 'client');
  21  
  22          $mform->addElement('htmleditor', 'intro', get_string('journalquestion', 'journal'));
  23          $mform->setType('intro', PARAM_RAW);
  24          $mform->addRule('intro', get_string('required'), 'required', null, 'client');
  25          $mform->setHelpButton('intro', array('writing', 'questions', 'richtext'), false, 'editorhelpbutton');
  26  
  27          $mform->addElement('format', 'introformat', get_string('format'));
  28  
  29          $mform->addElement('modgrade', 'assessed', get_string('grade'), false);
  30          $mform->setDefault('assessed', 0);
  31  
  32          $options = array();
  33          $options[0] = get_string('alwaysopen', 'journal');
  34          for ($i=1;$i<=13;$i++) {
  35              $options[$i] = get_string('numdays', '', $i);
  36          }
  37          for ($i=2;$i<=16;$i++) {
  38              $days = $i * 7;
  39              $options[$days] = get_string('numweeks', '', $i);
  40          }
  41          $options[365] = get_string('numweeks', '', 52);
  42          $mform->addElement('select', 'days', get_string('daysavailable', 'journal'), $options);
  43          if ($COURSE->format == 'weeks') {
  44              $mform->setDefault('days', '7');
  45          } else {
  46              $mform->setDefault('days', '0');
  47          }
  48  
  49  //-------------------------------------------------------------------------------
  50          $this->standard_coursemodule_elements();
  51  //-------------------------------------------------------------------------------
  52  // buttons
  53          $this->add_action_buttons();
  54  
  55      }
  56  
  57  
  58  
  59  }
  60  ?>


Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7