Development

/plugins/sfJQueryDateTimeFormWidgetPlugin/README

You must first sign up to be able to contribute.

root/plugins/sfJQueryDateTimeFormWidgetPlugin/README

Revision 33407, 3.9 kB (checked in by zmijevik, 1 year ago)

created the svn repo

Line 
1 #sfSelectTimeInputJQueryTimePickerPlugin#
2
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.
5
6 ## Installation ##
7
8   * 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   * Install jQuery-UI (http://www.jqueryui.com) somewhere under your web folder (preferably under web/js).
13
14   * Install Datejs (http://www.datejs.com) somewhere under your web folder (preferably under web/js).
15
16   * Add the jQuery, timePicker, jQuery-UI and Datejs JavaScript files to the javascripts list in your application's config/view.yml file.
17  
18 * Add any CSS files you want to use for timePicker and datePicker, and add them to the stylesheets list in view.yml.
19
20   * Install the plugin.
21       Using symfony command line:
22           ./symfony plugin:install sfJQueryTimeDateFormWidgetPlugin
23       Or get the latest version from the subversion repository:
24           svn co http://svn.symfony-project.com/plugins/sfJQueryTimeDateFormWidgetPlugin plugins/sfJQueryTimeDateFormWidgetPlugin
25
26   * 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).
27
28         [php]
29         class ProjectConfiguration extends sfProjectConfiguration
30         {
31           public function setup()
32           {
33             ...
34             $this->enablePlugins('sfJQueryTimeDateFormWidgetPlugin');
35             ...
36           }
37         }
38
39
40
41 ## How to use ##
42
43   * Edit a form, for example lib/form/doctrine/MyForm.class.php.  To use the date component, do something like this:
44
45         [php]   
46         $fromOptions = array(
47                              'widget_name'=>'from',
48                              'params'=>$params,
49                              'default_date'=>'2008-01-01',
50                              'default_time'=>'12:00 AM'
51                             );
52
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                              );
59
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
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             else
75                 return null;
76         }
77
78   * Clear your cache.
79         ./symfony cc
80
81   * Test your form.
82
83 ## Options ##
84
85   * widget_name    (string)
86         the name of the widget
87   * time_interval  (string)
88         a number from one to 60 to minumize minute selection
89   * params         (array)
90         an array of form request data
91   * default_date   (string)
92         the default date for the date picker in YYYY-mm-dd
93   * default_time   (string)
94         the default time for the time picker in hh:ii AA
95   * time_start_stop     (array)
96         an array with two keys:
97           * start  (string)
98                 the start time of the time picker in HH.MM
99           * stop   (string)
100                 the stop time of the time picker in HH.MM
101   * time_image     (string)
102         a path to an image to display as the time picker button
103        
104  
Note: See TracBrowser for help on using the browser.