PluginProbe
ShiftController Employee Shift Scheduling / trunk
ShiftController Employee Shift Scheduling vtrunk
4.9.97 4.9.96 4.9.95 4.9.74 4.9.75 4.9.76 4.9.77 4.9.78 4.9.84 4.9.85 4.9.87 4.9.91 4.9.92 trunk 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 3.2.4 All 38 releases
shiftcontroller / sh4 / schedule / boot.php

boot.php in ShiftController Employee Shift Scheduling trunk, at sh4/schedule/boot.php

52 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if (! defined('ABSPATH')) exit; // Exit if accessed directly
2 class SH4_Schedule_Boot
3 {
4 public function __construct(
5 HC3_Dic $dic,
6 HC3_Hooks $hooks,
7 HC3_Ui_Topmenu $topmenu,
8 HC3_Router $router,
9 HC3_Acl $acl
10 )
11 {
12 $dic->bind( 'SH4_Permission', 'HC3_IPermission' );
13
14 $acl
15 ->register( 'get:myschedule', array('SH4_Schedule_Acl', 'checkMy') )
16 ->register( 'get:everyoneschedule', array('SH4_Schedule_Html_View_Index', 'checkEveryoneSchedule') )
17 ;
18
19 $scheduleParams = array('type' => NULL, 'groupby' => NULL, 'start' => NULL, 'end' => NULL);
20 $topmenu
21 ->addBefore( NULL, 'myschedule', array( array('myschedule', $scheduleParams), '__My Schedule__') )
22 ;
23
24 $everyoneLabel = '__Schedule__';
25 $toCheck = 'myschedule';
26 if( $acl->check('get:' . $toCheck) ){
27 $everyoneLabel = "__Everyone's Schedule__";
28
29 if( $acl->check('get:everyoneschedule') ){
30 $topmenu
31 ->addBefore( NULL, 'schedule', array( array('schedule', $scheduleParams), $everyoneLabel) )
32 ;
33 }
34 }
35 else {
36 $topmenu
37 ->addBefore( NULL, 'schedule', array( array('schedule', $scheduleParams), $everyoneLabel) )
38 ;
39 }
40
41 $router
42 ->register( 'get:schedule', array('SH4_Schedule_Html_View_Index', 'render') )
43 ->register( 'get:myschedule', array('SH4_Schedule_Html_View_Index', 'renderMy') )
44
45 ->register( 'post:schedule/dates', array('SH4_Schedule_Html_Controller_Dates', 'execute') )
46 ->register( 'post:schedule/exacttime', array('SH4_Schedule_Html_Controller_ExactTime', 'execute') )
47
48 ->register( 'post:myschedule/dates', array('SH4_Schedule_Html_Controller_Dates', 'executeMy') )
49 ->register( 'post:myschedule/exacttime', array('SH4_Schedule_Html_Controller_ExactTime', 'executeMy') )
50 ;
51 }
52 }