diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-11-26 04:04:24 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-11-26 04:04:24 +0000 |
commit | a41697ea25a58ea5db5ed46a251fb62364626b1b (patch) | |
tree | 9754a325a5c700135e69e341b47d2658d2344762 /lib | |
parent | 0635397ab2bd5afc6789cef56b9a9d87bd52bcfd (diff) | |
download | ampache-a41697ea25a58ea5db5ed46a251fb62364626b1b.tar.gz ampache-a41697ea25a58ea5db5ed46a251fb62364626b1b.tar.bz2 ampache-a41697ea25a58ea5db5ed46a251fb62364626b1b.zip |
tweaked icons to use built in functions and removed them from where there were not icons for every optin, added recently played
Diffstat (limited to 'lib')
-rw-r--r-- | lib/class/view.class.php | 11 | ||||
-rw-r--r-- | lib/song.php | 26 |
2 files changed, 34 insertions, 3 deletions
diff --git a/lib/class/view.class.php b/lib/class/view.class.php index afc81b22..4f58677a 100644 --- a/lib/class/view.class.php +++ b/lib/class/view.class.php @@ -167,8 +167,15 @@ class View { @discussion initializes the view object, checks $_REQUEST for changes to the view object */ - function initialize() { - + function initialize($sql='') { + + /* From time to time we need to change the SQL statement while + * maintaining the paging + */ + if ($sql) { + $this->change_sql($sql); + } + if ($_REQUEST['sort_type']) { $this->change_sort_type($_REQUEST['sort_type']); } diff --git a/lib/song.php b/lib/song.php index 5156ca88..b1d3579d 100644 --- a/lib/song.php +++ b/lib/song.php @@ -42,7 +42,31 @@ function get_songs($sql, $action=0) { return $results; -} // get_albums +} // get_songs + +/** + * get_recently_played + * This function returns the last X songs that have been played + * It uses the 'popular' threshold to determine how many to pull + */ +function get_recently_played() { + + $sql = "SELECT object_count.object_id, object_count.user, object_count.object_type, object_count.date " . + "FROM object_count " . + "WHERE object_type='song' " . + "ORDER by object_count.date DESC " . + "LIMIT " . conf('popular_threshold'); + $db_results = mysql_query($sql, dbh()); + + $results = array(); + + while ($r = mysql_fetch_assoc($db_results)) { + $results[] = $r; + } + + return $results; + +} // get_recently_played /*! @function format_song |