| 1 |
<?php if (! defined('ABSPATH')) exit; // Exit if accessed directly |
| 2 |
#[AllowDynamicProperties] |
| 3 |
class SH4_Employees_Html_Admin_View_Delete |
| 4 |
{ |
| 5 |
public function __construct( |
| 6 |
HC3_Hooks $hooks, |
| 7 |
HC3_Ui $ui, |
| 8 |
HC3_Ui_Layout1 $layout, |
| 9 |
|
| 10 |
SH4_Employees_Query $query |
| 11 |
) |
| 12 |
{ |
| 13 |
$this->ui = $ui; |
| 14 |
$this->layout = $layout; |
| 15 |
|
| 16 |
$this->query = $hooks->wrap($query); |
| 17 |
$this->self = $hooks->wrap($this); |
| 18 |
} |
| 19 |
|
| 20 |
public function render( $id ) |
| 21 |
{ |
| 22 |
$model = $this->query->findById( $id ); |
| 23 |
|
| 24 |
$out = $this->ui->makeForm( |
| 25 |
'admin/employees/' . $id . '/delete', |
| 26 |
$this->ui->makeList() |
| 27 |
->gutter(2) |
| 28 |
->add( $this->ui->makeInputSubmit( '__Confirm Delete__')->tag('danger') ) |
| 29 |
); |
| 30 |
|
| 31 |
$help = array(); |
| 32 |
$help[] = '__When an employee is deleted, all their data and information is permanently removed.__'; |
| 33 |
$help[] = '__This operation cannot be undone.__'; |
| 34 |
$help = $this->ui->makeList( $help ); |
| 35 |
|
| 36 |
$out = $this->ui->makeList( array($help, $out) ); |
| 37 |
|
| 38 |
$this->layout |
| 39 |
->setContent( $out ) |
| 40 |
->setBreadcrumb( $this->self->breadcrumb($model) ) |
| 41 |
->setHeader( $this->self->header($model) ) |
| 42 |
; |
| 43 |
|
| 44 |
$out = $this->layout->render(); |
| 45 |
return $out; |
| 46 |
} |
| 47 |
|
| 48 |
public function header( $model ) |
| 49 |
{ |
| 50 |
$out = '__Delete__'; |
| 51 |
return $out; |
| 52 |
} |
| 53 |
|
| 54 |
public function breadcrumb( $model ) |
| 55 |
{ |
| 56 |
$return = array(); |
| 57 |
$return['admin'] = array( 'admin', '__Administration__' ); |
| 58 |
$return['admin/employees'] = array( 'admin/employees', '__Employees__' ); |
| 59 |
$return['admin/employees/edit'] = array( 'admin/employees/' . $model->getId(), $model->getTitle() ); |
| 60 |
return $return; |
| 61 |
} |
| 62 |
} |