2017 © Pedro Peláez
 

symfony-bundle timezone-bundle

Readable Timezone Field Type for Symfony2

image

bertrandom/timezone-bundle

Readable Timezone Field Type for Symfony2

  • Tuesday, June 3, 2014
  • by ollietb
  • Repository
  • 1 Watchers
  • 0 Stars
  • 11,734 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 2 Versions
  • 1 % Grown

The README.md

Readable Timezone Field Type for Symfony2

The stock Symfony2 timezone field type organizes all of the Olson Timezone Identifiers in PHP by Continent and displays them to the user. This dropdown is pretty bad from a UI perspective. This bundles provides an alternate dropdown that is similar to the one found when choosing a time zone on a Windows computer., (*1)

This is my first symfony2 bundle, feedback welcome!, (*2)

Installation

Edit your deps file and add the following:, (*3)

[BertTimezoneBundle]
    git=git://github.com/bertrandom/BertTimezoneBundle.git
    target=/bundles/Bert/TimezoneBundle

Run the vendors install script:, (*4)

bin/vendors install, (*5)

This will pull down the latest version of this bundle from github. Alternatively you can just put the files in /vendor/bundles/Bert/TimezoneBundle, (*6)

Next, add the namespace to the end of the registerNamespaces bit in autoload.php:, (*7)

$loader->registerNamespaces(array(
    'Symfony'          => array(__DIR__.'/../vendor/symfony/src', __DIR__.'/../vendor/bundles'),
    'Sensio'           => __DIR__.'/../vendor/bundles',

    .
    .
    .

    'Bert'             => __DIR__.'/../vendor/bundles',
));

Add the bundle in AppKernel.php:, (*8)

$bundles = array(
    new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
    new Symfony\Bundle\SecurityBundle\SecurityBundle(),

    .
    .
    .

    new Bert\TimezoneBundle\BertTimezoneBundle(),
);

That's it, the field type should be ready to use., (*9)

Usage

Simply use the field type readabletimezone in your form builder, e.g.:, (*10)

$builder
    ->add('username')
    ->add('plainPassword', 'repeated', array('type' => 'password'))
    ->add('firstname')
    ->add('lastname')
    ->add('email', 'email')
    ->add('timezone', 'readabletimezone')
;

Data

The data is taken from the work of two blog posts on the subject of readable timezones:, (*11)

Presenting a list of Timezones to the user, (*12)

Olson Time Zone Database to Standard Windows Time Zone v0.1, (*13)

I've made mirrors of these two posts and put them in Resources/source/mirrors/ in case the blog posts go away., (*14)

The timezone data itself can be found in Resources/config/timezones.yml, (*15)

Credits

Bertrand Fan (bertrand@fan.net), (*16)

Timezone data provided by Avi Block and Tim Davis, see Data section for more details., (*17)

The Versions

03/06 2014

dev-master

9999999-dev https://github.com/bertrandom/BertTimezoneBundle

Readable Timezone Field Type for Symfony2

  Sources   Download

MIT

The Requires

 

form symfony2 type timezone

15/08 2012

dev-composer

dev-composer https://github.com/bertrandom/BertTimezoneBundle

Readable Timezone Field Type for Symfony2

  Sources   Download

MIT

The Requires

 

form symfony2 type timezone