PluginProbe
ShiftController Employee Shift Scheduling / 2.1.0
ShiftController Employee Shift Scheduling v2.1.0
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 / shiftcontroller.php

shiftcontroller.php in ShiftController Employee Shift Scheduling 2.1.0, at shiftcontroller.php

142 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package ShiftController
4 * @author ShiftController
5 * @version 2.1.0
6 */
7 /*
8 Plugin Name: ShiftController
9 Plugin URI: http://www.shiftcontroller.com/
10 Description: Staff scheduling plugin.
11 Author: ShiftController
12 Version: 2.1.0
13 Author URI: http://www.shiftcontroller.com/
14 */
15
16 global $wp_version;
17 if (version_compare($wp_version, "3.3", "<"))
18 {
19 exit('ShiftController requires WordPress 3.3 or newer, yours is ' . $wp_version);
20 }
21
22 if( file_exists(dirname(__FILE__) . '/db.php') )
23 {
24 $nts_no_db = TRUE;
25 include_once( dirname(__FILE__) . '/db.php' );
26 }
27
28 if( defined('NTS_DEVELOPMENT') )
29 $happ_path = NTS_DEVELOPMENT;
30 else
31 $happ_path = dirname(__FILE__) . '/happ';
32 include_once( $happ_path . '/application/libraries/hcWpBase.php' );
33
34 class ShiftController extends hcWpBase2
35 {
36 var $happ_path = '';
37 var $happ_web_dir = '';
38
39 public function __construct()
40 {
41 if( defined('NTS_DEVELOPMENT') )
42 {
43 $this->happ_path = NTS_DEVELOPMENT;
44 $this->happ_web_dir = 'http://localhost';
45 }
46 else
47 {
48 $this->happ_path = dirname(__FILE__) . '/happ';
49 $this->happ_web_dir = plugins_url('', __FILE__);
50 }
51
52 $GLOBALS['NTS_APPPATH'] = dirname(__FILE__) . '/application';
53
54 parent::__construct(
55 strtolower(get_class()),
56 dirname(__FILE__),
57 array(),
58 TRUE
59 );
60
61 require( $this->happ_path . '/assets/files.php' );
62 reset( $css_files );
63 foreach( $css_files as $f )
64 {
65 if( is_array($f) )
66 $f[0] = $this->happ_web_dir . '/' . $f[0];
67 else
68 $f = $this->happ_web_dir . '/' . $f;
69 $this->register_admin_style($f);
70 }
71
72 reset( $js_files );
73 foreach( $js_files as $f )
74 {
75 if( is_array($f) )
76 $f[0] = $this->happ_web_dir . '/' . $f[0];
77 else
78 $f = $this->happ_web_dir . '/' . $f;
79 $this->register_admin_script($f);
80 }
81
82 add_shortcode( $this->app, array($this, 'front_view'));
83 add_action('wp', array($this, 'front_init') );
84 add_action( 'admin_init', array($this, 'admin_init') );
85 add_action( 'admin_menu', array($this, 'admin_menu') );
86 }
87
88 public function admin_menu()
89 {
90 $page = add_menu_page(
91 'ShiftController',
92 'ShiftController',
93 'read',
94 $this->app,
95 array( $this, 'admin_view' )
96 );
97 }
98
99 public function admin_init()
100 {
101 if( $this->is_me_admin() )
102 {
103 parent::admin_init();
104 // action
105 require( $this->happ_path . '/application/index_action.php' );
106 }
107 }
108
109 public function front_init()
110 {
111 if( ! is_admin() )
112 {
113 if( parent::front_init() )
114 {
115 // action
116 require( $this->happ_path . '/application/index_action.php' );
117 $GLOBALS['NTS_CONFIG'][$this->app]['ACTION_STARTED'] = 1;
118 }
119 }
120 }
121
122 public function admin_view()
123 {
124 $file = $this->happ_path . '/application/index_view.php';
125 require( $file );
126 }
127
128 public function front_view()
129 {
130 if(
131 isset($GLOBALS['NTS_CONFIG'][$this->app]['ACTION_STARTED']) &&
132 $GLOBALS['NTS_CONFIG'][$this->app]['ACTION_STARTED']
133 )
134 {
135 $file = $this->happ_path . '/application/index_view.php';
136 require( $file );
137 }
138 }
139 }
140
141 $sh = new ShiftController();
142 ?>