Пример #1
0
    $tableauServices = Connexion::query('SELECT services.id,utilisateurs_id,nom,url,port,texte,mail,tel,monitore,trl,frequence,statut FROM services ORDER BY id');
}
for ($i = 0; $i < sizeof($tableauServices) - $compteur; $i++) {
    if ($tableauServices[$i][11] != 1 and $tableauServices[$i][8] == 1) {
        $class = ' class="danger"';
    } elseif ($tableauServices[$i][11] == 1 and $tableauServices[$i][8] == 1) {
        $class = ' class="success"';
    } else {
        $class = ' class="info"';
    }
    echo '<tr' . $class . '>';
    for ($j = 0; $j < 11; $j++) {
        if ($j == 8) {
            echo '<td>', statutServices($tableauServices[$i][$j], $tableauServices[$i][0]), '</td>';
        } elseif ($j == 1) {
            echo '<td>', nomPseudo($tableauServices[$i][1]), '</td>';
        } elseif ($j == 10) {
            echo '<td>', $tableauServices[$i][$j], ' minute(s)</td>';
        } elseif ($j == 9) {
            echo '<td>', $tableauServices[$i][$j], ' ms</td>';
        } else {
            echo '<td>', $tableauServices[$i][$j], '</td>';
        }
    }
    echo '<td>';
    echo boutonModifierService($tableauServices[$i][0]);
    echo '</td>';
    echo '<td>';
    echo boutonSupprimerService($tableauServices[$i][0]);
    echo '</td>';
    echo '<td>';
function formulaireModifierService($idService)
{
    $ligneModif = Connexion::query('SELECT id,utilisateurs_id,nom,url,port,texte,mail,tel,monitore,trl,frequence FROM services WHERE id =' . $idService);
    if ($ligneModif[0][8] == 1) {
        $bouttonOui = 'checked';
        $bouttonNon = '';
    }
    if ($ligneModif[0][8] == 0) {
        $bouttonOui = '';
        $bouttonNon = 'checked';
    }
    $html = ' <form name ="formulaire" action=".?page=services" method="POST">
    <p>
    
    <input type="hidden" name="idServices" value="' . $ligneModif[0][0] . '" />
    <label style="margin-left:30px;">Pseudo : </label>
    <select class="form-control" name="pseudo">';
    $tableauPseudo = pseudo();
    $html .= '<option value="' . $ligneModif[0][1] . '">' . nomPseudo($ligneModif[0][1]) . '</option>';
    for ($i = 0; $i < sizeof($tableauPseudo); $i++) {
        if ($tableauPseudo[$i][0] != $ligneModif[0][1]) {
            $html .= '<option value="' . $tableauPseudo[$i][0] . '">' . $tableauPseudo[$i][1] . '</option>';
        }
    }
    $html .= '</select><br/>
    <label style="margin-left:30px;">Nom du service : </label> 
              <input class="form-control" type="text" name="nomService"placeholder="Nom du service " value="' . $ligneModif[0][2] . '" required ><br/>
    <label style="margin-left:30px;">URL : </label>
              <input class="form-control" type="text" name="urledit" placeholder="URL " value="' . $ligneModif[0][3] . '"required ><br/>
    <label style="margin-left:30px;">Port : </label>
              <input class="form-control" type="number" name="port" placeholder="Port" value="' . $ligneModif[0][4] . '" required ><br/>
    <label style="margin-left:30px;">Texte important: </label>
              <input class="form-control" type="text" name="texte" placeholder="Texte important " value="' . $ligneModif[0][5] . '" required ><br/>
    <label style="margin-left:30px;">Adresse mail : </label>
              <input class="form-control" type="email" name="mail" placeholder="Adresse mail " value="' . $ligneModif[0][6] . '" required><br/>
    <label style="margin-left:30px;">Téléphone : </label> 
    <input class="form-control" type="text" name="tel" placeholder="Téléphone" value="' . $ligneModif[0][7] . '" required ><br/>
    <label style="margin-left:30px;"> TRL : (ms) </label> 
            <input class="form-control" type="decimal" name="trl" placeholder="TRL" value="' . $ligneModif[0][9] . '" required ><br/>
    <label style="margin-left:30px;">Fréquence de test : (minutes) </label> 
    <input class="form-control" type="decimal" name="frequence" placeholder="Fréquence" value="' . $ligneModif[0][10] . '" required ><br/>
    <label style="margin-left:30px;">Suivi : </label> 
        <div class="form-group"  style="margin-left:50px;">
            <div class="radio"><label><input type= "radio" name="monitore" value="1"  ' . $bouttonOui . '> oui<br/></div></label>
            <div class="radio"><label><input type= "radio" name="monitore" value="0" ' . $bouttonNon . '> non<br/></div></label>
        </div>
    
    </p> 
    <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Fermer</button>
        <button type="submit" class="btn btn-primary">Modifier</button>
      </div>
   </form>';
    return $html;
}