public function get_default_course_enddate($mform, $fieldnames = array()) {

        if (empty($fieldnames)) {
            $fieldnames = array('startdate' => 'startdate');
        }

        $startdate = $this->get_form_start_date($mform, $fieldnames);
        $courseduration = intval(get_config('moodlecourse', 'courseduration'));
        if (!$courseduration) {
            // Default, it should be already set during upgrade though.
            $courseduration = YEARSECS;
        }

        return $startdate + $courseduration;
    }
public function get_default_course_enddate($mform, $fieldnames = array()) {

        if (empty($fieldnames)) {
            $fieldnames = array('startdate' => 'startdate');
        }

        $startdate = $this->get_form_start_date($mform, $fieldnames);
        $courseduration = intval(get_config('moodlecourse', 'courseduration'));
        if (!$courseduration) {
            // Default, it should be already set during upgrade though.
            $courseduration = YEARSECS;
        }

        return $startdate + $courseduration;
    }
public function get_default_course_enddate ( $ mform , $ fieldnames = array ( ) ) { if ( empty ( $ fieldnames ) ) { $ fieldnames = array ( 'startdate' => 'startdate' ) ; } $ startdate = $ this -> get_form_start_date ( $ mform , $ fieldnames ) ; $ courseduration = intval ( get_config ( 'moodlecourse' , 'courseduration' ) ) ; if ( ! $ courseduration ) { // Default, it should be already set during upgrade though. $ courseduration = YEARSECS ; } return $ startdate + $ courseduration ; }
Returns the default end date value based on the start date.

This is the default implementation for course formats, it is based on
moodlecourse/courseduration setting. Course formats like format_weeks for
example can overwrite this method and return a value based on their internal options.

@param moodleform $mform
@param array $fieldnames The form - field names mapping.
@return int
Returns the default end date value based on the start date .