Permalink
Browse files

There were other magic numbers that needed changing as well.

There's also a bug in there with DST and repeating events. No easy way
to fix it right now, but I documented it to squash later.
  • Loading branch information...
1 parent 60979d3 commit 3a5d4d8525452ae07804d5638105f262bfe1c875 defacer committed Feb 17, 2005
Showing with 7 additions and 5 deletions.
  1. +7 −5 calendar/event.php
View
@@ -124,7 +124,7 @@
}
}
else if($form->duration == 2) {
- $form->timeduration = $form->minutes * 60;
+ $form->timeduration = $form->minutes * MINSECS;
}
else {
$form->timeduration = 0;
@@ -164,7 +164,7 @@
}
}
else if ($form->duration == 2) {
- $form->timeduration = $form->minutes * 60;
+ $form->timeduration = $form->minutes * MINSECS;
}
else {
$form->timeduration = 0;
@@ -184,6 +184,8 @@
if ($form->repeat) {
for($i = 1; $i < $form->repeats; $i++) {
+ // [pj]
+ // This will not necessarily work correctly because of DST
$form->timestart += 604800; // add one week
/// Get the event id for the log record.
$eventid = insert_record('event', $form, true);
@@ -207,7 +209,7 @@
// Let's see if we are supposed to provide a referring course link
// but NOT for the "main page" course
- if($SESSION->cal_course_referer > 1 &&
+ if($SESSION->cal_course_referer != SITEID &&
($shortname = get_field('course', 'shortname', 'id', $SESSION->cal_course_referer)) !== false) {
// If we know about the referring course, show a return link
$nav = '<a href="'.$CFG->wwwroot.'/course/view.php?id='.$SESSION->cal_course_referer.'">'.$shortname.'</a> -> '.$nav;
@@ -269,15 +271,15 @@
$form->timeduration = $event->timeduration;
$form->id = $event->id;
$form->format = $defaultformat;
- if($event->timeduration > 3600) {
+ if($event->timeduration > HOURSECS) {
// More than one hour, so default to normal duration mode
$form->duration = 1;
$form->minutes = '';
}
else if($event->timeduration) {
// Up to one hour, "minutes" mode probably is better here
$form->duration = 2;
- $form->minutes = $event->timeduration / 60;
+ $form->minutes = $event->timeduration / MINSECS;
}
else {
// No duration

0 comments on commit 3a5d4d8

Please sign in to comment.