/**
  * Defines fields to add to the settings form
  *
  * @param moodle_form $mform
  */
 protected function specific_definition($mform)
 {
     $mform->addElement('header', 'configheader', get_string('blocksettings', 'core_block'));
     $mform->addElement('text', 'config_blocktitle', get_string('config_blocktitle', 'block_course_contents'));
     $mform->setDefault('config_blocktitle', '');
     $mform->setType('config_blocktitle', PARAM_MULTILANG);
     $mform->addHelpButton('config_blocktitle', 'config_blocktitle', 'block_course_contents');
     $mform->addElement('advcheckbox', 'config_enumerate', get_string('config_enumerate', 'block_course_contents'), get_string('config_enumerate_label', 'block_course_contents'));
     $mform->setDefault('config_enumerate', 1);
     $mform->setType('config_enumerate', PARAM_BOOL);
 }
 /**
  * Add appropriate form elements to the critieria form
  *
  * @param moodle_form $mform Moodle forms object
  * @param stdClass $data containing default values to be set in the form
  */
 public function config_form_display(&$mform, $data = null)
 {
     $mform->addElement('checkbox', 'criteria_grade', get_string('enable'));
     $mform->addElement('text', 'criteria_grade_value', get_string('graderequired', 'completion'));
     $mform->disabledIf('criteria_grade_value', 'criteria_grade');
     $mform->setType('criteria_grade_value', PARAM_RAW);
     // Uses unformat_float.
     $mform->setDefault('criteria_grade_value', format_float($data));
     if ($this->id) {
         $mform->setDefault('criteria_grade', 1);
         $mform->setDefault('criteria_grade_value', format_float($this->gradepass));
     }
 }
Ejemplo n.º 3
0
 /**
  * Add appropriate form elements to the critieria form
  *
  * @param moodle_form $mform Moodle forms object
  * @param stdClass $data containing default values to be set in the form
  */
 public function config_form_display(&$mform, $data = null)
 {
     $mform->addElement('checkbox', 'criteria_grade', get_string('enable'));
     $mform->addElement('text', 'criteria_grade_value', get_string('graderequired', 'completion'));
     $mform->disabledIf('criteria_grade_value', 'criteria_grade');
     $mform->setType('criteria_grade_value', PARAM_RAW);
     // Uses unformat_float.
     // Grades are stored in Moodle with 5 decimal points, make sure we do not accidentally round them
     // when setting the form value.
     $mform->setDefault('criteria_grade_value', format_float($data, 5));
     if ($this->id) {
         $mform->setDefault('criteria_grade', 1);
         $mform->setDefault('criteria_grade_value', format_float($this->gradepass, 5));
     }
 }