\n
\n \n \n \n"; $thetable = $wpdb->prefix . $TABLE_NAME[TABLE_ARTIST_MUSIC_ALBUMS]; $query = "SELECT * FROM $thetable ORDER BY album_date DESC"; $num = $wpdb->query($query); if($num === FALSE) { wp_die( sprintf(__('An error occurred while trying to perform a query: "%s"', $i18n_domain), $query) ); } else { $row = $wpdb->get_row($query, ARRAY_A, 0); $cols = 4; $rows = ((int)($num / $cols) < (float)($num / $cols)) ? (int)($num / $cols) + 1 : (int)($num / $cols); $width = '150px'; $height = '150px'; echo "
$init_artist
\n"; if ($num === 0) { echo " \n \n \n"; } else { for ($i = 0; $i < $rows; $i++) { echo " \n"; for($j = 0; $j < $cols && ((($cols * ($i)) + ($j+1)) <= $num); $j++) { $album_id = $row['id']; $picture_url = stripslashes($row['picture_url']); $download_id = stripslashes($row['download_id']); $artist_name = stripslashes($row['artist_name']); $album_name = stripslashes($row['album_name']); $album_date = stripslashes($row['album_date']); $artist_url = stripslashes($row['artist_url']); $store_url = stripslashes($row['store_url']); $free_download_enabled = $row['free_download_enabled']; $featured = $row['featured']; $description = stripslashes($row['description']); $thetable = $wpdb->prefix . $TABLE_NAME[TABLE_ARTIST_ALBUM_LINKER]; $query = "SELECT * FROM $thetable WHERE artist_id='$artist_id' AND album_id='$album_id'"; $num2 = $wpdb->query($query); if($num2 === FALSE) { wp_die( sprintf(__('An error occurred while trying to perform a query: "%s"', $i18n_domain), $query) ); } else { $row2 = $wpdb->get_row($query, ARRAY_A, $j); if ($num2 > 0) { $album_checked = 'checked '; } else { $album_checked = ''; } echo " \n"; } } for($j; $j < $cols; $j++) { echo "\n"; } echo " \n"; if ($i < ($rows-1)) { echo "\n"; } } } } echo "\n
" .__('No Music Available in the Database!', $i18n_domain). "
\n
\n
\n $artist_name
\n $album_name
\n
\n Link this Album
\n
\n
\n
 

"; } function display_artist_discography ($artist_id = 0) { $thetable = $wpdb->prefix . $TABLE_NAME[TABLE_ARTIST_MUSIC_ALBUMS]; $thetable2 = $wpdb->prefix . $TABLE_NAME[TABLE_ARTIST_ALBUM_LINKER]; $query = "SELECT * FROM $thetable WHERE id IN (SELECT album_id FROM $thetable2 WHERE artist_id=$artist_id AND enabled=1) ORDER BY album_date DESC"; $num = $wpdb->query($query); if($num === FALSE) { wp_die( sprintf(__('An error occurred while trying to perform a query: "%s"', $i18n_domain), $query) ); } else { $cols = 1; $rows = ((int)($num / $cols) < (float)($num / $cols)) ? (int)($num / $cols) + 1 : (int)($num / $cols); $width = '225px'; //'150px'; $height = '225px'; //'150px'; $discog_html .= "
\n"; if ($num == 0) { $discog_html .= " \n"; } else { for ($i = 0; $i < $rows; $i++) { $discog_html .= " \n"; for($j = 0; $j < $cols && ((($cols * ($i)) + ($j+1)) <= $num); $j++) { $row = $wpdb->get_row($query, ARRAY_A, $j); $id = $row['id']; $picture_url = stripslashes($row['picture_url']); $download_id = stripslashes($row['download_id']); $artist_id = NULL; $artist_name = stripslashes($row['artist_name']); $album_name = stripslashes($row['album_name']); $album_date = stripslashes($row['album_date']); $artist_url = stripslashes($row['artist_url']); $store_url = stripslashes($row['store_url']); $free_download_enabled = $row['free_download_enabled']; $featured = $row['featured']; $description = stripslashes($row['description']); $released = date("M",mktime(0,0,0,(int)substr($album_date, 5, 2), (int)substr($album_date, 8, 2), (int)substr($album_date, 0, 4))). "." .substr($album_date, 8, 2). "." .substr($album_date, 0, 4); $discog_html .= " \n \n"; } for($j; $j < $cols; $j++) { $discog_html .= "\n"; } $discog_html .= " \n"; if ($i < ($rows-1)) { $discog_html .= "\n"; } } } $discog_html .= "
" .__('No Music Available in the Database!', $i18n_domain). "
\n
\n $artist_name
\n $album_name
\n " .$released. " - $artist_name - $album_name
\n Released: " .date("M",mktime(0,0,0,(int)substr($album_date, 5, 2), (int)substr($album_date, 8, 2), (int)substr($album_date, 0, 4))). "." .substr($album_date, 8, 2). "." .substr($album_date, 0, 4). "
\n \n
\n
\n
\n \n $description\n \n
\n
 

\n"; } return $discog_html; } ?>