/** * Output the checkbox for this setting flag. Should only be called if the flag is enabled. * * @param admin_setting $setting - The admin setting for this flag * @return string - The html for the checkbox. */ public function output_setting_flag(admin_setting $setting) { $value = $setting->get_setting_flag_value($this); $output = ' <input type="checkbox" class="form-checkbox" ' . ' id="' . $setting->get_id() . '_' . $this->get_shortname() . '" ' . ' name="' . $setting->get_full_name() . '_' . $this->get_shortname() . '" ' . ' value="1" ' . ($value ? 'checked="checked"' : '') . ' />' . ' <label for="' . $setting->get_id() . '_' . $this->get_shortname() . '">' . $this->get_displayname() . ' </label> '; return $output; }
/** * Output the checkbox for this setting flag. Should only be called if the flag is enabled. * * @param admin_setting $setting - The admin setting for this flag * @return string - The html for the checkbox. */ public function output_setting_flag(admin_setting $setting) { global $OUTPUT; $value = $setting->get_setting_flag_value($this); $context = new stdClass(); $context->id = $setting->get_id() . '_' . $this->get_shortname(); $context->name = $setting->get_full_name() . '_' . $this->get_shortname(); $context->value = 1; $context->checked = $value ? true : false; $context->label = $this->get_displayname(); return $OUTPUT->render_from_template('core_admin/setting_flag', $context); }