sfCalendarPlugin - 1.0.2

A calendar on steroirds.

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
Show source

sfCalendarPlugin plugin

The sfCalendarPlugin is a symfony plugin that provides a better date picker with enhanced features.

  • It manages all events added to it.
  • Displays how many events are in each day.
  • Can set a Past limit on the minimum day a user can pick.
  • Can set a Future limit on the maximum day a user can pick.
  • Ajax independed. Uses old school own ajax library.

Installation

  • Install the plugin

    $ symfony plugin:install sfCalendarPlugin
    
  • Enable one or more modules in your settings.yml (optional)

    • For general use: sfCalendarPlugin

      all:
        .settings:
          enabled_modules:      [default, sfCalendarPlugin]
  • Clear you cache

    $ symfony cc
    

Using in you application

  • Initialise calendar in action:

        [php]
    
        $cal = new sfCalendarPlugin();
    
        //Add events to calendar
        $cal->addEvent("2010-04-10","First Event");
        $cal->addEvent("2010-04-25","Second Event");
        ... and so on
    
        //Force user to select a date greater than 2010-01-01 (Optional)
        $cal->setPastLimit("2010-01-01");
    
        //Force user to select a date smaller than 2011-01-01 (Optional)
        $cal->setFutureLimit("2011-01-01");
    
        //We save the calendar class to session (To be used in ajax navigation of months and years)
        $cal->save($this->getUser());
    
        //We pass on the calendar to the template
        $this->cal = $cal;
    
  • Use calendar in template:

        [php]
    
        <!-- Generate the date picker input field -->
        <!-- The parameter represents the name & id of the input field generated -->
        <?=$cal->RenderAjax("mydate")?>
    
  • It generated a input field and a button. Once the button was clicked or the input field was clicked, the calendar will appear.

  • A demo image can be found here

    Demo image