PluginProbe
ShiftController Employee Shift Scheduling / 4.9.59
ShiftController Employee Shift Scheduling v4.9.59
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.59, at sh4/conf/html/admin/view/datetime.php

261 lines 7.7 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',
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 $monthSlimView = $this->ui->makeInputCheckbox( 'datetime_month_slim_view', '__Slim Month Schedule Grouped View__', 1, $values['datetime_month_slim_view'] );
182 $moreInputs[] = $monthSlimView;
183
184 // default schedule view
185 $moreInputs3 = array();
186 // $defaultView = $this->ui->makeInputCheckbox( 'datetime_hide_schedule_reports', '__Hide Hours Reports In Schedule View__', 1, $values['datetime_hide_schedule_reports'] );
187 $defaultViewOptions = array( 'day' => '__Day__', 'week' => '__Week__', 'month' => '__Month__', '4weeks' => '__4 Weeks__', 'list' => '__List__' );
188 $defaultView = $this->ui->makeInputSelect(
189 'default_schedule_view',
190 '__Default Schedule View__',
191 $defaultViewOptions,
192 $values['default_schedule_view']
193 );
194 $moreInputs3[] = $defaultView;
195
196 $defaultGroupbyOptions = array( 'employee' => '__Employee__', 'calendar' => '__Calendar__', 'none' => '__None__' );
197 $defaultGroupby = $this->ui->makeInputSelect(
198 'default_schedule_groupby',
199 '__Default Schedule Group By__',
200 $defaultGroupbyOptions,
201 $values['default_schedule_groupby']
202 );
203 $moreInputs3[] = $defaultGroupby;
204
205 $nWeeksOptions = array( 3 => 3, 4 => 4, 5 => 5, 6 => 6 );
206 $nWeeks = $this->ui->makeInputSelect(
207 'datetime_n_weeks',
208 '__Multiple Weeks View__',
209 $nWeeksOptions,
210 $values['datetime_n_weeks']
211 );
212 $moreInputs3[] = $nWeeks;
213
214 $moreInputs3 = $this->ui->makeGrid( $moreInputs3 );
215 $moreInputs[] = $moreInputs3;
216
217 $moreInputs[] = $this->ui->makeInputSelect(
218 'pref_csv_separator',
219 '__CSV Delimiter__',
220 array(
221 ',' => ',',
222 ';' => ';',
223 ),
224 $values['pref_csv_separator']
225 );
226
227 $moreInputs = $this->ui->makeList( $moreInputs );
228
229 $inputs = $this->ui->makeList( array($inputs, $moreInputs) );
230
231 $out = $this->ui->makeForm(
232 'admin/conf/datetime',
233 $this->ui->makeList(
234 array( $inputs, $this->ui->makeInputSubmit( '__Save__')->tag('primary') )
235 )
236 );
237
238 $this->layout
239 ->setContent( $out )
240 ->setBreadcrumb( $this->self->breadcrumb() )
241 ->setHeader( $this->self->header() )
242 // ->setMenu( $this->self->menu() )
243 ;
244
245 $out = $this->layout->render();
246 return $out;
247 }
248
249 public function header()
250 {
251 $out = '__Date and Time__';
252 return $out;
253 }
254
255 public function breadcrumb()
256 {
257 $return = array();
258 $return['admin'] = array( 'admin', '__Administration__' );
259 return $return;
260 }
261 }