summaryrefslogtreecommitdiffstats
path: root/templates/sidebar.inc.php
blob: 0df1240a39f215dc4c9bb1b5dae885465435cdac (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
/* vim:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab: */
/**
 *
 * LICENSE: GNU General Public License, version 2 (GPLv2)
 * Copyright 2001 - 2013 Ampache.org
 *
 * 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' => T_('Home'), 'icon'=>'home', 'access'=>5);
$sidebar_items[] = array('id'=>'localplay', 'title' => T_('Localplay'), 'icon'=>'volumeup', 'access'=>5);
$sidebar_items[] = array('id'=>'preferences', 'title' => T_('Preferences'), 'icon'=>'edit', 'access'=>5);
$sidebar_items[] = array('id'=>'modules','title' => T_('Modules'),'icon'=>'plugin','access'=>100);
$sidebar_items[] = array('id'=>'admin', 'title' => T_('Admin'), 'icon'=>'admin', 'access'=>100);


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

?>
<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', T_('Logout')); ?>
	</a>
</li>
</ul>