| 1 |
<?php if (! defined('ABSPATH')) exit; // Exit if accessed directly |
| 2 |
#[AllowDynamicProperties] |
| 3 |
class SH4_Shifts_View_Delete |
| 4 |
{ |
| 5 |
public function __construct( |
| 6 |
HC3_Hooks $hooks, |
| 7 |
|
| 8 |
HC3_Ui $ui, |
| 9 |
HC3_Ui_Layout1 $layout, |
| 10 |
|
| 11 |
SH4_Shifts_View_Common $common, |
| 12 |
SH4_Shifts_Query $query |
| 13 |
) |
| 14 |
{ |
| 15 |
$this->ui = $ui; |
| 16 |
$this->layout = $layout; |
| 17 |
|
| 18 |
$this->query = $hooks->wrap($query); |
| 19 |
$this->common = $hooks->wrap($common); |
| 20 |
$this->self = $hooks->wrap($this); |
| 21 |
} |
| 22 |
|
| 23 |
public function render( $id ) |
| 24 |
{ |
| 25 |
$model = $this->query->findById($id); |
| 26 |
|
| 27 |
$out = $this->ui->makeList() |
| 28 |
->gutter(2) |
| 29 |
->add( $this->ui->makeInputSubmit( '__Confirm Delete__')->tag('danger') ) |
| 30 |
; |
| 31 |
|
| 32 |
// schedule link |
| 33 |
$scheduleLink = HC3_Session::instance()->getUserdata( 'scheduleLink' ); |
| 34 |
if( ! $scheduleLink ){ |
| 35 |
$scheduleLink = array( 'schedule', array() ); |
| 36 |
} |
| 37 |
$scheduleLinkValue = json_encode( $scheduleLink ); |
| 38 |
$inputBackHidden = $this->ui->makeInputHidden( 'back', $scheduleLinkValue ); |
| 39 |
$out = $this->ui->makeCollection( array($out, $inputBackHidden) ); |
| 40 |
|
| 41 |
$out = $this->ui->makeForm( |
| 42 |
'shifts/' . $id . '/delete', |
| 43 |
$out |
| 44 |
); |
| 45 |
|
| 46 |
$help = '__This operation cannot be undone.__'; |
| 47 |
|
| 48 |
$out = $this->ui->makeList( array($help, $out) ); |
| 49 |
|
| 50 |
$this->layout |
| 51 |
->setContent( $out ) |
| 52 |
->setBreadcrumb( $this->common->breadcrumb($model) ) |
| 53 |
->setHeader( $this->self->header($model) ) |
| 54 |
; |
| 55 |
|
| 56 |
$out = $this->layout->render(); |
| 57 |
|
| 58 |
return $out; |
| 59 |
} |
| 60 |
|
| 61 |
public function header( $model ) |
| 62 |
{ |
| 63 |
$out = '__Delete__'; |
| 64 |
return $out; |
| 65 |
} |
| 66 |
} |