<?php
/**
* @package mediaman
* @version $Id: artists.php,v 1.5 2005/09/30 14:26:27 brechin Exp $
* @author Jason Brechin <hide@address.com>
* artists.php presents the artist list
*/
/**
* Standard requires
*/
require_once("lib/inc-common.php");
require_once(MM_PATH . '/lib/db.php');
require_once(MM_PATH . '/lib/music.php');
include( MM_PATH . '/lib/login.php');
includeStyle();
printNavbar();
$limit = 10;
$offset = 0;
if ( isset( $_GET['offset'] ) ) {
$offset = intval($_GET['offset']);
}
if ( isset( $_GET['limit'] ) ) {
$limit = intval($_GET['limit']);
}
?>
<div class='artists'>
<table><caption>Artists</caption>
<tr id='tableheading'><td>Artist</td><td>Track Count</td></tr>
<?
$rows = 0;
$artists = array();
list( $rows, $artists ) = getArtists($limit, $offset);
for ($index = 0; $index < sizeof($artists); $index++) {
$artistinfo = $artists[$index];
print( '<tr><td><a href="artist.php?id=' . $artistinfo[2] . '">' .
$artistinfo[0] . '</td><td>' . $artistinfo[1] . '</td></tr>');
}
?>
</table>
</div>
<?
//TODO: Add page number navigation
$webpath = MM_WEBPATH;
if ( $offset >= $limit ) {
pprint( "<a href='$webpath/artists.php?" .
'offset=' . strval($offset-$limit) .
'&limit=' . strval($limit) .
"'>Previous Page</a>" );
}
if ( $rows > ($offset + $limit) ) {
pprint( "<a href='$webpath/artists.php?" .
'offset=' . strval($offset+$limit) .
'&limit=' . strval($limit) .
"'>Next Page</a>" );
}
printBenchmark();
?>