/** * Converts the data_object a dumb object representation (without * associations). This is required when using the Moodle *_record * functions, or get_string. * * Overridden to add custom fields. */ public function to_object() { $obj = parent::to_object(); $this->_load_field_data(); foreach ($this->_field_data as $name => $value) { $fieldname = "field_{$name}"; $obj->{$fieldname} = $value; } return $obj; }
/** * Add params fields to the form object */ public function to_object() { $obj = parent::to_object(); $fields = array('autoenrol_curricula', 'autoenrol_tracks', 'child_classification', 'autoenrol_groups', 'autoenrol_groupings', 'elis_files_shared_folder'); foreach ($fields as $field) { $field_name = "param_{$field}"; if (isset($this->{$field_name})) { $obj->{$field_name} = $this->{$field_name}; } } return $obj; }