| 1 |
<?php if (! defined('ABSPATH')) exit; // Exit if accessed directly |
| 2 |
interface SH4_Employees_IPresenter |
| 3 |
{ |
| 4 |
public function presentTitle( SH4_Employees_Model $employee ); |
| 5 |
} |
| 6 |
|
| 7 |
class SH4_Employees_Presenter implements SH4_Employees_IPresenter |
| 8 |
{ |
| 9 |
public function __construct( |
| 10 |
HC3_Hooks $hooks, |
| 11 |
HC3_Settings $settings, |
| 12 |
SH4_App_Query $appQuery, |
| 13 |
HC3_Ui $ui |
| 14 |
) |
| 15 |
{ |
| 16 |
$this->ui = $ui; |
| 17 |
$this->settings = $hooks->wrap( $settings ); |
| 18 |
$this->appQuery = $hooks->wrap($appQuery); |
| 19 |
} |
| 20 |
|
| 21 |
public function presentDescription( SH4_Employees_Model $employee ) |
| 22 |
{ |
| 23 |
$return = $employee->getDescription(); |
| 24 |
|
| 25 |
// if( defined('WPINC') ){ |
| 26 |
// $return = do_shortcode( $return ); |
| 27 |
// } |
| 28 |
|
| 29 |
return $return; |
| 30 |
} |
| 31 |
|
| 32 |
public function presentTitle( SH4_Employees_Model $employee ) |
| 33 |
{ |
| 34 |
$ret = $employee->getTitle(); |
| 35 |
|
| 36 |
$showUserEmployee = $this->settings->get('shifts_show_employee_user'); |
| 37 |
if( $showUserEmployee ){ |
| 38 |
$user = $this->appQuery->findUserByEmployee( $employee ); |
| 39 |
if( $user ){ |
| 40 |
$userView = $user->getUsername(); |
| 41 |
$ret .= ' (' . $userView . ')'; |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
return $ret; |
| 46 |
} |
| 47 |
} |