Ejemplo n.º 1
0
function echoRecherche()
{
    echo '
			<div id="contenu" class="cRecherche">
				<h2 class="hRecherche">Recherche</h2>
				<form method="REQUEST" action="">
					<input type="hidden" name="p" value="recherche" />
					<label for="q">Votre recherche : </label>
					<input type="text" id="q" name="q" size="25" placeholder="The Beatles, I am the Walrus…" value="' . (isset($_REQUEST["q"]) ? $_REQUEST["q"] : "") . '" />
					<select name="categorie">
						<option value="tout"' . isSelectedOption("tout") . '>Tout</option>
						<option value="Ar"' . isSelectedOption("Ar") . '>Artistes</option>
						<option value="Al"' . isSelectedOption("Al") . '>Albums</option>
						<option value="Ti"' . isSelectedOption("Ti") . '>Titres</option>
					</select>
					<input type="submit" value="Rechercher" />
				</form>';
    if (isset($_REQUEST["q"]) && isset($_REQUEST["categorie"])) {
        echo '
				<div class="divResultatsRecherche">';
        switch ($_REQUEST["categorie"]) {
            case "Ar":
                // Artiste
                rechercheArtiste();
                break;
            case "Al":
                // Album
                rechercheAlbum();
                break;
            case "Ti":
                // Titre
                rechercheTitre();
                break;
            case "tout":
                // Tout
                rechercheArtiste();
                rechercheAlbum();
                rechercheTitre();
                break;
            default:
                // echo "<p>Coucou ?</p>";
                break;
        }
        echo '
				</div>';
    }
    echo '
			</div>';
}
Ejemplo n.º 2
0
});
// Lecture APP
Flight::route('GET /album/@id', function ($id) {
    $album = json_decode(getAlbum($id));
    $Header_include = '<script type="text/javascript" src="' . _URL_APP_THEME_ . 'js/soundmanager2.js"></script>';
    //------
    if (isset($album->error)) {
        Flight::notFound();
    }
    //------
    Flight::render('album', array('album' => $album, 'tracks' => 'soon'), 'body_content');
    Flight::render('layout', array('Titre' => $album[0]->title, 'include_in_header' => $Header_include));
});
// Recherche
Flight::route('POST /recherche', function () {
    $response = json_decode(rechercheAlbum($_POST['q']));
    Flight::render('recherche', array('query' => strip_tags($_POST['q']), "resultat" => $response), 'body_content');
    Flight::render('layout', array('Titre' => strip_tags($_POST['q'])));
});
// Ajout / modification
/**
****
******
******
****** routing tracks
******
******
****
**/
/* ADD new track interface
i use JS to send data to the API , ( js/app.js)