PluginProbe
ShiftController Employee Shift Scheduling / 4.9.85
ShiftController Employee Shift Scheduling v4.9.85
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 / employees / html / admin / view / settings.php

settings.php in ShiftController Employee Shift Scheduling 4.9.85, at sh4/employees/html/admin/view/settings.php

154 lines 4.9 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 #[AllowDynamicProperties]
3 class SH4_Employees_Html_Admin_View_Settings
4 {
5 public function __construct(
6 HC3_Hooks $hooks,
7 HC3_Ui $ui,
8 HC3_Ui_Layout1 $layout,
9 HC3_Post $post,
10 HC3_Settings $settings
11 )
12 {
13 $this->ui = $ui;
14 $this->layout = $layout;
15 $this->self = $hooks->wrap($this);
16 $this->post = $hooks->wrap($post);
17 $this->settings = $hooks->wrap($settings);
18 }
19
20 public function get()
21 {
22 $form = $this->ui->makeForm(
23 'admin/employees/settings',
24 $this->self->form()
25 );
26
27 $this->layout
28 ->setContent( $form )
29 ->setBreadcrumb( $this->self->breadcrumb() )
30 ->setHeader( $this->self->header() )
31 ;
32
33 $out = $this->layout->render();
34 return $out;
35 }
36
37 public function post()
38 {
39 $take = array( 'shifts_show_employee_user' );
40 foreach( $take as $k ){
41 $this->settings->set( $k, $this->post->get($k) );
42 }
43
44 $v = $this->post->get('shifts_employee_create_mindate_qty') . ' ' . $this->post->get('shifts_employee_create_mindate_measure');
45 $this->settings->set( 'shifts_employee_create_mindate', $v );
46
47 $v = $this->post->get('shifts_employee_create_maxdate_qty') . ' ' . $this->post->get('shifts_employee_create_maxdate_measure');
48 $this->settings->set( 'shifts_employee_create_maxdate', $v );
49
50 $return = array( 'admin/employees/settings', '__Settings Updated__' );
51 return $return;
52 }
53
54 public function breadcrumb()
55 {
56 $return = array();
57 $return['admin'] = array( 'admin', '__Administration__' );
58 $return['admin/employees'] = array( 'admin/employees', '__Employees__' );
59 return $return;
60 }
61
62 public function menu()
63 {
64 $return = array();
65 return $return;
66 }
67
68 public function header()
69 {
70 $out = '__Settings__';
71 return $out;
72 }
73
74 public function form()
75 {
76 $values = array();
77 $pnames = array( 'shifts_show_employee_user', 'shifts_employee_create_mindate', 'shifts_employee_create_maxdate' );
78 foreach( $pnames as $pname ){
79 $values[$pname] = $this->settings->get($pname);
80 }
81
82 $inputs = array();
83
84 $inputs[] = $this->ui->makeInputCheckbox( 'shifts_show_employee_user', '__Show Employee Username In Schedule__', 1, $values['shifts_show_employee_user'] );
85
86
87 $help = '__If you allow employees to create shifts, they can do this within the following date range:__';
88 $inputs[] = $help;
89
90 $option = [ 'day' => '__Day__', 'week' => '__Week__', 'month' => '__Month__', 'year' => '__Year__' ];
91
92 $minDate = [];
93 $vs = explode( ' ', $values['shifts_employee_create_mindate'] );
94 $minDate[] = $this->ui->makeInputText( 'shifts_employee_create_mindate_qty', '', $vs[0] );
95 $minDate[] = $this->ui->makeInputSelect( 'shifts_employee_create_mindate_measure', '', $option, $vs[1] );
96 $minDate = $this->ui->makeListInline( $minDate );
97 $minDate = $this->ui->makeLabelled( '__Earliest Date__', $minDate );
98
99 $examples = [];
100 $examples[] = '0 - ' . '__Beginning of today__';
101 $examples[] = '1 ' . '__Day__' . ' - ' . '__Beginning of tomorrrow__';
102 $examples[] = '0 ' . '__Week__' . ' - ' . '__Beginning of current week__';
103 $examples[] = '1 ' . '__Week__' . ' - ' . '__Beginning of next week__';
104 $examples[] = '-1 ' . '__Week__' . ' - ' . '__Beginning of previous week__';
105 $examples[] = '0 ' . '__Month__' . ' - ' . '__Beginning of current month__';
106
107 $help = '<small>__Examples__</small><br>';
108 $help .= '<ul>';
109 foreach( $examples as $e ) $help .= '<li>' . $e . '</li>';
110 $help .= '</ul>';
111
112 $minDate = $this->ui->makeList( array($minDate, $help) )->gutter(0);
113
114 $maxDate = [];
115 $vs = explode( ' ', $values['shifts_employee_create_maxdate'] );
116 $maxDate[] = $this->ui->makeInputText( 'shifts_employee_create_maxdate_qty', '', $vs[0] );
117 $maxDate[] = $this->ui->makeInputSelect( 'shifts_employee_create_maxdate_measure', '', $option, $vs[1] );
118 $maxDate = $this->ui->makeListInline( $maxDate );
119 $maxDate = $this->ui->makeLabelled( '__Latest Date__', $maxDate );
120
121 $examples = [];
122 $examples[] = '0 - ' . '__End of today__';
123 $examples[] = '1 ' . '__Day__' . ' - ' . '__End of tomorrrow__';
124 $examples[] = '0 ' . '__Week__' . ' - ' . '__End of current week__';
125 $examples[] = '1 ' . '__Week__' . ' - ' . '__End of next week__';
126 $examples[] = '0 ' . '__Month__' . ' - ' . '__End of current month__';
127
128 $help = '<small>__Examples__</small><br>';
129 $help .= '<ul>';
130 foreach( $examples as $e ) $help .= '<li>' . $e . '</li>';
131 $help .= '</ul>';
132
133 $maxDate = $this->ui->makeList( array($maxDate, $help) )->gutter(0);
134
135 $inputDates = $this->ui->makeGrid( array($minDate, $maxDate) );
136
137 $inputs[] = $inputDates;
138 // $maxDate = $this->ui->makeInputSelect( 'shifts_employee_create_after' )
139
140
141 $inputs = $this->ui->makeList( $inputs );
142
143 $buttons = $this->ui->makeInputSubmit( '__Save__')
144 ->tag('primary')
145 ;
146
147 $out = $this->ui->makeList()
148 ->add( $inputs )
149 ->add( $buttons )
150 ;
151
152 return $out;
153 }
154 }