PluginProbe
ShiftController Employee Shift Scheduling / 4.9.85
ShiftController Employee Shift Scheduling v4.9.85
4.9.97 4.9.96 4.9.95 4.9.74 4.9.75 4.9.76 4.9.77 4.9.78 4.9.84 4.9.85 4.9.87 4.9.91 4.9.92 trunk 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 3.2.4 All 38 releases
shiftcontroller / sh4 / calendars / presenter.php

presenter.php in ShiftController Employee Shift Scheduling 4.9.85, at sh4/calendars/presenter.php

62 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 export( SH4_Calendars_Model $model )
12 {
13 $ret = array();
14
15 $ret['id'] = $model->getId();
16 $ret['title'] = $model->getTitle();
17 $ret['type'] = $model->isTimeoff() ? 'timeoff' : 'shift';
18 $ret['active'] = $model->isActive() ? 1 : 0;
19
20 return $ret;
21 }
22
23 public function presentDescription( SH4_Calendars_Model $calendar )
24 {
25 $return = $calendar->getDescription();
26
27 if( defined('WPINC') ){
28 $return = do_shortcode( $return );
29 }
30
31 return $return;
32 }
33
34 public function presentTitle( SH4_Calendars_Model $calendar )
35 {
36 $ret = $calendar->getTitle();
37 $ret = esc_html( $ret );
38
39 if( $calendar->isTimeoff() ){
40 $label = '(' . '__Time Off__' . ')';
41 $ret = $this->ui->makeListInline( array($ret, $label) );
42 }
43
44 if( $calendar->isAvailability() ){
45 $label = '(' . '__Availability__' . ')';
46 $ret = $this->ui->makeListInline( array($ret, $label) );
47 }
48
49 $ret = $this->ui->makeBlockInline( $ret )
50 ->paddingX(1)
51 ->tag('bgcolor', $calendar->getColor() )
52 ->tag('color', 'white')
53 ;
54 if( $calendar->isArchived() ){
55 $ret
56 ->tag('font-style', 'line-through')
57 ;
58 }
59
60 return $ret;
61 }
62 }