2017 © Pedro Peláez
 

symfony-bundle full-calendar-bundle

Symfony2 integration with the library FullCalendar.js

image

szabogyula/full-calendar-bundle

Symfony2 integration with the library FullCalendar.js

  • Sunday, March 13, 2016
  • by gyufi
  • Repository
  • 1 Watchers
  • 0 Stars
  • 73 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 31 Forks
  • 0 Open issues
  • 15 Versions
  • 0 % Grown

The README.md

FullCalendarBundle

Build Status, (*1)

This bundle allow you to integrate FullCalendar.js library in your Symfony2., (*2)

Requirements

  • FullCalendar.js v2.3.2
  • Symfony v2.3+
  • PHP v5.3+
  • PHPSpec

Installation

Installation process:, (*3)

  1. Download FullCalendarBundle using composer
  2. Enable bundle
  3. Create your Event class
  4. Create your listener
  5. Add styles and scripts in your template
  6. Add Routing

1. Download FullCalendarBundle using composer

$> composer require ancarebeca/full-calendar-bundle

2. Enable bundle

// app/AppKernel.php

public function registerBundles()
{
    return array(
        // ...
        new AncaRebeca\FullCalendarBundle\FullCalendarBundle(),
    );
}

3. Create your Calendar Event class

// src/AppBundle/Entity/EventCustom.php

<?php

namespace AppBundle\Entity;

use AncaRebeca\FullCalendarBundle\Model\Event as BaseEvent;

class CalendarEvent extends BaseEvent
{
    // Your fields 
}

4. Create your listener

You need to create your listener/subscriber class in order to load your events data in the calendar., (*4)

// service.yml
services:
   app_bundle.service.listener:
        class: AppBundle\Listener\LoadDataListener
    tags:
        - { name: 'kernel.event_listener', event: 'fullcalendar.set_data', method: loadData }

This listener is called when the event 'fullcalendar.set_data' is launched, for this reason you will need add this in your service.yml., (*5)

// src/AppBundle/Listener/LoadDataListener.php

<?php

namespace AppBundle\Listener;

use AncaRebeca\FullCalendarBundle\Model\Event;

class LoadDataListener
{
    /**
     * @param CalendarEvent $calendarEvent
     *
     * @return EventInterface[]
     */
    public function loadData(CalendarEvent $calendarEvent)
    {
         $startDate = $calendarEvent->getStartDatetime();
         $endDate = $calendarEvent->getEndDatetime();
         $filters = $calendarEvent->getFilters();

         //You may want do a custom query to populate the events

         $calendarEvent->addEvent(new Event('Event Title 1', new \DateTime());
         $calendarEvent->addEvent(new Event('Event Title 2', new \DateTime()));
    }
}

 5. Add styles and scripts in your template

Add html template to display the calendar:, (*6)

{% block body %}
    {% include '@FullCalendar/Calendar/calendar.html.twig' %}
{% endblock %}

Add styles:, (*7)

{% block stylesheets %}
    <link rel="stylesheet" href="{{ asset('bundles/fullcalendar/css/fullcalendar/fullcalendar.min.css') }}" />
{% endblock %}

Add javascript:, (*8)

{% block javascripts %}
    <script type="text/javascript" src="{{ asset('bundles/fullcalendar/js/fullcalendar/lib/jquery.min.js') }}"></script>
    <script type="text/javascript" src="{{ asset('bundles/fullcalendar/js/fullcalendar/lib/moment.min.js') }}"></script>
    <script type="text/javascript" src="{{ asset('bundles/fullcalendar/js/fullcalendar/fullcalendar.min.js') }}"></script>
    <script type="text/javascript" src="{{ asset('bundles/fullcalendar/js/fullcalendar/fullcalendar.default-settings.js') }}"></script>
{% endblock %}

Install assets, (*9)

$> php app/console assets:install web

6. Define routes by default

# app/config/config.yml

ancarebeca_fullcalendar:
    resource: "@FullCalendarBundle/Resources/config/routing.yml"

Extending Basic functionalities

Extending the Calendar Javascript

If you want to customize the FullCalendar javascript you can copy the fullcalendar.default-settings.js in Resources/public/js, and add your own logic:, (*10)

$(function () {
    $('#calendar-holder').fullCalendar({
        header: {
            left: 'prev, next',
            center: 'title',
            right: 'month, agendaWeek, agendaDay'
        },
        timezone: ('Europe/London'),
        businessHours: {
            start: '09:00',
            end: '17:30',
            dow: [1, 2, 3, 4, 5]
        },
        allDaySlot: false,
        defaultView: 'agendaWeek',
        lazyFetching: true,
        firstDay: 1,
        selectable: true,
        timeFormat: {
            agenda: 'h:mmt',
            '': 'h:mmt'
        },
        columnFormat:{
            month: 'ddd',
            week: 'ddd D/M',
            day: 'dddd'
        },
        editable: true,
        eventDurationEditable: true,
        eventSources: [
        {
            url: /full-calendar/load,
            type: 'POST',
            data: {
                filters: { param: foo }
            }
            error: function() {
               //alert()
            }
        }
]

Contribute and feedback

Any feedback and contribution will be very appreciated., (*11)

The Versions

13/03 2016

dev-master

9999999-dev https://github.com/ancarebeca/FullCalendarBundle

Symfony2 integration with the library FullCalendar.js

  Sources   Download

MIT

The Requires

 

The Development Requires

by Rebeca Mora Anca

calendar fullcalendar jquery calendar symfony2 bundle symfony2 calendar

13/03 2016

v2.0.3

2.0.3.0 https://github.com/ancarebeca/FullCalendarBundle

Symfony2 integration with the library FullCalendar.js

  Sources   Download

MIT

The Requires

 

The Development Requires

by Rebeca Mora Anca

calendar fullcalendar jquery calendar symfony2 bundle symfony2 calendar

04/03 2016

dev-patch-4

dev-patch-4 https://github.com/ancarebeca/FullCalendarBundle

Symfony2 integration with the library FullCalendar.js

  Sources   Download

MIT

The Requires

 

The Development Requires

by Rebeca Mora Anca

calendar fullcalendar jquery calendar symfony2 bundle symfony2 calendar

04/03 2016

dev-patch-3

dev-patch-3 https://github.com/ancarebeca/FullCalendarBundle

Symfony2 integration with the library FullCalendar.js

  Sources   Download

MIT

The Requires

 

The Development Requires

by Rebeca Mora Anca

calendar fullcalendar jquery calendar symfony2 bundle symfony2 calendar

04/03 2016

dev-patch-2

dev-patch-2 https://github.com/ancarebeca/FullCalendarBundle

Symfony2 integration with the library FullCalendar.js

  Sources   Download

MIT

The Requires

 

The Development Requires

by Rebeca Mora Anca

calendar fullcalendar jquery calendar symfony2 bundle symfony2 calendar

04/03 2016

dev-patch-1

dev-patch-1 https://github.com/ancarebeca/FullCalendarBundle

Symfony2 integration with the library FullCalendar.js

  Sources   Download

MIT

The Requires

 

The Development Requires

by Rebeca Mora Anca

calendar fullcalendar jquery calendar symfony2 bundle symfony2 calendar

23/08 2015

dev-develop

dev-develop https://github.com/ancarebeca/FullCalendarBundle

Symfony2 integration with the library FullCalendar.js

  Sources   Download

MIT

The Requires

 

The Development Requires

by Rebeca Mora Anca

calendar fullcalendar jquery calendar symfony2 bundle symfony2 calendar

23/08 2015

v2.0.2

2.0.2.0 https://github.com/ancarebeca/FullCalendarBundle

Symfony2 integration with the library FullCalendar.js

  Sources   Download

MIT

The Requires

 

The Development Requires

by Rebeca Mora Anca

calendar fullcalendar jquery calendar symfony2 bundle symfony2 calendar

23/08 2015

v2.0.1

2.0.1.0 https://github.com/ancarebeca/FullCalendarBundle

Symfony2 integration with the library FullCalendar.js

  Sources   Download

MIT

The Requires

 

The Development Requires

by Rebeca Mora Anca

calendar fullcalendar jquery calendar symfony2 bundle symfony2 calendar

21/08 2015

v2.0

2.0.0.0 https://github.com/ancarebeca/FullCalendarBundle

Symfony2 integration with the library FullCalendar.js

  Sources   Download

MIT

The Requires

 

The Development Requires

by Rebeca Mora Anca

calendar fullcalendar jquery calendar symfony2 bundle symfony2 calendar

18/08 2015

v1.0.4

1.0.4.0 https://github.com/ancarebeca/FullCalendarBundle

Symfony2 integration with the library FullCalendar.js

  Sources   Download

MIT

The Requires

 

The Development Requires

by Rebeca Mora Anca

calendar fullcalendar jquery calendar symfony2 bundle symfony2 calendar

16/08 2015

v1.0.3

1.0.3.0 https://github.com/ancarebeca/FullCalendarBundle

Symfony2 integration with the library FullCalendar.js

  Sources   Download

MIT

The Requires

 

The Development Requires

by Rebeca Mora Anca

calendar fullcalendar jquery calendar symfony2 bundle symfony2 calendar

16/08 2015

v1.0.2

1.0.2.0 https://github.com/ancarebeca/FullCalendarBundle

Symfony2 integration with the library FullCalendar.js

  Sources   Download

MIT

The Requires

 

The Development Requires

by Rebeca Mora Anca

calendar fullcalendar jquery calendar symfony2 bundle symfony2 calendar

16/08 2015

v1.0.1

1.0.1.0 https://github.com/ancarebeca/FullCalendarBundle

Symfony2 integration with the library FullCalendar.js

  Sources   Download

MIT

The Requires

 

The Development Requires

by Rebeca Mora Anca

calendar fullcalendar jquery calendar symfony2 bundle symfony2 calendar

16/08 2015

v1.0.0-alpha

1.0.0.0-alpha https://github.com/ancarebeca/FullCalendarBundle

Symfony2 integration with the library FullCalendar.js

  Sources   Download

MIT

The Requires

 

The Development Requires

by Rebeca Mora Anca

calendar fullcalendar jquery calendar symfony2 bundle symfony2 calendar