PHP code example of italix / calendars

1. Go to this page and download the library: Download italix/calendars library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

italix / calendars example snippets


use Italix\Calendars\CalendarSet;
use Italix\Calendars\Drivers\FullCalendar\FullCalendarDriver;

$cal = new CalendarSet();

$cal->id('events-calendar')->height('750px')
    ->views(['month', 'week', 'day', 'list'])->initial_view('month')
    ->locale($lang)->first_day(1)
    ->toolbar(true)
    ->ajax_url('/it/admin/calendar/events.json');

$script = (new FullCalendarDriver())->render_script($cal, '#events-calendar', 'events_calendar');

use Italix\Calendars\CalendarFeedRequest;
use Italix\Calendars\CalendarFeedResponse;

$freq = CalendarFeedRequest::from($_GET);

$events = [];
foreach ($rows as $row) {
    if (!in_range($row['when_dt'], $freq->start(), $freq->end())) {
        continue;
    }
    $events[] = [
        'id'     => 'appointment_' . $row['id'],
        'title'  => $t->get('calendar.appointment_created', ['code' => $row['code']]),
        'start'  => $row['when_dt'],
        'allDay' => false,
        'color'  => '#3b82f6',
        'url'    => "/{$lang}/admin/appointments/{$row['id']}/edit.html",
    ];
}

return (new CalendarFeedResponse($events))->to_json();