From 99baf7582de072847cf6307d5b291168520554b1 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Mon, 3 Dec 2007 09:14:38 +0000 Subject: added paging to the playlist view, corrected a few stupid parse errors / mistakes --- lib/class/browse.class.php | 51 +++++++++++++++++++++++++++++++++++++++++++--- lib/init.php | 2 +- lib/stream.lib.php | 2 +- 3 files changed, 50 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/class/browse.class.php b/lib/class/browse.class.php index 2fb346f5..61baebcf 100644 --- a/lib/class/browse.class.php +++ b/lib/class/browse.class.php @@ -94,6 +94,17 @@ class Browse { } // reset_filters + /** + * reset_supplemental_objects + * This clears any sup objects we've added, normally called on every set_type + */ + public static function reset_supplemental_objects() { + + + $_SESSION['browse']['supplemental'] = array(); + + } // reset_supplemental_objects + /** * get_filter * returns the specified filter value @@ -127,6 +138,7 @@ class Browse { $_SESSION['browse']['type'] = $type; // Resets the simple browse self::set_simple_browse(0); + self::reset_supplemental_objects(); break; default: // Rien a faire @@ -256,6 +268,33 @@ class Browse { } // get_objects + /** + * get_supplemental_objects + * This returns an array of 'class','id' for additional objects that need to be + * created before we start this whole browsing thing + */ + public static function get_supplemental_objects() { + + $objects = $_SESSION['browse']['supplemental']; + + if (!is_array($objects)) { $objects = array(); } + + return $objects; + + } // get_supplemental_objects + + /** + * add_supplemental_object + * This will add a suplemental object that has to be created + */ + public static function add_supplemental_object($class,$uid) { + + $_SESSION['browse']['supplemental'][$class] = intval($uid); + + return true; + + } // add_supplemental_object + /** * get_base_sql * This returns the base SQL (select + from) for the different types @@ -537,13 +576,21 @@ class Browse { if (count($object_ids) > self::$start) { $object_ids = array_slice($object_ids,self::$start,$limit); } -print_r($object_ids); + // Format any matches we have so we can show them to the masses $match = $_SESSION['browse']['filter']['alpha_match'] ? ' (' . $_SESSION['browse']['filter']['alpha_match'] . ')' : ''; // Set the correct classes based on type $class = "box browse_".$_SESSION['browse']['type']; + // Load any additional object we need for this + $extra_objects = self::get_supplemental_objects(); + + foreach ($extra_objects as $class_name => $id) { + ${$class_name} = new $class_name($id); + } + + // Switch on the type of browsing we're doing switch ($_SESSION['browse']['type']) { case 'song': show_box_top(_('Songs') . $match, $class); @@ -581,8 +628,6 @@ print_r($object_ids); show_box_bottom(); break; case 'playlist_song': - // We need a playlist for this one man this is a hack, should figure out a better way - $playlist = $GLOBALS['playlist']; show_box_top(_('Playlist Songs') . $match,$class); require_once Config::get('prefix') . '/templates/show_playlist_songs.inc.php'; show_box_bottom(); diff --git a/lib/init.php b/lib/init.php index 668ae41f..0342b01f 100644 --- a/lib/init.php +++ b/lib/init.php @@ -81,7 +81,7 @@ if (!count($results)) { } /** This is the version.... fluf nothing more... **/ -$results['version'] = '3.4-Alpha4 Build (002)'; +$results['version'] = '3.4-Alpha4 Build (003)'; $results['int_config_version'] = '6'; $results['raw_web_path'] = $results['web_path']; diff --git a/lib/stream.lib.php b/lib/stream.lib.php index 30721837..588f9251 100644 --- a/lib/stream.lib.php +++ b/lib/stream.lib.php @@ -27,7 +27,7 @@ function show_now_playing() { // GC! Stream::gc_session(); - gc_now_playing(); + Stream::gc_now_playing(); $web_path = Config::get('web_path'); $results = get_now_playing(); -- cgit