/** * This function builds an 'select course' form in the add category process, * if parent id is 0, it will only show courses */ protected function build_select_course_form() { $select = $this->addElement('select', 'select_course', array(get_lang('PickACourse'), 'test'), null); $coursecat = Category::get_all_courses(api_get_user_id()); //only return courses that are not yet created by the teacher foreach ($coursecat as $row) { $select->addoption($row[1], $row[0]); } $this->setDefaults(array('hid_user_id' => $this->category_object->get_user_id(), 'hid_parent_id' => $this->category_object->get_parent_id())); $this->addElement('hidden', 'hid_user_id'); $this->addElement('hidden', 'hid_parent_id'); $this->addElement('submit', null, get_lang('Ok')); }