function get_subject_menu() { $html = '<select id="courseSubjects">' . "\n"; $html .= '<option value="">--</option>'; foreach (get_course_subjects() as $subject) { $html .= '<option value="' . $subject . '">' . $subject . '</option>'; } $html .= '</select>' . "\n"; return $html; }
function get_course_editor($course) { $this->form->set_element_properties('subject', array('options' => get_course_subjects())); $this->form->set_value('subject', $course->get_value('org_id')); $this->form->set_value('course_number', $course->get_value('course_number')); $this->form->set_value('title', $course->get_value('title')); $this->form->set_value('description', $course->get_value('long_description')); $this->form->set_value('prerequisites', $course->get_value('list_of_prerequisites')); $this->form->set_value('faculty', join(', ', $this->format_faculty_for_display($course->get_value('faculty')))); $this->form->set_value('credits', $course->get_value('credits')); $this->form->set_value('display_in_catalog', $course->owned_or_borrowed_by($this->site_id)); if ($sections = $course->get_sections()) { $checked = array(); $sections = array_reverse($sections); foreach ($sections as $id => $section) { $section_list[$id] = $section->get_value('name'); if ($section->get_value('long_description') == $course->get_value('long_description')) { $checked[] = $id; } } $this->form->set_element_properties('sections', array('options' => $section_list)); $this->form->set_value('sections', $checked); } // If this entity has an id tying it to an external data source, make the externally-sourced // fields non-editable. if ($course->get_value('sourced_id')) { foreach ($this->sourced_elements as $element) { $this->form->change_element_type($element, 'solidtext'); } $info = '<ul id="courseInfo">'; $info .= '<li>Course ID: ' . $course->get_value('sourced_id') . '</li>' . "\n"; if ($start = $course->get_value('start_date')) { $start = date('M d, Y', strtotime($start)); } else { $start = 'NOT SET'; } $info .= '<li>Start Date: ' . $start . '</li>' . "\n"; if ($end = $course->get_value('end_date')) { $info .= '<li>End Date: ' . date('M d, Y', strtotime($end)) . '</li>' . "\n"; } $info .= '</li>'; $this->form->set_element_properties('course_info', array('text' => $info)); $this->form->set_value('requirements', join(' ', $course->get_value('requirements'))); $this->form->set_value('grading', $course->get_value('grading')); } $this->form->run(); }