/** * Create a section linked to this offering * * @param boolean $validate Validate data? * @return boolean True on success, False on error */ public function makeSection($alias = '__default', $is_default = 1) { $section = new Section(); $section->set('offering_id', $this->get('id')); $section->set('alias', $alias); $section->set('title', Lang::txt('Default')); $section->set('state', 1); $section->set('is_default', $is_default); $section->set('enrollment', $this->config('default_enrollment', 0)); $section->set('start_date', $this->get('start_date')); $section->set('end_date', $this->get('end_date')); $section->set('publish_up', $this->get('publish_up')); $section->set('publish_down', $this->get('publish_down')); if (!$section->store()) { $this->setError($section->getError()); return false; } $this->_sections = null; return true; }