![]() |
|
sfJQueryDateTimeFormWidgetPlugin - 1.0.1A plugin used to implement a jquery date and time picker widget within the forms |
|
![]() |
2
users
Sign-in
to change your status |
A plugin used to implement a jquery date and time picker widget within the forms |
A plugin using juqery TimePicker library to provide a dropdown of time based on specification of intervals and start and stop times.
The most recent version of this plugin includes a validator class which can be used to bind value based on a datetime format.
The version of the plugin also comes with javascript and css assets for the time picker.
| Name | Status | |
|---|---|---|
|
|
lead | moc.liamg <<ta>> hpesoj.eisrep |
Copyright (c) 2012 Joseph M. Persie
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
| Version | License | API | Released |
|---|---|---|---|
| 1.1.0stable | MIT license | 1.4.0stable | 20/04/2012 |
| 1.0.2stable | MIT license | 1.4.0stable | 20/04/2012 |
| 1.0.1stable | MIT license | 1.4.0stable | 15/04/2012 |
| Version | License | API | Released |
|---|---|---|---|
| 1.1.0stable | MIT license | 1.4.0stable | 20/04/2012 |
| 1.0.2stable | MIT license | 1.4.0stable | 20/04/2012 |
| 1.0.1stable | MIT license | 1.4.0stable | 15/04/2012 |
*
*
*
*
A plugin using juqery TimePicker library to provide a dropdown of time based on specification of intervals and start and stop times. Feel free to contact me with any questions.
Install jQuery (http://www.jquery.com) somewhere under your web folder (preferably under web/js).
Install jQuery timePicker (http://github.com/perifer/timePicker) somewhere under your web folder (preferably under web/js).
Install jQuery-UI (http://www.jqueryui.com) somewhere under your web folder (preferably under web/js).
Install Datejs (http://www.datejs.com) somewhere under your web folder (preferably under web/js).
Add the jQuery, timePicker, jQuery-UI and Datejs JavaScript files to the javascripts list in your application's config/view.yml file.
Install the plugin. Using symfony command line: ./symfony plugin:install sfJQueryTimeDateFormWidgetPlugin Or get the latest version from the subversion repository: svn co http://svn.symfony-project.com/plugins/sfJQueryTimeDateFormWidgetPlugin plugins/sfJQueryTimeDateFormWidgetPlugin
If you installed by subversion, activate the plugin in the config/ProjectConfiguration.class.php file (this will have already been done automatically if you used the plugin:install symfony command).
class ProjectConfiguration extends sfProjectConfiguration { public function setup() { ... $this->enablePlugins('sfJQueryTimeDateFormWidgetPlugin'); ... } }
Edit a form, for example lib/form/doctrine/MyForm.class.php. To use the date component, do something like this:
$fromOptions = array( 'widget_name'=>'from', 'params'=>$params, 'default_date'=>'2008-01-01', 'default_time'=>'12:00 AM' ); $untilOptions = array( 'widget_name'=>'until', 'params'=>$params, 'default_date'=>date('Y-m-d'), 'default_time'=>date('h:i A') ); $this->setWidgets(array( 'staff' => new sfWidgetFormDoctrineChoice(array('model' => 'Staff', 'add_empty' => false)), 'from' => new sfJQueryDateTimeWidget($fromOptions), 'until' => new sfJQueryDateTimeWidget($untilOptions), ));
Edit an action, for example apps/frontend/modules/timequery/actions/actions.class.php and add and implement the following function to perform date time queries:
private function convertParamToDatetime($time) { $time = DateTime::createFromFormat('Y-m-d h:i A',$time); if($time instanceof DateTime) return $time->format('Y-m-d H:i:s'); else return null; }
Clear your cache. ./symfony cc
Test your form.
