Changeset 2258787
- Timestamp:
- 03/11/2020 08:10:33 AM (6 years ago)
- Location:
- shiftcontroller/trunk
- Files:
-
- 20 edited
-
hc3/_wordpress/abstract/plugin.php (modified) (1 diff)
-
hc3/_wordpress/ui/element/input/richtextarea.php (modified) (1 diff)
-
hc3/assets/js/hc2.js (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
-
sh4/app/boot.php (modified) (1 diff)
-
sh4/calendars/boot.php (modified) (1 diff)
-
sh4/calendars/html/admin/controller/new.php (modified) (1 diff)
-
sh4/calendars/html/admin/controller/shifttypes.php (modified) (2 diffs)
-
sh4/calendars/html/admin/view/index.php (modified) (3 diffs)
-
sh4/calendars/html/admin/view/shifttypes.php (modified) (2 diffs)
-
sh4/calendars/permissions.php (modified) (2 diffs)
-
sh4/new/view/calendar.php (modified) (3 diffs)
-
sh4/new/view/employee.php (modified) (4 diffs)
-
sh4/schedule/html/view/index.php (modified) (5 diffs)
-
sh4/shifts/view/employee.php (modified) (2 diffs)
-
sh4/shifttypes/boot.php (modified) (1 diff)
-
sh4/shifttypes/html/admin/controller/settings.php (modified) (1 diff)
-
sh4/shifttypes/html/admin/view/new.php (modified) (1 diff)
-
sh4/shifttypes/html/admin/view/settings.php (modified) (2 diffs)
-
shiftcontroller4.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
shiftcontroller/trunk/hc3/_wordpress/abstract/plugin.php
r2241596 r2258787 71 71 $lang = $settings->get('lang'); 72 72 73 // Polylang plugin 73 74 if( function_exists('pll_current_language') ){ 74 75 $lang = pll_current_language( 'locale' ); -
shiftcontroller/trunk/hc3/_wordpress/ui/element/input/richtextarea.php
r2182610 r2258787 57 57 58 58 $out = ob_get_clean(); 59 60 if( strlen($this->label) ){ 61 $out = $this->htmlFactory->makeLabelled( $this->label, $out, $this->htmlId() ); 62 } 63 59 64 return $out; 60 65 } -
shiftcontroller/trunk/hc3/assets/js/hc2.js
r2212879 r2258787 131 131 // parse default value 132 132 var this_value = $hidden.val(); 133 133 self.default_duration = 5 * 60; 134 134 self.input_value = []; 135 135 … … 138 138 for( var jj = 0; jj < this_times.length; jj++ ){ 139 139 self.input_value.push( parseInt(this_times[jj]) ); 140 } 141 142 if( 2 == this_times.length ){ 143 self.default_duration = parseInt(this_times[1]) - parseInt(this_times[0]); 140 144 } 141 145 } … … 207 211 208 212 var current_end = self.input_value[1] ? self.input_value[1] : $input_end.val(); 213 current_end = start + self.default_duration; 209 214 current_end = parseInt( current_end ); 210 215 -
shiftcontroller/trunk/readme.txt
r2241596 r2258787 5 5 Stable tag: trunk 6 6 Requires at least: 4.1 7 Tested up to: 5. 37 Tested up to: 5.4 8 8 Requires PHP: 5.3 9 9 … … 60 60 61 61 == Changelog == 62 63 = 4.5.9 = 64 * Added label for textarea custom field in the admin area. 65 * When creating a shift or assigning new or another employee, unavailable employees are displayed below available ones. 66 * Added a setting for default shift duration. 67 * In the admin calendars list view we added the quantity of notifications and permission options enabled for each calendar. 68 * The schedule view remembers last filtered calendars and employees. 62 69 63 70 = 4.5.8 = -
shiftcontroller/trunk/sh4/app/boot.php
r2221157 r2258787 28 28 ->init( 'datetime_max_time', 24*60*60 ) 29 29 ->init( 'datetime_step', 5*60 ) 30 31 ->init( 'shifttypes_nobreak', FALSE )32 30 33 31 ->init( 'datetime_hide_schedule_reports', 0 ) -
shiftcontroller/trunk/sh4/calendars/boot.php
r2107416 r2258787 46 46 ->register( 'post:admin/calendars/{id}/shifttypes', array('SH4_Calendars_Html_Admin_Controller_ShiftTypes', 'execute') ) 47 47 48 ->register( 'get:admin/calendars/{id}/shifttypes/{new}', array('SH4_Calendars_Html_Admin_View_ShiftTypes', 'render') ) 49 ->register( 'post:admin/calendars/{id}/shifttypes/{new}', array('SH4_Calendars_Html_Admin_Controller_ShiftTypes', 'execute') ) 50 48 51 ->register( 'get:admin/calendars/{id}/prm', array('SH4_Calendars_Html_Admin_View_Permissions', 'render') ) 49 52 ->register( 'post:admin/calendars/{id}/prm', array('SH4_Calendars_Html_Admin_Controller_Permissions', 'execute') ) -
shiftcontroller/trunk/sh4/calendars/html/admin/controller/new.php
r1909721 r2258787 22 22 $newId = $this->command->create( $title, $color, $description, $type ); 23 23 24 $to = 'admin/calendars/' . $newId . '/shifttypes ';24 $to = 'admin/calendars/' . $newId . '/shifttypes/new'; 25 25 $return = array( $to, array('__New Calendar Added__') ); 26 26 return $return; -
shiftcontroller/trunk/sh4/calendars/html/admin/controller/shifttypes.php
r1851180 r2258787 22 22 } 23 23 24 public function execute( $calendarId )24 public function execute( $calendarId, $new = FALSE ) 25 25 { 26 26 $calendar = $this->calendarsQuery->findById( $calendarId ); … … 51 51 } 52 52 53 $return = array( 'admin/calendars', '__Calendar Updated__' ); 53 if( $new ){ 54 $to = 'admin/calendars/' . $calendarId . '/prm'; 55 } 56 else { 57 $to = 'admin/calendars'; 58 } 59 60 $return = array( $to, array('__Calendar Updated__') ); 61 54 62 return $return; 55 63 } -
shiftcontroller/trunk/sh4/calendars/html/admin/view/index.php
r2107416 r2258787 14 14 SH4_Calendars_Query $calendarsQuery, 15 15 SH4_Calendars_Presenter $calendarsPresenter, 16 SH4_Calendars_Permissions $calendarsPermissions, 17 18 SH4_Notifications_Service $notificationsService, 16 19 17 20 SH4_Employees_Query $employees … … 28 31 $this->calendarsQuery = $hooks->wrap( $calendarsQuery ); 29 32 $this->calendarsPresenter = $hooks->wrap( $calendarsPresenter ); 33 $this->calendarsPermissions = $hooks->wrap( $calendarsPermissions ); 30 34 31 35 $this->employees = $hooks->wrap($employees); 36 $this->notificationsService = $hooks->wrap( $notificationsService ); 32 37 33 38 $this->self = $hooks->wrap($this); … … 238 243 ); 239 244 240 $return['notifications'] = array( 'admin/notifications/' . $id, '__Notifications__'); 241 $return['permissions'] = array( 'admin/calendars/' . $id . '/prm', '__Permissions__'); 245 $allNotifications = $this->notificationsService->findAll(); 246 $allNotifications = array_keys( $allNotifications ); 247 $notificationsCount = 0; 248 foreach( $allNotifications as $notificationId ){ 249 if( $this->notificationsService->isOn($model, $notificationId) ){ 250 $notificationsCount++; 251 } 252 } 253 $label = '__Notifications__' . ' [' . $notificationsCount . ']'; 254 255 $return['notifications'] = array( 'admin/notifications/' . $id, $label ); 256 257 $allPermissionsOptions = $this->calendarsPermissions->categorizedOptions(); 258 $thisPermissionsOptions = $this->calendarsPermissions->getAll( $model ); 259 260 $permissionCounts = array(); 261 foreach( $allPermissionsOptions as $group => $perms ){ 262 // $permissionCounts[ $group ] = array( 0, count($perms) ); 263 $permissionCounts[ $group ] = 0; 264 } 265 266 foreach( $thisPermissionsOptions as $k => $v ){ 267 if( ! $v ){ 268 continue; 269 } 270 271 $ka = explode( '_', $k ); 272 $group = $ka[0]; 273 274 if( ! isset($allPermissionsOptions[$group]) ){ 275 continue; 276 } 277 278 if( ! in_array($k, $allPermissionsOptions[$group]) ){ 279 continue; 280 } 281 282 $permissionCounts[ $group ]++; 283 } 284 $permissionCountsView = join( '/', $permissionCounts ); 285 286 $label = '__Permissions__' . ' [' . $permissionCountsView . ']'; 287 $return['permissions'] = array( 'admin/calendars/' . $id . '/prm', $label); 242 288 243 289 if( $model->isArchived() ){ -
shiftcontroller/trunk/sh4/calendars/html/admin/view/shifttypes.php
r1854904 r2258787 29 29 } 30 30 31 public function render( $id )31 public function render( $id, $new = FALSE ) 32 32 { 33 33 $model = $this->calendarsQuery->findById($id); … … 74 74 $out = $this->ui->makeList( array($out, $buttons) ); 75 75 76 $out = $this->ui->makeForm( 77 'admin/calendars/' . $id . '/shifttypes', 78 $out 79 ); 76 $to = $new ? 'admin/calendars/' . $id . '/shifttypes/new' : 'admin/calendars/' . $id . '/shifttypes'; 77 $out = $this->ui->makeForm( $to, $out ); 80 78 81 79 $this->layout -
shiftcontroller/trunk/sh4/calendars/permissions.php
r2217010 r2258787 5 5 public function get( SH4_Calendars_Model $calendar, $permissionId ); 6 6 public function getAll( SH4_Calendars_Model $calendar ); 7 public function options(); 8 public function categorizedOptions(); 7 9 } 8 10 … … 35 37 } 36 38 } 39 } 40 41 public function categorizedOptions() 42 { 43 $ret = array( 'employee' => array(), 'employee2' => array(), 'visitor' => array() ); 44 45 $options = $this->self->options(); 46 foreach( $options as $o ){ 47 $label = array_shift( $o ); 48 $employeeOption = array_shift( $o ); 49 $visitorOption = array_shift( $o ); 50 $employee2Option = array_shift( $o ); 51 // list( $label, $employeeOption, $visitorOption ) = $o; 52 53 if( $employeeOption ){ 54 $ret['employee'][] = $employeeOption[0]; 55 } 56 if( $visitorOption ){ 57 $ret['visitor'][] = $visitorOption[0]; 58 } 59 if( $employee2Option ){ 60 $ret['employee2'][] = $employee2Option[0]; 61 } 62 } 63 64 return $ret; 37 65 } 38 66 -
shiftcontroller/trunk/sh4/new/view/calendar.php
r2149207 r2258787 18 18 HC3_Hooks $hooks, 19 19 20 HC3_Settings $settings, 20 21 HC3_Request $request, 21 22 HC3_Ui $ui, … … 36 37 $this->layout = $layout; 37 38 $this->common = $hooks->wrap($common); 39 $this->settings = $hooks->wrap($settings); 38 40 39 41 $this->appQuery = $hooks->wrap( $appQuery ); … … 274 276 $to = 'new/customtime/' . $calendarId; 275 277 $to = array( $to, $params ); 276 $thisForm = $this->ui->makeForm( 277 $to, 278 $this->ui->makeList() 279 // ->add( $this->ui->makeInputTimeRange( 'time', '__Time__' ) ) 280 ->add( $this->ui->makeInputTimeRange( 'time', NULL ) ) 281 ->add( 282 $this->ui->makeCollapseCheckbox( 283 'break_on', 284 '__Lunch Break__' . '?', 285 $this->ui->makeInputTimeRange( 'break', NULL) 286 ) 287 ) 288 ->add( $this->ui->makeInputSubmit( '__Continue__')->tag('secondary') ) 289 ); 278 279 $thisFormInputs = array(); 280 281 $value = array(); 282 $minTime = $this->settings->get('datetime_min_time'); 283 $defaultDuration = $this->settings->get('shifttypes_default_duration'); 284 if( (NULL !== $minTime) && (NULL !== $defaultDuration) ){ 285 $value = array( $minTime, $minTime + $defaultDuration ); 286 } 287 $thisFormInputs[] = $this->ui->makeInputTimeRange( 'time', NULL, $value ); 288 289 $noBreak = $this->settings->get( 'shifttypes_nobreak' ); 290 if( ! $noBreak ){ 291 $thisFormInputs[] = $this->ui->makeCollapseCheckbox( 292 'break_on', 293 '__Lunch Break__' . '?', 294 $this->ui->makeInputTimeRange( 'break', NULL) 295 ); 296 } 297 298 $thisFormInputs[] = $this->ui->makeInputSubmit( '__Continue__')->tag('secondary'); 299 300 $thisFormInputs = $this->ui->makeList( $thisFormInputs ); 301 302 $thisForm = $this->ui->makeForm( $to, $thisFormInputs ); 290 303 291 304 $thisForm = $this->ui->makeBlock( $thisForm ) -
shiftcontroller/trunk/sh4/new/view/employee.php
r2107416 r2258787 128 128 129 129 $employeesView = array(); 130 $employeesWithConflictsView = array(); 130 131 131 132 foreach( $employees as $employee ){ … … 287 288 } 288 289 289 $employeesView[] = $thisView; 290 if( $withConflicts ){ 291 $employeesWithConflictsView[] = $thisView; 292 } 293 else { 294 $employeesView[] = $thisView; 295 } 290 296 } 291 297 … … 298 304 299 305 $employeesView = $this->ui->makeList( array($toggleAll, $employeesView) ); 300 301 $out = array( $employeesView );302 303 $btn = $this->self->buttons( $calendarId, $shiftTypeId );304 $btn = $this->ui->makeListInline( $btn );305 306 // open shift307 // $inputs = $this->common->inputs( $calendarId, $shiftTypeId, $employeeId );308 // $out = array_merge( $out, $inputs );309 310 $out[] = $btn;311 312 $out = $this->ui->makeList( $out )->gutter(3);313 306 314 307 $js = <<<EOT … … 331 324 EOT; 332 325 333 $ out = $this->ui->makeCollection( array($js, $out) );334 $ out = $this->ui->makeBlock( $out)326 $employeesView = $this->ui->makeCollection( array($js, $employeesView) ); 327 $employeesView = $this->ui->makeBlock( $employeesView ) 335 328 ->addAttr( 'class', 'sh4-new-employee-container' ) 336 329 ; 330 331 $out = array(); 332 $out[] = $employeesView; 333 334 if( $employeesWithConflictsView ){ 335 $employeesWithConflictsView = $this->ui->makeGrid( $employeesWithConflictsView, 4 ); 336 $employeesWithConflictsView = $this->ui->makeCollapse( '__Unavailable Employees__', $employeesWithConflictsView ); 337 $out[] = $employeesWithConflictsView; 338 } 339 340 $btn = $this->self->buttons( $calendarId, $shiftTypeId ); 341 $btn = $this->ui->makeListInline( $btn ); 342 343 // open shift 344 // $inputs = $this->common->inputs( $calendarId, $shiftTypeId, $employeeId ); 345 // $out = array_merge( $out, $inputs ); 346 347 $out[] = $btn; 348 349 $out = $this->ui->makeList( $out )->gutter(3); 350 351 337 352 338 353 $to = 'new/employee'; -
shiftcontroller/trunk/sh4/schedule/html/view/index.php
r2241596 r2258787 104 104 105 105 $employee = array( $meEmployeeId ); 106 $calendar = array(); 106 107 $calendar = $this->session->getUserdata('scheduleViewCalendar'); 108 if( ! $calendar ){ 109 $calendar = array(); 110 } 111 107 112 $hideui = array( 108 113 'filter-employee', … … 153 158 ->setUserdata( 'scheduleViewType', $params['type'] ) 154 159 ->setUserdata( 'scheduleViewGroupby', $params['groupby'] ) 160 // ->setUserdata( 'scheduleViewEmployee', $params['employee'] ) 161 ->setUserdata( 'scheduleViewCalendar', $params['calendar'] ) 155 162 ; 156 163 … … 427 434 } 428 435 429 $employee = array(); 430 $calendar = array(); 436 $employee = $this->session->getUserdata('scheduleViewEmployee'); 437 if( ! $employee ){ 438 $employee = array(); 439 } 440 441 $calendar = $this->session->getUserdata('scheduleViewCalendar'); 442 if( ! $calendar ){ 443 $calendar = array(); 444 } 445 431 446 $hideui = array(); 432 447 … … 442 457 443 458 $params = $this->request->getParams(); 444 445 459 $params = array_merge( $defaultParams, $params ); 446 460 … … 462 476 ->setUserdata( 'scheduleViewType', $params['type'] ) 463 477 ->setUserdata( 'scheduleViewGroupby', $params['groupby'] ) 478 ->setUserdata( 'scheduleViewEmployee', $params['employee'] ) 479 ->setUserdata( 'scheduleViewCalendar', $params['calendar'] ) 464 480 ; 465 481 -
shiftcontroller/trunk/sh4/shifts/view/employee.php
r1912260 r2258787 87 87 88 88 $employeesView = array(); 89 $employeesWithConflictsView = array(); 89 90 90 91 foreach( $employees as $employee ){ … … 223 224 } 224 225 225 $employeesView[] = $thisView; 226 } 227 228 if( $employeesView ){ 226 if( $withConflicts ){ 227 $employeesWithConflictsView[] = $thisView; 228 } 229 else { 230 $employeesView[] = $thisView; 231 } 232 } 233 234 if( $employeesView OR $employeesWithConflictsView ){ 235 229 236 $out = $this->ui->makeGrid(); 230 237 foreach( $employeesView as $ev ){ 231 238 $out->add( $ev, 3, 12 ); 239 } 240 241 if( $employeesWithConflictsView ){ 242 $out = array( $out ); 243 244 $employeesWithConflictsView = $this->ui->makeGrid( $employeesWithConflictsView, 4 ); 245 $employeesWithConflictsView = $this->ui->makeCollapse( '__Unavailable Employees__', $employeesWithConflictsView ); 246 $out[] = $employeesWithConflictsView; 247 248 $out = $this->ui->makeList( $out )->gutter(2); 232 249 } 233 250 } -
shiftcontroller/trunk/sh4/shifttypes/boot.php
r1857967 r2258787 13 13 $settings 14 14 ->init( 'shifttypes_show_title', 1 ) 15 ->init( 'shifttypes_default_duration', 4*60*60 ) 16 ->init( 'shifttypes_nobreak', FALSE ) 15 17 ; 16 18 -
shiftcontroller/trunk/sh4/shifttypes/html/admin/controller/settings.php
r2212879 r2258787 14 14 public function execute() 15 15 { 16 $take = array( 'shifttypes_show_title', 'shifttypes_nobreak' );16 $take = array( 'shifttypes_show_title', 'shifttypes_nobreak', 'shifttypes_default_duration' ); 17 17 18 18 foreach( $take as $k ){ -
shiftcontroller/trunk/sh4/shifttypes/html/admin/view/new.php
r2212879 r2258787 46 46 $inputs = array(); 47 47 $inputs[] = $this->ui->makeInputText( 'title', '__Title__' )->bold(); 48 $inputs[] = $this->ui->makeInputTimeRange( 'time', '__Time__' ); 48 49 $value = array(); 50 $minTime = $this->settings->get('datetime_min_time'); 51 $defaultDuration = $this->settings->get('shifttypes_default_duration'); 52 if( (NULL !== $minTime) && (NULL !== $defaultDuration) ){ 53 $value = array( $minTime, $minTime + $defaultDuration ); 54 } 55 $inputs[] = $this->ui->makeInputTimeRange( 'time', '__Time__', $value ); 49 56 50 57 $noBreak = $this->settings->get( 'shifttypes_nobreak' ); -
shiftcontroller/trunk/sh4/shifttypes/html/admin/view/settings.php
r2212879 r2258787 23 23 public function render() 24 24 { 25 $pnames = array( 'shifttypes_show_title', 'shifttypes_nobreak' );25 $pnames = array( 'shifttypes_show_title', 'shifttypes_nobreak', 'shifttypes_default_duration' ); 26 26 foreach( $pnames as $pname ){ 27 27 $values[$pname] = $this->settings->get($pname); … … 41 41 1, 42 42 $values['shifttypes_nobreak'] 43 ); 44 45 $options = range( 1, 24, 1 ); 46 $defaultDurationOptions = array(); 47 foreach( $options as $e ){ 48 $defaultDurationOptions[ $e*60*60 ] = $e; 49 } 50 $inputs[] = $this->ui->makeInputSelect( 51 'shifttypes_default_duration', 52 '__Default Shift Duration__' . ' (' . '__Hours__' . ')', 53 $defaultDurationOptions, 54 $values['shifttypes_default_duration'] 43 55 ); 44 56 -
shiftcontroller/trunk/shiftcontroller4.php
r2241596 r2258787 4 4 * Plugin URI: http://www.shiftcontroller.com/ 5 5 * Description: Staff scheduling plugin 6 * Version: 4.5. 86 * Version: 4.5.9 7 7 * Author: hitcode.com 8 8 * Author URI: http://www.shiftcontroller.com/ … … 11 11 */ 12 12 13 define( 'SH4_VERSION', 45 8);13 define( 'SH4_VERSION', 459 ); 14 14 15 15 if (! defined('ABSPATH')) exit; // Exit if accessed directly
Note: See TracChangeset
for help on using the changeset viewer.