Changeset 2212879
- Timestamp:
- 12/16/2019 11:55:11 AM (6 years ago)
- Location:
- shiftcontroller/trunk
- Files:
-
- 13 edited
-
hc3/assets/js/hc2.js (modified) (2 diffs)
-
hc3/ui.php (modified) (2 diffs)
-
readme.txt (modified) (1 diff)
-
sh4/app/boot.php (modified) (1 diff)
-
sh4/conf/html/admin/controller/datetime.php (modified) (2 diffs)
-
sh4/conf/html/admin/view/datetime.php (modified) (2 diffs)
-
sh4/shifts/duration.php (modified) (1 diff)
-
sh4/shifttypes/html/admin/controller/settings.php (modified) (1 diff)
-
sh4/shifttypes/html/admin/view/edit.php (modified) (3 diffs)
-
sh4/shifttypes/html/admin/view/new.php (modified) (3 diffs)
-
sh4/shifttypes/html/admin/view/settings.php (modified) (2 diffs)
-
sh4/shifttypes/presenter.php (modified) (3 diffs)
-
shiftcontroller4.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
shiftcontroller/trunk/hc3/assets/js/hc2.js
r1892921 r2212879 213 213 var end_from = start + time_unit; 214 214 var end_to = start + end_day; 215 var last_seen_end = 0; 215 216 216 217 $input_end.empty(); 217 218 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 218 229 if( ts == current_end ){ 219 230 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;226 231 } 227 232 … … 240 245 241 246 if( ! current_end_exists ){ 242 current_end = end_from; 243 } 247 current_end = last_seen_end; 248 } 249 244 250 $input_end.val(current_end); 245 251 self.input_value[1] = current_end; -
shiftcontroller/trunk/hc3/ui.php
r1913326 r2212879 487 487 } 488 488 489 $step = 5 * 60; 489 $step = $this->settings->get('datetime_step'); 490 if( ! $step ){ 491 $step = 5 * 60; 492 } 493 490 494 $noOfSteps = ( $endWith - $startWith) / $step; 491 495 for( $ii = 0; $ii <= $noOfSteps; $ii++ ){ … … 529 533 } 530 534 531 $step = 5 * 60; 535 $step = $this->settings->get('datetime_step'); 536 if( ! $step ){ 537 $step = 5 * 60; 538 } 539 532 540 $noOfSteps = ( $endWith - $startWith) / $step; 533 541 for( $ii = 0; $ii <= $noOfSteps; $ii++ ){ -
shiftcontroller/trunk/readme.txt
r2196245 r2212879 60 60 61 61 == 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. 62 66 63 67 = 4.5.3 = -
shiftcontroller/trunk/sh4/app/boot.php
r1971587 r2212879 26 26 ->init( 'datetime_min_time', 0 ) 27 27 ->init( 'datetime_max_time', 24*60*60 ) 28 ->init( 'datetime_step', 5*60 ) 29 30 ->init( 'shifttypes_nobreak', FALSE ) 28 31 29 32 ->init( 'datetime_hide_schedule_reports', 0 ) -
shiftcontroller/trunk/sh4/conf/html/admin/controller/datetime.php
r1971587 r2212879 16 16 $take = array( 17 17 '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', 19 19 'datetime_hide_schedule_reports' 20 20 ); … … 27 27 $k = 'skip_weekdays'; 28 28 $v = $this->post->get($k); 29 30 29 if( $v ){ 31 30 $this->settings->set( $k, $v ); -
shiftcontroller/trunk/sh4/conf/html/admin/view/datetime.php
r1971587 r2212879 28 28 'datetime_date_format', 'datetime_time_format', 'datetime_week_starts', 'full_day_count_as', 29 29 'skip_weekdays', 30 'datetime_min_time', 'datetime_max_time', 30 'datetime_min_time', 'datetime_max_time', 'datetime_step', 31 31 'datetime_hide_schedule_reports' 32 32 ); … … 109 109 'nolimit' 110 110 ); 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 111 120 $moreInputs2 = $this->ui->makeGrid( $moreInputs2 ); 112 121 $moreInputs[] = $moreInputs2; -
shiftcontroller/trunk/sh4/shifts/duration.php
r2120574 r2212879 81 81 } 82 82 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(); 85 87 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(); 91 93 92 $breakDuration = $breakEndTs - $breakStartTs; 93 $duration = $duration - $breakDuration; 94 $breakDuration = $breakEndTs - $breakStartTs; 95 $duration = $duration - $breakDuration; 96 } 94 97 } 95 98 -
shiftcontroller/trunk/sh4/shifttypes/html/admin/controller/settings.php
r1857967 r2212879 14 14 public function execute() 15 15 { 16 $take = array( 'shifttypes_show_title' );16 $take = array( 'shifttypes_show_title', 'shifttypes_nobreak' ); 17 17 18 18 foreach( $take as $k ){ 19 19 $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 ); 20 29 } 21 30 -
shiftcontroller/trunk/sh4/shifttypes/html/admin/view/edit.php
r1909721 r2212879 7 7 HC3_Ui_Layout1 $layout, 8 8 9 HC3_Settings $settings, 9 10 SH4_ShiftTypes_Presenter $shiftTypesPresenter, 10 11 SH4_ShiftTypes_Query $query … … 14 15 $this->layout = $layout; 15 16 17 $this->settings = $hooks->wrap($settings); 16 18 $this->shiftTypesPresenter = $hooks->wrap($shiftTypesPresenter); 17 19 $this->query = $hooks->wrap($query); … … 76 78 $end = $model->getEnd(); 77 79 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; 81 84 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) ); 86 98 } 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; 91 112 } 92 113 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 ); 108 115 109 116 $buttons = $this->ui->makeInputSubmit( '__Save__') -
shiftcontroller/trunk/sh4/shifttypes/html/admin/view/new.php
r1857967 r2212879 5 5 HC3_Hooks $hooks, 6 6 7 HC3_Settings $settings, 7 8 HC3_Ui $ui, 8 9 HC3_Ui_Layout1 $layout … … 12 13 $this->layout = $layout; 13 14 15 $this->settings = $hooks->wrap($settings); 14 16 $this->self = $hooks->wrap($this); 15 17 } … … 42 44 public function renderHours() 43 45 { 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 44 62 $out = $this->ui->makeForm( 45 63 '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 ) 59 65 ); 60 66 -
shiftcontroller/trunk/sh4/shifttypes/html/admin/view/settings.php
r1857967 r2212879 23 23 public function render() 24 24 { 25 $pnames = array( 'shifttypes_show_title');25 $pnames = array( 'shifttypes_show_title', 'shifttypes_nobreak' ); 26 26 foreach( $pnames as $pname ){ 27 27 $values[$pname] = $this->settings->get($pname); … … 34 34 1, 35 35 $values['shifttypes_show_title'] 36 ); 37 38 $inputs[] = $this->ui->makeInputCheckbox( 39 'shifttypes_nobreak', 40 '__No Lunch Break__', 41 1, 42 $values['shifttypes_nobreak'] 36 43 ); 37 44 -
shiftcontroller/trunk/sh4/shifttypes/presenter.php
r1992902 r2212879 3 3 { 4 4 public function __construct( 5 HC3_Hooks $hooks, 6 HC3_Settings $settings, 5 7 HC3_Time $t, 6 8 HC3_Ui $ui 7 9 ) 8 10 { 11 $this->settings = $hooks->wrap($settings); 9 12 $this->ui = $ui; 10 13 $this->t = $t; … … 45 48 { 46 49 $return = NULL; 50 51 $noBreak = $this->settings->get( 'shifttypes_nobreak' ); 47 52 48 53 $start = (NULL === $start) ? $e->getStart() : $start; … … 86 91 $return = $this->ui->makeListInline( array($startView, '-', $endView) )->gutter(1); 87 92 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); 93 116 } 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);110 117 } 111 118 } -
shiftcontroller/trunk/shiftcontroller4.php
r2196245 r2212879 4 4 * Plugin URI: http://www.shiftcontroller.com/ 5 5 * Description: Staff scheduling plugin 6 * Version: 4.5. 36 * Version: 4.5.4 7 7 * Author: hitcode.com 8 8 * Author URI: http://www.shiftcontroller.com/ … … 11 11 */ 12 12 13 define( 'SH4_VERSION', 45 3);13 define( 'SH4_VERSION', 454 ); 14 14 15 15 if (! defined('ABSPATH')) exit; // Exit if accessed directly
Note: See TracChangeset
for help on using the changeset viewer.