Subversion Repositories computer_asset_manager_v2

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
46 rodolico 1
               <div class="menu">
2
                  <div class="boxtitle">
42 rodolico 3
                     Menu 
4
                  </div>
5
                  <?php 
45 rodolico 6
                     if ( isset( $_SESSION['user'] ) && $_SESSION['user']->name() ) {
7
                        include_once("DBMenu.class.php");
8
                        $menu = new DBMenu( $dbConnection, '_menu', '_menu_id' );
46 rodolico 9
                        $additionalMenus = array( 
10
                              array( 
11
                                 'caption' => 'User: ' . $_SESSION['user']->name(), 
12
                                 'url' => "/index.php?doAdmin=1",
13
                                 'shortname' => 'user'
14
                              ), 
15
                              array( 
16
                                 'caption' => 'Log Out',
17
                                 'url' => "/index.php?logout=1",
18
                                 'shortname' => 'logout'
19
                              ) 
20
                           );
21
                        if ( $_SESSION['user']->isAdmin() ) {
22
                           $additionalMenus[] = array( 
23
                                 'caption' => 'Administration', 
55 rodolico 24
                                 'url' => "/index.php?module=admin",
46 rodolico 25
                                 'shortname' => 'admin'
26
                              );
27
                        }
50 rodolico 28
                        /* 
29
                         * if they are an admin, pass an empty array
30
                         * which gives them all menu. If not an admin
31
                         * pass in the permissions
32
                         */
33
                        print $menu->DBMenu2String( $baseURL, $additionalMenus, $_SESSION['user']->isAdmin() ? array() : $_SESSION['user']->getPermissionList() );
45 rodolico 34
                     }
42 rodolico 35
                  ?>
36
               </div>