| 1 |
<?php if (! defined('ABSPATH')) exit; // Exit if accessed directly |
| 2 |
interface SH4_New_View_ICommon |
| 3 |
{ |
| 4 |
public function breadcrumb( $calendarId, $shiftTypeId = 'x' ); |
| 5 |
public function inputs( $calendarId, $shiftTypeId, $employeeId ); |
| 6 |
} |
| 7 |
|
| 8 |
#[AllowDynamicProperties] |
| 9 |
class SH4_New_View_Common implements SH4_New_View_ICommon |
| 10 |
{ |
| 11 |
public function __construct( |
| 12 |
HC3_Hooks $hooks, |
| 13 |
|
| 14 |
HC3_Request $request, |
| 15 |
HC3_Ui $ui, |
| 16 |
HC3_Time $t, |
| 17 |
|
| 18 |
SH4_Calendars_Query $calendarsQuery, |
| 19 |
SH4_Calendars_Presenter $calendarsPresenter, |
| 20 |
|
| 21 |
SH4_ShiftTypes_Query $shiftTypesQuery, |
| 22 |
SH4_ShiftTypes_Presenter $shiftTypesPresenter, |
| 23 |
|
| 24 |
SH4_Notifications_Html_Admin_View_TurnOnOff $notificationsTurnOnOff, |
| 25 |
|
| 26 |
SH4_Employees_Query $employees |
| 27 |
) |
| 28 |
{ |
| 29 |
$this->request = $request; |
| 30 |
$this->ui = $ui; |
| 31 |
$this->t = $t; |
| 32 |
|
| 33 |
$this->calendarsQuery = $hooks->wrap( $calendarsQuery ); |
| 34 |
$this->calendarsPresenter = $hooks->wrap( $calendarsPresenter ); |
| 35 |
|
| 36 |
$this->shiftTypesQuery = $hooks->wrap( $shiftTypesQuery ); |
| 37 |
$this->shiftTypesPresenter = $hooks->wrap( $shiftTypesPresenter ); |
| 38 |
|
| 39 |
$this->notificationsTurnOnOff = $hooks->wrap( $notificationsTurnOnOff ); |
| 40 |
|
| 41 |
$this->employees = $hooks->wrap($employees); |
| 42 |
|
| 43 |
$this->self = $hooks->wrap($this); |
| 44 |
} |
| 45 |
|
| 46 |
public function breadcrumb( $calendarId, $shiftTypeId = 'x' ) |
| 47 |
{ |
| 48 |
$params = $this->request->getParams(); |
| 49 |
|
| 50 |
$return = array(); |
| 51 |
|
| 52 |
$calendar = $this->calendarsQuery->findById( $calendarId ); |
| 53 |
$label = $this->calendarsPresenter->presentTitle( $calendar ); |
| 54 |
|
| 55 |
// if( $calendar->isShift() ){ |
| 56 |
// $return['new'] = '+' . ' ' . '__Shift__'; |
| 57 |
// $return['new/calendar'] = array( 'newshift', $label ); |
| 58 |
// } |
| 59 |
// elseif( $calendar->isTimeoff() ){ |
| 60 |
// $return['new'] = array( 'newtimeoff', '+' . ' ' . '__Time Off__' ); |
| 61 |
// $return['new/calendar'] = array( 'newtimeoff', $label ); |
| 62 |
// } |
| 63 |
// elseif( $calendar->isAvailability() ){ |
| 64 |
// $return['new'] = array( 'newavailability', '+' . ' ' . '__Availability__' ); |
| 65 |
// $return['new/calendar'] = array( 'newavailability', $label ); |
| 66 |
// } |
| 67 |
|
| 68 |
$return['new/calendar'] = $label; |
| 69 |
if( $shiftTypeId != 'x' ){ |
| 70 |
$shiftType = $this->shiftTypesQuery->findById( $shiftTypeId ); |
| 71 |
// $label = $this->shiftTypesPresenter->presentTitleTime( $shiftType ); |
| 72 |
$label1 = $this->shiftTypesPresenter->presentTitle( $shiftType ); |
| 73 |
$label2 = $this->shiftTypesPresenter->presentTime( $shiftType ); |
| 74 |
$label = $this->ui->makeListInline( array($label1, $label2) )->gutter(1); |
| 75 |
|
| 76 |
// $return['new/shifttype'] = array( 'new/' . $calendarId . '/' . 'x' . '/' . $employeeId, $label ); |
| 77 |
$return['new/shifttype'] = $label; |
| 78 |
} |
| 79 |
|
| 80 |
return $return; |
| 81 |
} |
| 82 |
|
| 83 |
public function inputs( $calendarId, $shiftTypeId, $employeeId ) |
| 84 |
{ |
| 85 |
$return = array(); |
| 86 |
|
| 87 |
// if( ! $employeeId ){ |
| 88 |
// $qtyOptions = range( 1, 50 ); |
| 89 |
// $qtyOptions = array_combine( $qtyOptions, $qtyOptions ); |
| 90 |
// $qtyField = $this->ui->makeInputSelect( 'qty', '__How Many__', $qtyOptions ); |
| 91 |
// $return['qty'] = $qtyField; |
| 92 |
// } |
| 93 |
|
| 94 |
$return['notifications'] = $this->notificationsTurnOnOff->renderInput(); |
| 95 |
return $return; |
| 96 |
} |
| 97 |
} |