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

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