mirror of
https://github.com/moodle/moodle.git
synced 2025-01-31 04:33:13 +01:00
Merge branch 'MDL-59921-master' of git://github.com/lameze/moodle
This commit is contained in:
commit
8c0f6e5419
@ -88,20 +88,7 @@ class create_update_form_mapper implements create_update_form_mapper_interface {
|
||||
public function from_data_to_event_properties(\stdClass $data) {
|
||||
$properties = clone($data);
|
||||
|
||||
// Undo the form definition work around to allow us to have two different
|
||||
// course selectors present depending on which event type the user selects.
|
||||
if ($data->eventtype == 'course') {
|
||||
// Default course id if none is set.
|
||||
if (!isset($properties->courseid)) {
|
||||
if ($properties->eventtype === 'site') {
|
||||
$properties->courseid = SITEID;
|
||||
} else {
|
||||
$properties->courseid = 0;
|
||||
}
|
||||
} else {
|
||||
$properties->courseid = $data->courseid;
|
||||
}
|
||||
} else if ($data->eventtype == 'group') {
|
||||
if ($data->eventtype == 'group') {
|
||||
if (isset($data->groupcourseid)) {
|
||||
$properties->courseid = $data->groupcourseid;
|
||||
unset($properties->groupcourseid);
|
||||
@ -113,6 +100,17 @@ class create_update_form_mapper implements create_update_form_mapper_interface {
|
||||
list($courseid, $groupid) = explode('-', $data->groupid);
|
||||
$properties->groupid = $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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user