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 / conflicts / view / index.php

index.php in ShiftController Employee Shift Scheduling 4.9.85, at sh4/conflicts/view/index.php

92 lines 2.3 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_Conflicts_View_Index
4 {
5 public function __construct(
6 HC3_Hooks $hooks,
7
8 HC3_Ui $ui,
9 HC3_Ui_Layout1 $layout,
10
11 SH4_Calendars_Query $calendars,
12 SH4_Employees_Query $employees,
13
14 SH4_Shifts_View_Widget $widget,
15 SH4_Shifts_Presenter $presenter,
16
17 SH4_Shifts_Query $shiftsQuery,
18 SH4_Shifts_Conflicts $conflicts
19 )
20 {
21 $this->ui = $ui;
22 $this->layout = $layout;
23
24 $this->calendars = $hooks->wrap($calendars);
25 $this->employees = $hooks->wrap($employees);
26 $this->shiftsQuery = $hooks->wrap($shiftsQuery);
27
28 $this->conflicts = $hooks->wrap( $conflicts );
29
30 $this->widget = $hooks->wrap($widget);
31 $this->presenter = $hooks->wrap($presenter);
32 $this->self = $hooks->wrap($this);
33 }
34
35 public function render( $shiftId, $calendarId, $start, $end, $employeeId )
36 {
37 $calendar = $this->calendars->findById( $calendarId );
38 $employee = $this->employees->findById( $employeeId );
39
40 // test model
41 $testModel = new SH4_Shifts_Model( NULL, $calendar, $start, $end, $employee );
42
43 $out = array();
44
45 // conflicts view
46 $conflicts = $this->conflicts->get( $testModel );
47 if( $conflicts ){
48 $conflictsView = array();
49 foreach( $conflicts as $conflict ){
50 $conflictsView[] = $conflict->render();
51 }
52 $conflictsView = $this->ui->makeList($conflictsView);
53 $out[] = $conflictsView;
54 }
55
56 $out = $this->ui->makeList($out);
57
58 $this->layout
59 ->setContent( $out )
60 ->setBreadcrumb( $this->breadcrumb($shiftId, $calendarId, $start, $end, $employeeId) )
61 ->setHeader( $this->self->header() )
62 ;
63
64 $out = $this->layout->render();
65
66 return $out;
67 }
68
69 public function header()
70 {
71 $out = '__Conflicts__';
72 return $out;
73 }
74
75 public function breadcrumb( $shiftId, $calendarId, $start, $end, $employeeId )
76 {
77 $return = array();
78
79 $calendar = $this->calendars->findById( $calendarId );
80 $employee = $this->employees->findById( $employeeId );
81
82 $testModel = new SH4_Shifts_Model( NULL, $calendar, $start, $end, $employee );
83
84 $label = $this->presenter->presentTitle( $testModel );
85 if( $shiftId ){
86 $label = array( 'shifts/' . $shiftId , $label );
87 }
88 $return['new'] = $label;
89
90 return $return;
91 }
92 }