ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

I need help with a calendaring class, but not within CodeIgniter - days/dates are off

August 17, 2009 9:08pm

Subscribe [3]
  • #1 / Aug 17, 2009 9:08pm

    Kinsbane

    67 posts

    First, I’ve attached the class in a text file to this post.

    Here’s the issue:
    I didn’t program this class and I’ve always had trouble figuring it out. We moved our site to a new server and now some months have incorrect dates on incorrect days (usually only off by one day/date).

    So, here’s how it works. A query on the events table is run that grabs the events that start in the indicated month. It then runs a while loop and adds the dates it finds for the current month and year into the $cal object, like so:

    while($data = mysql_fetch_array($result, MYSQL_ASSOC)) {
                    
        if($data['event_date'] > $month_start and $data['event_date'] < $month_end) {
                    
                $cal->add_event($data['event_title'], $data['event_date'], $data['event_length'], "events/event/{$data['event_id']}", $data['event_status'], $data['event_id']);
        }
    }

    Then, the calendar is displayed:

    $body .= $cal->display(mktime(0,0,0,$month,1,$year));

    The $cal->display() method generates an HTML string which is added to $body for output.

    I’ve tried all I can think of to fix this problem. You can see it further in the attachments I provided, which show October 2009, Nov 2009, and December 2009 - in this set of three, only November has the correct dates on the correct days. If you look at October, you’ll see it shows the 31st being on a Friday, when it should be on a Saturday.

    The crap thing about this? I’ve ported this over to CI 1.7.1 as my own Library and it works FANTASTIC, with NO PROBLEMS!

    Please please please! I know there’s some smart cookies here and I am literally on the floor, rolling around, banging my feet, crying and throwing a tantrum because I just need help to figure this out and get some people off my back. The fact that I’ve been at it for two weeks straight and have gone nowhere is seriously not helping me one bit.

    Thanks everyone!

  • #2 / Aug 17, 2009 9:09pm

    Kinsbane

    67 posts

    Forgot to mention, I also posted this on phpfreaks.com with screenshots:
    http://www.phpfreaks.com/forums/index.php/topic,263662.0.html

  • #3 / Aug 18, 2009 9:26am

    jdfwarrior

    444 posts

    Why not just try another calendar class if this one is working for you? Also, it sounds like the class just doesnt get things set up properly. You have to know a lot of things to get it set up right..

    1. Month/Year to display.
    2. What day the first day of that month starts on.
    3. How many blank days to display before the first day of the desired month.
    4. The date of the last day of that month.
    5. etc.

    Have to make it show the initial blank days out front (padding kinda), then finish off that week, then skip two days at the end of every week for the weekend (if its a five day calendar), then know when to end, how many blank days to put at the end for padding (if needed), etc.

    Obviously, I’ve built a few of these in my time 😊

  • #4 / Aug 19, 2009 5:12pm

    Kinsbane

    67 posts

    Hi JDFWarrior,

    Sorry if I sound like a complete asshole when I say this, but, did you read my post? Did you look at the screenshots of what’s going on? Did you look at the class file itself?

    The things you list in your post are all things the class currently does. There’s only this small issue (now, since I’ve been messing with it) where events in November of 2009 are buggy when displayed in the calendar, because I imagine, of the fact that in November of 2009, November starts on the first day of the week. So does one of our events - starts on the first day of the first week of November. For some reason, it’s causing November to display two November 1sts, on Sunday and Monday.

    Believe me, I would switch it over to a completely different calendar class if I could - but people are so attached to seeing our events calendar this way they just will not give it up. Even at the slightest mention of changing it, and you’d think I was eating their newborn son right in front of their eyes. They are very protective of it.

    So, I need this class to stay how it is, with the exception of the issue I am having regarding November of 2009 having two November 1st’s, on Sunday and Monday.

  • #5 / Aug 19, 2009 5:33pm

    sophistry

    906 posts

    @kinsbane

    november 1st 2009 is the start end of DST.

    http://daylight-savings-time.info/

    maybe that’s the problem?

    i downloaded and looked at that calendar class you posted and it is pretty amateur - you’re better off with something else.

  • #6 / Aug 19, 2009 8:25pm

    jdfwarrior

    444 posts

    Since you decided to be a smartass, I found it necessary that I reply. Yes, I read your post. Yes I looked at your screenshots of two different calendars. No, I didn’t tell you how to fix your issue, I commented that it you could easily just make your own calendar class, and could easily do it in a lot less time than you’ve wasted complaining about your issue here. I made the majority of one today, in spare time. And oh no, you can’t change it because they will complain?! Last time I checked, you could take css and html and make stuff look pretty much however you want, therefore, if I wanted it to look like something else, I could.

    So yes, your reply did make you seem like an asshole. You decided to ignore my comment, and you are still sitting here with the same problem. Congrats.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases