PluginProbe
ShiftController Employee Shift Scheduling / trunk
ShiftController Employee Shift Scheduling vtrunk
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 / hc3 / ui / layout.php

layout.php in ShiftController Employee Shift Scheduling trunk, at hc3/ui/layout.php

77 lines 1.8 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 HC3_Ui_Layout
3 {
4 public $ui, $uri, $request, $topmenu, $auth, $usersQuery, $usersPresenter;
5
6 public function __construct(
7 HC3_Hooks $hooks,
8 HC3_Ui $ui,
9 HC3_Request $request,
10 HC3_Ui_Topmenu $topmenu,
11
12 HC3_Uri $uri,
13 HC3_Auth $auth,
14 HC3_Users_Query $usersQuery,
15 HC3_Users_Presenter $usersPresenter
16 )
17 {
18 $this->ui = $ui;
19 $this->uri = $uri;
20 $this->request = $request;
21 $this->topmenu = $topmenu;
22
23 $this->auth = $hooks->wrap( $auth );
24 $this->usersQuery = $hooks->wrap( $usersQuery );
25 $this->usersPresenter = $hooks->wrap( $usersPresenter );
26 }
27
28 public function render( $content )
29 {
30 $options = $this->topmenu->getChildren();
31 $topmenu = array();
32 foreach( $options as $item ){
33 $link = $this->ui->makeAhref( $item[0], $item[1] )
34 ->tag('tab-link')
35 ;
36
37 if( $this->uri->isFullUrl($item[0]) ){
38 $link->newWindow();
39 }
40
41 $topmenu[] = $link;
42 }
43 $topmenu = $this->ui->makeList( $topmenu )
44 ->gutter(1)
45 ;
46
47 $topmenuLabel = '__Menu__';
48
49 $currentUser = $this->auth->getCurrentUser();
50 $currentUserId = $currentUser->getId();
51
52 if( $currentUserId ){
53 $currentUser = $this->usersQuery->findById( $currentUserId );
54 $currentUserLabel = $this->usersPresenter->presentTitle( $currentUser );
55 // $topmenuLabel = $this->ui->makeListInline( array($topmenuLabel, $currentUserLabel) );
56 $topmenuLabel = $currentUserLabel;
57 }
58
59 $topmenu = $this->ui->makeCollapse( $topmenuLabel, $topmenu )
60 ->border(FALSE)
61 ->arrow('&#9776;')
62 ;
63
64 $topmenu = $this->ui->makeBlock( $topmenu )
65 ->tag('border', 'bottom')
66 ->tag('border-color', 'gray')
67 ->padding(2)
68 ;
69
70 $out = $this->ui->makeList()
71 ->add( $topmenu )
72 ->add( $content )
73 ;
74
75 return $out;
76 }
77 }