PluginProbe
ShiftController Employee Shift Scheduling / 4.9.66
ShiftController Employee Shift Scheduling v4.9.66
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.66, at sh4/upgrade3/view.php

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