2024-06-10 14:08:26 +02:00
< h5 > Artistes list </ h5 >
2024-06-18 17:27:04 +02:00
< div class = " sorting-search " >
< form action = " <?= site_url('Artistes/tri'); ?> " method = " get " class = " tri-form " >
< select name = " Ctri " class = " tri-select " >
< option value = " " > Trier </ option >
< option value = " ASC " < ? php echo isset ( $_GET [ 'Ctri' ]) && $_GET [ 'Ctri' ] == 'ASC' ? ' selected' : '' ; ?> >Trie A-Z</option>
< option value = " DESC " < ? php echo isset ( $_GET [ 'Ctri' ]) && $_GET [ 'Ctri' ] == 'DESC' ? ' selected' : '' ; ?> >Trie Z-A</option>
< option value = " year ASC " < ? php echo isset ( $_GET [ 'Ctri' ]) && $_GET [ 'Ctri' ] == 'year ASC' ? ' selected' : '' ; ?> >Trie par année (croissant)</option>
< option value = " year DESC " < ? php echo isset ( $_GET [ 'Ctri' ]) && $_GET [ 'Ctri' ] == 'year DESC' ? ' selected' : '' ; ?> >Trie par année (décroissant)</option>
</ select >
< button type = " submit " class = " tri-button " > Appliquer le tri </ button >
</ form >
</ ul >
< form action = " <?= site_url('Artistes/search'); ?> " method = " get " class = " search-form " >
< input type = " text " name = " query " placeholder = " Chercher des albums " class = " search-input " >
< button type = " submit " class = " search-button " > Rechercher </ button >
</ form >
< ? php if ( isset ( $is_search ) && $is_search ) : ?>
< form action = " <?= site_url('Albums'); ?> " method = " get " class = " back-form " >
< button type = " submit " class = " back-button " > Retour à la liste complète </ button >
</ form >
< ? php endif ; ?>
</ div >
< ? php if ( isset ( $is_search ) && $is_search ) : ?>
< p > Nombre de résultats : < ? php echo $num_results ; ?> </p>
< ? php endif ; ?>
2024-06-10 14:08:26 +02:00
< section class = " list " >
< ? php
$artistAlbums = array ();
foreach ( $artistes as $artist ) {
if ( ! array_key_exists ( $artist -> artistName , $artistAlbums )) {
$artistAlbums [ $artist -> artistName ] = array ();
}
$artistAlbums [ $artist -> artistName ][] = array (
'albumName' => $artist -> albumName ,
2024-06-17 15:10:10 +02:00
'albumId' => $artist -> albumId ,
2024-06-10 14:08:26 +02:00
'year' => $artist -> year
);
}
foreach ( $artistAlbums as $artistName => $albums ) {
echo " <div><article> " ;
echo " <header class='short-text'> " ;
echo " <h2> $artistName </h2> " ;
echo " </header> " ;
echo " <ul> " ;
foreach ( $albums as $album ) {
2024-06-17 15:10:10 +02:00
echo " <li> " . anchor ( " music/view/ { $album [ 'albumId' ] } " , $album [ 'albumName' ]) . " - " . $album [ 'year' ] . " </li> " ;
2024-06-18 18:58:04 +02:00
echo " <button onclick= \" location.href=' " . site_url ( " playlist/choix_playlist/ { $album [ 'albumId' ] } " ) . " ' \" >Ajouter toutes les chansons à la Playlist</button> " ;
2024-06-10 14:08:26 +02:00
}
echo " </ul> " ;
echo " </article></div> " ;
}
?>
</ section >