<?php

require_once __DIR__ . "/../autoload/session.autoload.php";
require_once __DIR__ . "/../class/Sound.class.php";
if (isset($_POST)) {
    $Sound = new Sound();
    $Sound->setUsername($_POST['username']);
    $Sound->toggle();
    header("location:/users.admin.php?event=param-changed");
}
?>

            </div>

            <div class="row-fluid margin-top-2">
              
              <legend>Sound</legend>

              <?php 
foreach ($users as $key => $value) {
    echo '<div class="row-fluid margin-top-1">';
    echo '<div class="span6">';
    echo '<p>[' . $value['username'] . ']</p>';
    echo '</div>';
    echo '<div class="span6">';
    $Sound->setUsername($value['username']);
    if ($Sound->isSoundActivated()) {
        echo '<p>SON ACTIF</p>';
    } else {
        echo '<p>SON INACTIF</p>';
    }
    echo '<form action="postcall/togglesound.postcall.php" method="POST">';
    echo '<input type="hidden" name="username" value="' . $value['username'] . '">';
    echo '<br>';
    echo '<input type="submit" value="Changer">';
    echo '</form>';
    echo '</div>';
    echo '</div>';
}
?>