2017 © Pedro Peláez
 

symfony-bundle events-bundle

Tool to manage events and display a carousel

image

c975l/events-bundle

Tool to manage events and display a carousel

  • Saturday, July 21, 2018
  • by Laurent3170
  • Repository
  • 1 Watchers
  • 1 Stars
  • 58 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 39 Versions
  • 7 % Grown

The README.md

EventsBundle

EventsBundle does the following:, (*1)

  • Displays event requested,
  • Provides tools to manage events,
  • Provides a carousel of events,
  • Provides a link to integrate to calendar (ics),
  • Integrates with your web design,

This Bundle relies on the use of TinyMce, jQuery, Bootstrap and Bootstrap DatePicker and requires Twig/Extensions for localizing dates and time., (*2)

EventsBundle dedicated web page., (*3)

EventsBundle API documentation., (*4)

Bundle installation

Step 1: Download the Bundle

Use Composer to install the library, (*5)

    composer require c975l/evebts-bundle

Step 2: Enable the Bundle

Then, enable the bundles by adding them to the list of registered bundles in the app/AppKernel.php file of your project:, (*6)

<?php
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            // ...
            new c975L\EventsBundle\c975LEventsBundle(),
        ];
    }
}

Step 3: Configure the Bundles

Check dependencies for their configuration:, (*7)

v2.0+ of c975LEventsBundle uses c975L/ConfigBundle to manage configuration parameters. Use the Route "/events/config" with the proper user role to modify them., (*8)

Upgrading from v1.x? Check UPGRADE.md., (*9)

If you use Git for version control, you need to add the full path web/images/[folderPictures] in the .gitignore, otherwise all the content will be altered by Git., (*10)

Step 4: Enable the Routes

Then, enable the routes by adding them to the app/config/routing.yml file of your project:, (*11)

c975_l_events:
    resource: "@c975LEventsBundle/Controller/"
    type: annotation
    prefix: /
    #Multilingual website use the following
    #prefix: /{_locale}
    #defaults:   { _locale: '%locale%' }
    #requirements:
    #    _locale: en|fr|es

Step 5: Create MySql table

You can use php bin/console make:migration to create the migration file as documented in Symfony's Doctrine docs OR use /Resources/sql/events.sql to create the table events. The DROP TABLE is commented to avoid dropping by mistake., (*12)

It is strongly recommended to use the Override Templates from Third-Party Bundles feature to integrate fully with your site., (*13)

For this, simply, create the following structure app/Resources/c975LEventsBundle/views/ in your app and then duplicate the files layout.html.twig and tinymceInit.html.twig in it, to override the existing Bundle files, then apply your needed changes, such as language, etc., (*14)

In layout.html.twig, it will mainly consist to extend your layout and define specific variables, i.e. :, (*15)

{% extends 'layout.html.twig' %}

{# Defines specific variables #}
{% set title = 'Events (' ~ title ~ ')' %}

{% block content %}
    {% block events_content %}
    {% endblock %}
{% endblock %}

It is recommended to use Tinymce Cloud version. You will need a free API key. OR you can download and link to your project https://www.tinymce.com/download/., (*16)

If you want to keep all the available tools and make no change to Tinymce as it is, you don't need to overwrite tinymceInit.html.twig. You just need to provide, in config.yml your tinymceApiKey, if you use the cloud version and the tinymceLanguage (+ upload the corresponding file on your server under web/vendor/tinymce/[tinymceLanguage].js). Or you can overwrite tinymceInit.html.twig., (*17)

In the overridding file setup above, you must add a link to the cloud version (recommended) https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.7.0/js/bootstrap-datepicker.min.js of Bootstrap DatePicker., (*18)

You may also want to setup the specific locales from cdnjs.com., (*19)

Initialization is done inside the templates of the Bundle., (*20)

How to use

The Route to display an event is http://example.com/events/{event}, the one to edit is http://example.com/events/edit/{event}., (*21)

A toolbar is displayed below the title if user is identified and has the acess rights., (*22)

Link to a page, in Twig, can be done by <a href="{{ path('events_display', { 'slug': 'slug' }) }}">Title of the event</a>., (*23)

The different Routes (naming self-explanatory) available are:, (*24)

  • events_display
  • events_config
  • events_create
  • events_modify
  • events_duplicate
  • events_delete
  • events_dashboard
  • events_all
  • events_ical
  • events_slug
  • events_help

To include the carousel in a page, simply use {{ events_carousel(number) }} where you want it to appear and where number is the number of events to display., (*25)

Create Sitemap

In a console use php bin/console events:createSitemap to create a sitemap-events.xml in the web folder of your project. You can use a crontab to generate it every day. You can add this file in a sitemap-index.xmlthat groups all your sitemaps or directly use it if you have only one., (*26)

If this project help you to reduce time to develop, you can sponsor me via the "Sponsor" button at the top :), (*27)

The Versions

21/06 2017
20/06 2017
20/06 2017
20/06 2017
12/06 2017

v1.0

1.0.0.0 https://github.com/975L/EventsBundle

Tool to manage events and display a carousel

  Sources   Download

MIT

The Requires

 

twig events bundle symfony