/** * This function is a hook that contains all of the extra initialization code * for the collapsed labels. * */ function init_collapsed_labels() { global $PAGE, $COURSE; $PAGE->requires->js('/course/format/collblct/js/jquery.nestedAccordion.js'); $PAGE->requires->js('/course/format/collblct/js/init_accordion.js'); $PAGE->requires->js('/course/format/collblct/js/setup_nested_rev07252013.js'); $colorrecord = new course_color_record($COURSE->id); $PAGE->requires->js_function_call('color_init', array($colorrecord->get_background_color(), $colorrecord->get_foreground_color()), false); }
/** * This function just grabs any pre-existing values for the form settings and * adds them to an array. * * @param int $courseid This is the course ID. * @return array pre-existing form values (use ->set_data()) to set. * */ function set_values($courseid) { $colorrecord = new course_color_record($courseid); // Saving the blockid and courseid allows the page to continue upon post. $toform['courseid'] = $courseid; $toform['backgroundcolor'] = $colorrecord->get_background_color(); $toform['foregroundcolor'] = $colorrecord->get_foreground_color(); $sectionheaders = array(); $numberofsections = ctwcl_get_section_titles($courseid, $sectionheaders); $csr = new course_section_record($courseid); for ($i = 0; $i < $numberofsections; $i++) { $sectioncheckbox = 'sectioncheckbox_' . "{$i}"; // Moodle sections count 1->N, section 0 is the summary area at the top. $toform[$sectioncheckbox] = $csr->get_section_status($i + 1); } return $toform; }