Problem with Attendance Report when displaying by months

Problem with Attendance Report when displaying by months

by Richard Webb -
Number of replies: 3
I am trying to upgrade to the latest version of Attendance module with Moodle 1.9.4. It all seems to be working fine, except when I do an attendance report and order it by month, I get nothing to display. If I order it by week or all taken, the report is fine. Any ideas what has gone wrong?

Thanks,

Richard
Average of ratings: -
In reply to Richard Webb

Re: Problem with Attendance Report when displaying by months

by Richard Webb -
I've done a little exploration and I have isolated the problem to the variable $syear. From the time it first appears in report.php (line 84) on, $syear has a value of 1 rather than 2009. That means that all of the make_timestamp functions must be returning errant data I expect, although I haven't seen any problems with them.

Doing a little work, it looks like the output of the function usergetdata is being placed in the wrong order. I believe the following changes need to be made:

Line 84:

- list(,,,$wday, $syear, $smonth, $sday) = array_values(usergetdate($firstdate));
+ list(,,,$wday, $sday, $smonth, $syear) = array_values(usergetdate($firstdate));

Line 133:

- list(,,,, $syear, $smonth, $sday) = array_values(usergetdate($current));
+ list(,,,, $sday, $smonth, $syear) = array_values(usergetdate($current));

Richard






In reply to Richard Webb

Re: Problem with Attendance Report when displaying by months

by Richard Webb -
Oddly enough, the usergetdate function apparently returns information in a different order on my Mac as compared to on our production server. My two changes required to fix the reports on my Mac broke the reports on our production server.
In reply to Richard Webb

Re: Problem with Attendance Report when displaying by months

by Richard Webb -
Just to put closure on this miserable thread, the original report.php works properly on our production server so clearly this is not a Moodle bug but, apparently, an Apple implementation of PHP bug. I'm sorry to have wasted anyone's time on this (and even sorrier that I noticed the problem on my Mac and spent time figuring out the problem when it was specific to my Mac).