Beispiel #1
0
<?php

include "autoload.php";
use Controller\LightShowController;
$lightShow = new LightShowController();
if ($_POST['btnStart']) {
    $lightShow->playPlaylist();
} else {
    if ($_POST['btnStop']) {
        $lightShow->stop();
    }
}
$songs[] = $lightShow->getSongs();
foreach ($songs as &$value) {
    echo $value;
}
?>

<html>
    <head>
        <title>Leuchtender Christbaum </title>
    </head>

    <body>
        <h1>Christmas Tree</h1>

        <form method="post" action="index.php">
            <input type="submit" value="start playlist" name="btnStart" />
            <input type="submit" value="stop playlist" name="btnStop" />
        </form>
    </body>
Beispiel #2
0
<?php

error_reporting(E_ALL);
include "autoload.php";
use Controller\LightShowController;
// Todo: Start coding here
$ctrl = new LightShowController();
switch ($_GET["action"]) {
    case "play":
        $ctrl->playPlaylist();
        break;
    case "add":
        echo "add";
        $song = $_GET["song"];
        $ctrl->addToPlaylist($song, $song);
        echo "Added {$song} to playlist<br>";
        break;
}
?>

<a href="?action=play">play playlist</a>

<form action="index.php" method="get">

    Add song to playlist:
    <select name="song">
        <?php 
foreach ($ctrl->getSongs() as $song) {
    echo "<option value='{$song}'>{$song}</option>";
}
?>
<?php

include "autoload.php";
use Controller\LightShowController;
// Todo: Start coding here
$controller = new LightShowController();
$controller->getPlaylistContent();
$controller->playPlaylist();