Changeset 33419
- Timestamp:
- 04/20/12 22:42:46 (1 year ago)
- Files:
-
- plugins/sfJQueryDateTimeFormWidgetPlugin/README (modified) (6 diffs)
- plugins/sfJQueryDateTimeFormWidgetPlugin/package.xml.tmpl (added)
- plugins/sfJQueryDateTimeFormWidgetPlugin/sfJQueryDateTimeFormWidgetPlugin-1.0.2.tgz (added)
- plugins/sfJQueryDateTimeFormWidgetPlugin/web (added)
- plugins/sfJQueryDateTimeFormWidgetPlugin/web/css (added)
- plugins/sfJQueryDateTimeFormWidgetPlugin/web/css/timePicker.css (added)
- plugins/sfJQueryDateTimeFormWidgetPlugin/web/js (added)
- plugins/sfJQueryDateTimeFormWidgetPlugin/web/js/jquery.timePicker.js (added)
- plugins/sfJQueryDateTimeFormWidgetPlugin/web/js/jquery.timePicker.js.bak (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfJQueryDateTimeFormWidgetPlugin/README
r33407 r33419 1 #sf SelectTimeInputJQueryTimePickerPlugin#1 #sfJQueryDateTimePickerPlugin# 2 2 3 3 A plugin using juqery TimePicker library to provide a dropdown of time based on specification of intervals and start and stop times. 4 Feel free to contact me with any questions. 4 5 The most recent version of this plugin includes a validator class which can be used to bind value based on a datetime format. 6 7 The version of the plugin also comes with javascript and css assets for the time picker. 5 8 6 9 ## Installation ## 7 10 8 11 * Install jQuery (http://www.jquery.com) somewhere under your web folder (preferably under web/js). 9 10 * Install jQuery timePicker (http://github.com/perifer/timePicker) somewhere under your web folder (preferably under web/js).11 12 12 13 * Install jQuery-UI (http://www.jqueryui.com) somewhere under your web folder (preferably under web/js). … … 16 17 * Add the jQuery, timePicker, jQuery-UI and Datejs JavaScript files to the javascripts list in your application's config/view.yml file. 17 18 18 * Add any CSS files you want to use for timePicker and datePicker, and add them to the stylesheets list in view.yml. 19 * Add any CSS files you want to use for timePicker and datePicker, and add them to the stylesheets list in view.yml. 20 21 [php] 22 stylesheets: [ ... , /sfJQueryDateTimeFormWidgetPlugin/css/timePicker.css, ... ] 23 24 javascripts: [ ... , /sfJQueryDateTimeFormWidgetPlugin/js/jquery.timePicker.js, ... ] 25 19 26 20 27 * Install the plugin. … … 37 44 } 38 45 46 * Publish the Assets. 47 Using symfony command line: 48 ./symfony plugin:publish-assets 39 49 40 50 … … 44 54 45 55 [php] 46 $fromOptions = array( 47 'widget_name'=>'from', 48 'params'=>$params, 49 'default_date'=>'2008-01-01', 50 'default_time'=>'12:00 AM' 51 ); 56 $params = $this->getOption('params'); 52 57 53 $untilOptions = array(54 'widget_name'=>'until',55 'params'=>$params,56 'default_date'=>date('Y-m-d'),57 'default_time'=>date('h:i A')58 );58 $options = array( 59 'widget_name'=>'time', 60 'params'=>$params, 61 'default_date'=>date('Y-m-d'), 62 'default_time'=>date('h:i A') 63 ); 59 64 60 $this->setWidgets(array( 61 'staff' => new sfWidgetFormDoctrineChoice(array('model' => 'Staff', 'add_empty' => false)), 62 'from' => new sfJQueryDateTimeWidget($fromOptions), 63 'until' => new sfJQueryDateTimeWidget($untilOptions), 64 )); 65 $this->setWidget('time',new sfJQueryDateTimeWidget($options)); 66 $this->setValidator('time', new sfJQueryDateTimeValidator(array('widget_name'=>'time'))); 65 67 66 * 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:67 68 [php]69 private function convertParamToDatetime($time) {70 $time = DateTime::createFromFormat('Y-m-d h:i A',$time);71 72 if($time instanceof DateTime)73 return $time->format('Y-m-d H:i:s');74 else75 return null;76 }77 68 78 69 * Clear your cache. … … 81 72 * Test your form. 82 73 83 ## Options ##74 ## Widget Options ## 84 75 85 76 * widget_name (string) … … 102 93 a path to an image to display as the time picker button 103 94 104 95 ## Validator Options ## 96 97 * widget_name (string): The name of the widget (to retrieve specific input value) 98 * date_format (string): The format to use when submitting a date with time (default to Y-m-d h:i A) 99 * with_time (string): true if the validator must return a time, false otherwise 100 * date_output (string): The format to use when returning a date (default to Y-m-d) 101 * datetime_output (string): The format to use when returning a date with time (default to Y-m-d H:i:s) 102