Event Calendar - weekly view

81 posts by 2 authors in: Forums > CMS Builder
Last Post: Thursday at 1:15am   (RSS)

By Djulia - October 28 - edited: October 30

Yes, you are right. It's an error in the array(). It was for my tests.

It should be replaced

'start_date' => '2024-11-02 14:00:00',
'end_date' => '2024-11-02 00:00:00',

With:

'start_date' => '2024-11-02 14:00:00',
'end_date' => '2024-11-02 17:00:00',

OK, I've updated and it works but it still doesn't work fully in production mode. 

I think I'm going to remove some dates and test one at a time.

By Djulia - October 28 - edited: October 29

I added this condition to correct events where the end date is less than or equal to the start date by assigning them a minimum duration of one hour, thereby ensuring that all events have a valid duration.

// Condition to check if end_date needs to be corrected
if ($eventEnd <= $eventStart) {
    // Add 1 hour to the start date for the end date
    $eventEnd = $eventStart->modify('+1 hour');
}

I also added the schema that I use.

Thanks!

Attachments:

calendar.zip 10K

By Djulia - October 29 - edited: October 29

Hi MercerDesign,

If you're interested, this version adds a color parameter to events and improves the year view (12 months).

It is necessary to add a "color" field to your events table.

Don't forget to back up your table.

Thanks, Djulia

Thank you. I've updated so will see what happens when I put in my events. We won't need the year view but it's very useful to have. Thank you again for all your help.

By Djulia - October 29 - edited: October 29

> Can you try with this? Thanks!

$events = [
[
'title' => 'Annual Conference',
'start_date' => '2024-10-21 09:00:00',
'end_date' => '2024-10-21 17:00:00',
'permalink' => 'annual-conference',
'description' => 'Annual conference on technological innovations.',
'location' => 'Main Auditorium',
],
[
'title' => 'Digital Marketing Seminar',
'start_date' => '2024-10-22 10:00:00',
'end_date' => '2024-10-22 15:00:00',
'permalink' => 'digital-marketing-seminar',
'description' => 'Seminar on the latest trends in digital marketing.',
'location' => 'Meeting Room B',
],
[
'title' => 'Team Meeting',
'start_date' => '2024-10-25 14:00:00',
'end_date' => '2024-10-26 12:00:00',
'permalink' => 'team-meeting',
'description' => 'Weekly team meeting to discuss progress.',
'location' => 'Conference Room C',
],
[
'title' => 'PHP Workshop',
'start_date' => '2024-11-02 08:00:00',
'end_date' => '2024-11-02 17:00:00',
'permalink' => 'php-workshop',
'description' => 'A hands-on workshop on PHP development.',
'location' => 'Training Room D',
],
[
'title' => 'Product Launch',
'start_date' => '2024-11-30 10:00:00',
'end_date' => '2024-11-30 16:00:00',
'permalink' => 'product-launch',
'description' => 'Launch event for our new product.',
'location' => 'Main Hall',
],
[
'title' => 'Holiday Party',
'start_date' => '2024-12-01 18:00:00',
'end_date' => '2024-12-01 23:00:00',
'permalink' => 'holiday-party',
'description' => 'Annual holiday party for all employees.',
'location' => 'Rooftop Lounge',
// This event appears in week 48.
],
[
'title' => 'Year-End Review',
'start_date' => '2024-12-02 14:00:00',
'end_date' => '2024-12-02 17:00:00',
'permalink' => 'year-end-review',
'description' => 'Review of the year\'s achievements and goals.',
'location' => 'Conference Room A',
// This event appears in week 49
]
];

in production mode? so in the CMS?

By Djulia - October 29 - edited: October 29

'example'

If you export your calendar and send me your schema file (events.ini.php), I can try to see what’s going on.

That works, but here is my schema so you can see what is going on when it's in the CMS

Attachments:

events.ini.php 5K