| 1 |
<?php if (! defined('ABSPATH')) exit; // Exit if accessed directly |
| 2 |
#[AllowDynamicProperties] |
| 3 |
class SH4_Users_Html_User_View_Profile |
| 4 |
{ |
| 5 |
public function __construct( |
| 6 |
SH4_App_Acl $appAcl, |
| 7 |
|
| 8 |
HC3_Auth $auth, |
| 9 |
HC3_IPermission $permission, |
| 10 |
SH4_App_Query $appQuery, |
| 11 |
|
| 12 |
HC3_Ui $ui, |
| 13 |
HC3_Ui_Layout1 $layout, |
| 14 |
|
| 15 |
HC3_Hooks $hooks |
| 16 |
) |
| 17 |
{ |
| 18 |
$this->ui = $ui; |
| 19 |
$this->layout = $layout; |
| 20 |
|
| 21 |
$this->auth = $hooks->wrap( $auth ); |
| 22 |
$this->permission = $hooks->wrap( $permission ); |
| 23 |
$this->appQuery = $hooks->wrap( $appQuery ); |
| 24 |
$this->appAcl = $hooks->wrap( $appAcl ); |
| 25 |
|
| 26 |
$this->self = $hooks->wrap($this); |
| 27 |
} |
| 28 |
|
| 29 |
public function render() |
| 30 |
{ |
| 31 |
$options = $this->self->menu(); |
| 32 |
$out = array(); |
| 33 |
foreach( $options as $item ){ |
| 34 |
list( $href, $label ) = $item; |
| 35 |
$this_menu = $this->ui->makeAhref( $href, $label ) |
| 36 |
->tag('tab-link') |
| 37 |
; |
| 38 |
$out[] = $this_menu; |
| 39 |
} |
| 40 |
$out = $this->ui->makeList( $out ); |
| 41 |
|
| 42 |
$this->layout |
| 43 |
->setContent( $out ) |
| 44 |
->setBreadcrumb( $this->self->breadcrumb() ) |
| 45 |
->setHeader( $this->self->header() ) |
| 46 |
// ->setMenu( $this->self->menu() ) |
| 47 |
; |
| 48 |
|
| 49 |
$out = $this->layout->render(); |
| 50 |
return $out; |
| 51 |
} |
| 52 |
|
| 53 |
public function menu() |
| 54 |
{ |
| 55 |
$ret = array(); |
| 56 |
|
| 57 |
// if have roles |
| 58 |
if( $this->appAcl->checkUserProfile() ){ |
| 59 |
$ret['roles'] = array( 'user/profile/roles', '__My Roles__' ); |
| 60 |
} |
| 61 |
|
| 62 |
if( ! defined('WPINC') ){ |
| 63 |
$ret['profile'] = array( 'user/profile/edit', '__Edit My Details__' ); |
| 64 |
} |
| 65 |
|
| 66 |
return $ret; |
| 67 |
} |
| 68 |
|
| 69 |
public function header() |
| 70 |
{ |
| 71 |
$out = '__Profile__'; |
| 72 |
return $out; |
| 73 |
} |
| 74 |
|
| 75 |
public function breadcrumb() |
| 76 |
{ |
| 77 |
$return = array(); |
| 78 |
// $return['admin'] = array( 'admin', '__Administration__' ); |
| 79 |
if( defined('WPINC') && (! is_admin()) ){ |
| 80 |
$return['schedule'] = array( '', '← ' . '__Schedule__' ); |
| 81 |
} |
| 82 |
|
| 83 |
return $return; |
| 84 |
} |
| 85 |
} |