Plugin Directory

Changeset 1148497


Ignore:
Timestamp:
04/28/2015 10:40:10 PM (11 years ago)
Author:
a2rocklobster
Message:

Feature ADD! You now have the ability to pick which type of reservation length to use

Location:
vacancy-personal-edition
Files:
62 added
3 edited

Legend:

Unmodified
Added
Removed
  • vacancy-personal-edition/trunk/readme.txt

    r1137504 r1148497  
    5252== Changelog ==
    5353
     54= 1.2.2 =
     55* Feature ADD! You now have the ability to pick which type of reservation length to use; Standard (any length), Fixed Length, or Min/Max Length with custom Intervals
     56
    5457= 1.2.1 =
    5558* Fixed a bug where reservations for locations with custom availability weren't getting errors
     
    9194== Upgrade Notice ==
    9295
     96= 1.2.2 =
     97* Feature ADD! You now have the ability to pick which type of reservation length to use; Standard (any length), Fixed Length, or Min/Max Length with custom Intervals
     98
    9399= 1.2.1 =
    94100* Fixed a bug where reservations for locations with custom availability weren't getting errors
  • vacancy-personal-edition/trunk/va-settings.php

    r1119174 r1148497  
    4343                        </select>
    4444                        <div id="va-show-admin-bar" style="display:none;">
    45                             <p>Show WP admin bar for</p>
     45                            <p>BUT, Still Show WP admin bar for</p>
    4646                            <?php global $wp_roles; ?>
    4747                            <ul>
     
    9393            <div id="va-forms">
    9494                <form method="post" action="">
    95                     <h2 class="va-tab-title">Form Field Labels</h2><hr/>
    96                     <p>This allows you to update the labels on the reservation form. Leave blank for default values shown.</p>
    97                     <div class="form-field-labels">
    98                         <p>
    99                             <label><?php echo $this->va_settings['reservation_single']; ?> Title:</label>
    100                             <input type="text" name="va_title_label" value="<?php echo $this->va_settings['title_label'];?>"/>
    101                         </p>                   
    102                         <p>
    103                             <label>Your Name:</label>
    104                             <input type="text" name="va_name_label" value="<?php echo $this->va_settings['name_label'];?>"/>
    105                         </p>
    106                         <p>
    107                             <label>Phone:</label>
    108                             <input type="text" name="va_phone_label" value="<?php echo $this->va_settings['phone_label']; ?>"/>
    109                         </p>                   
    110                         <p>
    111                             <label>Email:</label>
    112                             <input type="text" name="va_email_label" value="<?php echo $this->va_settings['email_label'];?>"/>
    113                         </p>
    114                         <p>
    115                             <label><?php echo $this->va_settings['reservation_single']; ?> Type:</label>
    116                             <input type="text" name="va_reservation_type_label" value="<?php echo $this->va_settings['reservation_type_label'];?>"/>
    117                         </p>                   
    118                         <p>
    119                             <label><?php echo $this->va_settings['reservation_single']; ?> Description:</label>
    120                             <input type="text" name="va_description_label" value="<?php echo $this->va_settings['description_label'];?>"/>
    121                            
    122                         </p>                   
    123                         <p>
    124                             <label>Setup Needs:</label>
    125                             <input type="text" name="va_setup_needs_label" value="<?php echo $this->va_settings['setup_needs_label'];?>"/>
    126                         </p>                   
    127                         <p>
    128                             <label>A/V Tech Needs: (ie. Screen, Projector, Speakers, Microphone, etc.)</label>
    129                             <input type="text" name="va_av_needs_label" value="<?php echo $this->va_settings['av_needs_label'];?>"/>
    130                         </p>
     95                    <h2 class="va-tab-title"><?php echo $this->va_settings['reservation_single']; ?> End Time Options</h2><hr/>
     96                    <div id="va-end-time-options">
     97                        <div class="reservation-end-time-type">
     98                            <p>
     99                                <label style="width:auto;"><input id="va-standard-end-time" type="radio" name="va_end_time_type" value="standard" <?php if($this->va_settings['end_time_type'] == 'standard'){echo 'checked';};?> /> Standard End Time Selection</label><br/>
     100                                <label style="width:auto;"><input id="va-fixed-end-time" type="radio" name="va_end_time_type" value="fixed" <?php if($this->va_settings['end_time_type'] == 'fixed'){echo 'checked';};?> /> Fixed <?php echo $this->va_settings['reservation_single']; ?> Length</label><br/>
     101                                <label style="width:auto;"><input id="va-minmax-end-time" type="radio" name="va_end_time_type" value="minmax" <?php if($this->va_settings['end_time_type'] == 'minmax'){echo 'checked';};?> /> Min/Max <?php echo $this->va_settings['reservation_single']; ?> Length Selection</label>
     102                            </p>
     103                        </div>
     104                        <span class="va-clearer"></span>
     105                        <div class="reservation-fixed-end-times" style="display:none;">
     106                            <p>
     107                                <?php echo $this->va_settings['reservation_plural']; ?> last for:<br/>
     108                                <select name="va_end_time_length_hr">
     109                                <?php for($i=0;$i<24;$i++) : ?>
     110                                    <option value="<?php echo $i; ?>" <?php if($this->va_settings['end_time_length_hr'] == $i){echo 'selected';};?>><?php echo $i; ?></option>
     111                                <?php endfor; ?>
     112                                </select> hours
     113                                <select name="va_end_time_length_min">
     114                                    <option value="00" <?php if($this->va_settings['end_time_length_min'] == '00'){echo 'selected';};?>>00</option>
     115                                    <option value="15" <?php if($this->va_settings['end_time_length_min'] == '15'){echo 'selected';};?>>15</option>
     116                                    <option value="30" <?php if($this->va_settings['end_time_length_min'] == '30'){echo 'selected';};?>>30</option>
     117                                    <option value="45" <?php if($this->va_settings['end_time_length_min'] == '45'){echo 'selected';};?>>45</option>
     118                                </select> minutes
     119                            </p>
     120                        </div> 
     121                        <span class="va-clearer"></span>               
     122                        <div class="reservation-minmax-end-times" style="display:none;">
     123                            <p>
     124                                Minimum <?php echo $this->va_settings['reservation_single']; ?> Length:<br/><span class="description">(if a user chooses a 1:00pm start time and this setting is 30 minutes, the first available end time will be 1:30pm)</span><br/>
     125                                <select name="va_end_time_min_length_hr">
     126                                <?php for($i=0;$i<24;$i++) : ?>
     127                                    <option value="<?php echo $i; ?>" <?php if($this->va_settings['end_time_min_length_hr'] == $i){echo 'selected';};?>><?php echo $i; ?></option>
     128                                <?php endfor; ?>
     129                                </select> hours
     130                                <select name="va_end_time_min_length_min">
     131                                    <option value="00" <?php if($this->va_settings['end_time_min_length_min'] == '00'){echo 'selected';};?>>00</option>
     132                                    <option value="15" <?php if($this->va_settings['end_time_min_length_min'] == '15'){echo 'selected';};?>>15</option>
     133                                    <option value="30" <?php if($this->va_settings['end_time_min_length_min'] == '30'){echo 'selected';};?>>30</option>
     134                                    <option value="45" <?php if($this->va_settings['end_time_min_length_min'] == '45'){echo 'selected';};?>>45</option>
     135                                </select> minutes
     136                            </p>                           
     137                            <p>
     138                                Maximum <?php echo $this->va_settings['reservation_single']; ?> Length:<br/><span class="description">(if a user chooses a 1:00pm start time and this setting is 2 hours, the last available end time will be 3:00pm)</span><br/>
     139                                <select name="va_end_time_max_length_hr">
     140                                <?php for($i=0;$i<24;$i++) : ?>
     141                                    <option value="<?php echo $i; ?>" <?php if($this->va_settings['end_time_max_length_hr'] == $i){echo 'selected';};?>><?php echo $i; ?></option>
     142                                <?php endfor; ?>
     143                                </select> hours
     144                                <select name="va_end_time_max_length_min">
     145                                    <option value="00" <?php if($this->va_settings['end_time_max_length_min'] == '00'){echo 'selected';};?>>00</option>
     146                                    <option value="15" <?php if($this->va_settings['end_time_max_length_min'] == '15'){echo 'selected';};?>>15</option>
     147                                    <option value="30" <?php if($this->va_settings['end_time_max_length_min'] == '30'){echo 'selected';};?>>30</option>
     148                                    <option value="45" <?php if($this->va_settings['end_time_max_length_min'] == '45'){echo 'selected';};?>>45</option>
     149                                </select> minutes
     150                            </p>
     151                            <p>                             
     152                                <?php echo $this->va_settings['reservation_single']; ?> Time Interval:<br/><span class="description">(end times available to the user will be in intervals of this setting. make sure it fits evenly between your Min/Max settings above)</span><br/>
     153                                <select name="va_end_time_minmax_interval">
     154                                    <option value="0.25" <?php if($this->va_settings['end_time_minmax_interval'] == '0.25'){echo 'selected';};?>>15 minutes</option>
     155                                    <option value="0.5" <?php if($this->va_settings['end_time_minmax_interval'] == '0.5'){echo 'selected';};?>>30 minutes</option>
     156                                    <option value="0.75" <?php if($this->va_settings['end_time_minmax_interval'] == '0.75'){echo 'selected';};?>>45 minutes</option>
     157                                    <option value="1" <?php if($this->va_settings['end_time_minmax_interval'] == '1'){echo 'selected';};?>>1 hour</option>
     158                                    <option value="1.25" <?php if($this->va_settings['end_time_minmax_interval'] == '1.25'){echo 'selected';};?>>1 hour 15 minutes</option>
     159                                    <option value="1.5" <?php if($this->va_settings['end_time_minmax_interval'] == '1.5'){echo 'selected';};?>>1 hour 30 minutes</option>
     160                                    <option value="1.75" <?php if($this->va_settings['end_time_minmax_interval'] == '1.75'){echo 'selected';};?>>1 hour 45 minutes</option>
     161                                    <option value="2" <?php if($this->va_settings['end_time_minmax_interval'] == '2'){echo 'selected';};?>>2 hours</option>
     162                                    <option value="2.25" <?php if($this->va_settings['end_time_minmax_interval'] == '2.25'){echo 'selected';};?>>2 hours 15 minutes</option>
     163                                    <option value="2.5" <?php if($this->va_settings['end_time_minmax_interval'] == '2.5'){echo 'selected';};?>>2 hours 30 minutes</option>
     164                                    <option value="2.75" <?php if($this->va_settings['end_time_minmax_interval'] == '2.75'){echo 'selected';};?>>2 hours 45 minutes</option>
     165                                    <option value="3" <?php if($this->va_settings['end_time_minmax_interval'] == '3'){echo 'selected';};?>>3 hours</option>
     166                                    <option value="3.25" <?php if($this->va_settings['end_time_minmax_interval'] == '3.25'){echo 'selected';};?>>3 hours 15 minutes</option>
     167                                    <option value="3.5" <?php if($this->va_settings['end_time_minmax_interval'] == '3.5'){echo 'selected';};?>>3 hours 30 minutes</option>
     168                                    <option value="3.75" <?php if($this->va_settings['end_time_minmax_interval'] == '3.75'){echo 'selected';};?>>3 hours 45 minutes</option>
     169                                    <option value="4" <?php if($this->va_settings['end_time_minmax_interval'] == '4'){echo 'selected';};?>>4 hours</option>
     170                                    <option value="4.25" <?php if($this->va_settings['end_time_minmax_interval'] == '4.25'){echo 'selected';};?>>4 hours 15 minutes</option>
     171                                    <option value="4.5" <?php if($this->va_settings['end_time_minmax_interval'] == '4.5'){echo 'selected';};?>>4 hours 30 minutes</option>
     172                                    <option value="4.75" <?php if($this->va_settings['end_time_minmax_interval'] == '4.75'){echo 'selected';};?>>4 hours 45 minutes</option>
     173                                    <option value="5" <?php if($this->va_settings['end_time_minmax_interval'] == '5'){echo 'selected';};?>>5 hours</option>
     174                                </select>
     175                            </p>
     176                        </div>
    131177                    </div>
    132178                    <br/>
     
    137183                        <?php
    138184                            $fields = array(
    139                                 'end_time' => 'End Time',
     185                                //'end_time' => 'End Time',
    140186                                'setup_time' => 'Setup Time',
    141187                                'cleanup_time' => 'Cleanup Time',
     
    158204                        </ul>
    159205                    </div>
    160                     <div class="reservation-end-times" style="display:none;">
    161                         <p>
    162                             <?php echo $this->va_settings['reservation_plural']; ?> last for:<br/>
    163                             <select name="va_end_time_length_hr">
    164                             <?php for($i=0;$i<24;$i++) : ?>
    165                                 <option value="<?php echo $i; ?>" <?php if($this->va_settings['end_time_length_hr'] == $i){echo 'selected';};?>><?php echo $i; ?></option>
    166                             <?php endfor; ?>
    167                             </select> hours<br/>
    168                             <select name="va_end_time_length_min">
    169                                 <option value="00" <?php if($this->va_settings['end_time_length_hr'] == '00'){echo 'selected';};?>>00</option>
    170                                 <option value="15" <?php if($this->va_settings['end_time_length_hr'] == '15'){echo 'selected';};?>>15</option>
    171                                 <option value="30" <?php if($this->va_settings['end_time_length_hr'] == '30'){echo 'selected';};?>>30</option>
    172                                 <option value="45" <?php if($this->va_settings['end_time_length_hr'] == '45'){echo 'selected';};?>>45</option>
    173                             </select> minutes
     206                    <br/>
     207                    <h2 class="va-tab-title">Form Field Labels</h2><hr/>
     208                    <p>This allows you to update the labels on the reservation form. Leave blank for default values shown.</p>
     209                    <div class="form-field-labels">
     210                        <p>
     211                            <label><?php echo $this->va_settings['reservation_single']; ?> Title:</label>
     212                            <input type="text" name="va_title_label" value="<?php echo $this->va_settings['title_label'];?>"/>
     213                        </p>                   
     214                        <p>
     215                            <label>Your Name:</label>
     216                            <input type="text" name="va_name_label" value="<?php echo $this->va_settings['name_label'];?>"/>
     217                        </p>
     218                        <p>
     219                            <label>Phone:</label>
     220                            <input type="text" name="va_phone_label" value="<?php echo $this->va_settings['phone_label']; ?>"/>
     221                        </p>                   
     222                        <p>
     223                            <label>Email:</label>
     224                            <input type="text" name="va_email_label" value="<?php echo $this->va_settings['email_label'];?>"/>
     225                        </p>
     226                        <p>
     227                            <label><?php echo $this->va_settings['reservation_single']; ?> Type:</label>
     228                            <input type="text" name="va_reservation_type_label" value="<?php echo $this->va_settings['reservation_type_label'];?>"/>
     229                        </p>                   
     230                        <p>
     231                            <label><?php echo $this->va_settings['reservation_single']; ?> Description:</label>
     232                            <input type="text" name="va_description_label" value="<?php echo $this->va_settings['description_label'];?>"/>
     233                           
     234                        </p>                   
     235                        <p>
     236                            <label>Setup Needs:</label>
     237                            <input type="text" name="va_setup_needs_label" value="<?php echo $this->va_settings['setup_needs_label'];?>"/>
     238                        </p>                   
     239                        <p>
     240                            <label>A/V Tech Needs: (ie. Screen, Projector, Speakers, Microphone, etc.)</label>
     241                            <input type="text" name="va_av_needs_label" value="<?php echo $this->va_settings['av_needs_label'];?>"/>
    174242                        </p>
    175243                    </div>
     244                    <br/>
    176245                    <input type="hidden" name="va_save_form_settings" />
    177246                    <input class="button button-primary" type="submit" name="va_update_settings" value="Update Settings" />
     
    360429        });
    361430
    362         if(!($('#va-forms #end_time:checked').length > 0)){
    363             $('.reservation-end-times').slideToggle('fast');
     431        // show/hide end time types
     432        var selectedVal = "";
     433        var selected = $("input[type='radio'][name='va_end_time_type']:checked");
     434        if(selected.length > 0){
     435            selectedVal = selected.val();
    364436        }
    365         $('#end_time').on('click', function(){
    366             $('.reservation-end-times').slideToggle('fast');
    367         });
     437
     438        if(selectedVal == 'fixed'){
     439            $('.reservation-fixed-end-times').fadeIn('fast');
     440        }else if(selectedVal == 'minmax'){
     441            $('.reservation-minmax-end-times').fadeIn('fast');
     442        }
     443
     444        // toggle fixed and min/max
     445        $('.reservation-end-time-type label').on('click', function(){
     446            var selectedVal = $('input', this).val();
     447            if(selectedVal == 'fixed'){
     448                $('.reservation-fixed-end-times').fadeIn('fast');
     449                $('.reservation-minmax-end-times').hide();
     450            }else if(selectedVal == 'minmax'){
     451                $('.reservation-minmax-end-times').fadeIn('fast');
     452                $('.reservation-fixed-end-times').hide();
     453            }else {
     454                $('.reservation-fixed-end-times').hide();
     455                $('.reservation-minmax-end-times').hide();
     456            }
     457        });
    368458    });
    369459</script>
  • vacancy-personal-edition/trunk/vacancy.php

    r1137504 r1148497  
    44    Plugin URI: http://kraftpress.it
    55    Description: A full featured appointment and reservation booking solution
    6     Version: 1.2.1
     6    Version: 1.2.2
    77    Author: kraftpress
    88    Author URI: http://kraftpress.it
     
    2121             // vars
    2222            $this->va_settings = array(
    23                 'version' => '1.2.1',
     23                'version' => '1.2.2',
    2424                'path' => apply_filters('va_get_path', __FILE__),
    2525                'dir' => apply_filters('va_get_dir', __FILE__),
     
    3636                'end_time_length_hr' => '0',
    3737                'end_time_length_min' => '0',
     38                'end_time_min_length_hr' => '0',
     39                'end_time_min_length_min' => '0',
     40                'end_time_max_length_hr' => '0',
     41                'end_time_max_length_min' => '0',
     42                'end_time_minmax_interval' => 0.25,
     43                'end_time_type' => 'standard',
    3844                'require_login' => 'yes',
    3945                'admin_new_notification' => 'yes',
     
    5460                'saving_reservation_meta' => false,
    5561                'show_reservation_details' => 'yes',
    56                 'show_form_fields' => array('end_time','setup_time','cleanup_time','title','venue','location','phone','type','description','setup_needs','av_needs'),
     62                'show_form_fields' => array('setup_time','cleanup_time','title','venue','location','phone','type','description','setup_needs','av_needs'),
    5763                'title_label' => '',
    5864                'name_label' => '',
     
    124130                if(isset($_POST['va_av_needs_label'])){update_option('va_av_needs_label', sanitize_text_field($_POST['va_av_needs_label']));}
    125131               
     132                if(!empty($_POST['va_end_time_type'])){update_option('va_end_time_type', sanitize_text_field($_POST['va_end_time_type']));}
    126133                if(!empty($_POST['va_end_time_length_hr'])){update_option('va_end_time_length_hr', sanitize_text_field($_POST['va_end_time_length_hr']));}
    127134                if(!empty($_POST['va_end_time_length_min'])){update_option('va_end_time_length_min', sanitize_text_field($_POST['va_end_time_length_min']));}
     135                if(!empty($_POST['va_end_time_min_length_hr'])){update_option('va_end_time_min_length_hr', sanitize_text_field($_POST['va_end_time_min_length_hr']));}
     136                if(!empty($_POST['va_end_time_min_length_min'])){update_option('va_end_time_min_length_min', sanitize_text_field($_POST['va_end_time_min_length_min']));}
     137                if(!empty($_POST['va_end_time_max_length_hr'])){update_option('va_end_time_max_length_hr', sanitize_text_field($_POST['va_end_time_max_length_hr']));}
     138                if(!empty($_POST['va_end_time_max_length_min'])){update_option('va_end_time_max_length_min', sanitize_text_field($_POST['va_end_time_max_length_min']));}
     139                if(!empty($_POST['va_end_time_minmax_interval'])){update_option('va_end_time_minmax_interval', sanitize_text_field($_POST['va_end_time_minmax_interval']));}
    128140
    129141                if(!empty($_POST['va_require_login'])){update_option('va_require_login', sanitize_text_field($_POST['va_require_login']));}
     
    208220            if(!empty($av_needs_label)){$this->va_settings['av_needs_label'] = $av_needs_label;}
    209221
     222            $end_time_type = get_option('va_end_time_type');
     223            if(!empty($end_time_type)){$this->va_settings['end_time_type'] = $end_time_type;}
    210224            $end_time_length_hr = get_option('va_end_time_length_hr');
    211225            if(!empty($end_time_length_hr)){$this->va_settings['end_time_length_hr'] = $end_time_length_hr;}
    212226            $end_time_length_min = get_option('va_end_time_length_min');
    213227            if(!empty($end_time_length_min)){$this->va_settings['end_time_length_min'] = $end_time_length_min;}
     228            $end_time_min_length_hr = get_option('va_end_time_min_length_hr');
     229            if(!empty($end_time_min_length_hr)){$this->va_settings['end_time_min_length_hr'] = $end_time_min_length_hr;}
     230            $end_time_min_length_min = get_option('va_end_time_min_length_min');
     231            if(!empty($end_time_min_length_min)){$this->va_settings['end_time_min_length_min'] = $end_time_min_length_min;}
     232            $end_time_max_length_hr = get_option('va_end_time_max_length_hr');
     233            if(!empty($end_time_max_length_hr)){$this->va_settings['end_time_max_length_hr'] = $end_time_max_length_hr;}
     234            $end_time_max_length_min = get_option('va_end_time_max_length_min');
     235            if(!empty($end_time_max_length_min)){$this->va_settings['end_time_max_length_min'] = $end_time_max_length_min;}
     236            $end_time_minmax_interval = get_option('va_end_time_minmax_interval');
     237            if(!empty($end_time_minmax_interval)){$this->va_settings['end_time_minmax_interval'] = $end_time_minmax_interval;}
    214238
    215239            $require_login = get_option('va_require_login');
     
    909933            }
    910934            $start_time = sanitize_text_field($_POST['va_start_time']);
    911             if(in_array('end_time',$this->va_settings['show_form_fields'])){
    912                 $end_time = sanitize_text_field($_POST['va_end_time']);
    913             }else{
    914                 $start_time_temp = strtotime($start_time);
    915                 $end_time_temp = strtotime("+".$this->va_settings['end_time_length_hr']." hours", $start_time_temp);
    916                 $end_time = date('H:i',strtotime("+".$this->va_settings['end_time_length_min']." minutes", $end_time_temp));
    917             }
     935            $end_time = sanitize_text_field($_POST['va_end_time']);
     936       
    918937            $name = sanitize_text_field($_POST['va_reservation_name']);
    919938            if(in_array('phone',$this->va_settings['show_form_fields'])){
     
    17041723                    <?php $setup_cleanup = $this->va_settings['setup_cleanup']; ?>
    17051724                    <div class="va-start">
    1706                         <label><strong>Start <?php echo $this->va_settings['reservation_single']; ?> at:</strong> <?php echo $this->va_get_time_select('va_start_time', $start_time, null, true); ?></label>
     1725                        <label>
     1726                            <strong>Start <?php echo $this->va_settings['reservation_single']; ?> at:</strong><br/>
     1727                            <?php echo $this->va_get_time_select('va_start_time', $start_time, null, true, $start_time, $start_time); ?>
     1728                        </label>
    17071729                        <?php if(in_array('setup_time', $this->va_settings['show_form_fields'])) : ?>
    17081730                            <div class="va-setup-time" <?php if($setup_cleanup == 'no'){echo 'style="display:none;"';}?>>
     
    17151737                                <div id="va-setup-time" style="display:none;">
    17161738                                    <label>Start Setup before <?php echo $this->va_settings['reservation_single']; ?> at:
    1717                                         <?php echo $this->va_get_time_select('va_start_setup_time',null,null,false,false,$start_time); ?>
     1739                                        <?php echo $this->va_get_time_select('va_start_setup_time',null,null,false,false,$start_time,0.25,true); ?>
    17181740                                    </label>
    17191741                                </div>
     
    17221744                    </div>
    17231745                    <div class="va-end">
    1724                         <?php if(in_array('end_time', $this->va_settings['show_form_fields'])) : ?>
    1725                             <label><strong>End <?php echo $this->va_settings['reservation_single']; ?> at:</strong> <?php echo $this->va_get_time_select('va_end_time', null, null, true, $start_time); ?></label>
    1726                         <?php else : ?>
    1727                             <br/>
    1728                             <label><?php echo $this->va_settings['reservation_plural']; ?> last for: <?php echo $this->va_settings['end_time_length_hr']; ?> hr <?php echo $this->va_settings['end_time_length_min']; ?> min</label>
     1746                        <?php if($this->va_settings['end_time_type'] == "standard") : ?>
     1747                            <label>
     1748                                <strong>End <?php echo $this->va_settings['reservation_single']; ?> at:</strong>
     1749                                <?php $start_time = date('H:i',strtotime("+ 15 minutes", strtotime($start_time))); ?>
     1750                                <?php echo $this->va_get_time_select('va_end_time', $start_time, null, true, $start_time); ?>
     1751                            </label>
     1752                        <?php elseif($this->va_settings['end_time_type'] == "fixed") : ?>
     1753                            <label>
     1754                                <strong>End <?php echo $this->va_settings['reservation_single']; ?> at:</strong>
     1755                                <?php
     1756                                    $end_time_temp = strtotime("+".$this->va_settings['end_time_length_hr']." hours", strtotime($start_time));
     1757                                    $end_time = date('H:i',strtotime("+".$this->va_settings['end_time_length_min']." minutes", $end_time_temp));
     1758                                ?>
     1759                                <?php echo $this->va_get_time_select('va_end_time', $end_time, null, true, $end_time, $end_time); ?>
     1760                            </label>
     1761                        <?php else : // min/max ?>
     1762                            <label>
     1763                                <strong>End <?php echo $this->va_settings['reservation_single']; ?> at:</strong>
     1764                                <?php
     1765
     1766                                    $start_time_temp = strtotime("+".$this->va_settings['end_time_min_length_hr']." hours", strtotime($start_time));
     1767                                    $start_time_min = date('H:i',strtotime("+".$this->va_settings['end_time_min_length_min']." minutes", $start_time_temp));
     1768                                                 
     1769                                    $end_time_temp = strtotime("+".$this->va_settings['end_time_max_length_hr']." hours", strtotime($start_time));
     1770                                    $end_time_max = date('H:i',strtotime("+".$this->va_settings['end_time_max_length_min']." minutes", $end_time_temp));     
     1771
     1772                                    $interval = $this->va_settings['end_time_minmax_interval'];
     1773                                ?>
     1774                                <?php echo $this->va_get_time_select('va_end_time', $start_time_min, null, true, $start_time_min, $end_time_max, $interval); ?>
     1775                            </label>
    17291776                        <?php endif; ?>
    17301777                        <?php if(in_array('cleanup_time', $this->va_settings['show_form_fields'])) : ?>
     
    22852332        }
    22862333       
    2287         function va_get_time_select($name, $value = null, $id = null, $required = false, $start = false, $end = false){
     2334        function va_get_time_select($name, $value = null, $id = null, $required = false, $start = false, $end = false, $interval = 0.25, $reverse = false){
    22882335            ob_start();
    22892336            ?>
    22902337            <select id="<?php echo $id; ?>" name="<?php echo $name; ?>" <?php if($required){echo 'required';} ?>>
    2291                 <?php if($start) : ?>
    2292                     <?php $time_arr = explode(':',$start); ?>
    2293                     <?php $start_at = $time_arr[0] + ($time_arr[1]/60); ?>
    2294                     <?php $times = $this->va_get_times($start_at,23.75,0.25); ?>
    2295                 <?php elseif($end) : ?>
    2296                     <?php $time_arr = explode(':',$end); ?>
    2297                     <?php $end_at = $time_arr[0] + ($time_arr[1]/60); ?>
    2298                     <?php $times = $this->va_get_times(0,$end_at,0.25); ?>
    2299                     <?php arsort($times); ?>
    2300                 <?php else : ?>
    2301                     <?php $times = $this->va_get_times(0,23.75,0.25); ?>
    2302                 <?php endif; ?>
     2338           
     2339                <?php
     2340                    $start_at = 0;
     2341                    $end_at = 23.75;
     2342
     2343                    if($start){
     2344                        $time_arr = explode(':',$start);
     2345                        $start_at = $time_arr[0] + ($time_arr[1]/60);
     2346                    }
     2347                    if($end){
     2348                        $time_arr = explode(':',$end);
     2349                        $end_at = $time_arr[0] + ($time_arr[1]/60);
     2350                    }
     2351
     2352                    $times = $this->va_get_times($start_at,$end_at,$interval);
     2353                    if($reverse){
     2354                        arsort($times);
     2355                    }
     2356                ?>
    23032357                <option></option>
    23042358                <?php foreach ($times as $time) : ?>
Note: See TracChangeset for help on using the changeset viewer.