mirror of
https://github.com/moodle/moodle.git
synced 2025-06-01 05:35:55 +02:00
MDL-62944 activities: Activities should not require capability
Activities should not require the user manipulating them to have calendar capabilities for their events to be added to the Moodle calendar
This commit is contained in:
parent
196aa50489
commit
bbf1fde412
@ -345,7 +345,7 @@ function assign_update_events($assign, $override = null) {
|
||||
unset($event->id);
|
||||
}
|
||||
$event->name = $eventname.' ('.get_string('duedate', 'assign').')';
|
||||
calendar_event::create($event);
|
||||
calendar_event::create($event, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1328,9 +1328,9 @@ class assign {
|
||||
// Now process the event.
|
||||
if ($event->id) {
|
||||
$calendarevent = calendar_event::load($event->id);
|
||||
$calendarevent->update($event);
|
||||
$calendarevent->update($event, false);
|
||||
} else {
|
||||
calendar_event::create($event);
|
||||
calendar_event::create($event, false);
|
||||
}
|
||||
} else {
|
||||
$DB->delete_records('event', array('modulename' => 'assign', 'instance' => $instance->id,
|
||||
@ -1349,9 +1349,9 @@ class assign {
|
||||
// Now process the event.
|
||||
if ($event->id) {
|
||||
$calendarevent = calendar_event::load($event->id);
|
||||
$calendarevent->update($event);
|
||||
$calendarevent->update($event, false);
|
||||
} else {
|
||||
calendar_event::create($event);
|
||||
calendar_event::create($event, false);
|
||||
}
|
||||
} else {
|
||||
$DB->delete_records('event', array('modulename' => 'assign', 'instance' => $instance->id,
|
||||
|
@ -134,7 +134,7 @@ function chat_add_instance($chat) {
|
||||
$event->timesort = $chat->chattime;
|
||||
$event->timeduration = 0;
|
||||
|
||||
calendar_event::create($event);
|
||||
calendar_event::create($event, false);
|
||||
}
|
||||
|
||||
if (!empty($chat->completionexpected)) {
|
||||
@ -174,7 +174,7 @@ function chat_update_instance($chat) {
|
||||
$event->timesort = $chat->chattime;
|
||||
|
||||
$calendarevent = calendar_event::load($event->id);
|
||||
$calendarevent->update($event);
|
||||
$calendarevent->update($event, false);
|
||||
} else {
|
||||
// Do not publish this event, so delete it.
|
||||
$calendarevent = calendar_event::load($event->id);
|
||||
@ -197,7 +197,7 @@ function chat_update_instance($chat) {
|
||||
$event->timesort = $chat->chattime;
|
||||
$event->timeduration = 0;
|
||||
|
||||
calendar_event::create($event);
|
||||
calendar_event::create($event, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -501,7 +501,7 @@ function chat_prepare_update_events($chat, $cm = null) {
|
||||
if ($event->id = $DB->get_field('event', 'id', array('modulename' => 'chat', 'instance' => $chat->id,
|
||||
'eventtype' => CHAT_EVENT_TYPE_CHATTIME))) {
|
||||
$calendarevent = calendar_event::load($event->id);
|
||||
$calendarevent->update($event);
|
||||
$calendarevent->update($event, false);
|
||||
} else if ($chat->schedule > 0) {
|
||||
// The chat is scheduled and the event should be published.
|
||||
$event->courseid = $chat->course;
|
||||
@ -512,7 +512,7 @@ function chat_prepare_update_events($chat, $cm = null) {
|
||||
$event->eventtype = CHAT_EVENT_TYPE_CHATTIME;
|
||||
$event->timeduration = 0;
|
||||
$event->visible = $cm->visible;
|
||||
calendar_event::create($event);
|
||||
calendar_event::create($event, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ function choice_set_events($choice) {
|
||||
$event->visible = instance_is_visible('choice', $choice);
|
||||
$event->timeduration = 0;
|
||||
$calendarevent = calendar_event::load($event->id);
|
||||
$calendarevent->update($event);
|
||||
$calendarevent->update($event, false);
|
||||
} else {
|
||||
// Calendar event is on longer needed.
|
||||
$calendarevent = calendar_event::load($event->id);
|
||||
@ -78,7 +78,7 @@ function choice_set_events($choice) {
|
||||
$event->timesort = $choice->timeopen;
|
||||
$event->visible = instance_is_visible('choice', $choice);
|
||||
$event->timeduration = 0;
|
||||
calendar_event::create($event);
|
||||
calendar_event::create($event, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ function choice_set_events($choice) {
|
||||
$event->visible = instance_is_visible('choice', $choice);
|
||||
$event->timeduration = 0;
|
||||
$calendarevent = calendar_event::load($event->id);
|
||||
$calendarevent->update($event);
|
||||
$calendarevent->update($event, false);
|
||||
} else {
|
||||
// Calendar event is on longer needed.
|
||||
$calendarevent = calendar_event::load($event->id);
|
||||
@ -117,7 +117,7 @@ function choice_set_events($choice) {
|
||||
$event->timesort = $choice->timeclose;
|
||||
$event->visible = instance_is_visible('choice', $choice);
|
||||
$event->timeduration = 0;
|
||||
calendar_event::create($event);
|
||||
calendar_event::create($event, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -613,7 +613,7 @@ function data_set_events($data) {
|
||||
$event->visible = instance_is_visible('data', $data);
|
||||
$event->timeduration = 0;
|
||||
$calendarevent = calendar_event::load($event->id);
|
||||
$calendarevent->update($event);
|
||||
$calendarevent->update($event, false);
|
||||
} else {
|
||||
// Calendar event is on longer needed.
|
||||
$calendarevent = calendar_event::load($event->id);
|
||||
@ -633,7 +633,7 @@ function data_set_events($data) {
|
||||
$event->timesort = $data->timeavailablefrom;
|
||||
$event->visible = instance_is_visible('data', $data);
|
||||
$event->timeduration = 0;
|
||||
calendar_event::create($event);
|
||||
calendar_event::create($event, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -652,7 +652,7 @@ function data_set_events($data) {
|
||||
$event->visible = instance_is_visible('data', $data);
|
||||
$event->timeduration = 0;
|
||||
$calendarevent = calendar_event::load($event->id);
|
||||
$calendarevent->update($event);
|
||||
$calendarevent->update($event, false);
|
||||
} else {
|
||||
// Calendar event is on longer needed.
|
||||
$calendarevent = calendar_event::load($event->id);
|
||||
@ -672,7 +672,7 @@ function data_set_events($data) {
|
||||
$event->timesort = $data->timeavailableto;
|
||||
$event->visible = instance_is_visible('data', $data);
|
||||
$event->timeduration = 0;
|
||||
calendar_event::create($event);
|
||||
calendar_event::create($event, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -826,7 +826,7 @@ function feedback_set_events($feedback) {
|
||||
// Calendar event exists so update it.
|
||||
$event->id = $eventid;
|
||||
$calendarevent = calendar_event::load($event->id);
|
||||
$calendarevent->update($event);
|
||||
$calendarevent->update($event, false);
|
||||
} else {
|
||||
// Event doesn't exist so create one.
|
||||
$event->courseid = $feedback->course;
|
||||
@ -835,7 +835,7 @@ function feedback_set_events($feedback) {
|
||||
$event->modulename = 'feedback';
|
||||
$event->instance = $feedback->id;
|
||||
$event->eventtype = FEEDBACK_EVENT_TYPE_OPEN;
|
||||
calendar_event::create($event);
|
||||
calendar_event::create($event, false);
|
||||
}
|
||||
} else if ($eventid) {
|
||||
// Calendar event is on longer needed.
|
||||
@ -861,7 +861,7 @@ function feedback_set_events($feedback) {
|
||||
// Calendar event exists so update it.
|
||||
$event->id = $eventid;
|
||||
$calendarevent = calendar_event::load($event->id);
|
||||
$calendarevent->update($event);
|
||||
$calendarevent->update($event, false);
|
||||
} else {
|
||||
// Event doesn't exist so create one.
|
||||
$event->courseid = $feedback->course;
|
||||
@ -869,7 +869,7 @@ function feedback_set_events($feedback) {
|
||||
$event->userid = 0;
|
||||
$event->modulename = 'feedback';
|
||||
$event->instance = $feedback->id;
|
||||
calendar_event::create($event);
|
||||
calendar_event::create($event, false);
|
||||
}
|
||||
} else if ($eventid) {
|
||||
// Calendar event is on longer needed.
|
||||
|
@ -217,7 +217,7 @@ function lesson_update_events($lesson, $override = null) {
|
||||
}
|
||||
$event->name = get_string('lessoneventopens', 'lesson', $eventname);
|
||||
// The method calendar_event::create will reuse a db record if the id field is set.
|
||||
calendar_event::create($event);
|
||||
calendar_event::create($event, false);
|
||||
}
|
||||
if ($deadline && $addclose) {
|
||||
if ($oldevent = array_shift($oldevents)) {
|
||||
@ -236,7 +236,7 @@ function lesson_update_events($lesson, $override = null) {
|
||||
$event->priority = $closepriorities[$deadline];
|
||||
}
|
||||
}
|
||||
calendar_event::create($event);
|
||||
calendar_event::create($event, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1340,7 +1340,7 @@ function quiz_update_events($quiz, $override = null) {
|
||||
}
|
||||
$event->name = get_string('quizeventopens', 'quiz', $eventname);
|
||||
// The method calendar_event::create will reuse a db record if the id field is set.
|
||||
calendar_event::create($event);
|
||||
calendar_event::create($event, false);
|
||||
}
|
||||
if ($timeclose && $addclose) {
|
||||
if ($oldevent = array_shift($oldevents)) {
|
||||
@ -1359,7 +1359,7 @@ function quiz_update_events($quiz, $override = null) {
|
||||
$event->priority = $closepriorities[$timeclose];
|
||||
}
|
||||
}
|
||||
calendar_event::create($event);
|
||||
calendar_event::create($event, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2397,7 +2397,7 @@ function scorm_update_calendar(stdClass $scorm, $cmid) {
|
||||
$event->timeduration = 0;
|
||||
|
||||
$calendarevent = calendar_event::load($event->id);
|
||||
$calendarevent->update($event);
|
||||
$calendarevent->update($event, false);
|
||||
} else {
|
||||
// Calendar event is on longer needed.
|
||||
$calendarevent = calendar_event::load($event->id);
|
||||
@ -2418,7 +2418,7 @@ function scorm_update_calendar(stdClass $scorm, $cmid) {
|
||||
$event->visible = instance_is_visible('scorm', $scorm);
|
||||
$event->timeduration = 0;
|
||||
|
||||
calendar_event::create($event);
|
||||
calendar_event::create($event, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2438,7 +2438,7 @@ function scorm_update_calendar(stdClass $scorm, $cmid) {
|
||||
$event->timeduration = 0;
|
||||
|
||||
$calendarevent = calendar_event::load($event->id);
|
||||
$calendarevent->update($event);
|
||||
$calendarevent->update($event, false);
|
||||
} else {
|
||||
// Calendar event is on longer needed.
|
||||
$calendarevent = calendar_event::load($event->id);
|
||||
@ -2459,7 +2459,7 @@ function scorm_update_calendar(stdClass $scorm, $cmid) {
|
||||
$event->visible = instance_is_visible('scorm', $scorm);
|
||||
$event->timeduration = 0;
|
||||
|
||||
calendar_event::create($event);
|
||||
calendar_event::create($event, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user