diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2009-03-09 15:32:18 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2009-03-09 15:32:18 +0000 |
commit | 50036b1fad29cc7e2b2da30cc63d95e48c625a2a (patch) | |
tree | 042c5dc1a29cdc5901138ef4267309e4dbd97035 | |
parent | 242401a915eb2600f242af92c98cc9dc7190735c (diff) | |
download | ampache-50036b1fad29cc7e2b2da30cc63d95e48c625a2a.tar.gz ampache-50036b1fad29cc7e2b2da30cc63d95e48c625a2a.tar.bz2 ampache-50036b1fad29cc7e2b2da30cc63d95e48c625a2a.zip |
fix some browsing issues I created with the query switch, considering having browse class extend query
-rw-r--r-- | lib/class/browse.class.php | 12 | ||||
-rw-r--r-- | lib/search.php | 28 | ||||
-rw-r--r-- | localplay.php | 3 | ||||
-rw-r--r-- | search.php | 1 |
4 files changed, 15 insertions, 29 deletions
diff --git a/lib/class/browse.class.php b/lib/class/browse.class.php index 99fd42da..2aea8a8d 100644 --- a/lib/class/browse.class.php +++ b/lib/class/browse.class.php @@ -211,6 +211,16 @@ class Browse { } // set_static_content /** + * save_objects + * This calles the internal query stuff + */ + public static function save_objects($results) { + + Query::save_objects($results); + + } // save_objects + + /** * get_saved * This looks in the session for the saved * stuff and returns what it finds @@ -224,7 +234,7 @@ class Browse { if (!Query::is_simple()) { // If not then we're going to need to read from the database :( - $sid = session_id() . '::' . self::$type; + $sid = session_id() . '::' . Query::get_type(); $sql = "SELECT `data` FROM `tmp_browse` WHERE `sid`='$sid'"; $db_results = Dba::read($sql); diff --git a/lib/search.php b/lib/search.php index 01946745..4a10aff7 100644 --- a/lib/search.php +++ b/lib/search.php @@ -182,7 +182,7 @@ function search_song($data,$operator,$method,$limit) { // This is a little more complext, pull a list of IDs that have this average rating $rating_sql = "SELECT `object_id`,AVG(`rating`.`rating`) AS avgrating FROM `rating` " . "WHERE `object_type`='song' GROUP BY `object_id`"; - $db_results = Dba::query($rating_sql); + $db_results = Dba::read($rating_sql); // Fill it with one value to prevent sql error on no results $where_sql .= " `song`.`id` IN ("; @@ -238,7 +238,7 @@ function search_song($data,$operator,$method,$limit) { */ $_SESSION['userdata']['stored_search'] = $sql; - $db_results = Dba::query($sql); + $db_results = Dba::read($sql); $results = array(); @@ -251,28 +251,4 @@ function search_song($data,$operator,$method,$limit) { } // search_songs -/** - * show_search - * This shows the results of a search, it takes the input from a run_search function call - * @package Search - * @catagory Display - */ -function show_search($type,$results) { - - /* Display based on the type of object we are trying to view */ - switch ($type) { - case 'artist': - - break; - case 'album': - - break; - case 'song': - default: - show_songs($results,0); - break; - } // end type switch - -} // show_search - ?> diff --git a/localplay.php b/localplay.php index 27871aa0..6aef4b2b 100644 --- a/localplay.php +++ b/localplay.php @@ -83,8 +83,7 @@ switch ($_REQUEST['action']) { require_once Config::get('prefix') . '/templates/show_localplay_status.inc.php'; Browse::set_type('playlist_localplay'); Browse::set_static_content(1); - Browse::save_objects($objects); - Browse::show_objects(); + Browse::show_objects($objects); break; } // end switch action @@ -45,6 +45,7 @@ switch ($_REQUEST['action']) { $results = run_search($_REQUEST); Browse::set_type('song'); Browse::reset(); + Browse::save_objects($results); Browse::show_objects($results); break; case 'save_as_track': |