[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[coldsync-hackers] Documentation clarification



HI,

I don't know if this has already been looked at, but the section of the documentation regarding the Datebook module is a little misleading:

<EXTRACT>
3   a "monthly by day" event, e.g., one that occurs on the
          second Friday of every month.

          For "monthly by day" events, the following fields are
          defined:

              $record->{repeat}{weeknum}

          The number of the week on which the event occurs. A
          value of 5 means that the event occurs on the last
          week of the month.
</EXTRACT>

Strictly speaking, the weeknum is not the week number, as referred to in the last paragraph, but as stated in the first paragraph. I would like to suggest that the paragraph be reworded to something like:

"The number of occurrences of the day (within that month) that must pass before the event is due. A value of 0 means the first {repeat}{daynum} of the month (e.g Friday). A value of 5 means that the event occurs on the last {repeat}{daynum} of the month (e.g Friday), which may also be the fourth Friday ({repeat}{weeknum}= 4)."

I worked out the following PHP code to pass the appropriate data through to an SQL query later in the script, in case it is of interest to anyone. $ViewDate is the day we wish to view, and is in YYYY-MM-DD format, but using strtotime function, most formats will work.

<?PHP
       $MyDayOfMonth = date("j",strtotime($ViewDate));
       if ( ( $MyDayOfMonth - 7  ) <= 0 ) $MyWeekNum = 0;
       if ( ( $MyDayOfMonth - 14 ) <= 0 ) $MyWeekNum = 1;
       if ( ( $MyDayOfMonth - 21 ) <= 0 ) $MyWeekNum = 2;
       if ( ( $MyDayOfMonth - 28 ) <= 0 ) $MyWeekNum = 3;
       if ( $MyDayOfMonth       > 28 ) $MyWeekNum = 4;

$MyNumberOfDays = date("t",strtotime($ViewDate));
if ( $MyDayOfMonth < $MyNumberOfDays - 6 ) $WeekNumQuery = "RepeatWeekNum = '$MyWeekNum'";
else $WeekNumQuery = "( RepeatWeekNum = '$MyWeekNum' OR RepeatWeekNum = '5' )";
?>


It looks like I am about a week away from having a stable set of Coldsync Conduits for my MySQL <-> Palm Project, and the PHP front end is starting to take shape as well. I am going to try for a stable release of SSiS (http://ssis.sourceforge.net) within the next month or so, before starting work on an LDAP module.

Thanks to everyone on the list who helped and/or offered encouragement.

Regards,

Marco van Beek.



This message was sent through the coldsync-hackers mailing list.  To remove
yourself from this mailing list, send a message to majordomo@thedotin.net
with the words "unsubscribe coldsync-hackers" in the message body.  For more
information on Coldsync, send mail to coldsync-hackers-owner@thedotin.net.