PEAK XOOPS - Recurring Event (Summertime) Problem SOLVED and other hacks in englishin japanese

Recurring Event (Summertime) Problem SOLVED and other hacks

  • You cannot open a new topic into this forum
  • Guests cannot post into this forum
Previous post - Next post | Parent - Children.1 .2 .3 | Posted on 2004/8/30 14:48
AZNative  办霹始 From: Phoenix, Arizona, USA  Posts: 12
As many of you, the issue with recurring events was driving me crazy. This caused problems for me specifically because my servers are in a state that observes summertime while my state does not.

The problem was noticeable when creating a recurring event that overlapped a change in summertime. This would be October/November and April/May. Events would be off by one hour and all-day events would span multiple days. This happens because the physical servers are set to adjust for summertime automatically. Thus, any PHP calls involving date would inherit the summertime rules and then insert the inappropriate date into the database. Of course, this would easily be solved if web hosts wouldn't use summertime.

I've solved the problem by using GMT dates for the recurring events in the PHP code instead of the event time and then letting the database automatically do the proper adjustment for me by using a MySql method.

There is a side-effect to this change that you must be aware of. It is very minor compared to the summertime issue. Let's say you create an event from 10:00 - 14:00 that recurs every Wednesday. Each instance of that event will be 10:00-14:00. When you get to summertime/wintertime, it will not change by one hour. It will always be scheduled with the same start and end time, regardless.

For all-day events, let's say you schedule an all-day, recurring event for the 15th of each month. No matter what time zone the user is in, the event will always shows as all-day for the 15th. Even if the user is in a different time zone than where the event is occurring, the
event will show on the day in the location the event was scheduled.

I think most people can figure it out from here. I did do some testing of this code, but you may experience other issues. If you do, please let me know and I'll see if I can get them fixed. I may not be able to get to it right away however. If you can't wait, then either live with the hack or rollback to the old code.

In addition to the summertime/wintertime changes, I also made other changes so that all times are in 12 hours format using am/pm instead of the 24-hour clock.

I will make a separate post for each of the hacks, so please continue to read my other posts for the hacks.

IMPORTANT NOTE: This code works with MySql only since the database inserts were changed to use the UNIX_TIMESTAMP method in MySql. DO NOT IMPLEMENT THESE CHANGES UNLESS YOU ARE USING MYSQL. I do no warrant the code and I'm not responsible for any problems your website incurs due to this code. You implement this code at your own risk
Votes:1 Average:0.00
Previous post - Next post | Parent - Children.1 .2 .3 | Posted on 2004/8/30 15:40
AZNative  办霹始 From: Phoenix, Arizona, USA  Posts: 12
NOTE: This hack only works with MySql as it uses the UNIX_TIMESTAMP method to do the inserts. You implement this code at your own risk

Since there were a lot of lines changed, here is what you need to do to implement this hack.

Open piCal.php and do a search for the function
function rrule_extract(
This is the very last function defined in the file, so if you can't find it by doing a search, just go to the bottom of the file and look for it around line 3320.

Remove the entire function and replace it with the following:

function rrule_extract ($event_id) {
  $yrs = mysql_query ("SELECT *,TO_DAYS(end_date)-TO_DAYS(start_date) AS date_diff FROM $this->table WHERE id='$event_id'", $this->conn);

  if (mysql_num_rows($yrs) < 1) return;
 
  $event = mysql_fetch_object($yrs);

  if($event->rrule == '') return;

  $rrule = strtoupper($event->rrule);
  $rules = split( ';' , $rrule );

  foreach( $rules as $rule ) {
    list($key, $val) = explode('=', $rule, 2);
    $key = trim($key);
    $$key = trim($val);
  }

  if (empty($FREQ)) $FREQ = 'DAILY';

  if (empty($INTERVAL) || $INTERVAL <= 0) $INTERVAL = 1;

  $base_sql = "INSERT INTO $this->table SET uid='$event->uid',groupid='$event->groupid',summary='".addslashes($event->summary)."',location='".addslashes($event->location)."',organizer='".addslashes($event->organizer)."',sequence='$event->sequence',contact='".addslashes($event->contact)."',tzid='$event->tzid',description='".addslashes($event->description)."',dtstamp='$event->dtstamp',categories='".addslashes($event->categories)."',transp='$event->transp',priority='$event->priority',admission='$event->admission',class='$event->class',rrule='".addslashes($event->rrule)."',unique_id='$event->unique_id',allday='$event->allday',start_date=null,end_date=null,cid='$event->cid',event_tz='$event->event_tz',server_tz='$event->server_tz',poster_tz='$event->poster_tz',extkey0='$event->extkey0',extkey1='$event->extkey1',rrule_pid='$event_id'";

  $count = $this->max_rrule_extract;

  if (isset($COUNT) && $COUNT > 0 && $COUNT < $count) {
    $count = $COUNT;
  }

  if (isset($UNTIL)) {
    $year = substr($UNTIL, 0, 4);
    $month = substr($UNTIL, 4, 2);
    $date = substr($UNTIL, 6, 2);

    if (! checkdate($month, $date, $year)) {
      $until = 0x7FFFFFFF;
    } else {
      $until = mktime( 23 , 59 , 59 , $month , $date , $year, 0 ) ;
   
      if (! $event->allday) {
        $until -= intval($tzoffset_date * 86400);
      }
    }
  } else {
    $until = 0x7FFFFFFF ;
  }

  // WKST
  if (empty($WKST)) {
    $WKST = 'MO';
  }

  // UnixTimestamp认跋嘲の借妄
  if (isset($event->start_date)) {

    if (date('Y', $event->start) >= 2038) {
      return;
    }

    if (date('Y', $event->end ) >= 2038) {
      return;
    }

    // 1971
    $event->start = mktime(0, 0, 0, substr($event->start_date, 5 ,2), substr($event->start_date, 8, 2), 1970 + 1);

    // end 1970
    if (isset($event->end_date)) {
      $event->end = $event->start + ($event->date_diff + 1) * 86400;
    }
  }

  $sqls = array();

  switch ($FREQ) {

    case 'DAILY':

      $start = gmmktime(date("H", $event->start), date("i", $event->start), date("s", $event->start), date("m", $event->start), date("d", $event->start), date("Y", $event->start) ) ;
      $end = gmmktime(date("H", $event->end), date("i", $event->end), date("s", $event->end), date("m", $event->end), date("d", $event->end), date("Y", $event->end) ) ;

      for($c = 1; $c < $count; $c ++) {
        $start += $INTERVAL * 86400;
        $end += $INTERVAL * 86400;

        if($start > $until) {
          break;
        } 

        $sqls[] = $base_sql . ",start=UNIX_TIMESTAMP('".gmdate("Y-m-d H:i:s", $start)."'),end=UNIX_TIMESTAMP('".gmdate("Y-m-d H:i:s", $end)."')";
      }

      break;
			
    case 'WEEKLY':

      $start = gmmktime( date("H", $event->start), date("i", $event->start), date("s", $event->start), date("m", $event->start), date("d", $event->start), date("Y", $event->start) ) ;
      $end = gmmktime( date("H", $event->end), date("i", $event->end), date("s", $event->end), date("m", $event->end), date("d", $event->end), date("Y", $event->end) ) ;

      $duration = $end - $start;
      $wtop_date = gmdate('j', $start) - gmdate('w', $start);

      if ($WKST != 'SU') {
        $wtop_date = $wtop_date == 7 ? 1 : $wtop_date + 1;
      }

      $secondofday = (gmdate('Z') + $start) % 86400;
      $month = gmdate('m', $start);
      $year  = gmdate('Y', $start);
      $week_top = gmmktime(0, 0, 0, $month, $wtop_date, $year);
      $c = 1;

      $temp_dates = explode(',', $BYDAY);
      $wdays = array_keys($this->byday2langday_w);

      if($WKST != 'SU') {
        // rotate wdays for creating array stating with Monday
        $sun_date = array_shift( $wdays);
        array_push($wday , $sun_date);
      }

      $dates = array();
      foreach ($temp_dates as $date) {

        // measure for bug of PHP<4.2.0
        if( in_array($date, $wdays)) {
          $dates[] = array_search($date, $wdays);
        }
      }

      sort($dates);
      $dates = array_unique($dates);

      if (! count($dates)) {
        return;
      }

      while (1) {
        foreach ($dates as $date) {
          $start = $week_top + ($date - $tzoffset_date) * 86400 + $secondofday;

          if($start <= $event->start) {
            continue;
          }

          $end = $start + $duration;

          if($start > $until) {
            break 2;
          }
          if(++ $c > $count) {
            break 2;
          }

          $sqls[] = $base_sql . ",start=UNIX_TIMESTAMP('".gmdate("Y-m-d H:i:s", $start)."'),end=UNIX_TIMESTAMP('".gmdate("Y-m-d H:i:s", $end)."')" ;
        }

        $week_top += $INTERVAL * 86400 * 7 ;
      }

      break;
			
    case 'MONTHLY':

      $start = $event->start;
      $secondofday = (date('Z') + $start) % 86400;
      $duration = $event->end - $event->start;
      $month = date('m', $start);
      $year = date('Y', $start);
      $c = 1;

      if (isset($BYDAY) && ereg('^(-1|[1-4])(SU|MO|TU|WE|TH|FR|SA)', $BYDAY, $regs)) {
        $wdays = array_keys($this->byday2langday_w);
        $wday = array_search($regs[2], $wdays);
        $first_ymw = gmdate('Ym', $start) . intval((date('j', $start) - 1) / 7);

        if ($regs[1] == -1) {
          $monthday_bottom = gmmktime(0, 0, 0, $month + 1, 0, $year);

          while (1) {
            for ($i = 0; $i < $INTERVAL; $i ++) {
              $monthday_bottom += gmdate('t', $monthday_bottom + 86400) * 86400;
            }

            $last_monthdays_wday = gmdate('w', $monthday_bottom);
            $date_back = $wday - $last_monthdays_wday;

            if ($date_back > 0) {
              $date_back -= 7;
            }

            $start = $monthday_bottom + ($date_back - $tzoffset_date) * 86400 + $secondofday;
            $end = $start + $duration;

            if ($start > $unti ) {
              break;
            }

            if(++ $c > $count) {
              break;
            }

            // echo date( "Y-m-d" , $start ) . "<br />" ;
            $sqls[] = $base_sql . ",start=UNIX_TIMESTAMP('".gmdate("Y-m-d H:i:s", $start)."'),end=UNIX_TIMESTAMP('".gmdate("Y-m-d H:i:s", $end)."')" ;
          }
        } else {

          $monthday_top = gmmktime(0, 0, 0, $month, 1, $year);
          $week_number_offset = ($regs[1] - 1) * 7 * 86400;

          while (1) {
            for ($i = 0; $i < $INTERVAL; $i ++) {
              $monthday_top += gmdate('t', $monthday_top) * 86400;
            }


            $week_numbers_top_wday = gmdate('w', $monthday_top + $week_number_offset);
            $date_ahead = $wday - $week_numbers_top_wday;

            if ($date_ahead < 0) {
              $date_ahead += 7;
            }

            $start = $monthday_top + $week_number_offset + ($date_ahead - $tzoffset_date) * 86400 + $secondofday;
            $end = $start + $duration ;

            if ($start > $until) {
              break;
            }

            if (++ $c > $count) {
              break;
            }

            // echo date( "Y-m-d" , $start ) . "<br />" ;
            $sqls[] = $base_sql . ",start=UNIX_TIMESTAMP('".gmdate("Y-m-d H:i:s", $start)."'),end=UNIX_TIMESTAMP('".gmdate("Y-m-d H:i:s", $end)."')" ;
          }
        }
      } else if (isset($BYMONTHDAY)) {

        $monthday_top = gmmktime(0, 0, 0, $month, 1, $year);
        $temp_dates = explode(',', $BYMONTHDAY);
        $dates = array();

        foreach ($temp_dates as $date) {
          if ($date > 0 && $date <= 31) {
            $dates[] = intval($date);
          }
        }
        sort($dates);
        $dates = array_unique($dates);

        if (! count($dates)) {
          return;
        }

        while (1) {
          $months_day = gmdate('t', $monthday_top);

          foreach ($dates as $date) {
            if ($date > $months_day) {
              $date = $months_day;
            }

            $start = $monthday_top + ($date - 1 - $tzoffset_date) * 86400 + $secondofday;

            if ($start <= $event->start) {
              continue;
            }

            $end = $start + $duration;

            if ($start > $until) {
              break 2;
            }
            if (++ $c > $count) {
              break 2;
            }

            // echo date( "Y-m-d" , $start ) . "<br />" ;
            $sqls[] = $base_sql . ",start=UNIX_TIMESTAMP('".gmdate("Y-m-d H:i:s", $start)."'),end=UNIX_TIMESTAMP('".gmdate("Y-m-d H:i:s", $end)."')" ;
          }

          for ($i = 0; $i < $INTERVAL; $i ++) {
            $monthday_top += gmdate('t', $monthday_top) * 86400;
          }
        }
      } else {
        return;
      }

      break;
			
    case 'YEARLY':

      $start = gmmktime( date("H", $event->start), date("i", $event->start), date("s", $event->start), date("m", $event->start), date("d", $event->start), date("Y", $event->start) ) ;
      $end = gmmktime(date("H", $event->end), date("i", $event->end), date("s", $event->end), date("m", $event->end), date("d", $event->end), date("Y", $event->end) ) ;
      $secondofday = (gmdate('Z') + $start) % 86400;
      $duration = $end - $start;

      // BYMONTH を涟借妄して、$months芹误にする∈BYMONTHは剩眶材∷
      $temp_months = explode(',', $BYMONTH );
      $months = array();

      foreach ($temp_months as $month) {
        if ($month > 0 && $month <= 12) {
          $months[] = intval( $month );
        }
      }

      sort( $months ) ;
      $months = array_unique( $months ) ;

      if (! count($months)) {
        return;
      }

      if (isset($BYDAY) && ereg('^(-1|[1-4])(SU|MO|TU|WE|TH|FR|SA)', $BYDAY, $regs)) {
        $wdays = array_keys($this->byday2langday_w);
	$wday = array_search($regs[2], $wdays);
        $first_ym = gmdate('Ym', $start );
        $year = gmdate('Y', $start );
        $c = 1;

        if ($regs[1] == -1) {

          while (1) {

            foreach ($months as $month) {

              $last_monthdays_wday = gmdate('w', mktime(0, 0, 0, $month + 1, 0, $year));
              $date_back = $wday - $last_monthdays_wday;

              if ($date_back > 0) {
                $date_back -= 7;
              }

              $start = gmmktime(0, 0, 0, $month + 1, $date_back - $tzoffset_date, $year) + $secondofday;

              if (gmdate('Ym', $start) <= $first_ym) {
                continue;
              }

              $end = $start + $duration ;

              if ($start > $until) {
                break 2;
              }

              if (++ $c > $count) {
                break 2;
              }

              // echo date( "Y-m-d" , $start ) . "<br />" ;
              $sqls[] = $base_sql . ",start=UNIX_TIMESTAMP('".gmdate("Y-m-d H:i:s", $start)."'),end=UNIX_TIMESTAMP('".gmdate("Y-m-d H:i:s", $end)."')" ;
            }

            $year += $INTERVAL;

            if ($year >= 2038) {
              break;
            }
          }
        } else {

          $week_numbers_top_date = 1 + ($regs[1] - 1) * 7;

          while (1) {

            foreach ($months as $month) {
              $week_numbers_top_wday = gmdate('w', gmmktime(0, 0, 0, $month, $week_numbers_top_date, $year));
              $date_ahead = $wday - $week_numbers_top_wday;

              if ($date_ahead < 0) {
                $date_ahead += 7;
              }

              $start = gmmktime(0, 0, 0, $month, $week_numbers_top_date + $date_ahead - $tzoffset_date, $year) + $secondofday;

              if (date('Ym', $start) <= $first_ym) {
                continue;
              }

              $end = $start + $duration;

              if ($start > $until) {
                break 2;
              }

              if (++ $c > $count) {
                break 2;
              }

              // echo date( "Y-m-d" , $start ) . "<br />" ;
              $sqls[] = $base_sql . ",start=UNIX_TIMESTAMP('".gmdate("Y-m-d H:i:s", $start)."'),end=UNIX_TIMESTAMP('".gmdate("Y-m-d H:i:s", $end)."')" ;
            }

            $year += $INTERVAL;

            if ($year >= 2038) {
              break;
            }
          }
        }
      } else {

        $first_date = gmdate('j', $start);
        $year = gmdate('Y', $start);
        $c = 1 ;

        while (1) {

          foreach($months as $month) {
            $date = $first_date ;

            while (! checkdate($month, $date, $year ) && $date > 0) {
              $date -- ;
            }

            $start = gmmktime(0, 0, 0, $month, $date, $year, 0) + $secondofday;

            if ($start <= $event->start) {
              continue;
            }

            $end = $start + $duration ;

            if ($start > $until) {
              break 2;
            }

            if (++ $c > $count) {
              break 2;
            }

            // echo date( "Y-m-d" , $start ) . "<br />" ;
            $sqls[] = $base_sql . ",start=UNIX_TIMESTAMP('".gmdate("Y-m-d H:i:s", $start)."'),end=UNIX_TIMESTAMP('".gmdate("Y-m-d H:i:s", $end)."')" ;
          }

          $year += $INTERVAL;

          if ($year >= 2038) {
            break;
          }
	}
      }

      break;
			
    default:
      return;

  }

  // echo "<pre>" ; print_r( $sqls ) ; echo "</pre>" ; exit ;
  foreach ($sqls as $sql) {
    mysql_query($sql, $this->conn);
  }
} // END FUNCTION

Votes:2 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2004/8/30 15:54
AZNative  办霹始 From: Phoenix, Arizona, USA  Posts: 12
This hack changes the dropdown menus when creating/adding event. Currently, the dropdowns show the 24-hour clock, 0-23. This hack changes those drop down to use the 12-hour clock, making it easier for your users to add events.

Open the piCal.php file and do a search for the method
function get_schedule_edit_htm
. Scroll down through the method and find the following FOR LOOP CODE
		$select_start_hour = "<select name='StartHour' $allday_select>\n" ;

for( $h = 0 ; $h < 24 ; $h ++ ) {
. Replace the entire FOR LOOP (between the { }) with the following code:

	for( $h = 0 ; $h < 24 ; $h ++ ) {
                // Convert 24-hour clock to 12-hour clock
                if ($h == 0) {
                  $x = 12;
                  $y = "am";
                } else if ($h == 12) {
                  $x = 12;
                  $y = "pm";
                } else if ($h >= 13) {
                  $x = $h - 12;
                  $y = "pm";
                } else {
                  $x = $h;
                  $y = "am";
                }

		if ($h == $start_hour) {
                  $select_start_hour .= "<option value='$h' selected='selected'>$x $y</option>\n" ;
                } else {
                  $select_start_hour .= "<option value='$h'>$x $y</option>\n" ;
                }

	}

Now find the FOR LOOP for the end hour
	$select_end_hour = "<select name='EndHour' $allday_select>\n" ;
	for( $h = 0 ; $h < 24 ; $h ++ ) {

and replace the entire FOR LOOP with the following code

	for( $h = 0 ; $h < 24 ; $h ++ ) {
                // Convert 24-hour clock to 12-hour clock
                if ($h == 0) {
                  $x = 12;
                  $y = "am";
                } else if ($h == 12) {
                  $x = 12;
                  $y = "pm";
                } else if ($h >= 13) {
                  $x = $h - 12;
                  $y = "pm";
                } else {
                  $x = $h;
                  $y = "am";
                }

		if ($h == $end_hour) {
                  $select_end_hour .= "<option value='$h' selected='selected'>$x $y</option>\n" ;
                } else {
                  $select_end_hour .= "<option value='$h'>$x $y</option>\n" ;
                }
	}
Votes:0 Average:0.00
Previous post - Next post | Parent - Children.1 .2 | Posted on 2004/8/30 16:01
AZNative  办霹始 From: Phoenix, Arizona, USA  Posts: 12
You might experience an issue with all-day events for the month of April while in full month view. The all-day events might show up on two days. This is caused by the way the calendar is rendered. When each month is rendered on the calendar, it usesthe first day of the month, in this case, April 1. For example, April 1 + 1. April 1 + 2, April 1 + 3 and so on. Summer time begins within the first week of April, meaning that the first few days of April use winter time while the rest of April uses summer time. Since we're keying off of the first day in April, all the days end up using winter time. Obviously, this is incorrect as we should check each day independently for the change in summer time / winter time.

To solve the problem, open up piCal.php and do a search for

$now_unixtime = $mtop_unixtime + ( $date - 1 ) * 86400 ;

You should only find one occurance of this line somewhere around line number 1030. Sorry, my file is so hacked I can't give you exact line numbers.

Anyway, simply remove the line above and replace it with

$now_unixtime  = mktime(0,0,0, $this->month, $date, $this->year) ;
Votes:2 Average:10.00
Previous post - Next post | Parent - Children.1 | Posted on 2004/9/1 3:11
AZNative  办霹始 From: Phoenix, Arizona, USA  Posts: 12
When viewing the month-view, days that have multiple events scheduled seem to run together. Some events may be more than one line long and just blend in with all the other events?

Add a bullet to the beginning of each event so as to distinguish and seperate the different events.

Open piCal.php and do a search for the following line of code (note that the string below is only the begiinning part of the line and should result in only one hit.)

$event_str_tmp = "<a href='$get_target?smode=Monthly ;

Remove the entire line of code and replace it with the following


$event_str_tmp = "&#149;&nbsp;<a href='$get_target?smode=Monthly&action=View&event_id=$event->id&caldate=$this->caldate' style='font-size:10px;font-weight:normal;text-decoration:none;'>$summary</a>" ;
Votes:0 Average:0.00
Previous post - Next post | Parent - No child | Posted on 2004/9/9 16:31
coachdash  企霹始   Posts: 1
Quote:
Warning: array_push(): First argument should be an array in W:\www\xoops2\modules\piCal\piCal.php on line 3400
array_push($wday , $sun_date);

Quote:
Notice: Undefined variable: tzoffset_date in W:\www\xoops2\modules\piCal\piCal.php on line 3421
$start = $week_top + ($date - $tzoffset_date) * 86400 + $secondofday;

Quote:
Warning: Cannot modify header information - headers already sent by (output started at W:\www\xoops2\modules\piCal\piCal.php:3421) in W:\www\xoops2\modules\piCal\piCal.php on line 2084
Header( "Location: $this->connection://$HTTP_HOST$PHP_SELF?smode={$_POST['last_smode']}&caldate={$_POST['last_caldate']}" ) ;

The above three debugging issues came up when I tried a recurring Weekly event. It would let me select Sunday without the above issues, but it simply wouldn't place the event in those recurring dates. No modifications to your code were made. Any thoughts?

It doesn't give me that trouble when I recur daily or yearly. It does come up with other line numbers when I try to recur monthly. Basically anywhere that tzoffset_date is used.

Any help is appreciated.
Votes:0 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2004/9/11 16:18
cchiu  企霹始   Posts: 3
hi..
i try to use the code.. then if I add event for weekly, monthly, and yearly , the first event will come out twice ..

HELPPP:)
Votes:0 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2004/9/17 11:39
temporary  企霹始   Posts: 3
Has anyone implemented this successfully?

I was not able to get the summertime hack to work.
Votes:0 Average:0.00
Previous post - Next post | Parent - No child | Posted on 2004/9/17 11:48
temporary  企霹始   Posts: 3
I really need this update to work for my church website.

Would be at all possible for someone to e-mail me the updated files. For some reason, I am not able to get the hack to work at all.

My e-mail is jpsn56@umr.edu

Thank You,
Jake
Votes:0 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2004/9/29 19:06
GIJOE  黎扦烦菱   Posts: 4110
I'm now checking your codes.
But I can't make some conditions which allday&recurring events are overlapped.
This is the reason why I didnot fix them.

Anyway, I'll try later.
Wait a moment.
Votes:0 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2004/9/29 23:16
temporary  企霹始   Posts: 3
I was contacted by e-mail, and a working version of this hack for piCal was e-mailed to me.

Thank You
Votes:0 Average:0.00
Previous post - Next post | Parent - No child | Posted on 2004/9/30 6:17
GIJOE  黎扦烦菱   Posts: 4110
Quote:
AZNative wrote:
When viewing the month-view, days that have multiple events scheduled seem to run together. Some events may be more than one line long and just blend in with all the other events?

Add a bullet to the beginning of each event so as to distinguish and seperate the different events.

Open piCal.php and do a search for the following line of code (note that the string below is only the begiinning part of the line and should result in only one hit.)

$event_str_tmp = "<a href='$get_target?smode=Monthly ;

Remove the entire line of code and replace it with the following


$event_str_tmp = "• <a href='$get_target?smode=Monthly&action=View&event_id=$event->id&caldate=$this->caldate' style='font-size:10px;font-weight:normal;text-decoration:none;'>$summary</a>" ;
It looks nice.
I've just adopted.
Votes:0 Average:0.00
Previous post - Next post | Parent - No child | Posted on 2004/9/30 6:20
GIJOE  黎扦烦菱   Posts: 4110
Quote:
AZNative wrote:
You might experience an issue with all-day events for the month of April while in full month view. The all-day events might show up on two days. This is caused by the way the calendar is rendered. When each month is rendered on the calendar, it usesthe first day of the month, in this case, April 1. For example, April 1 + 1. April 1 + 2, April 1 + 3 and so on. Summer time begins within the first week of April, meaning that the first few days of April use winter time while the rest of April uses summer time. Since we're keying off of the first day in April, all the days end up using winter time. Obviously, this is incorrect as we should check each day independently for the change in summer time / winter time.

To solve the problem, open up piCal.php and do a search for

$now_unixtime = $mtop_unixtime + ( $date - 1 ) * 86400 ;

You should only find one occurance of this line somewhere around line number 1030. Sorry, my file is so hacked I can't give you exact line numbers.

Anyway, simply remove the line above and replace it with

$now_unixtime  = mktime(0,0,0, $this->month, $date, $this->year) ;
Certainly, it's a bug.
I've just fixed it.
I've also fixed the same bug of weekly view.
Thanks!
Votes:0 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2004/9/30 11:08
GIJOE  黎扦烦菱   Posts: 4110
Thank you for sending them to me.

But I will not adopt the codes as is.

Although the codes written by AZNative are better, it is not the best.

eg) the codes ignore the relationships between event's timezone and server's timezone.

Now, I'm remaking the codes of rrules.
Just wait.
Votes:0 Average:0.00
Previous post - Next post | Parent - No child | Posted on 2004/9/30 19:32
GIJOE  黎扦烦菱   Posts: 4110
hi AZNative.

I've just merged your codes.
The coding technique using 'UNIX_TIMESTAMP' looks very cool!

I tested the new routine of rrule extraction with America/LosAngels and it works perfect.

Note:
After changing server's timezone, don't forget restart httpd and mysqld.
This fact bothers me critically.
Votes:0 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2004/10/7 14:42
dezklr  企霹始   Posts: 2
First of all: I received great advice from this forum previously and was able to remedy my previous problem with Japanese holidays in an English calendar. THANK YOU!!!

Sorry if this is a repeat, but it seems that this summertime bug is exactly the problem I am having as well.

I set an event beginning on October 8th and recuring on the 8th, 18th, and 28th of every month ENDING Dec 28th. I am set for JAPAN time, so I would not think that Summer time (daylight savings time) would be a factor here.. However here is what happens:

Set as All-Day event:
Oct 8th, 17th, 27th
Nov 7, 17, 27
Dec 7, 8, 17, 18, 27, 28

set as an event occuring 9:00-16:00
Oct 8, 19, 29th
Nov 9,19,29
Dec 10, 20th

Thanks again! yoroshiku onegaishimasu!!
Dezzie
Votes:4 Average:0.00
Previous post - Next post | Parent - No child | Posted on 2004/10/7 17:48
GIJOE  黎扦烦菱   Posts: 4110
hi dezklr.
Do you know the place of the server?

It looks like "daylight savings time" is enabled in your server.

And which versions do you use?
piCal 0.6 beta has some bugs with extracting rrule.
Votes:0 Average:0.00

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!