/** * Deletes a section * * Do not call this function directly, instead call {@link course_delete_section()} * * @param int|stdClass|section_info $section * @param bool $forcedeleteifnotempty if set to false section will not be deleted if it has modules in it. * @return bool whether section was deleted */ public function delete_section($section, $forcedeleteifnotempty = false) { global $DB; if (!is_object($section)) { $section = $DB->get_record('course_sections', array('course' => $this->get_courseid(), 'section' => $section), 'id,section,sequence'); } if (parent::delete_section($section, $forcedeleteifnotempty)) { $coursecontext = context_course::instance($this->courseid); $this->delete_image($section->id, $coursecontext->id); return true; } return false; }