summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-09-20 01:56:42 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-09-20 01:56:42 +0000
commit649c44446a2368ac004ffa5778704f7213cf54ad (patch)
treeba7ff7c8cdfd75f78ada744d51b7cc04ac452900 /lib
parentc796c8be3803cf7e49b39a2d3fbb9f85f7e7667c (diff)
downloadampache-649c44446a2368ac004ffa5778704f7213cf54ad.tar.gz
ampache-649c44446a2368ac004ffa5778704f7213cf54ad.tar.bz2
ampache-649c44446a2368ac004ffa5778704f7213cf54ad.zip
more sorting fixes, and move catalog stats to statistics
Diffstat (limited to 'lib')
-rw-r--r--lib/class/browse.class.php10
-rw-r--r--lib/class/catalog.class.php24
-rw-r--r--lib/ui.lib.php47
3 files changed, 34 insertions, 47 deletions
diff --git a/lib/class/browse.class.php b/lib/class/browse.class.php
index 3ed20eae..fae2670b 100644
--- a/lib/class/browse.class.php
+++ b/lib/class/browse.class.php
@@ -128,6 +128,9 @@ class Browse {
case 'artist':
$valid_array = array('name');
break;
+ case 'genre':
+ $valid_array = array('name');
+ break;
case 'album':
$valid_array = array('name','year');
break;
@@ -455,6 +458,13 @@ class Browse {
break;
} // end switch
break;
+ case 'genre':
+ switch ($field) {
+ case 'name':
+ $sql = "`genre`.`name`";
+ break;
+ } // end switch
+ break;
default:
// Rien a faire
break;
diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php
index e4aa43a2..f07c1b9a 100644
--- a/lib/class/catalog.class.php
+++ b/lib/class/catalog.class.php
@@ -144,6 +144,30 @@ class Catalog {
$results = self::count_songs($catalog_id);
$results = array_merge(self::count_users($catalog_id),$results);
+ $hours = floor($results['time']/3600);
+ $size = $results['size']/1048576;
+ $days = floor($hours/24);
+ $hours = $hours%24;
+
+ $time_text = "$days ";
+ $time_text .= ($days == 1) ? _('day') : _('days');
+ $time_text .= ", $hours ";
+ $time_text .= ($hours == 1) ? _('hour') : _('hours');
+
+ $results['time_text'] = $time_text;
+
+ if ($size > 1024) {
+ $total_size = sprintf("%.2f",($size/1024));
+ $size_unit = "GB";
+ }
+ else {
+ $total_size = sprintf("%.2f",$size);
+ $size_unit = "MB";
+ }
+
+ $results['total_size'] = $total_size;
+ $results['size_unit'] = $size_unit;
+
return $results;
} // get_stats
diff --git a/lib/ui.lib.php b/lib/ui.lib.php
index 13065075..df4251b3 100644
--- a/lib/ui.lib.php
+++ b/lib/ui.lib.php
@@ -412,53 +412,6 @@ function show_all_popular() {
} // show_all_popular
/**
- * show_local_catalog_info
- * Shows the catalog stats
- * @package Web INterface
- * @catagory Display
- */
-function show_local_catalog_info() {
-
- /* Before we display anything make sure that they have a catalog */
- $query = "SELECT * FROM catalog";
- $db_results = Dba::query($query);
-
- // Make sure we have something to display
- if (Dba::num_rows($db_results) < 1) {
- show_box_top();
- echo "<span align=\"center\" class=\"error\">" . _('No Catalogs Found!') . "</span><br />";
- echo "<a href=\"" . Config::get('web_path') . "/admin/catalog.php?action=show_add_catalog\">" ._('Add a Catalog') . "</a>";
- show_box_bottom();
- return false;
- }
-
- $results = Catalog::get_stats();
-
- $hours = floor($results['time']/3600);
- $size = $results['size']/1048576;
-
- $days = floor($hours/24);
- $hours = $hours%24;
-
- $time_text = "$days ";
- $time_text .= ($days == 1) ? _("day") : _("days");
- $time_text .= ", $hours ";
- $time_text .= ($hours == 1) ? _("hour") : _("hours");
-
- if ( $size > 1024 ) {
- $total_size = sprintf("%.2f", ($size/1024));
- $size_unit = "GB";
- }
- else {
- $total_size = sprintf("%.2f", $size);
- $size_unit = "MB";
- }
-
- require Config::get('prefix') . '/templates/show_local_catalog_info.inc.php';
-
-} // show_local_catalog_info
-
-/**
* img_resize
* this automaticly resizes the image for thumbnail viewing
* only works on gif/jpg/png this function also checks to make