2017 © Pedro Peláez
 

symfony-bundle calendar-bundle

A bundle for handling events in calendar

image

carlescliment/calendar-bundle

A bundle for handling events in calendar

  • Friday, October 14, 2016
  • by carlescliment
  • Repository
  • 7 Watchers
  • 44 Stars
  • 15,376 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 16 Forks
  • 9 Open issues
  • 15 Versions
  • 1 % Grown

The README.md

CalendarBundle

Build Status, (*1)

The CalendarBundle gives you a built-in calendar for managing events without relying on third-parties like Google. It comes with four different default views; agenda, by day, by week and by month. If you need greater customizations, you can use the bundle as a simple calendar API and build your own logic on it., (*2)

Installation

1. Update your vendors

Add this line to your composer.json, (*3)

"require": {
    "carlescliment/calendar-bundle": "dev-master"
}

Execute php composer.phar update carlescliment/calendar-bundle, (*4)

2. Load the bundle in app/AppKernel.php

$bundles = array(
    // ...
    new BladeTester\CalendarBundle\BladeTesterCalendarBundle(),
);

3. Update your routing:

// ...

BladeTesterCalendarBundle:
    resource: "@BladeTesterCalendarBundle/Resources/config/routing.yml"
    prefix:   /

4. Create your calendar bundle

Create a new bundle extending BladeTesterCalendarBundle, (*5)

namespace Your\OwnCalendarBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class YourOwnCalendarBundle extends Bundle
{

   public function getParent()
    {
        return 'BladeTesterCalendarBundle';
    }
}

WARNING: If your bundle includes its own routing file, remember to delete it or completely override the parent bundle paths., (*6)

Add it to AppKernel., (*7)

    $bundles = array(
        // ...
        new Your\OwnCalendarBundle\YourOwnCalendarBundle(),
    );

5. Update the schema

php app/console doctrine:schema:update --force

6. Install the assets

php app/console assets:install

Using the calendar

Go to http://www.example.com/calendar and enjoy :), (*8)

Customizing the bundle

If you want to override the bundle default views to use your design and markup, please follow the next steps., (*9)

1. Override the default base template

Copy the template in Resources/views/Base/base.html.twig into your own bundle and modify it to extend your base template., (*10)

2. Add the assets to your base template

<script type="text/javascript" src="{{ asset('bundles/bladetestercalendar/js/jquery-1.9.1.min.js') }}"></script>
<link rel="stylesheet" href="{{ asset('bundles/bladetestercalendar/css/calendar.css') }}" />
<script type="text/javascript" src="{{ asset('bundles/bladetestercalendar/js/calendar.js') }}"></script>

Note: remove the line including jquery if your template already includes it., (*11)

How to override the default entities

You can define your own entities. First, create your custom entity:, (*12)

namespace Your\OwnCalendarBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use BladeTester\CalendarBundle\Entity\Event as BaseEvent;


/**
 * @ORM\Entity(repositoryClass="BladeTester\CalendarBundle\Repository\EventRepository")
 * @ORM\Table(name="events")
 */
class Event extends BaseEvent
{
  // ... your implementation goes here
}

Then modify your app/config/config.yml, (*13)

    blade_tester_calendar:
        driver: doctrine/orm
        engine: twig
        classes:
            event:
                entity: Your\OwnBundle\Entity\Event
            category:
                entity: Your\OwnBundle\Entity\EventCategory

Extending the behaviour

It is easy to extend the behaviour of this bundle by using inheritance in your models and entities. If it is not enough, you can register listeners to the calendar events., (*14)

Pre-persist event

Dispatched whenever an item is about to be created in the database., (*15)

    your_own_calendar_listener:
        class: Your\OwnCalendarBundle\Event\CalendarListener
        tags:
          - { name: kernel.event_listener, event: calendar.pre-persist, method: onPrePersist }

namespace Your\OwnCalendarBundle\Event; use BladeTester\CalendarBundle\Event\CalendarEvent; class CalendarListener { public function onPrePersist(CalendarEvent $event) { $event_model = $event->getEvent(); // do whatever with the object before persisting it. } }

Post-add event

Dispatched after an item is added to the database., (*16)

    your_own_calendar_listener:
        class: Your\OwnCalendarBundle\Event\CalendarListener
        tags:
          - { name: kernel.event_listener, event: calendar.post-add, method: onPostAdd }

Post-update event

Dispatched after an item is updated., (*17)

    your_own_calendar_listener:
        class: Your\OwnCalendarBundle\Event\CalendarListener
        tags:
          - { name: kernel.event_listener, event: calendar.post-update, method: onPostUpdate }

Testing

CalendarBundle contains unitary and functional tests. Download the bundle, create the database according to the travis.yml file and configure the access settings in src/BladeTester/CalendarBundle/Tests/App/parameters.ini. Run the following command:, (*18)

cd /path/to/calendar-bundle
composer update
php vendor/bin/phpunit

Credits

Contribute and feedback

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

The Versions

14/10 2016

dev-master

9999999-dev https://github.com/carlescliment/calendar-bundle

A bundle for handling events in calendar

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

calendar events

23/05 2016

dev-dev-symfony3

dev-dev-symfony3 https://github.com/carlescliment/calendar-bundle

A bundle for handling events in calendar

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

calendar events

30/03 2016
05/02 2016
05/02 2016

dev-fix/travis-build

dev-fix/travis-build https://github.com/carlescliment/calendar-bundle

A bundle for handling events in calendar

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

calendar events

25/11 2014
12/10 2014

dev-more_events

dev-more_events https://github.com/carlescliment/calendar-bundle

A bundle for handling events in calendar

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

calendar events

11/06 2014
19/03 2014
19/03 2014

dev-bump_2_4

dev-bump_2_4 https://github.com/carlescliment/calendar-bundle

A bundle for handling events in calendar

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

calendar events

05/03 2014

dev-refactorings

dev-refactorings https://github.com/carlescliment/calendar-bundle

A bundle for handling events in calendar

  Sources   Download

Apache2

The Requires

 

The Development Requires

calendar events

14/10 2013

2.3.0

2.3.0.0 https://github.com/carlescliment/calendar-bundle

A bundle for handling events in calendar

  Sources   Download

Apache2

The Requires

 

calendar events

14/10 2013

2.1.0

2.1.0.0 https://github.com/carlescliment/calendar-bundle

A bundle for handling events in calendar

  Sources   Download

Apache2

The Requires

 

calendar events

24/04 2013

2.1.x-dev

2.1.9999999.9999999-dev https://github.com/carlescliment/calendar-bundle

A bundle for handling events in calendar

  Sources   Download

Apache2

The Requires

 

calendar events

24/04 2013

v2.1.x-dev

2.1.9999999.9999999-dev https://github.com/carlescliment/calendar-bundle

A bundle for handling events in calendar

  Sources   Download

Apache2

The Requires

 

calendar events