| 1 |
<?php if (! defined('ABSPATH')) exit; // Exit if accessed directly |
| 2 |
#[AllowDynamicProperties] |
| 3 |
class SH4_Shifts_View_Conflicts |
| 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 |
SH4_Shifts_Conflicts $conflicts |
| 14 |
) |
| 15 |
{ |
| 16 |
$this->ui = $ui; |
| 17 |
$this->layout = $layout; |
| 18 |
|
| 19 |
$this->query = $hooks->wrap($query); |
| 20 |
|
| 21 |
$this->conflicts = $hooks->wrap($conflicts); |
| 22 |
$this->common = $hooks->wrap($common); |
| 23 |
$this->self = $hooks->wrap($this); |
| 24 |
} |
| 25 |
|
| 26 |
public function render( $id ) |
| 27 |
{ |
| 28 |
// model |
| 29 |
$model = $this->query->findById($id); |
| 30 |
|
| 31 |
$out = NULL; |
| 32 |
|
| 33 |
$conflicts = $this->conflicts->get( $model ); |
| 34 |
if( $conflicts ){ |
| 35 |
$conflictsView = array(); |
| 36 |
foreach( $conflicts as $conflict ){ |
| 37 |
$conflictsView[] = $conflict->render(); |
| 38 |
} |
| 39 |
|
| 40 |
$out = $this->ui->makeList( $conflictsView ); |
| 41 |
} |
| 42 |
|
| 43 |
$this->layout |
| 44 |
->setContent( $out ) |
| 45 |
->setBreadcrumb( $this->common->breadcrumb($model) ) |
| 46 |
->setHeader( $this->self->header($model) ) |
| 47 |
; |
| 48 |
$out = $this->layout->render(); |
| 49 |
|
| 50 |
return $out; |
| 51 |
} |
| 52 |
|
| 53 |
public function header() |
| 54 |
{ |
| 55 |
$out = '__Conflicts__'; |
| 56 |
return $out; |
| 57 |
} |
| 58 |
} |