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

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

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