@@ -18,18 +18,7 @@ public function __construct($theme, $page) {
18
18
protected function renderLinks () {
19
19
$ webroot = $ this ->app ->request ->webRoot ;
20
20
$ rc = '<link rel="stylesheet" href=" ' .$ webroot .FontAwesome::getUri ().'" rel="stylesheet" type="text/css"> ' .
21
- '<link rel="stylesheet" href=" ' .$ webroot .Bootstrap::getCssUri ().'" rel="stylesheet" type="text/css"> ' .
22
- '<style> ' .
23
- '.dropdown-item.nav-link { ' .
24
- 'padding: .25rem 1.5rem !important; ' .
25
- '} ' .
26
- '.navbar-dark .dropdown-item.nav-link:hover, ' .
27
- '.navbar-dark .dropdown-item.nav-link:active, ' .
28
- '.navbar-dark .dropdown-item.nav-link:focus { ' .
29
- 'color: #333333 !important; ' .
30
- 'background-color: #f8f9fa !important; ' .
31
- '} ' .
32
- '</style> ' ;
21
+ '<link rel="stylesheet" href=" ' .$ webroot .Bootstrap::getCssUri ().'" rel="stylesheet" type="text/css"> ' ;
33
22
if ($ this ->theme ->hasFeature (BootstrapTheme::DATEPICKER )) {
34
23
$ rc .= '<link rel="stylesheet" href=" ' .Utils::getCssBasePath (TRUE ).'/bootstrap-datepicker.min.css" rel="stylesheet" type="text/css"> ' ;
35
24
}
@@ -109,38 +98,36 @@ protected function renderNavbarContent() {
109
98
}
110
99
}
111
100
$ rc .= '</ul> ' ;
112
- $ principal = $ this -> app -> getPrincipal ();
113
- if ( $ principal != NULL ) {
114
- $ rc .= ' <ul class="navbar-nav user-menu"> ' ;
115
- $ userMenu = $ this -> app -> getMenu ( ' user ' );
116
- if ( $ userMenu == NULL ) {
117
- $ userMenu = array ();
101
+
102
+ $ userMenu = $ this -> app -> getMenu ( ' user ' );
103
+ if ( $ userMenu == NULL ) {
104
+ $ userMenu = array ( );
105
+ $ principal = $ this -> app -> getPrincipal ();
106
+ if ( $ principal != NULL ) {
118
107
$ userItem = new \WebApp \Component \MenuItem ($ this , $ principal ->__toString (), '# ' );
119
108
$ logoutLink = $ this ->app ->getPageLink ('logout ' );
120
109
if ($ logoutLink != NULL ) $ logoutLink = $ this ->app ->router ->getCanonicalPath ($ logoutLink );
121
110
else $ logoutLink = '' ;
122
111
$ userMenu [] = new \WebApp \Component \MenuItem ($ userItem , 'logout_label ' , $ logoutLink .'?logout ' );
123
112
$ userMenu = array ($ userItem );
124
- }
125
- if (($ userMenu != NULL ) && is_array ($ userMenu )) {
126
- //$userMenu[] = new \WebApp\Component\MenuItem($this, 'logout_label', '?logout');
127
- foreach ($ userMenu AS $ menuItem ) {
128
- $ rc .= $ this ->theme ->renderComponent ($ menuItem );
113
+ } else if ($ this ->app ->getPageLink ('login ' ) != NULL ) {
114
+ $ uri = $ this ->app ->request ->uri ;
115
+ $ login = $ this ->app ->router ->getCanonicalPath ($ this ->app ->getPageLink ('login ' ));
116
+ if ($ this ->app ->request ->originalPath == $ login ) {
117
+ $ uri = $ this ->app ->request ->originalPath ;
118
+ } else {
119
+ $ uri = $ login .'?return= ' .urlencode ($ this ->app ->request ->originalPath );
129
120
}
130
-
131
- }
132
- //$rc .= '<span class="navbar-text align-middle">'.$principal->__toString().'<a class="px-2" href="?logout"><i class="fas fa-sign-out-alt fa-lg"></i></a></span>';
133
- $ rc .= '</ul> ' ;
134
- } else if ($ this ->app ->getPageLink ('login ' ) != NULL ) {
135
- $ uri = $ this ->app ->request ->uri ;
136
- $ login = $ this ->app ->router ->getCanonicalPath ($ this ->app ->getPageLink ('login ' ));
137
- if ($ this ->app ->request ->originalPath == $ login ) {
138
- $ uri = $ this ->app ->request ->originalPath ;
139
- } else {
140
- $ uri = $ login .'?return= ' .urlencode ($ this ->app ->request ->originalPath );
121
+ $ userMenu [] = '<span class="navbar-text align-middle"><a class="px-2" href=" ' .$ uri .'"> ' .I18N ::_ ('login_label ' ).'</a></span> ' ;
141
122
}
142
- $ rc .= '<span class="navbar-text align-middle"><a class="px-2" href=" ' .$ uri .'"> ' .I18N ::_ ('login_label ' ).'</a></span> ' ;
123
+ }
124
+
125
+ if ($ userMenu != NULL ) {
126
+ $ rc .= '<ul class="navbar-nav user-menu"> ' ;
127
+ $ rc .= $ this ->theme ->renderComponent ($ userMenu );
128
+ $ rc .= '</ul> ' ;
143
129
}
130
+
144
131
$ rc .= '</nav> ' ;
145
132
return $ rc ;
146
133
}
0 commit comments