| 1 |
<?php if (! defined('ABSPATH')) exit; // Exit if accessed directly |
| 2 |
class SH4_Calendars_Presenter |
| 3 |
{ |
| 4 |
public $ui; |
| 5 |
|
| 6 |
public function __construct( HC3_Ui $ui ) |
| 7 |
{ |
| 8 |
$this->ui = $ui; |
| 9 |
} |
| 10 |
|
| 11 |
public function presentDescription( SH4_Calendars_Model $calendar ) |
| 12 |
{ |
| 13 |
$return = $calendar->getDescription(); |
| 14 |
|
| 15 |
if( defined('WPINC') ){ |
| 16 |
$return = do_shortcode( $return ); |
| 17 |
} |
| 18 |
|
| 19 |
return $return; |
| 20 |
} |
| 21 |
|
| 22 |
public function presentTitle( SH4_Calendars_Model $calendar ) |
| 23 |
{ |
| 24 |
$ret = $calendar->getTitle(); |
| 25 |
$ret = esc_html( $ret ); |
| 26 |
|
| 27 |
if( $calendar->isTimeoff() ){ |
| 28 |
$label = '(' . '__Time Off__' . ')'; |
| 29 |
$ret = $this->ui->makeListInline( array($ret, $label) ); |
| 30 |
} |
| 31 |
|
| 32 |
if( $calendar->isAvailability() ){ |
| 33 |
$label = '(' . '__Availability__' . ')'; |
| 34 |
$ret = $this->ui->makeListInline( array($ret, $label) ); |
| 35 |
} |
| 36 |
|
| 37 |
$ret = $this->ui->makeBlockInline( $ret ) |
| 38 |
->paddingX(1) |
| 39 |
->tag('bgcolor', $calendar->getColor() ) |
| 40 |
->tag('color', 'white') |
| 41 |
; |
| 42 |
if( $calendar->isArchived() ){ |
| 43 |
$ret |
| 44 |
->tag('font-style', 'line-through') |
| 45 |
; |
| 46 |
} |
| 47 |
|
| 48 |
return $ret; |
| 49 |
} |
| 50 |
} |