public function from_data_to_event_properties(\stdClass $data) {
        $properties = clone($data);

        if ($data->eventtype == 'group') {
            if (isset($data->groupcourseid)) {
                $properties->courseid = $data->groupcourseid;
                unset($properties->groupcourseid);
            }
            if (isset($data->groupid)) {
                $properties->groupid = $data->groupid;
            }
        } else {
            // Default course id if none is set.
            if (empty($properties->courseid)) {
                if ($properties->eventtype == 'site') {
                    $properties->courseid = SITEID;
                } else {
                    $properties->courseid = 0;
                }
            } else {
                $properties->courseid = $data->courseid;
            }
        }

        // Decode the form fields back into valid event property.
        $properties->timeduration = $this->get_time_duration_from_form_data($data);

        return $properties;
    }
public function from_data_to_event_properties(\stdClass $data) {
        $properties = clone($data);

        if ($data->eventtype == 'group') {
            if (isset($data->groupcourseid)) {
                $properties->courseid = $data->groupcourseid;
                unset($properties->groupcourseid);
            }
            if (isset($data->groupid)) {
                $properties->groupid = $data->groupid;
            }
        } else {
            // Default course id if none is set.
            if (empty($properties->courseid)) {
                if ($properties->eventtype == 'site') {
                    $properties->courseid = SITEID;
                } else {
                    $properties->courseid = 0;
                }
            } else {
                $properties->courseid = $data->courseid;
            }
        }

        // Decode the form fields back into valid event property.
        $properties->timeduration = $this->get_time_duration_from_form_data($data);

        return $properties;
    }
public function from_data_to_event_properties ( \ stdClass $ data ) { $ properties = clone ( $ data ) ; if ( $ data -> eventtype == 'group' ) { if ( isset ( $ data -> groupcourseid ) ) { $ properties -> courseid = $ data -> groupcourseid ; unset ( $ properties -> groupcourseid ) ; } if ( isset ( $ data -> groupid ) ) { $ properties -> groupid = $ data -> groupid ; } } else { // Default course id if none is set. if ( empty ( $ properties -> courseid ) ) { if ( $ properties -> eventtype == 'site' ) { $ properties -> courseid = SITEID ; } else { $ properties -> courseid = 0 ; } } else { $ properties -> courseid = $ data -> courseid ; } } // Decode the form fields back into valid event property. $ properties -> timeduration = $ this -> get_time_duration_from_form_data ( $ data ) ; return $ properties ; }
Generate the appropriate calendar_event properties from the form data.

@param \stdClass $data
@return stdClass
Generate the appropriate calendar_event properties from the form data .