Skip to content
Snippets Groups Projects
Select Git revision
  • 1966bc252dccda36ab0525e72d8beb30f6771ab7
  • master default protected
2 results

.gitkeep

Blame
  • template.php 6.39 KiB
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
    
    <head>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      <title>Spotify playlist generator</title>
      <link rel="icon" type="image/png" href="img/favicon.png"/>
      <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css" media="all" />
      <link rel="stylesheet" href="css/styles.css" type="text/css" media="all" />
      <script src="js/scripts.js"></script>
    </head>
    
    <body>
    
      <nav class="navbar navbar-expand-lg navbar-dark bg-primary">
        <div class="container-fluid">
          <a class="navbar-brand" href="playlist-generator">
          <?php if (count($templateData['user']->images)) { ?>
            <img src="<?php echo $templateData['user']->images[0]->url; ?>" class="rounded border" alt="<?php echo $templateData['user']->display_name; ?>" style="max-height: 2rem;">
          <?php } ?>
          <?php echo $templateData['user']->display_name; ?>
        </a>
          <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
          </button>
          <div class="collapse navbar-collapse" id="navbarNav">
            <ul class="navbar-nav">
              <li class="nav-item">
                <a class="nav-link" href="<?php echo $templateData['user']->external_urls->spotify; ?>">Profile</a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="?logout">Logout</a>
              </li>
            </ul>
          </div>
        </div>
      </nav>
    
      <div class="container-fluid mb-5">
    
        <?php if (count($templateData['errors'])) { ?>
          <?php foreach ($templateData['errors'] as $message) { ?>
            <div class="alert alert-warning mt-2" role="alert"><?php echo $message; ?></div>
          <?php } ?>
        <?php } ?>
    
        <?php if (count($templateData['infos'])) { ?>
          <?php foreach ($templateData['infos'] as $message) { ?>
            <div class="alert alert-primary mt-2" role="alert"><?php echo $message; ?></div>
          <?php } ?>
        <?php } ?>
    
        <?php if (count($templateData['topArtists'])) { ?>
          <form class="clearfix">
            <legend>Generate playlist from artists:</legend>
            <ul class="list-unstyled row row-cols-md-4 row-cols-2">
              <?php foreach ($templateData['topArtists'] as $artist) { ?>
                <li class="col">
                  <div class="custom-control custom-checkbox">
                    <input
                      type="checkbox"
                      class="custom-control-input checkbox-artist"
                      id="check-top-artist-<?php echo $artist->id; ?>"
                      name="selected-artist[]"
                      value="<?php echo $artist->id; ?>"
                    >
                    <label class="custom-control-label" for="check-top-artist-<?php echo $artist->id; ?>">
                      <?php if (count($artist->images)) { ?>
                        <span class="spotify-image"><img src="<?php echo $artist->images[count($artist->images) - 1]->url; ?>" style="max-height: 1rem; max-width: 1rem;" /></span>
                      <?php } ?>
                      <?php echo $artist->name; ?>
                    </label>
                  </div>
                </li>
              <?php } ?>
            </ul>
            <div class="row">
              <div class="col-md-8 col-sm-12">
                <input
                  type="checkbox"
                  class="custom-control-input"
                  id="check-top-artist-filter-artists"
                  name="check-top-artist-filter-artists"
                  value="filter-artists"
                  checked
                >
                <label class="custom-control-label" for="check-top-artist-filter-artists">
                  Allow only selected artists in recommendations
                </label>
              </div>
              <div class="col-md-4 col-sm-12">
                <div class="btn-group float-end" role="group" aria-label="Action buttons">
                  <button name="pick-random-artist" type="button" class="btn btn-secondary" onclick="pickRandomArtists()">🎲 Pick random artists</button>
                  <button name="generate-playlist-top-artists" type="submit" class="btn btn-primary float-end">🎶 Generate!</button>
                </div>
              </div>
            </div>
          </form>
        <?php } ?>
    
        <?php if (count($templateData['playlists'])) { ?>
          <form class="clearfix">
            <legend>Generate playlist from tracks in existing playlist:</legend>
            <ul class="list-unstyled row row-cols-md-2 row-cols-1">
              <?php foreach ($templateData['playlists'] as $playlist) { ?>
                <li class="col">
                  <div class="custom-control custom-checkbox">
                    <input
                      type="checkbox"
                      class="custom-control-input"
                      id="check-playlist-<?php echo $playlist->id; ?>"
                      name="selected-playlist[]"
                      value="<?php echo $playlist->id; ?>"
                    >
                    <label class="custom-control-label" for="check-playlist-<?php echo $playlist->id; ?>">
                      <?php if (count($playlist->images)) { ?>
                        <span class="spotify-image"><img src="<?php echo $playlist->images[count($playlist->images) - 1]->url; ?>" style="max-height: 1rem; max-width: 1rem;" /></span>
                      <?php } ?>
                      <?php echo $playlist->name; ?>
                    </label>
                  </div>
                </li>
              <?php } ?>
            </ul>
            <div class="row">
              <div class="col-md-8 col-sm-12">
                <input
                  type="checkbox"
                  class="custom-control-input"
                  id="check-playlist-filter-artists"
                  name="check-playlist-filter-artists"
                  value="filter-artists"
                  checked
                >
                <label class="custom-control-label" for="check-playlist-filter-artists">
                  Allow only artists in selected playlists in recommendations
                </label>
              </div>
              <div class="col-md-4 col-sm-12">
                <button name="generate-playlist-from-playlist" type="submit" class="btn btn-secondary float-end">🎶 Generate!</button>
              </div>
            </div>
          </form>
        <?php } ?>
    
      </div>
    
      <script src="js/bootstrap.min.js"></script>
    </body>
    
    </html>