|
[Calendar] Event not shown in month view [R]
|
|
06-06-2009, 10:59 AM
(This post was last modified: 06-06-2009 04:18 PM by Gionet82.)
Post: #11
|
|||
|
|||
|
RE: [Calendar] Event not shown in month view [R]
Of course I could not try all the possible combinations of variables. I have tested out only those involved in the changes I made. However I feel so sure now because the code is simpler than before. For example take a look at this snippet of code:
Old code: PHP Code: // Start constructing the calendarMy code: PHP Code: // Start constructing the calendarIn the old code, under certain circumstances, the variable $day reached 32 or 33 causing unpredictable behaviors. This is the main cause of the bug reported in the first post. |
|||
|
06-06-2009, 09:09 PM
Post: #12
|
|||
|
|||
RE: [Calendar] Event not shown in month view [R]
(06-06-2009 10:59 AM)Gionet82 Wrote: Of course I could not try all the possible combinations of variables. I have tested out only those involved in the changes I made. However I feel so sure now because the code is simpler than before. For example take a look at this snippet of code: Yeah, and you know what you also did? You broke the "Start Of Day" functionality. That fix is invalid. |
|||
|
06-07-2009, 07:43 AM
Post: #13
|
|||
|
|||
RE: [Calendar] Event not shown in month view [R]
(06-06-2009 09:09 PM)Ryan Gordon Wrote: [...] Don't worry "Start Of Day" feature is safe and works pretty good with that fix. Trust me, these fixes work very well. I'm not the only one who says that: (06-05-2009 02:34 PM)Tomm M Wrote: [...] If there is something that you don't understand in the files that I have posted ask and I'll reply if I can. On the contrary if there is some reason why my contribution is not appreciated tell me and I'll not spend another second of my time here.
|
|||
|
06-07-2009, 07:53 AM
Post: #14
|
|||
|
|||
RE: [Calendar] Event not shown in month view [R]
(06-07-2009 07:43 AM)Gionet82 Wrote:(06-06-2009 09:09 PM)Ryan Gordon Wrote: [...] You still do need to take into account the "Start Of Day" within the code. |
|||
|
06-07-2009, 02:56 PM
(This post was last modified: 06-08-2009 06:35 PM by Gionet82.)
Post: #15
|
|||
|
|||
RE: [Calendar] Event not shown in month view [R]
(06-07-2009 07:53 AM)Ryan Gordon Wrote:(06-07-2009 07:43 AM)Gionet82 Wrote:(06-06-2009 09:09 PM)Ryan Gordon Wrote: [...] First of all, are we speaking of the same thing? With the term "Start Of Day" you mean "Start of Week", is it right? In this case I'm going to explain how my code takes into account also the "Start of week" functionality. Please read this carefully before reply me. For convenience I quote the snippet of code here: PHP Code: // Start constructing the calendarThe variable $calendar['startofweek'] contains the start day of the week and it comes from the database. It is used to build the array $weekdays trough the function fetch_weekday_structure(). So $weekdays contains an ordered list of weekdays depending on a specified starting day. Here there is the definition of this function: http://crossreference.mybboard.de/nav.ht....html#l546 Please notice that $calendar['startofweek'] and $weekdays[0] always contain the same value. So when we check if($month_start_weekday != $weekdays[0]) we are comparing the day of the week in which the current month starts and our start day of the week. Indeed you could equivalently write it as: PHP Code: if($month_start_weekday != $calendar['startofweek'])So if the day of the week in which the month starts(e.g. Monday) and our start day of the week (e.g. ...Monday) match, there are no days of the previous month to show and the starting point is: PHP Code: $day = 1;PHP Code: $day = gmdate("t", gmmktime(0, 0, 0, $prev_month['month'], 1, $prev_month['year']));array_search($month_start_weekday, $weekdays) - 1 that is the position(the index) of $month_start_weekday in our ordered list of weekdays (minus one). With a real calendar in front of you it should be very easy to understand. Notice that is true for any start day of the week, even Sunday or Saturday. Other additions like $day+=$calendar['startofweek']+1 in the old code may cause an overflow of days (32,33,34...). This is the main cause of the reported bug, as the fetching of the events follows that snippet of code. I hope that you believe me now.
|
|||
|
08-20-2009, 07:32 PM
Post: #16
|
|||
|
|||
|
RE: [Calendar] Event not shown in month view [R]
Corresponding Ticket: http://dev.mybboard.net/issues/413
![]() MyBBSource.com: Plugins, Themes and MyCodes |
|||
|
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)
Search
Member List
Calendar
Help




![[Image: logo2.png]](http://moviesandpopcorn.net/images/movie/logo2.png)