PluginProbe
ShiftController Employee Shift Scheduling / 4.9.24
ShiftController Employee Shift Scheduling v4.9.24
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 / upgrade3 / view.php

view.php in ShiftController Employee Shift Scheduling 4.9.24, at sh4/upgrade3/view.php

87 lines 2.4 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_Upgrade3_View
3 {
4 public function __construct(
5 HC3_Hooks $hooks,
6 HC3_Ui $ui,
7 HC3_Ui_Layout1 $layout
8 )
9 {
10 $this->ui = $ui;
11 $this->layout = $layout;
12
13 $this->self = $hooks->wrap($this);
14 }
15
16 public function render()
17 {
18 global $wpdb;
19 $prfx = $wpdb->prefix . 'shiftcontroller_v3_';
20
21 $out = array();
22
23 // find locations
24 // $sql = "SELECT * FROM {$prfx}locations";
25 // $results = $wpdb->get_results( $sql, ARRAY_A );
26
27 // locations
28 $sql = "SELECT COUNT(*) FROM {$prfx}locations";
29 $count = $wpdb->get_var( $sql );
30 $count = $this->ui->makeSpan($count)->tag('font-size', 4)->tag('font-style', 'bold');
31 $out[] = $this->ui->makeListInline( array('__Calendars__', $count) );
32
33 // employees
34 $level = 1;
35 $sql = "SELECT COUNT(*) FROM {$prfx}users WHERE level & $level";
36 $count = $wpdb->get_var( $sql );
37 $count = $this->ui->makeSpan($count)->tag('font-size', 4)->tag('font-style', 'bold');
38 $out[] = $this->ui->makeListInline( array('__Employees__', $count) );
39
40 // shift types
41 // $sql = "SELECT DISTINCT CONCAT(start, '-', end) AS time_range FROM {$prfx}shifts";
42 // $results = $wpdb->get_results( $sql, ARRAY_A );
43 // $sql = "SELECT COUNT(DISTINCT CONCAT(start, '-', end)) FROM {$prfx}shifts";
44 // $count = $wpdb->get_var( $sql );
45 // $count = $this->ui->makeSpan($count)->tag('font-size', 4)->tag('font-style', 'bold');
46 // $out[] = $this->ui->makeListInline( array('__Shift Types__', $count) );
47
48 // shifts
49 $sql = "SELECT COUNT(*) FROM {$prfx}shifts";
50 $count = $wpdb->get_var( $sql );
51 $count = $this->ui->makeSpan($count)->tag('font-size', 4)->tag('font-style', 'bold');
52 $out[] = $this->ui->makeListInline( array('__Shifts__', $count) );
53
54 // notice
55 $out[] = '__Please note that your current data will be overwritten.__';
56
57 // confirm
58 $out[] = $this->ui->makeForm(
59 'upgrade3',
60 $this->ui->makeInputSubmit('__Proceed To Upgrade__')->tag('primary')
61 );
62
63 $out = $this->ui->makeList($out);
64
65 $this->layout
66 ->setContent( $out )
67 // ->setBreadcrumb( $this->self->breadcrumb() )
68 ->setHeader( $this->self->header() )
69 // ->setMenu( $this->self->menu() )
70 ;
71
72 $out = $this->layout->render();
73 return $out;
74 }
75
76 public function breadcrumb()
77 {
78 $return = array();
79 return $return;
80 }
81
82 public function header()
83 {
84 $out = '__Upgrade From 3.x__';
85 return $out;
86 }
87 }