Skip to content

Commit

Permalink
MDL-23616 fixed deleting of events
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Aug 2, 2010
1 parent dcd79f4 commit ae53bd1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions calendar/delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@
* a course
*/
if ($event->eventtype !== 'user' && $event->eventtype !== 'site') {
if ($courseid !== $event->courseid) {
print_error('invalidcourse');
}
require_login($event->courseid);
$courseid = $event->courseid;
$course = $DB->get_record('course', array('id'=>$courseid), '*', MUST_EXIST);
require_login($course);
} else {
require_login();
}
Expand Down
8 changes: 4 additions & 4 deletions calendar/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ function calendar_add_event_metadata($event) {
* @deprecated 2.0
*/
function calendar_print_event($event, $showactions=true) {
global $CFG, $USER, $OUTPUT;
global $CFG, $USER, $OUTPUT, $PAGE;
debugging('calendar_print_event is deprecated please update your code', DEBUG_DEVELOPER);
$renderer = $PAGE->get_renderer('core_calendar');
if (!($event instanceof calendar_event)) {
Expand Down Expand Up @@ -681,7 +681,7 @@ function calendar_top_controls($type, $data) {
list($nextmonth, $nextyear) = calendar_add_month($data['m'], $data['y']);
$nextlink = calendar_get_link_next(get_string('monthnext', 'access'), 'index.php?', 0, $nextmonth, $nextyear, $accesshide=true);
$prevlink = calendar_get_link_previous(get_string('monthprev', 'access'), 'index.php?', 0, $prevmonth, $prevyear, true);

if (right_to_left()) {
$content .= "\n".'<div class="calendar-controls">'. $nextlink;
$content .= '<span class="hide"> | </span><span class="current"><a href="'.calendar_get_link_href(CALENDAR_URL.'view.php?view=month'.$courseid.'&amp;', 1, $data['m'], $data['y']).'">'.userdate($time, get_string('strftimemonthyear')).'</a></span>';
Expand All @@ -693,7 +693,7 @@ function calendar_top_controls($type, $data) {
$content .= '<span class="hide"> | </span>'. $nextlink ."\n";
$content .= "<span class=\"clearer\"><!-- --></span></div>\n";
}

break;
case 'course':
list($prevmonth, $prevyear) = calendar_sub_month($data['m'], $data['y']);
Expand Down Expand Up @@ -934,7 +934,7 @@ function calendar_get_link_previous($text, $linkbase, $d, $m, $y, $accesshide=fa
function calendar_get_link_next($text, $linkbase, $d, $m, $y, $accesshide=false) {
$href = calendar_get_link_href($linkbase, $d, $m, $y);
if(empty($href)) return $text;

return link_arrow_right($text, $href, $accesshide, 'next');
}

Expand Down

0 comments on commit ae53bd1

Please sign in to comment.