| 1 |
<?php if (! defined('ABSPATH')) exit; // Exit if accessed directly |
| 2 |
class SH4_App_Boot |
| 3 |
{ |
| 4 |
public function __construct( |
| 5 |
HC3_Dic $dic, |
| 6 |
HC3_Settings $settings, |
| 7 |
HC3_Ui_Topmenu $topmenu, |
| 8 |
HC3_Router $router, |
| 9 |
HC3_Acl $acl, |
| 10 |
HC3_Hooks $hooks, |
| 11 |
|
| 12 |
SH4_App_Migration $migration |
| 13 |
) |
| 14 |
{ |
| 15 |
$migration->up(); |
| 16 |
|
| 17 |
$dic->bind( 'SH4_Permission', 'HC3_IPermission' ); |
| 18 |
|
| 19 |
$settings |
| 20 |
->init( 'datetime_date_format', 'j M Y' ) |
| 21 |
->init( 'datetime_time_format', 'g:ia' ) |
| 22 |
->init( 'datetime_week_starts', 0 ) |
| 23 |
->init( 'datetime_timezone', '' ) |
| 24 |
->init( 'full_day_count_as', 8*60*60 ) |
| 25 |
|
| 26 |
->init( 'skip_weekdays', array() ) |
| 27 |
|
| 28 |
->init( 'datetime_min_time', 0 ) |
| 29 |
->init( 'datetime_max_time', 24*60*60 ) |
| 30 |
->init( 'datetime_step', 5*60 ) |
| 31 |
|
| 32 |
->init( 'datetime_hide_schedule_reports', 0 ) |
| 33 |
->init( 'datetime_summary_by_calendar', 0 ) |
| 34 |
->init( 'datetime_hide_bottom_date_navigation', 0 ) |
| 35 |
->init( 'datetime_month_slim_view', 1 ) |
| 36 |
->init( 'datetime_compact_shift_label', 'abbr' ) |
| 37 |
|
| 38 |
->init( 'conflicts_calendar_only', 0 ) |
| 39 |
->init( 'shifts_no_draft', 0 ) |
| 40 |
->init( 'shifts_confirm_publish', 0 ) |
| 41 |
|
| 42 |
->init( 'default_schedule_view', 'week' ) |
| 43 |
->init( 'default_schedule_groupby', 'employee' ) |
| 44 |
|
| 45 |
->init( 'datetime_n_weeks', 4 ) |
| 46 |
->init( 'pref_csv_separator', ',' ) |
| 47 |
; |
| 48 |
|
| 49 |
$topmenu |
| 50 |
->addAfter( NULL, 'profile', array('user/profile', '__Profile__') ) |
| 51 |
->addBefore( 'profile', 'admin', array('admin', '__Administration__') ) |
| 52 |
; |
| 53 |
|
| 54 |
$router |
| 55 |
->register( 'get:admin', array('SH4_App_Html_View_Admin', 'render') ) |
| 56 |
|
| 57 |
->register( 'get:admin/about', array('SH4_App_Html_View_Admin_About', 'render') ) |
| 58 |
|
| 59 |
->register( 'get:admin/reinstall', array('SH4_App_Html_Controller_Admin_Reinstall', 'execute') ) |
| 60 |
->register( 'post:admin/reinstall', array('SH4_App_Html_Controller_Admin_Reinstall', 'execute') ) |
| 61 |
->register( 'post:admin/reinstall/shifts', array('SH4_App_Html_Controller_Admin_Reinstall', 'executeShifts') ) |
| 62 |
->register( 'get:cron', array('SH4_App_Html_Cron', 'run') ) |
| 63 |
; |
| 64 |
|
| 65 |
$acl |
| 66 |
->register( 'get:admin', array('SH4_App_Acl', 'checkAdmin') ) |
| 67 |
->register( 'get:admin/{anything}', array('SH4_App_Acl', 'checkAdmin') ) |
| 68 |
->register( 'post:admin/{anything}', array('SH4_App_Acl', 'checkAdmin') ) |
| 69 |
->register( 'get:admin/{anything}/{anything}', array('SH4_App_Acl', 'checkAdmin') ) |
| 70 |
->register( 'post:admin/{anything}/{anything}', array('SH4_App_Acl', 'checkAdmin') ) |
| 71 |
->register( 'get:admin/{anything}/{anything}/{anything}', array('SH4_App_Acl', 'checkAdmin') ) |
| 72 |
->register( 'post:admin/{anything}/{anything}/{anything}', array('SH4_App_Acl', 'checkAdmin') ) |
| 73 |
|
| 74 |
->register( 'get:manager', array('SH4_App_Acl', 'checkManager') ) |
| 75 |
->register( 'get:manager/{anything}', array('SH4_App_Acl', 'checkManager') ) |
| 76 |
->register( 'post:manager/{anything}', array('SH4_App_Acl', 'checkManager') ) |
| 77 |
->register( 'get:manager/{anything}/{anything}', array('SH4_App_Acl', 'checkManager') ) |
| 78 |
->register( 'post:manager/{anything}/{anything}', array('SH4_App_Acl', 'checkManager') ) |
| 79 |
|
| 80 |
->register( 'get:employee', array('SH4_App_Acl', 'checkEmployee') ) |
| 81 |
->register( 'get:employee/{anything}', array('SH4_App_Acl', 'checkEmployee') ) |
| 82 |
->register( 'post:employee/{anything}', array('SH4_App_Acl', 'checkEmployee') ) |
| 83 |
->register( 'get:employee/{anything}/{anything}', array('SH4_App_Acl', 'checkEmployee') ) |
| 84 |
->register( 'post:employee/{anything}/{anything}', array('SH4_App_Acl', 'checkEmployee') ) |
| 85 |
|
| 86 |
->register( 'get:user', array('SH4_App_Acl', 'checkUser') ) |
| 87 |
// ->register( 'get:user/profile', array('SH4_App_Acl', 'checkUserProfile') ) |
| 88 |
->register( 'get:user/{anything}', array('SH4_App_Acl', 'checkUser') ) |
| 89 |
->register( 'post:user/{anything}', array('SH4_App_Acl', 'checkUser') ) |
| 90 |
->register( 'get:user/{anything}/{anything}', array('SH4_App_Acl', 'checkUser') ) |
| 91 |
->register( 'post:user/{anything}/{anything}', array('SH4_App_Acl', 'checkUser') ) |
| 92 |
; |
| 93 |
|
| 94 |
$hooks |
| 95 |
->add( 'sh4/users/html/user/view/profile::menu::after', function( $ret ){ |
| 96 |
$ret['pref'] = array( 'user/profile/pref', '__Preferences__' ); |
| 97 |
return $ret; |
| 98 |
}) |
| 99 |
; |
| 100 |
|
| 101 |
$router |
| 102 |
->register( 'get:user/profile/pref', array('SH4_App_Html_View_User_Pref', 'get') ) |
| 103 |
->register( 'post:user/profile/pref', array('SH4_App_Html_View_User_Pref', 'post') ) |
| 104 |
; |
| 105 |
} |
| 106 |
} |