ricgrangeia/yii2-fullcalendar

Yii2 widget for fullcalendar

Installs: 176

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 0

Forks: 9

Language:JavaScript

Type:yii2-extension

v2.0.0 2023-04-21 10:18 UTC

This package is auto-updated.

Last update: 2024-05-22 02:51:42 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License composer.lock

Installation

The preferred way to install this extension is through composer.

To install, either run

$ php composer.phar require ricgrangeia/yii2-fullcalendar

or add

"ricgrangeia/yii2-fullcalendar": "*"

Main Features and Changes

Features

  • Extension for Yii2 Framework Yii2
  • PHP 8.0 ready
  • Show events in a calendar Fullcalendar.io
  • Manual events add by drag and drop, also by clicking in the calendar
  • Has translations (incomplete)

Changes

  • v1.4.0 - Stable, but unorganized

Events can be added in three ways, PHP array, Javascript array or JSON feed

View of the Calendar with draggable events

Php Header

use ricgrangeia\fullcalendar\Domain\Entity\Event;
use ricgrangeia\fullcalendar\UI\Widget\Fullcalendar;
use ricgrangeia\fullcalendar\UI\Widget\DraggableEvents;

Html Body

<!-- Main content -->
<section class="content">
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-3">
                <div class="sticky-top mb-3">
                    <?= DraggableEvents::widget() ?>
                </div>
            </div>
            <!-- /.col -->
            <div class="col-md-9">
                <div class="card card-primary">
                    <div class="card-body p-0">
                        <!-- THE CALENDAR -->
                        <div id="calendar"></div>
                    </div>
                    <!-- /.card-body -->
                </div>
                <!-- /.card -->
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->
    </div><!-- /.container-fluid -->
</section>
<!-- /.content -->

PHP

<?php
    $events = [
        new Event([
            'title' => 'Appointment #' . rand(1, 999),
            'start' => '2016-03-18T14:00:00',
        ]),
        // Everything editable
        new Event([
            'id'               => uniqid(),
            'title'            => 'Appointment #' . rand(1, 999),
            'start'            => '2016-03-17T12:30:00',
            'end'              => '2016-03-17T13:30:00',
            'editable'         => true,
            'startEditable'    => true,
            'durationEditable' => true,
        ]),
        // No overlap
        new Event([
            'id'               => uniqid(),
            'title'            => 'Appointment #' . rand(1, 999),
            'start'            => '2016-03-17T15:30:00',
            'end'              => '2016-03-17T19:30:00',
            'overlap'          => false, // Overlap is default true
            'editable'         => true,
            'startEditable'    => true,
            'durationEditable' => true,
        ]),
        // Only duration editable
        new Event([
            'id'               => uniqid(),
            'title'            => 'Appointment #' . rand(1, 999),
            'start'            => '2016-03-16T11:00:00',
            'end'              => '2016-03-16T11:30:00',
            'startEditable'    => false,
            'durationEditable' => true,
        ]),
        // Only start editable
        new Event([
            'id'               => uniqid(),
            'title'            => 'Appointment #' . rand(1, 999),
            'start'            => '2016-03-15T14:00:00',
            'end'              => '2016-03-15T15:30:00',
            'startEditable'    => true,
            'durationEditable' => false,
        ]),
    ];
?>

<?= Fullcalendar::widget([
    'options' => [
        // id of the div that will be replaced with the calendar
        'id' => 'calendar',
        'language' => 'pt-pt',
        // Set Monday first day of the week, default is Sunday.
        'firstDay' => Fullcalendar::MONDAY_FIRST,
    ],
	'events' => $events,
    ]);
?>