summaryrefslogtreecommitdiffstats
path: root/stats.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-12-17 08:41:21 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-12-17 08:41:21 +0000
commit7c661ba685287efd21512f9f0203641200bffed2 (patch)
treeb99371285778815b3faabbaae6b9e8d7bf3e19e1 /stats.php
parentce1a8672d4b2d78b8301527311a410af893c4943 (diff)
downloadampache-7c661ba685287efd21512f9f0203641200bffed2.tar.gz
ampache-7c661ba685287efd21512f9f0203641200bffed2.tar.bz2
ampache-7c661ba685287efd21512f9f0203641200bffed2.zip
* Added Recommendations based on matching ratings between users
* Integrated LastFM plugin (defaults to disabled still) * Fixed a view issue with the Admin Localplay Level preference * removed some old MPD pages that were not being usedwq
Diffstat (limited to 'stats.php')
-rw-r--r--stats.php92
1 files changed, 41 insertions, 51 deletions
diff --git a/stats.php b/stats.php
index 48e58a63..6bd5e077 100644
--- a/stats.php
+++ b/stats.php
@@ -26,56 +26,46 @@
*/
require_once('lib/init.php');
-/* If we are a full admin then we can see other peoples stats! */
-if ($GLOBALS['user']->has_access(100) AND isset($_REQUEST['user_id'])) {
- $working_user = new User($_REQUEST['user_id']);
-}
-else {
- $working_user = $GLOBALS['user'];
-}
-
show_template('header');
-$title = $working_user->fullname . ' ' . _('Favorites') . ':';
+
+$action = scrub_in($_REQUEST['action']);
+
+/* Switch on the action to be performed */
+switch ($action) {
+ case 'user_stats':
+ /* Get em! */
+ $working_user = new User($_REQUEST['user_id']);
+
+ /* Pull favs */
+ $favorite_artists = $working_user->get_favorites('artist');
+ $favorite_albums = $working_user->get_favorites('album');
+ $favorite_songs = $working_user->get_favorites('song');
+
+ require_once(conf('prefix') . '/templates/show_user_stats.inc.php');
+
+ break;
+ /* Show their stats */
+ default:
+ /* Here's looking at you kid! */
+ $working_user = $GLOBALS['user'];
+
+ /* Pull favs */
+ $favorite_artists = $working_user->get_favorites('artist');
+ $favorite_albums = $working_user->get_favorites('album');
+ $favorite_songs = $working_user->get_favorites('song');
+
+ require_once(conf('prefix') . '/templates/show_user_stats.inc.php');
+
+ /* Build Recommendations from Ratings */
+ $recommended_artists = $working_user->get_recommendations('artist');
+ $recommended_albums = $working_user->get_recommendations('albums');
+ $recommended_songs = $working_user->get_recommendations('song');
+
+ require_once(conf('prefix') . '/templates/show_user_recommendations.inc.php');
+
+ break;
+} // end switch on action
+
+show_footer();
+
?>
-<?php require (conf('prefix') . '/templates/show_box_top.inc.php'); ?>
-<table cellpadding="5" cellspacing="5" border="0" width="100%">
- <tr>
- <td valign="top">
- <?php
- if ( $items = $working_user->get_favorites('artist') ) {
- $items = $working_user->format_favorites($items);
- show_info_box('Favorite Artists', 'artist', $items);
- }
- else {
- echo "<span class=\"error\">" . _('Not Enough Data') . "</span>";
- }
- ?>
- </td>
-
- <td valign="top">
- <?php
- if ( $items = $working_user->get_favorites('song') ) {
- $items = $working_user->format_favorites($items);
- show_info_box('Favorite Songs', 'your_song', $items);
- }
- else {
- echo "<span class=\"error\">" . _('Not Enough Data') . "</span>";
- }
- ?>
- </td>
-
- <td valign="top">
- <?php
- if ( $items = $working_user->get_favorites('album') ) {
- $items = $working_user->format_favorites($items);
- show_info_box('Favorite Albums', 'album', $items);
- }
- else {
- echo "<span class=\"error\">" . _('Not Enough Data') . "</span>";
- }
- ?>
- </td>
- </tr>
-</table>
-<?php require (conf('prefix') . '/templates/show_box_bottom.inc.php'); ?>
-<?php show_footer(); ?>