PluginProbe
ShiftController Employee Shift Scheduling / 4.9.95
ShiftController Employee Shift Scheduling v4.9.95
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 / schedule / html / view / miscoptions.php

miscoptions.php in ShiftController Employee Shift Scheduling 4.9.95, at sh4/schedule/html/view/miscoptions.php

76 lines 1.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 #[AllowDynamicProperties]
3 class SH4_Schedule_Html_View_MiscOptions
4 {
5 public function __construct(
6 HC3_Hooks $hooks,
7 HC3_Ui $ui,
8 HC3_Request $request,
9
10 SH4_Shifts_Duration $shiftsDuration,
11 SH4_Schedule_Html_View_Common $common
12 )
13 {
14 $this->self = $hooks->wrap( $this );
15 $this->ui = $ui;
16 $this->request = $request;
17
18 $this->shiftsDuration = $hooks->wrap( $shiftsDuration );
19 $this->common = $hooks->wrap( $common );
20 }
21
22 public function render()
23 {
24 $options = $this->self->options();
25
26 if( ! array_key_exists(1, $options) ){
27 $options[1] = NULL;
28 }
29 if( ! array_key_exists(2, $options) ){
30 $options[2] = NULL;
31 }
32 if( ! array_key_exists(3, $options) ){
33 $options[3] = NULL;
34 }
35
36 $out = $this->ui->makeGrid()
37 ->add( $options[1], 3, 12 )
38 ->add( $options[2], 7, 12 )
39 ->add( $options[3], 2, 12 )
40 ;
41
42 return $out;
43 }
44
45 public function options()
46 {
47 $out = array();
48
49 $shifts = $this->common->getShifts();
50 $this->shiftsDuration->reset();
51
52 $counted = 0;
53
54 foreach( $shifts as $shift ){
55 $shiftCalendar = $shift->getCalendar();
56 // if( ! $shiftCalendar->isShift() ){
57 // continue;
58 // }
59 $this->shiftsDuration->add( $shift );
60 $counted++;
61 }
62
63 if( $counted ){
64 $out[] = $this->common->renderReport( $this->shiftsDuration, FALSE );
65 }
66
67 $out = $this->ui->makeListInline( $out )
68 ->gutter(1)
69 ;
70
71 $return = array();
72 $return[1] = $out;
73
74 return $return;
75 }
76 }