File: show_menu.inc.php

package info (click to toggle)
ibwebadmin 0.98-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,916 kB
  • ctags: 1,950
  • sloc: php: 12,454; makefile: 7
file content (140 lines) | stat: -rw-r--r-- 4,811 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?php
// File           show_menu.inc.php / ibWebAdmin
// Purpose        intiate and display the main menu
// Author         Lutz Brueckner <irie@gmx.de>
// Copyright      (c) 2000, 2001, 2002, 2003 by Lutz Brueckner,
//                published under the terms of the GNU General Public Licence v.2,
//                see file LICENCE for details
// Created        Thu Aug 31 14:12:47 CEST 2000
//
// $Id: show_menu.inc.php,v 1.15 2004/03/07 16:12:55 lbrueckner Exp $

// Variables:     $active    text ($menu->items[][text]) of the active menu item 


$menuentries = array('Database'    => url_session('database.php'),
                     'Tables'      => url_session('tables.php'),
                     'Accessories' => url_session('accessories.php'),
                     'SQL'         => url_session('sql.php'),
                     'Data'        => url_session('data.php'),
                     'Users'       => url_session('user.php'),
                     'Admin'       => url_session('admin.php'));


// use TABMENU_STYLE == 'HTML' as default setting
if (!defined('TABMENU_STYLE')  
||  !in_array(TABMENU_STYLE, array('IMAGE', 'BUILD'))
||  (TABMENU_STYLE == 'BUILD'  &&  $s_tab_menu == FALSE)) {

?>

<table width="100%" bgcolor="<?php echo $s_cust['color']['background']; ?>" cellpadding="2" cellspacing="0">
   <tr>
      <td width="20" style="border-right:2px solid <?php echo $s_cust['color']['menuborder']; ?>; border-bottom:2px solid <?php echo $s_cust['color']['menuborder']; ?>">
         &nbsp;&nbsp;
      </td>
<?php

    foreach ($menuentries as $item => $script) {
        if ($active == $item) {
?>
      <td nowrap style="border-right:2px solid <?php echo $s_cust['color']['menuborder']; ?>; border-top:2px solid <?php echo $s_cust['color']['menuborder']; ?>">
         <a href="<?php echo $script; ?>" style="color:black; font-weight:bold;">
             &nbsp;&nbsp;<?php echo $menu_strings[$item]; ?>&nbsp;&nbsp;
         </a>
      </td>
<?php
        }
        else {
?>
      <td nowrap style="border-right:2px solid <?php echo $s_cust['color']['menuborder']; ?>; border-top:2px solid <?php echo $s_cust['color']['menuborder']; ?>; border-bottom:2px solid <?php echo $s_cust['color']['menuborder']; ?>;" bgcolor="<?php echo $s_cust['color']['panel']; ?>">
         <a href="<?php echo $script; ?>" style="color:black; font-weight:bold;">
             &nbsp;&nbsp;<?php echo $menu_strings[$item]; ?>&nbsp;&nbsp;
         </a>
      </td>
<?php

        }
    }
?>
      <td height="20" width="100%" style="border-bottom:2px solid <?php echo $s_cust['color']['menuborder']; ?>">
         &nbsp;
      </td>
   </tr>
</table>

<?php

}

// use one of the precalculated menus from the ./data directory
elseif (TABMENU_STYLE == 'IMAGE') {
    $png = DATAPATH.'menu_'.$s_cust['language'].'/'.MENU_WIDTH.'/'.$active.'.png';
?>
<table>
  <tr>
    <td>
      <map name="Menu">
<?php

    foreach ($menuentries as $item => $script) {
        echo '         <area shape="rect" coords="'.$menu_coords[$item].'" href="'.$script."\">\n";
    }
?>
      </map>
      <img src="<?php echo $png; ?>" usemap="#Menu" border=0>
    </td>
    <td width="100%">
      &nbsp;
    </td>
  </tr>
</table>
<?php

}

// TABMENU_STYLE == 'BUILD', create the menu images on the fly 
else {

    include_once('./inc/TabMenu.class.php');
        
   // create the subdir in the ./DATA directory if it is not already there
    if (!is_dir(DATAPATH.'menu_'.$s_cust['language'].'/'.MENU_WIDTH)) {

        if (!is_dir(DATAPATH.'menu_'.$s_cust['language'])) {

            if (!mkdir(DATAPATH.'menu_'.$s_cust['language'], 0777)) {
                die ('Error: can not create directory <b>'.DATAPATH.'menu_'.$s_cust['language']."</b><br>\n"
                     .'Please check the permissions and/or your settings for MENU_WIDTH and TAB_MENU in ./inc/configuration.inc.php.');
            }
        }

        if (!mkdir(DATAPATH.'menu_'.$s_cust['language'].'/'.MENU_WIDTH, 0777)) {
            die ('Error: can not create directory <b>'.DATAPATH.'menu_'.$s_cust['language'].'/'.MENU_WIDTH."</b><br>\n"
                 .'Please check the permissions and/or your settings for MENU_WIDTH and TAB_MENU in ./inc/configuration.inc.php.');
        }
    }

    $menu = new TabMenu;
    $menu->active = $menu_strings[$active];
    $menu->font = TTF_FONT;
    $menu->fontsize = TTF_SIZE;
    $menu->bg1 = 0xf6f7c0;
//    $menu->fg = 0x005000;
    $menu->s2 = 0x008000;
    $menu->s1 = 0xcaea62;
    $menu->forcewidth = MENU_WIDTH;

    foreach ($menuentries as $item => $script) {
        $menu->addItem($menu_strings[$item], $script);
    }

    $png = DATAPATH.'menu_'.$s_cust['language'].'/'.MENU_WIDTH.'/'.$active.'.png';
    $menu->pngname = $png;
    	
    $menu->buildPNG();
    echo $menu->buildMenuTable();

}

?>