diff --git a/class.section.php b/class.section.php --- a/class.section.php +++ b/class.section.php @@ -146,4 +146,95 @@ function getF() return $this->bdays[4]; } + /** + * \brief + * Create output suitable for editing on input.php. + * + * \see Classes::input_form_render() + * + * \param $class_key + * The same $class_key passed to Classes::input_form_render(). + * \param $section_key + * The index of this section. + * \param $section_format + * The type of input method used for this section. Valid values + * are 'numerous', 'numbered', and 'lettered' + */ + function input_form_render($class_key, $section_key, $section_format = 'numerous') + { + static $n = "\n"; + $out = '' . $n + . ' ' . $n; + switch ($section_format) + { + case 'numerous': + default: + /* see customIds() in scheduleInput.js */ + $out .= ' ' . $n + . ' ' . $n + . " \n"; + break; + } + + $out .= " \n" + . ' \n" + . " \n"; + + /* ugh, code duplication :-( --binki commenting on his own code*/ + $out .= " \n" + . ' \n" + . " \n"; + + foreach ($this->bdays as $day_key => $day_enabled) + { + if ($day_enabled) + $day_enabled = 'checked="checked"'; + else + $day_enabled = ''; + $out .= " \n" + . ' ' . $n + . " \n"; + } + + $out .= "\n"; + + return $out; + } }