コード例 #1
0
ファイル: index.php プロジェクト: radiowarwick/digiplay
        $scheduleslot = $result->fetch();
        if ($track['id'] != $scheduleslot['audioid']) {
            $query = "UPDATE sustschedule SET audioid=:trackid, trim_start_smpl=0, trim_end_smpl = :tracklength, fade_in = 0, fade_out = :tracklength WHERE id = :scheduleslot";
            $parameters = array(':trackid' => $track['id'], ':tracklength' => $track['length_smpl'], ':scheduleslot' => $scheduleslot['id']);
            DigiplayDB::query($query, $parameters);
            $query = "INSERT INTO sustlog (audioid,userid,timestamp) VALUES (:audioid,:userid,:timestamp)";
            date_default_timezone_set("Europe/London");
            $parameters = array(':audioid' => $track['id'], ':userid' => Session::get_id(), ':timestamp' => time());
            DigiplayDB::query($query, $parameters);
            echo Bootstrap::alert_message_basic("info", "Track Scheduled.");
        } else {
            echo Bootstrap::alert_message_basic("warning", "This track is already at the top of the queue.");
        }
    }
}
$currentQueue = Sustainer::get_queue();
$i = 0;
echo "<h3>Current queue:</h3>";
if (!is_null($currentQueue)) {
    if (array_key_exists('id', $currentQueue)) {
        $currentQueueTemp = array(0 => $currentQueue);
        $currentQueue = $currentQueueTemp;
    }
    echo "<table class=\"table table-striped table-bordered\">\r\n\t\t<thead>\r\n\t\t<tr>\r\n\t\t<th></th>\r\n\t\t<th>Title</th>\r\n\t\t<th>Artist</th>\r\n\t\t<th>Album</th>\r\n\t\t</tr>\r\n\t\t</thead>\r\n\t\t<tbody>";
    foreach ($currentQueue as $row) {
        $i++;
        echo "<tr>\r\n\t\t\t<td>" . $i . "</td>\r\n\t\t<td>" . $row['title'] . "</td>\r\n\t\t<td>" . $row['artist'] . "</td>\r\n\t\t<td>" . $row['album'] . "</td>\r\n\t\t</tr>";
    }
    echo "</tbody>\r\n\t\t</table>";
} else {
    Bootstrap::alert("warning", "<b>Warning: </b>The current queue is empty", "", false);