Plugin Directory

Changeset 2212879


Ignore:
Timestamp:
12/16/2019 11:55:11 AM (6 years ago)
Author:
hitcode
Message:

4.5.4

Location:
shiftcontroller/trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • shiftcontroller/trunk/hc3/assets/js/hc2.js

    r1892921 r2212879  
    213213            var end_from = start + time_unit;
    214214            var end_to = start + end_day;
     215            var last_seen_end = 0;
    215216
    216217            $input_end.empty();
    217218            for( var ts = end_from; ts <= end_to; ts += time_unit ){
     219                var ts_key = ( ts > end_day ) ? ts % end_day : ts;
     220
     221                if( ! time_format.hasOwnProperty(ts_key) ){
     222                    continue;
     223                }
     224
     225                if( (! last_seen_end) && (ts > end_from) ){
     226                    last_seen_end = ts;
     227                }
     228
    218229                if( ts == current_end ){
    219230                    current_end_exists = true;
    220                 }
    221 
    222                 var ts_key = ( ts > end_day ) ? ts % end_day : ts;
    223 
    224                 if( ! time_format.hasOwnProperty(ts_key) ){
    225                     continue;
    226231                }
    227232
     
    240245
    241246            if( ! current_end_exists ){
    242                 current_end = end_from;
    243             }
     247                current_end = last_seen_end;
     248            }
     249
    244250            $input_end.val(current_end);
    245251            self.input_value[1] = current_end;
  • shiftcontroller/trunk/hc3/ui.php

    r1913326 r2212879  
    487487        }
    488488
    489         $step = 5 * 60;
     489        $step = $this->settings->get('datetime_step');
     490        if( ! $step ){
     491            $step = 5 * 60;
     492        }
     493
    490494        $noOfSteps = ( $endWith - $startWith) / $step;
    491495        for( $ii = 0; $ii <= $noOfSteps; $ii++ ){
     
    529533        }
    530534
    531         $step = 5 * 60;
     535        $step = $this->settings->get('datetime_step');
     536        if( ! $step ){
     537            $step = 5 * 60;
     538        }
     539
    532540        $noOfSteps = ( $endWith - $startWith) / $step;
    533541        for( $ii = 0; $ii <= $noOfSteps; $ii++ ){
  • shiftcontroller/trunk/readme.txt

    r2196245 r2212879  
    6060
    6161== Changelog ==
     62
     63= 4.5.4 =
     64* Added a setting to define the time increment for time selectors (5, 10, 15 etc minutes).
     65* Added a setting to define if the lunch break input is needed.
    6266
    6367= 4.5.3 =
  • shiftcontroller/trunk/sh4/app/boot.php

    r1971587 r2212879  
    2626            ->init( 'datetime_min_time', 0 )
    2727            ->init( 'datetime_max_time', 24*60*60 )
     28            ->init( 'datetime_step', 5*60 )
     29
     30            ->init( 'shifttypes_nobreak', FALSE )
    2831
    2932            ->init( 'datetime_hide_schedule_reports', 0 )
  • shiftcontroller/trunk/sh4/conf/html/admin/controller/datetime.php

    r1971587 r2212879  
    1616        $take = array(
    1717            'datetime_date_format', 'datetime_time_format', 'datetime_week_starts', 'full_day_count_as',
    18             'datetime_min_time', 'datetime_max_time',
     18            'datetime_min_time', 'datetime_max_time', 'datetime_step',
    1919            'datetime_hide_schedule_reports'
    2020            );
     
    2727        $k = 'skip_weekdays';
    2828        $v = $this->post->get($k);
    29 
    3029        if( $v ){
    3130            $this->settings->set( $k, $v );
  • shiftcontroller/trunk/sh4/conf/html/admin/view/datetime.php

    r1971587 r2212879  
    2828            'datetime_date_format', 'datetime_time_format', 'datetime_week_starts', 'full_day_count_as',
    2929            'skip_weekdays',
    30             'datetime_min_time', 'datetime_max_time',
     30            'datetime_min_time', 'datetime_max_time', 'datetime_step',
    3131            'datetime_hide_schedule_reports'
    3232        );
     
    109109            'nolimit'
    110110            );
     111
     112        $stepOptions = array( 5*60 => 5, 10*60 => 10, 15*60 => 15, 20*60 => 20, 30*60 => 30, 60*60 => 60 );
     113        $moreInputs2[] = $this->ui->makeInputSelect(
     114            'datetime_step',
     115            '__Time Increment__' . ' (' . '__Minutes__' . ')',
     116            $stepOptions,
     117            $values['datetime_step']
     118            );
     119
    111120        $moreInputs2 = $this->ui->makeGrid( $moreInputs2 );
    112121        $moreInputs[] = $moreInputs2;
  • shiftcontroller/trunk/sh4/shifts/duration.php

    r2120574 r2212879  
    8181        }
    8282
    83         $breakStart = $model->getBreakStart();
    84         $breakEnd = $model->getBreakEnd();
     83        $noBreak = $this->settings->get( 'shifttypes_nobreak' );
     84        if( ! $noBreak ){
     85            $breakStart = $model->getBreakStart();
     86            $breakEnd = $model->getBreakEnd();
    8587
    86         if( ! ((NULL === $breakStart) && (NULL === $breakEnd)) ){
    87             $this->t->setDateTimeDb( $breakStart );
    88             $breakStartTs = $this->t->getTimestamp();
    89             $this->t->setDateTimeDb( $breakEnd );
    90             $breakEndTs = $this->t->getTimestamp();
     88            if( ! ((NULL === $breakStart) && (NULL === $breakEnd)) ){
     89                $this->t->setDateTimeDb( $breakStart );
     90                $breakStartTs = $this->t->getTimestamp();
     91                $this->t->setDateTimeDb( $breakEnd );
     92                $breakEndTs = $this->t->getTimestamp();
    9193
    92             $breakDuration = $breakEndTs - $breakStartTs;
    93             $duration = $duration - $breakDuration;
     94                $breakDuration = $breakEndTs - $breakStartTs;
     95                $duration = $duration - $breakDuration;
     96            }
    9497        }
    9598
  • shiftcontroller/trunk/sh4/shifttypes/html/admin/controller/settings.php

    r1857967 r2212879  
    1414    public function execute()
    1515    {
    16         $take = array( 'shifttypes_show_title' );
     16        $take = array( 'shifttypes_show_title', 'shifttypes_nobreak' );
    1717
    1818        foreach( $take as $k ){
    1919            $this->settings->set( $k, $this->post->get($k) );
     20        }
     21
     22        $k = 'shifttypes_nobreak';
     23        $v = $this->post->get($k);
     24        if( $v ){
     25            $this->settings->set( $k, 1 );
     26        }
     27        else {
     28            $this->settings->reset( $k );
    2029        }
    2130
  • shiftcontroller/trunk/sh4/shifttypes/html/admin/view/edit.php

    r1909721 r2212879  
    77        HC3_Ui_Layout1 $layout,
    88
     9        HC3_Settings $settings,
    910        SH4_ShiftTypes_Presenter $shiftTypesPresenter,
    1011        SH4_ShiftTypes_Query $query
     
    1415        $this->layout = $layout;
    1516
     17        $this->settings = $hooks->wrap($settings);
    1618        $this->shiftTypesPresenter = $hooks->wrap($shiftTypesPresenter);
    1719        $this->query = $hooks->wrap($query);
     
    7678        $end = $model->getEnd();
    7779
    78         $breakOn = FALSE;
    79         $breakStart = $model->getBreakStart();
    80         $breakEnd = $model->getBreakEnd();
     80        $inputs = array();
     81        $inputs[] = $this->ui->makeInputText( 'title', '__Title__', $model->getTitle() )->bold();
     82        $inputs[] = $this->ui->makeInputTimeRange( 'time', '__Time__', $time );
     83        $inputs[] = $timeHelp;
    8184
    82         if( ! ((NULL === $breakStart) && (NULL === $breakEnd)) ){
    83             $breakOn = TRUE;
    84             if( $breakStart > 24*60*60 ){
    85                 $breakStart = $breakStart - 24*60*60;
     85        $noBreak = $this->settings->get( 'shifttypes_nobreak' );
     86
     87        if( ! $noBreak ){
     88            $breakOn = FALSE;
     89            $breakStart = $model->getBreakStart();
     90            $breakEnd = $model->getBreakEnd();
     91
     92            if( ! ((NULL === $breakStart) && (NULL === $breakEnd)) ){
     93                $breakOn = TRUE;
     94                if( $breakStart > 24*60*60 ){
     95                    $breakStart = $breakStart - 24*60*60;
     96                }
     97                $breakInput = $this->ui->makeInputTimeRange( 'break', NULL, array($breakStart, $breakEnd) );
    8698            }
    87             $breakInput = $this->ui->makeInputTimeRange( 'break', NULL, array($breakStart, $breakEnd) );
    88         }
    89         else {
    90             $breakInput = $this->ui->makeInputTimeRange( 'break', NULL );
     99            else {
     100                $breakInput = $this->ui->makeInputTimeRange( 'break', NULL );
     101            }
     102            $breakInput = $this->ui->makeCollapseCheckbox(
     103                'break_on',
     104                '__Lunch Break__' . '?',
     105                $breakInput
     106                );
     107            if( $breakOn ){
     108                $breakInput->expand();
     109            }
     110
     111            $inputs[] = $breakInput;
    91112        }
    92113
    93         $breakInput = $this->ui->makeCollapseCheckbox(
    94             'break_on',
    95             '__Lunch Break__' . '?',
    96             $breakInput
    97             );
    98         if( $breakOn ){
    99             $breakInput->expand();
    100         }
    101 
    102         $inputs = $this->ui->makeList()
    103             ->add( $this->ui->makeInputText( 'title', '__Title__', $model->getTitle() )->bold() )
    104             ->add( $this->ui->makeInputTimeRange( 'time', '__Time__', $time ) )
    105             ->add( $timeHelp )
    106             ->add( $breakInput )
    107             ;
     114        $inputs = $this->ui->makeList( $inputs );
    108115
    109116        $buttons = $this->ui->makeInputSubmit( '__Save__')
  • shiftcontroller/trunk/sh4/shifttypes/html/admin/view/new.php

    r1857967 r2212879  
    55        HC3_Hooks $hooks,
    66
     7        HC3_Settings $settings,
    78        HC3_Ui $ui,
    89        HC3_Ui_Layout1 $layout
     
    1213        $this->layout = $layout;
    1314
     15        $this->settings = $hooks->wrap($settings);
    1416        $this->self = $hooks->wrap($this);
    1517    }
     
    4244    public function renderHours()
    4345    {
     46        $inputs = array();
     47        $inputs[] = $this->ui->makeInputText( 'title', '__Title__' )->bold();
     48        $inputs[] = $this->ui->makeInputTimeRange( 'time', '__Time__' );
     49
     50        $noBreak = $this->settings->get( 'shifttypes_nobreak' );
     51
     52        if( ! $noBreak ){
     53            $inputs[] = $this->ui->makeCollapseCheckbox(
     54                'break_on',
     55                '__Lunch Break__' . '?',
     56                $this->ui->makeInputTimeRange( 'break', NULL)
     57                );
     58        }
     59
     60        $inputs[] = $this->ui->makeInputSubmit( '__Save__')->tag('primary');
     61
    4462        $out = $this->ui->makeForm(
    4563            'admin/shifttypes/new/hours',
    46             $this->ui->makeList()
    47                 ->add( $this->ui->makeInputText( 'title', '__Title__' )->bold() )
    48                 ->add( $this->ui->makeInputTimeRange( 'time', '__Time__' ) )
    49 
    50                 ->add(
    51                         $this->ui->makeCollapseCheckbox(
    52                             'break_on',
    53                             '__Lunch Break__' . '?',
    54                             $this->ui->makeInputTimeRange( 'break', NULL)
    55                             )
    56                     )
    57 
    58                 ->add( $this->ui->makeInputSubmit( '__Save__')->tag('primary') )
     64            $this->ui->makeList( $inputs )
    5965            );
    6066
  • shiftcontroller/trunk/sh4/shifttypes/html/admin/view/settings.php

    r1857967 r2212879  
    2323    public function render()
    2424    {
    25         $pnames = array('shifttypes_show_title');
     25        $pnames = array( 'shifttypes_show_title', 'shifttypes_nobreak' );
    2626        foreach( $pnames as $pname ){
    2727            $values[$pname] = $this->settings->get($pname);
     
    3434            1,
    3535            $values['shifttypes_show_title']
     36            );
     37
     38        $inputs[] = $this->ui->makeInputCheckbox(
     39            'shifttypes_nobreak',
     40            '__No Lunch Break__',
     41            1,
     42            $values['shifttypes_nobreak']
    3643            );
    3744
  • shiftcontroller/trunk/sh4/shifttypes/presenter.php

    r1992902 r2212879  
    33{
    44    public function __construct(
     5        HC3_Hooks $hooks,
     6        HC3_Settings $settings,
    57        HC3_Time $t,
    68        HC3_Ui $ui
    79        )
    810    {
     11        $this->settings = $hooks->wrap($settings);
    912        $this->ui = $ui;
    1013        $this->t = $t;
     
    4548    {
    4649        $return = NULL;
     50
     51        $noBreak = $this->settings->get( 'shifttypes_nobreak' );
    4752
    4853        $start = (NULL === $start) ? $e->getStart() : $start;
     
    8691                    $return = $this->ui->makeListInline( array($startView, '-', $endView) )->gutter(1);
    8792
    88                     if( ! ((NULL === $breakStart) && (NULL === $breakEnd)) ){
    89                         if( $breakStart OR $breakEnd ){
    90                             $this->t->setDateDb( 20180102 );
    91                             if( $breakStart ){
    92                                 $this->t->modify('+' . $breakStart . ' seconds');
     93                    if( ! $noBreak ){
     94                        if( ! ((NULL === $breakStart) && (NULL === $breakEnd)) ){
     95                            if( $breakStart OR $breakEnd ){
     96                                $this->t->setDateDb( 20180102 );
     97                                if( $breakStart ){
     98                                    $this->t->modify('+' . $breakStart . ' seconds');
     99                                }
     100                                $breakStartView = $this->t->formatTime();
     101
     102                                $this->t->setDateDb( 20180102 );
     103                                if( $breakEnd ){
     104                                    $this->t->modify('+' . $breakEnd . ' seconds');
     105                                }
     106                                $breakEndView = $this->t->formatTime();
     107
     108                                $breakView = $this->ui->makeListInline( array('__Break__', $breakStartView, '-', $breakEndView) )
     109                                    ->gutter(1)
     110                                    ;
     111                                $breakView = $this->ui->makeSpan( $breakView )
     112                                    ->tag('font-size', 2)
     113                                    ->tag('muted', 2)
     114                                    ;
     115                                $return = $this->ui->makeList( array($return, $breakView) )->gutter(0);
    93116                            }
    94                             $breakStartView = $this->t->formatTime();
    95 
    96                             $this->t->setDateDb( 20180102 );
    97                             if( $breakEnd ){
    98                                 $this->t->modify('+' . $breakEnd . ' seconds');
    99                             }
    100                             $breakEndView = $this->t->formatTime();
    101 
    102                             $breakView = $this->ui->makeListInline( array('__Break__', $breakStartView, '-', $breakEndView) )
    103                                 ->gutter(1)
    104                                 ;
    105                             $breakView = $this->ui->makeSpan( $breakView )
    106                                 ->tag('font-size', 2)
    107                                 ->tag('muted', 2)
    108                                 ;
    109                             $return = $this->ui->makeList( array($return, $breakView) )->gutter(0);
    110117                        }
    111118                    }
  • shiftcontroller/trunk/shiftcontroller4.php

    r2196245 r2212879  
    44 * Plugin URI: http://www.shiftcontroller.com/
    55 * Description: Staff scheduling plugin
    6  * Version: 4.5.3
     6 * Version: 4.5.4
    77 * Author: hitcode.com
    88 * Author URI: http://www.shiftcontroller.com/
     
    1111*/
    1212
    13 define( 'SH4_VERSION', 453 );
     13define( 'SH4_VERSION', 454 );
    1414
    1515if (! defined('ABSPATH')) exit; // Exit if accessed directly
Note: See TracChangeset for help on using the changeset viewer.