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 / conf / html / admin / view / datetime.php

datetime.php in ShiftController Employee Shift Scheduling 4.9.66, at sh4/conf/html/admin/view/datetime.php

263 lines 7.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_Conf_Html_Admin_View_Datetime
4 {
5 protected $ui = NULL;
6 protected $settings = NULL;
7
8 public function __construct(
9 HC3_Hooks $hooks,
10
11 HC3_Ui $ui,
12 HC3_Ui_Layout1 $layout,
13 HC3_Time $t,
14
15 HC3_Settings $settings
16 )
17 {
18 $this->ui = $ui;
19 $this->layout = $layout;
20 $this->t = $t;
21
22 $this->settings = $hooks->wrap($settings);
23 $this->self = $hooks->wrap($this);
24 }
25
26 public function render()
27 {
28 $values = array();
29 $pnames = array(
30 'datetime_date_format', 'datetime_time_format', 'datetime_week_starts', 'full_day_count_as',
31 'skip_weekdays', 'datetime_timezone',
32 'datetime_min_time', 'datetime_max_time', 'datetime_step',
33 'datetime_hide_schedule_reports', 'datetime_hide_bottom_date_navigation', 'datetime_month_slim_view', 'datetime_compact_shift_label',
34 'default_schedule_view', 'default_schedule_groupby', 'datetime_n_weeks',
35 'pref_csv_separator'
36 );
37 foreach( $pnames as $pname ){
38 $values[$pname] = $this->settings->get($pname);
39 }
40 $inputs = array();
41
42 $inputs[] = $this->ui->makeInputSelect(
43 'datetime_date_format',
44 '__Date Format__',
45 array(
46 'd/m/Y' => date('d/m/Y'),
47 'd-m-Y' => date('d-m-Y'),
48 'n/j/Y' => date('n/j/Y'),
49 'Y/m/d' => date('Y/m/d'),
50 'd.m.Y' => date('d.m.Y'),
51 'j M Y' => date('j M Y'),
52 'Y-m-d' => date('Y-m-d'),
53 ),
54 $values['datetime_date_format']
55 );
56
57 $options = array( 'g:ia', 'g:i A', '12short', '12xshort', 'H:i', '24short', );
58 $inputOptions = array();
59
60 $testTimes = array( '202103130800', '202103131400', '202103131515' );
61
62 foreach( $options as $e ){
63 $view = array( );
64 foreach( $testTimes as $test ){
65 $this->t->setDateTimeDb( $test );
66 $view[] = $this->t->formatTime( $e );
67 }
68 $view = join( ', ', $view );
69 $inputOptions[ $e ] = $view;
70 }
71
72 $inputs[] = $this->ui->makeInputSelect(
73 'datetime_time_format',
74 '__Time Format__',
75 $inputOptions,
76 $values['datetime_time_format']
77 );
78
79 $inputs[] = $this->ui->makeInputSelect(
80 'datetime_week_starts',
81 '__Week Starts On__',
82 array(
83 0 => '__Sun__',
84 1 => '__Mon__',
85 2 => '__Tue__',
86 3 => '__Wed__',
87 4 => '__Thu__',
88 5 => '__Fri__',
89 6 => '__Sat__',
90 ),
91 $values['datetime_week_starts']
92 );
93
94 $countAsOptionsValues = range( 1, 24 );
95 $countAsOptionsKeys = array();
96 foreach( $countAsOptionsValues as $v ){
97 $countAsOptionsKeys[] = $v * (60 * 60);
98 }
99 $countAsOptions = array_combine( $countAsOptionsKeys, $countAsOptionsValues );
100
101 $inputs[] = $this->ui->makeInputSelect(
102 'full_day_count_as',
103 '__Full Day Counts As__' . ' (' . '__Hours__' . ')',
104 $countAsOptions,
105 $values['full_day_count_as']
106 );
107
108 $inputs = $this->ui->makeGrid( $inputs );
109
110 $moreInputs = array();
111
112 // min/max time
113 $moreInputs2 = array();
114 $moreInputs2[] = $this->ui->makeInputTime(
115 'datetime_min_time',
116 '__Min Start Time__',
117 $values['datetime_min_time'],
118 'nolimit'
119 );
120 $moreInputs2[] = $this->ui->makeInputTime(
121 'datetime_max_time',
122 '__Max End Time__',
123 $values['datetime_max_time'],
124 'nolimit'
125 );
126
127 $stepOptions = array( 5*60 => 5, 10*60 => 10, 15*60 => 15, 20*60 => 20, 30*60 => 30, 60*60 => 60 );
128 $moreInputs2[] = $this->ui->makeInputSelect(
129 'datetime_step',
130 '__Time Increment__' . ' (' . '__Minutes__' . ')',
131 $stepOptions,
132 $values['datetime_step']
133 );
134
135 $moreInputs2 = $this->ui->makeGrid( $moreInputs2 );
136 $moreInputs[] = $moreInputs2;
137
138 // timezone
139 $timezoneOptions = $this->t->getTimezones();
140
141 $defaultLabel = $this->t->getDefaultTimezone();
142 $defaultLabel = ' - ' . '__Default Timezone__' . ' - ' . ' [' . $defaultLabel . ']';
143
144 $timezoneOptions = array_merge( array('' => $defaultLabel), $timezoneOptions );
145
146 $moreInputs[] = $this->ui->makeInputSelect(
147 'datetime_timezone',
148 '__Timezone__',
149 $timezoneOptions,
150 $values['datetime_timezone']
151 );
152
153 $this->t->setNow();
154 $currentTimeView = $this->t->formatDateWithWeekday() . ' ' . $this->t->formatTime();
155 $currentTimeView = '<div class="hc-muted2">' . $currentTimeView . '</div>';
156
157 $moreInputs[] = $currentTimeView;
158
159 // disabled weekdays
160 $disabledWeekdays = array();
161 $weekdays = $this->t->getWeekdays();
162
163 $currentDisabled = $this->settings->get( 'skip_weekdays', TRUE );
164 foreach( $weekdays as $wkd => $wkdName ){
165 $isChecked = in_array( $wkd, $currentDisabled ) ? TRUE : FALSE;
166 $disabledWeekdays[] = $this->ui->makeInputCheckbox( 'skip_weekdays[]', $wkdName, $wkd, $isChecked );
167 }
168 $disabledWeekdays = $this->ui->makeListInline( $disabledWeekdays );
169 $disabledWeekdays = $this->ui->makeLabelled( '__Days Of Week Disabled__', $disabledWeekdays );
170 $moreInputs[] = $disabledWeekdays;
171
172 // hide schedule reports
173 $hideScheduleReports = $this->ui->makeInputCheckbox( 'datetime_hide_schedule_reports', '__Hide Hours Reports In Schedule View__', 1, $values['datetime_hide_schedule_reports'] );
174 $moreInputs[] = $hideScheduleReports;
175
176 // hide bottom date navigation
177 $hideBottomDateNavigation = $this->ui->makeInputCheckbox( 'datetime_hide_bottom_date_navigation', '__Hide Bottom Date Navigation In Schedule View__', 1, $values['datetime_hide_bottom_date_navigation'] );
178 $moreInputs[] = $hideBottomDateNavigation;
179
180 // month slim view
181 $moreInputs[] = $this->ui->makeInputCheckbox( 'datetime_month_slim_view', '__Slim Month Schedule Grouped View__', 1, $values['datetime_month_slim_view'] );
182
183 $thisOptions = array( 'abbr' => '__Abbreviation__', 'none' => '__Space__' );
184 $moreInputs[] = $this->ui->makeInputSelect( 'datetime_compact_shift_label', '__Shift Label In Compact View__', $thisOptions, $values['datetime_compact_shift_label'] );
185
186 // default schedule view
187 $moreInputs3 = array();
188 // $defaultView = $this->ui->makeInputCheckbox( 'datetime_hide_schedule_reports', '__Hide Hours Reports In Schedule View__', 1, $values['datetime_hide_schedule_reports'] );
189 $defaultViewOptions = array( 'day' => '__Day__', 'week' => '__Week__', 'month' => '__Month__', '4weeks' => '__4 Weeks__', 'list' => '__List__' );
190 $defaultView = $this->ui->makeInputSelect(
191 'default_schedule_view',
192 '__Default Schedule View__',
193 $defaultViewOptions,
194 $values['default_schedule_view']
195 );
196 $moreInputs3[] = $defaultView;
197
198 $defaultGroupbyOptions = array( 'employee' => '__Employee__', 'calendar' => '__Calendar__', 'none' => '__None__' );
199 $defaultGroupby = $this->ui->makeInputSelect(
200 'default_schedule_groupby',
201 '__Default Schedule Group By__',
202 $defaultGroupbyOptions,
203 $values['default_schedule_groupby']
204 );
205 $moreInputs3[] = $defaultGroupby;
206
207 $nWeeksOptions = array( 3 => 3, 4 => 4, 5 => 5, 6 => 6 );
208 $nWeeks = $this->ui->makeInputSelect(
209 'datetime_n_weeks',
210 '__Multiple Weeks View__',
211 $nWeeksOptions,
212 $values['datetime_n_weeks']
213 );
214 $moreInputs3[] = $nWeeks;
215
216 $moreInputs3 = $this->ui->makeGrid( $moreInputs3 );
217 $moreInputs[] = $moreInputs3;
218
219 $moreInputs[] = $this->ui->makeInputSelect(
220 'pref_csv_separator',
221 '__CSV Delimiter__',
222 array(
223 ',' => ',',
224 ';' => ';',
225 ),
226 $values['pref_csv_separator']
227 );
228
229 $moreInputs = $this->ui->makeList( $moreInputs );
230
231 $inputs = $this->ui->makeList( array($inputs, $moreInputs) );
232
233 $out = $this->ui->makeForm(
234 'admin/conf/datetime',
235 $this->ui->makeList(
236 array( $inputs, $this->ui->makeInputSubmit( '__Save__')->tag('primary') )
237 )
238 );
239
240 $this->layout
241 ->setContent( $out )
242 ->setBreadcrumb( $this->self->breadcrumb() )
243 ->setHeader( $this->self->header() )
244 // ->setMenu( $this->self->menu() )
245 ;
246
247 $out = $this->layout->render();
248 return $out;
249 }
250
251 public function header()
252 {
253 $out = '__Date and Time__';
254 return $out;
255 }
256
257 public function breadcrumb()
258 {
259 $return = array();
260 $return['admin'] = array( 'admin', '__Administration__' );
261 return $return;
262 }
263 }