Nicely working now with several small javascript widgets.
[adorno.git] / inc / artist-list.php
blobd483e9282e10edb2ae409d256acaf184a14aa7e7
1 <?php
2 /**
3 * List artists
4 */
5 echo "<h3>Artists</h3>\n<p>";
6 $where = '';
7 $params = array();
8 if ( isset($search) ) {
9 $where = "(artist ~* :search OR album ~* :search OR title ~* :search OR path_name ~* :search) ";
10 $params[':search'] = $search;
12 if ( isset($altr) ) {
13 $altr = trim($altr);
14 $where .= ($where == ''? '' : ' AND ');
15 $where .= '(artist ~ :artist_match)';
16 $params[':artist_match'] = '^'.$altr;
18 if ( $where != '' ) $where = 'WHERE '. $where;
19 $sql = 'SELECT distinct ON (lower(artist)) artist FROM tracks '.$where.' ORDER BY lower(artist)';
20 $qry = new AwlQuery( $sql, $params );
22 if ( $qry->Exec('artist') && $qry->rows() > 0 ) {
23 while ( $artist = $qry->Fetch() ) {
24 $display = htmlspecialchars($artist->artist);
25 if ( trim($display) == "" ) $display = "&laquo;unknown&raquo;";
26 echo " <a href=\"?type=artist&a=" . urlencode($artist->artist) . "$letter_get\" class=\"artist\">$display</a>\n";