Development

Changeset 33419

You must first sign up to be able to contribute.

Changeset 33419

Show
Ignore:
Timestamp:
04/20/12 22:42:46 (1 year ago)
Author:
zmijevik
Message:

commiting version 1.0.2

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfJQueryDateTimeFormWidgetPlugin/README

    r33407 r33419  
    1 #sfSelectTimeInputJQueryTimePickerPlugin# 
     1#sfJQueryDateTimePickerPlugin# 
    22 
    33A 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 
     5The most recent version of this plugin includes a validator class which can be used to bind value based on a datetime format.  
     6 
     7The version of the plugin also comes with javascript and css assets for the time picker. 
    58 
    69## Installation ## 
    710 
    811  * 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). 
    1112 
    1213  * Install jQuery-UI (http://www.jqueryui.com) somewhere under your web folder (preferably under web/js). 
     
    1617  * Add the jQuery, timePicker, jQuery-UI and Datejs JavaScript files to the javascripts list in your application's config/view.yml file. 
    1718   
    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 
    1926 
    2027  * Install the plugin. 
     
    3744        } 
    3845 
     46  * Publish the Assets. 
     47      Using symfony command line: 
     48          ./symfony plugin:publish-assets 
    3949 
    4050 
     
    4454 
    4555        [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'); 
    5257 
    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                      ); 
    5964 
    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'))); 
    6567 
    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         } 
    7768 
    7869  * Clear your cache. 
     
    8172  * Test your form. 
    8273 
    83 ## Options ## 
     74## Widget Options ## 
    8475 
    8576  * widget_name    (string)  
     
    10293        a path to an image to display as the time picker button 
    10394        
    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