63 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			63 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
function format_duration($seconds) {
 | 
						|
    $minutes = floor($seconds / 60);
 | 
						|
    $seconds = $seconds % 60;
 | 
						|
    return sprintf("%02d:%02d", $minutes, $seconds);
 | 
						|
}
 | 
						|
?>
 | 
						|
 | 
						|
<!DOCTYPE html>
 | 
						|
<html>
 | 
						|
<body>
 | 
						|
    <section class="section">
 | 
						|
        <div class="container">
 | 
						|
            <h1 class="title"><?= $song['songName'] ?></h1>
 | 
						|
            <div class="columns">
 | 
						|
                <div class="column is-one-third">
 | 
						|
                    <figure class="image">
 | 
						|
                        <?php if(isset($song['jpeg']) && $song['jpeg'] != ''): ?>
 | 
						|
                            <img src="data:image/jpeg;base64,<?= base64_encode($song['jpeg']) ?>" alt="<?= $song['albumName'] ?> Cover">
 | 
						|
                        <?php else: ?>
 | 
						|
                            <img src="path_to_default_image" alt="Default Cover">
 | 
						|
                        <?php endif; ?>
 | 
						|
                    </figure>
 | 
						|
                </div>
 | 
						|
                <div class="column">
 | 
						|
                    <div class="table-container">
 | 
						|
                        <table class="table is-striped is-fullwidth">
 | 
						|
                            <tbody>
 | 
						|
                                <tr>
 | 
						|
                                    <th>Album</th>
 | 
						|
                                    <td><?= anchor("albums/view/{$song['albumId']}", $song['albumName']) ?> (<?= $song['year'] ?>)</td>
 | 
						|
                                </tr>
 | 
						|
                                <tr>
 | 
						|
                                    <th>Artist</th>
 | 
						|
                                    <td><?= $song['artistName'] ?></td>
 | 
						|
                                </tr>
 | 
						|
                                <tr>
 | 
						|
                                    <th>Disk Number</th>
 | 
						|
                                    <td><?= $song['diskNumber'] ?></td>
 | 
						|
                                </tr>
 | 
						|
                                <tr>
 | 
						|
                                    <th>Track Number</th>
 | 
						|
                                    <td><?= $song['number'] ?></td>
 | 
						|
                                </tr>
 | 
						|
                                <tr>
 | 
						|
                                    <th>Duration</th>
 | 
						|
                                    <td><?= format_duration($song['duration']) ?></td>
 | 
						|
                                </tr>
 | 
						|
                            </tbody>
 | 
						|
                        </table>
 | 
						|
                    </div>
 | 
						|
                    <form method="post" action="<?= site_url('playlist/selectPlaylist') ?>">
 | 
						|
                        <input type="hidden" name="itemId" value="<?= $song['songId'] ?>">
 | 
						|
                        <input type="hidden" name="itemType" value="song">
 | 
						|
                        <button type="submit" class="button is-link">Ajouter à la playlist</button>
 | 
						|
                    </form>
 | 
						|
                </div>
 | 
						|
            </div>
 | 
						|
        </div>
 | 
						|
    </section>
 | 
						|
</body>
 | 
						|
</html>
 |