user-menu.php 1.46 KB
Newer Older
1
<?php
Mike Sheldon's avatar
Mike Sheldon committed
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
/* GNU FM -- a free network service for sharing your music listening habits

   Copyright (C) 2009 Free Software Foundation, Inc

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU Affero General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   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 Affero General Public License for more details.

   You should have received a copy of the GNU Affero General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.

*/

function user_menu($user, $active_page) {
	global $this_user;

	$submenu = array(
25
		array('name' => _('Overview'), 'url' => $user->getURL())
Mike Sheldon's avatar
Mike Sheldon committed
26
	);
27 28 29 30 31 32 33

	if(!$user->remote) {
		$submenu[] = array('name' => _('Stats'), 'url' => $user->getURL('stats'));
	}

	$submenu[] = array('name' => _('Recent Tracks'), 'url' => $user->getURL('recent-tracks'));

34
	if ($user->hasLoved()) {
35
		$submenu[] = array('name' => _('Radio Stations'), 'url' => $user->getURL('station'));
Mike Sheldon's avatar
Mike Sheldon committed
36
	}
37
	if ($user->name == $this_user->name) {
38
		$submenu[] = array('name' => _('Edit'), 'url' => $user->getURL('edit'));
Mike Sheldon's avatar
Mike Sheldon committed
39 40 41 42 43 44 45 46
	}

	foreach ($submenu as &$item) {
		$item['active'] = ($item['name'] == $active_page);
	}

	return $submenu;
}