summaryrefslogtreecommitdiffstats
path: root/templates/sidebar.inc.php
blob: 42f2b3bba379b469d85488dadd6acf9eb03fd8c9 (plain)
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
<?php
/*

 Copyright (c) Ampache.org
 All rights reserved.

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License v2
 as published by the Free Software Foundation.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

*/

if (!$_SESSION['state']['sidebar_tab']) { $_SESSION['state']['sidebar_tab'] = 'home'; } 
$class_name = 'sidebar_' . $_SESSION['state']['sidebar_tab'];
${$class_name} = ' active';

// List of buttons ( id, title, icon, access level)
$sidebar_items[] = array('id'=>'home', 'title'=>_('Home'), 'icon'=>'home', 'access'=>5);
$sidebar_items[] = array('id'=>'localplay', 'title'=>_('Localplay'), 'icon'=>'volumeup', 'access'=>5);
$sidebar_items[] = array('id'=>'preferences', 'title'=>_('Preferences'), 'icon'=>'edit', 'access'=>5);
$sidebar_items[] = array('id'=>'modules','title'=>_('Modules'),'icon'=>'plugin','access'=>5); 
$sidebar_items[] = array('id'=>'admin', 'title'=>_('Admin'), 'icon'=>'admin', 'access'=>100);


$web_path = Config::get('web_path');
$ajax_url = Config::get('ajax_url'); 

?>
<ul id="sidebar-tabs">
<?php 
	foreach ($sidebar_items as $item) { 
		if (Access::check('interface',$item['access'])) {
			$li_params = "id='sb_tab_" . $item['id'] . "' class='sb1" . ${'sidebar_'.$item['id'] } . "'";
		?><li <?php echo $li_params; ?>>
      	<?php 
        // Button
        echo Ajax::button("?page=index&action=sidebar&button=".$item['id'],$item['icon'],$item['title'],'sidebar_'.$item['id']);
      	
      	// Include subnav if it's the selected one
      	// so that it's generated inside its parent li
	if ($item['id']==$_SESSION['state']['sidebar_tab']) {
      	  ?><div id="sidebar-page"><?php
      	  require_once Config::get('prefix') . '/templates/sidebar_' . $_SESSION['state']['sidebar_tab'] . '.inc.php';
      	  ?></div><?php
        }
       ?></li><?php
     }
	}
?>
<li id="sb_tab_logout" class="sb1">
	<a href="<?php echo Config::get('web_path'); ?>/logout.php" id="sidebar_logout" >
	<?php echo get_user_icon('logout',_('Logout')); ?>
	</a>
</li>
</ul>