Need help with finishing touches for multi-day and multi-same-day events in Calendar please :) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Need help with finishing touches for multi-day and multi-same-day events in Calendar please :) (/showthread.php?tid=29083) |
Need help with finishing touches for multi-day and multi-same-day events in Calendar please :) - El Forum - 03-29-2010 [eluser]Kinsbane[/eluser] Okay, so, I'm trying to hack n slash the CI Calendar to show both multi-day events, and multiple events on the same day. I've almost got it, but there's a few things bugging me that I just can't seem to figure out. First and foremost, dates for my events are stored with the starting date as a UNIX timestamp, and then the number of days for the event is specified. Here's how I'm grabbing and storing the event data: Code: $query = $this->db->select('event_id, event_date, event_length, event_title')->from('event') For the month of April, here's the print_r() of what the $cal_data array looks like: Code: Array As you can see, the top-level arrays are all days of the month - the arrays in those keys are the events for that day. And, finally, here's what I did to change the CI Library to loop through the arrays under each day with events, starting on or about line 220 in /libraries/Calendar.php Code: if (isset($data[$day])) I must have done something wrong, though, because when I view my source, it looks like this: Code: <td class="day"> Also, I noticed I was getting outputs of {day} and {content} in the days with events - the only way I could find out to remove those was to use str_replace at the very end of the generate() function to remove it: Code: $out .= $this->temp['table_close']; I know I am very close but I have been looking at this for two days and I can't seem follow the path of the data and the templates and I think I just need new eyeballs. Thanks! Need help with finishing touches for multi-day and multi-same-day events in Calendar please :) - El Forum - 03-30-2010 [eluser]Kinsbane[/eluser] No one's got ideas? I figure if we can get this together it would be a really good addition to the CI core. Need help with finishing touches for multi-day and multi-same-day events in Calendar please :) - El Forum - 03-30-2010 [eluser]Kinsbane[/eluser] Well, now my day-cells in the table look like this: Code: <td class="day"> This is the behavior I want - in the day before this, only event # 1266 is the event for that day. The day after this, is #1290 - but the issue here is making sure that the block for event #1290 stays in-line with where #1290 is for this current day - that is, one level below where #1266 would be if 1266 were also happening on the 17th. Can anyone offer assistance? Need help with finishing touches for multi-day and multi-same-day events in Calendar please :) - El Forum - 03-30-2010 [eluser]Kinsbane[/eluser] Is there a way to find out what position a current element is in an array? If I run a print_r() on my cal_data array, I have some days where the array for the day looks like this: Code: [3] => Array It would be great if I could have the program detect that event #1277 is in the 2nd position of the array (even though its index says 0) and use that to calculate a height position within the day-cell of the table to keep everything in line. Need help with finishing touches for multi-day and multi-same-day events in Calendar please :) - El Forum - 04-04-2010 [eluser]Philipp GĂ©rard[/eluser] Did you get around solving this riddle? I wanted to implement a similar feature-set and thus searched the forums. Need help with finishing touches for multi-day and multi-same-day events in Calendar please :) - El Forum - 09-08-2010 [eluser]bcorcoran[/eluser] Hi, I realize this is an old thread, but I was having the same issues myself (the fact the calendar only allows one entry per day is ridiculously short-sighted). I managed to come up with a way to add multiple events to each day. Each event's name is displayed and is a link to whatever link is in your data array. Copy /libraries/Calendar.php to /application/libraries/ and modify starting at line 219. Replace Code: if (isset($data[$day])) With Code: if (isset($data[$day])) |