PluginProbe
ShiftController Employee Shift Scheduling / 2.2.2
ShiftController Employee Shift Scheduling v2.2.2
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 / application / controllers / dispatcher.php

dispatcher.php in ShiftController Employee Shift Scheduling 2.2.2, at application/controllers/dispatcher.php

80 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if (!defined('BASEPATH')) exit('No direct script access allowed');
2
3 class Dispatcher_controller extends Front_controller
4 {
5 function __construct()
6 {
7 parent::__construct();
8 $app = $this->config->item('nts_app');
9
10 if ( ! $this->auth->check() )
11 {
12 if( isset($GLOBALS['NTS_CONFIG'][$app]['FORCE_LOGIN_ID']) )
13 {
14 $id = $GLOBALS['NTS_CONFIG'][$app]['FORCE_LOGIN_ID'];
15 $this->auth->login( $id );
16 }
17 }
18
19 // sync user account
20 $ri = $this->remote_integration();
21 if( $ri )
22 {
23 $id = $this->auth->check();
24 if( $id )
25 {
26 $model_name = $ri . '_User_Model';
27 $um = new $model_name;
28 $um->sync( $id );
29 $this->auth->reset_user();
30 }
31 }
32
33 // check user level
34 $user_level = 0;
35 $user_id = 0;
36 if( $this->auth->check() )
37 {
38 if( $test_user = $this->auth->user() )
39 {
40 $user_id = $test_user->id;
41 $user_level = $test_user->level;
42 }
43 }
44
45 if( isset($GLOBALS['NTS_CONFIG'][$app]['FORCE_USER_LEVEL']) )
46 {
47 $user_level = $GLOBALS['NTS_CONFIG'][$app]['FORCE_USER_LEVEL'];
48 }
49
50 $wall_schedule_display = $this->app_conf->get('wall_schedule_display');
51 $allowed = FALSE;
52 switch( $user_level )
53 {
54 case 0:
55 if( $wall_schedule_display <= $user_level )
56 $to = 'wall';
57 else
58 {
59 if( $user_id )
60 $to = 'auth/notallowed';
61 else
62 $to = 'auth/login';
63 }
64 break;
65 case USER_MODEL::LEVEL_ADMIN:
66 $to = 'admin/schedules';
67 break;
68 case USER_MODEL::LEVEL_MANAGER:
69 $to = 'admin/schedules';
70 break;
71 case USER_MODEL::LEVEL_STAFF:
72 $to = 'staff/shifts';
73 break;
74 }
75
76 ci_redirect( $to );
77 exit;
78 }
79 }
80