IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

Optimisation et Boucle For


Sujet :

Langage PHP

  1. #1
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Juillet 2016
    Messages
    5
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Associations - ONG

    Informations forums :
    Inscription : Juillet 2016
    Messages : 5
    Par défaut Optimisation et Boucle For
    Bonjour à tous,

    Je travail actuellement sur mon site et on ma conseillé d'optimiser mes pages en y ajoutant une boucle For.
    J'ai pas mal fais de tentative sans résultat.

    Le code initiale :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    <?php session_start();
    date_default_timezone_set('Europe/Paris');
    include('./lib/class-db.php');
    include('./lib/objects/class-tournament.php');
     
    $ez_tournament = new ezAdmin_Tournament();
     
         if(!isset($_SESSION['ez_admin'])) {
            header("Location: login.php");
         } else {
            $username = $_SESSION['ez_admin'];
         }
    if( isset( $_POST['form'] ) && isset( $_POST['tournament_id'] ) ) {
        $form = trim( $_POST['form'] );
        $tournament_id = trim( $_POST['tournament_id'] );
     
        if( $form == 'generate-matches' ) {
            // clear any previously generated matchups first
            $ez_tournament->clear_tournament_matchups( $tournament_id );
     
            // randomize tournament matchups and store them
            $tournament_max_teams = trim( $_POST['max_teams'] );
            $teams = $ez_tournament->get_tournament_teams( $tournament_id );
            shuffle( $teams );
        ?>
     
            <li class="spacer">&nbsp;</li>
            <!-- wrap score inside span element -->
            <li class="game game-top"><?php echo $teams[0]['guild']; ?></li>
            <li class="game game-spacer">&nbsp;</li>
            <li class="game game-bottom "><?php echo $teams[1]['guild']; ?></li>
            <?php $ez_tournament->set_tournament_matchups($tournament_id, $teams[0]['guild'], $teams[0]['id'], $teams[1]['guild'], $teams[1]['id'], '1'); ?>
            <li class="spacer">&nbsp;</li>
     
            <li class="game game-top"><?php echo $teams[2]['guild']; ?></li>
            <li class="game game-spacer">&nbsp;</li>
            <li class="game game-bottom "><?php echo $teams[3]['guild']; ?></li>
            <?php $ez_tournament->set_tournament_matchups($tournament_id, $teams[2]['guild'], $teams[2]['id'], $teams[3]['guild'], $teams[3]['id'], '1'); ?>
            <li class="spacer">&nbsp;</li>
            <?php if( $tournament_max_teams >= 8 ) { ?>
            <li class="game game-top "><?php echo $teams[4]['guild']; ?></li>
            <li class="game game-spacer">&nbsp;</li>
            <li class="game game-bottom"><?php echo $teams[5]['guild']; ?></li>
            <?php $ez_tournament->set_tournament_matchups($tournament_id, $teams[4]['guild'], $teams[4]['id'], $teams[5]['guild'], $teams[5]['id'], '1'); ?>
            <li class="spacer">&nbsp;</li>
     
            <li class="game game-top"><?php echo $teams[6]['guild']; ?></li>
            <li class="game game-spacer">&nbsp;</li>
            <li class="game game-bottom "><?php echo $teams[7]['guild']; ?></li>
            <?php $ez_tournament->set_tournament_matchups($tournament_id, $teams[6]['guild'], $teams[6]['id'], $teams[7]['guild'], $teams[7]['id'], '1'); ?>
            <li class="spacer">&nbsp;</li>
            <?php }
     
            if( $tournament_max_teams >= 16 ) { ?>
            <li class="game game-top "><?php echo $teams[8]['guild']; ?></li>
            <li class="game game-spacer">&nbsp;</li>
            <li class="game game-bottom"><?php echo $teams[9]['guild']; ?></li>
            <?php $ez_tournament->set_tournament_matchups($tournament_id, $teams[8]['guild'], $teams[8]['id'], $teams[9]['guild'], $teams[9]['id'], '1'); ?>
            <li class="spacer">&nbsp;</li>
     
            <li class="game game-top"><?php echo $teams[10]['guild']; ?></li>
            <li class="game game-spacer">&nbsp;</li>
            <li class="game game-bottom "><?php echo $teams[11]['guild']; ?></li>
            <?php $ez_tournament->set_tournament_matchups($tournament_id, $teams[10]['guild'], $teams[10]['id'], $teams[11]['guild'], $teams[11]['id'], '1'); ?>
            <li class="spacer">&nbsp;</li>
     
            <li class="game game-top "><?php echo $teams[12]['guild']; ?></li>
            <li class="game game-spacer">&nbsp;</li>
            <li class="game game-bottom"><?php echo $teams[13]['guild']; ?></li>
            <?php $ez_tournament->set_tournament_matchups($tournament_id, $teams[12]['guild'], $teams[12]['id'], $teams[13]['guild'], $teams[13]['id'], '1'); ?>
            <li class="spacer">&nbsp;</li>
     
            <li class="game game-top"><?php echo $teams[14]['guild']; ?></li>
            <li class="game game-spacer">&nbsp;</li>
            <li class="game game-bottom "><?php echo $teams[15]['guild']; ?></li>
            <?php $ez_tournament->set_tournament_matchups($tournament_id, $teams[14]['guild'], $teams[14]['id'], $teams[15]['guild'], $teams[15]['id'], '1'); ?>
            <li class="spacer">&nbsp;</li>
     
            <?php }
     
            if( $tournament_max_teams >= 32 ) { ?>
            <li class="game game-top "><?php echo $teams[16]['guild']; ?></li>
            <li class="game game-spacer">&nbsp;</li>
            <li class="game game-bottom"><?php echo $teams[17]['guild']; ?></li>
            <?php $ez_tournament->set_tournament_matchups($tournament_id, $teams[16]['guild'], $teams[16]['id'], $teams[17]['guild'], $teams[17]['id'], '1'); ?>
            <li class="spacer">&nbsp;</li>
     
            <li class="game game-top"><?php echo $teams[18]['guild']; ?></li>
            <li class="game game-spacer">&nbsp;</li>
            <li class="game game-bottom "><?php echo $teams[19]['guild']; ?></li>
            <?php $ez_tournament->set_tournament_matchups($tournament_id, $teams[18]['guild'], $teams[18]['id'], $teams[19]['guild'], $teams[19]['id'], '1'); ?>
            <li class="spacer">&nbsp;</li>
     
            <li class="game game-top "><?php echo $teams[20]['guild']; ?></li>
            <li class="game game-spacer">&nbsp;</li>
            <li class="game game-bottom"><?php echo $teams[21]['guild']; ?></li>
            <?php $ez_tournament->set_tournament_matchups($tournament_id, $teams[20]['guild'], $teams[20]['id'], $teams[21]['guild'], $teams[21]['id'], '1'); ?>
            <li class="spacer">&nbsp;</li>
     
            <li class="game game-top"><?php echo $teams[22]['guild']; ?></li>
            <li class="game game-spacer">&nbsp;</li>
            <li class="game game-bottom "><?php echo $teams[23]['guild']; ?></li>
            <?php $ez_tournament->set_tournament_matchups($tournament_id, $teams[22]['guild'], $teams[22]['id'], $teams[23]['guild'], $teams[23]['id'], '1'); ?>
            <li class="spacer">&nbsp;</li>
     
            <li class="game game-top "><?php echo $teams[24]['guild']; ?></li>
            <li class="game game-spacer">&nbsp;</li>
            <li class="game game-bottom"><?php echo $teams[25]['guild']; ?></li>
            <?php $ez_tournament->set_tournament_matchups($tournament_id, $teams[24]['guild'], $teams[24]['id'], $teams[25]['guild'], $teams[25]['id'], '1'); ?>
            <li class="spacer">&nbsp;</li>
     
            <li class="game game-top"><?php echo $teams[26]['guild']; ?></li>
            <li class="game game-spacer">&nbsp;</li>
            <li class="game game-bottom "><?php echo $teams[27]['guild']; ?></li>
            <?php $ez_tournament->set_tournament_matchups($tournament_id, $teams[26]['guild'], $teams[26]['id'], $teams[27]['guild'], $teams[27]['id'], '1'); ?>
            <li class="spacer">&nbsp;</li>
     
            <li class="game game-top "><?php echo $teams[28]['guild']; ?></li>
            <li class="game game-spacer">&nbsp;</li>
            <li class="game game-bottom"><?php echo $teams[29]['guild']; ?></li>
            <?php $ez_tournament->set_tournament_matchups($tournament_id, $teams[28]['guild'], $teams[28]['id'], $teams[29]['guild'], $teams[29]['id'], '1'); ?>
            <li class="spacer">&nbsp;</li>
     
            <li class="game game-top"><?php echo $teams[30]['guild']; ?></li>
            <li class="game game-spacer">&nbsp;</li>
            <li class="game game-bottom "><?php echo $teams[31]['guild']; ?></li>
            <?php $ez_tournament->set_tournament_matchups($tournament_id, $teams[30]['guild'], $teams[30]['id'], $teams[31]['guild'], $teams[31]['id'], '1'); ?>
            <li class="spacer">&nbsp;</li>
     
            <?php } ?>
    <?php
        }
     
        if( $form == 'clear-matches' ) {
            $ez_tournament->clear_tournament_matchups( $tournament_id );
        }
    }
    ?>
    J'ai essayer plusieurs choses mais je pense que celle qui s'approche le plus est celle ci :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    <?php session_start();
    date_default_timezone_set('Europe/Paris');
    include('./lib/class-db.php');
    include('./lib/objects/class-tournament.php');
     
    $ez_tournament = new ezAdmin_Tournament();
     
         if(!isset($_SESSION['ez_admin'])) {
            header("Location: login.php");
         } else {
            $username = $_SESSION['ez_admin'];
         }
    if( isset( $_POST['form'] ) && isset( $_POST['tournament_id'] ) ) {
        $form = trim( $_POST['form'] );
        $tournament_id = trim( $_POST['tournament_id'] );
     
        if( $form == 'generate-matches' ) {
            // clear any previously generated matchups first
            $ez_tournament->clear_tournament_matchups( $tournament_id );
     
            // randomize tournament matchups and store them
            $tournament_max_teams = trim( $_POST['max_teams'] );
            $teams = $ez_tournament->get_tournament_teams( $tournament_id );
            shuffle( $teams ); }
        ?>
     
            <li class="spacer">&nbsp;</li>
     
        <?php
     
        for($i=0;$i<=$tournament_max_teams;$i+2;) { ?>
     
            <li class="game game-top"><?php echo $teams[$i]['guild']; ?></li>
            <li class="game game-spacer">&nbsp;
            <li class="game game-bottom "><?php echo $teams[$i++]['guild']; ?></li>
            <?php $ez_tournament->set_tournament_matchups($tournament_id, $teams[$i]['guild'], $teams[$i]['id'], $teams[$i++]['guild'], $teams[$i++]['id'], '1'); ?>
            <li class="spacer">&nbsp;</li>
     
                <?php } ?>
    <?php
        }
     
        if( $form == 'clear-matches' ) {
            $ez_tournament->clear_tournament_matchups( $tournament_id );
        }
    }
    ?>
    Un coup de main ne serait pas de refut.
    Il s'agit d'un site de tournoi (pour information)

  2. #2
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Par défaut
    Tu fais des erreurs de syntaxe :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    <?php
    $i = 0;
     
    echo $i + 2; // 2;
    echo $i; // 0 : il n'y a pas eu de modification de $i
     
    echo $i += 2; // 2
     
    echo $i = $i + 2; // 4 // même chose qu'au dessus en version longue
     
    echo $i++; // 4 : $i est retourné PUIS incrementé 
    echo $i; // 5 : $i a bien été incrementé
    echo ++$i; //6 : $i est incrementé puis retourné
    Donc
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
     
    <?php
    for($i=0; $i < $tournament_max_teams; $i += 2;) { ?>
     
            <li class="game game-top"><?php echo $teams[$i]['guild']; ?></li>
            <li class="game game-spacer">&nbsp;
            <li class="game game-bottom "><?php echo $teams[$i+1]['guild']; ?></li>
            <?php $ez_tournament->set_tournament_matchups($tournament_id, $teams[$i]['guild'], $teams[$i]['id'], $teams[$i+1]['guild'], $teams[$i+1]['id'], '1'); ?>
            <li class="spacer">&nbsp;</li>
     
    <?php } ?>
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  3. #3
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Juillet 2016
    Messages
    5
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Associations - ONG

    Informations forums :
    Inscription : Juillet 2016
    Messages : 5
    Par défaut
    Merci pour votre aide, je vais essayer de comprendre mes erreurs puis je le referrais de mon côté.
    Bonne soirée !

  4. #4
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Juillet 2016
    Messages
    5
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Associations - ONG

    Informations forums :
    Inscription : Juillet 2016
    Messages : 5
    Par défaut
    Bonjour !

    Je reviens vers vous car malheureusement mon arbre ne se lance pas. J'ai essayé toutes la journée une solution mais la je ne comprend pas.

    J'ai fais les modifications sur mon fichier est à présent j'ai donc :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    <?php session_start();
    date_default_timezone_set('Europe/Paris');
    include('./lib/class-db.php');
    include('./lib/objects/class-tournament.php');
     
    $ez_tournament = new ezAdmin_Tournament();
     
         if(!isset($_SESSION['ez_admin'])) {
         	header("Location: login.php");
         } else {
         	$username = $_SESSION['ez_admin'];
         }
    if( isset( $_POST['form'] ) && isset( $_POST['tournament_id'] ) ) {
        $form = trim( $_POST['form'] );
        $tournament_id = trim( $_POST['tournament_id'] );
     
        if( $form == 'generate-matches' ) {
            // clear any previously generated matchups first
            $ez_tournament->clear_tournament_matchups( $tournament_id );
     
            // randomize tournament matchups and store them
            $tournament_max_teams = trim( $_POST['max_teams'] );
            $teams = $ez_tournament->get_tournament_teams( $tournament_id );
            shuffle( $teams ); }
        ?>
     
            <li class="spacer">&nbsp;</li>
     
    <?php for($i=0; $i =< $tournament_max_teams; $i+2;) { ?>
     
            <li class="game game-top"><?php echo $teams[$i]['guild']; ?></li>
            <li class="game game-spacer">&nbsp;</li>
            <li class="game game-bottom "><?php echo $teams[$i+1]['guild']; ?></li>
            <?php $ez_tournament->set_tournament_matchups($tournament_id, $teams[$i]['guild'], $teams[$i]['id'], $teams[$i+1]['guild'], $teams[$i+1]['id'], '1'); ?>
            <li class="spacer">&nbsp;</li>
     
    <?php } ?>
    <?php 
     
        if( $form == 'clear-matches' ) {
            $ez_tournament->clear_tournament_matchups( $tournament_id );
        }
    }
    ?>
    Quand je clique sur le bouton pour générer mon arbre je n'ai rien et sur ma console j'ai : "POST http://addict-esport.fr/tournoi/admi...01-bracket.php 500 Internal Server Error 102ms"

  5. #5
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  6. #6
    Invité
    Invité(e)
    Par défaut
    Bonjour,

    j'ai une ou deux remarques...

    si j'ai bien compris :
    • $tournament_max_teams est le nombre TOTAL d'équipes sur CE tournoi.
    • la boucle for parcourt ces équipes DEUX par DEUX : $teams[$i] et $teams[$i+1].


    Donc, la boucle devrait être :
    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    <?php for($i=0; $i <= floor($tournament_max_teams/2); $i+=2;) { ?>

    N.B. Si $tournament_max_teams est impair, la dernière équipe n'entre pas dans la boucle.

    Astuce pour tester un nombre pair/impair : le modulo "%" (voir : Les opérateurs arithmétiques)
    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    if( $nombre%2 == 0){
      echo $nombre.' est pair';
    }
    if( $nombre%2 == 1){
      echo $nombre.' est impair';
    }

  7. #7
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Juillet 2016
    Messages
    5
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Associations - ONG

    Informations forums :
    Inscription : Juillet 2016
    Messages : 5
    Par défaut
    Bonjour !

    Il est vrai que j'avais fais ces modifications pour voir, dans tous les cas je n'ai aucun résultat.

    En faite j'aurais plus au moins toujours des équipes pairs. Le but étant aprés cette optimisation de m'assurer que si l'une des deux équipes me renvoi null alors l'autre équipe passe le tour suivant.
    Mais faudrait il pour cela que l'arbre se génère ...

    Existe t'il un moyen autres que la console pour voir ou pourrez se trouver le soucis ?
    Carl lorsque je laisse le code brut, sa marche (mais c'est ultra lourd)

  8. #8
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Par défaut
    Compare le HTML obtenu avec celui que tu écris à la main.
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  9. #9
    Invité
    Invité(e)
    Par défaut
    Bonjour,

    1/ Remontre ton code PHP corrigé.

    2/ Montre aussi le code HTML généré ("Ctrl"+"U")

  10. #10
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Juillet 2016
    Messages
    5
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Associations - ONG

    Informations forums :
    Inscription : Juillet 2016
    Messages : 5
    Par défaut
    Merci infiniment pour le trés gros coup de main.

    Alors

    Le code corrigé :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    <?php session_start();
    date_default_timezone_set('Europe/Paris');
    include('./lib/class-db.php');
    include('./lib/objects/class-tournament.php');
     
    $ez_tournament = new ezAdmin_Tournament();
     
         if(!isset($_SESSION['ez_admin'])) {
         	header("Location: login.php");
         } else {
         	$username = $_SESSION['ez_admin'];
         }
    if( isset( $_POST['form'] ) && isset( $_POST['tournament_id'] ) ) {
        $form = trim( $_POST['form'] );
        $tournament_id = trim( $_POST['tournament_id'] );
     
        if( $form == 'generate-matches' ) {
            // clear any previously generated matchups first
            $ez_tournament->clear_tournament_matchups( $tournament_id );
     
            // randomize tournament matchups and store them
            $tournament_max_teams = trim( $_POST['max_teams'] );
            $teams = $ez_tournament->get_tournament_teams( $tournament_id );
            shuffle( $teams ); }
        ?>
     
            <li class="spacer">&nbsp;</li>
     
    <?php for($i=0; $i <= floor($tournament_max_teams/2); $i+=2;) { ?>
     
            <li class="game game-top"><?php echo $teams[$i]['guild']; ?></li>
            <li class="game game-spacer">&nbsp;</li>
            <li class="game game-bottom "><?php echo $teams[$i+1]['guild']; ?></li>
            <?php $ez_tournament->set_tournament_matchups($tournament_id, $teams[$i]['guild'], $teams[$i]['id'], $teams[$i+1]['guild'], $teams[$i+1]['id'], '1'); ?>
            <li class="spacer">&nbsp;</li>
     
    <?php } ?>
    <?php 
     
        if( $form == 'clear-matches' ) {
            $ez_tournament->clear_tournament_matchups( $tournament_id );
        }
    }
    ?>
    Et la source de ma page :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    <!DOCTYPE html>
    <html>
     
    <head>
     
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
     
        <title>ezLeague - Online Gaming League Management</title>
     
        <!-- Core CSS - Include with every page -->
        <link href="js/bootstrap.css" rel="stylesheet">
        <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
        <link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" rel="stylesheet">
        <link rel="stylesheet" type="text/css" media="screen" href="http://tarruda.github.com/bootstrap-datetimepicker/assets/css/bootstrap-datetimepicker.min.css">
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
        <script type="text/javascript" src="js/moment.js"></script>
        <script type="text/javascript" src="js/transition.js"></script>
        <script type="text/javascript" src="js/collapse.js"></script>
        <script type="text/javascript" src="http://tarruda.github.com/bootstrap-datetimepicker/assets/js/bootstrap-datetimepicker.min.js"></script>
        <script type="text/javascript" src="https://raw.githubusercontent.com/tarruda/bootstrap-datetimepicker/master/src/js/locales/bootstrap-datetimepicker.fr.js"></script>
     
        <!-- Page-Level Plugin CSS - Dashboard -->
        <link href="css/plugins/morris/morris-0.4.3.min.css" rel="stylesheet">
        <link href="css/plugins/timeline/timeline.css" rel="stylesheet">
     
        <!-- SB Admin CSS - Include with every page -->
        <link href="css/sb-admin.css" rel="stylesheet">
     
        <link href="css/ezleague.css?v1" rel="stylesheet">
        <link href="css/ezleague-tournament.css?v1" rel="stylesheet">
        <link href="css/redmond/jquery-ui-1.10.4.custom.css" rel="stylesheet">
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
    </head>
     
    <body>
     
        <div id="wrapper">
     
            <nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".sidebar-collapse">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="index.php">ezLeague <sup>v3.5.9</sup></a>
                </div>
                <!-- /.navbar-header -->
     
                <ul class="nav navbar-top-links navbar-right">
                    <li class="dropdown">
     
                        <a class="dropdown-toggle" data-toggle="dropdown" href="#">Welcome <em>admin</em>
                            <i class="fa fa-user fa-fw"></i>  <i class="fa fa-caret-down"></i>
                        </a>
                        <ul class="dropdown-menu dropdown-user">
                            <li><a href="settings.php?page=profile"><i class="fa fa-gear fa-fw"></i> My Settings</a>
                            </li>
                            <li class="divider"></li>
                            <li><a href="settings.php?page=admins"><i class="fa fa-users fa-fw"></i> View Admins</a>
                            </li>
                            <li><a href="logout.php"><i class="fa fa-sign-out fa-fw"></i> Logout</a>
                            </li>
                        </ul>
                        <!-- /.dropdown-user -->
                    </li>
                    <!-- /.dropdown -->
                </ul>
                <!-- /.navbar-top-links -->
     
            </nav>
            <!-- /.navbar-static-top -->
     
            <nav class="navbar-default navbar-static-side" role="navigation">
                <div class="sidebar-collapse">
                    <ul class="nav" id="side-menu">
                        <li class="sidebar-search">
                            <div class="input-group custom-search-form">
                                <input type="text" class="form-control" placeholder="Search...">
                                <span class="input-group-btn">
                                    <button class="btn btn-default" type="button">
                                        <i class="fa fa-search"></i>
                                    </button>
                                </span>
                            </div>
                        </li>
                        <li>
                            <a href="index.php"><i class="fa fa-dashboard fa-fw"></i> Dashboard</a>
                        </li>
                        <li>
                            <a href="#"><i class="fa fa-comment"></i> News<span class="fa arrow"></span></a>
                            <ul class="nav nav-second-level">
                                <li>
                                    <a href="news.php?page=add">Add</a>
                                </li>
                                <li>
                                    <a href="news.php?page=view">View</a>
                                </li>
                                <li>
                                    <a href="news.php?page=categories">Categories</a>
                                </li>
                                <li>
                                	<a href="news.php?page=media">Media</a>
                                </li>
                            </ul>
                        </li>
                        <li>
                            <a href="#"><i class="fa fa-trophy"></i> Leagues<span class="fa arrow"></span></a>
                            <ul class="nav nav-second-level">
                                <li>
                                    <a href="leagues.php?page=create">Create League</a>
                                </li>
                                <li>
                                    <a href="leagues.php">View All</a>
                                </li>
                            </ul>
                        </li>
                        <li>
                            <a href="#"><i class="fa fa-trophy"></i> Tournaments<span class="fa arrow"></span></a>
                            <ul class="nav nav-second-level">
                                <li>
                                    <a href="tournaments.php?page=create">Create Tournament</a>
                                </li>
                                <li>
                                    <a href="tournaments.php">View All</a>
                                </li>
                                <li>
                                    <a href="tournaments.php?page=disputes">View Disputes</a>
                                </li>
                            </ul>
                        </li>
                        <li>
                            <a href="#"><i class="fa fa-gamepad"></i> Matches<span class="fa arrow"></span></a>
                            <ul class="nav nav-second-level">
                                <li>
                                    <a href="matches.php?page=leagues">View Matches</a>
                                </li>
                                <li>
                                    <a href="matches.php?page=disputes">View Disputes</a>
                                </li>
                            </ul>
                        </li>
                        <li>
                            <a href="#"><i class="fa fa-user"></i> Users<span class="fa arrow"></span></a>
                            <ul class="nav nav-second-level">
                                <li>
                                    <a href="users.php?page=all">View All</a>
                                </li>
                                <li>
                                    <a href="users.php?page=create">Create Account</a>
                                </li>
                            </ul>
                        </li>
                        <li>
                            <a href="#"><i class="fa fa-users"></i> Teams <span class="fa arrow"></span></a>
                            <ul class="nav nav-second-level">
                                <li>
                                    <a href="teams.php?page=all">View All</a>
                                </li>
                                <li>
                                    <a href="teams.php?page=create">Create Team</a>
                                </li>
                            </ul>
                        </li>
                        <li>
                            <a href="#"><i class="fa fa-cogs"></i> Site Settings<span class="fa arrow"></span></a>
                            <ul class="nav nav-second-level">
                                <li>
                                    <a href="settings.php?page=games">Games</a>
                                </li>
                                <li>
                                    <a href="settings.php?page=admins">Admin Users</a>
                                </li>
                                <li>
                                	<a href="settings.php?page=social_networks">Social Networks</a>
                                </li>
                                <li>
                                    <a href="settings.php?page=twitter">Recent Tweets</a>
                                </li>
                                <li>
                                    <a href="settings.php?page=site">Site</a>
                                </li>
                            </ul>
                        </li>
                        <hr/>
                        <li>
                            <a href="upgrade.php"><i class="fa fa-database fa-fw"></i> Run Database Upgrade</a>
                        </li>
                        <li>
                            <a href="../index.php" target="_blank"><i class="fa fa-globe fa-fw"></i> View Site</a>
                        </li>
                    </ul>
                </div>
            </nav>
            <div id="page-wrapper">
            <div class="row">
        <div class="col-lg-12">
            <h1 class="page-header">Edit Tournament</h1>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-4">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <i class="fa fa-file-o"></i> Edit Tournament Details
                </div>
                <div class="panel-body">
                                <div class="row">
                        <div class="col-lg-12">
                        <form method="POST" id="editTournament">
      <input type="hidden" id="tournament-id" value="17" />
        <div class="form-group">
            <label>Type <small>(only single elimination is currently available)</small></label>
            <input disabled class="form-control" id="type" placeholder="Single Elimination" value="Single Elimination, Public" />
        </div>
        <div class="form-group">
            <label>Tournament</label>
            <input class="form-control" id="tournament" value="AddicT ddd" placeholder="Tournament Name" />
        </div>
        <div class="form-group">
            <label>Status</label>
            <select class="form-control" id="status">
                <option selected value="1">Running</option>
                <option  value="0">Closed</option>
            </select>
        </div>
        <div class="form-group">
            <label>Required (Max) Teams</label>
            <select class="form-control" id="max-teams">
                <option selected value="4">4</option>
                <option  value="8">8</option>
                <option  value="16">16</option>
                <option  value="32">32</option>
            </select>
        </div>
        <div class="form-group">
            <label>Format</label>
            <select class="form-control" id="format">
                         <option  value="1v1">1v1</option>
                         <option  value="2v2">2v2</option>
                         <option  value="3v3">3v3</option>
                         <option  value="4v4">4v4</option>
                         <option selected value="5v5">5v5</option>
                         <option  value="6v6">6v6</option>
                         <option  value="7v7">7v7</option>
                         <option  value="8v8">8v8</option>
                         <option  value="9v9">9v9</option>
                         <option  value="10v10">10v10</option>
                         <option  value="11v11">11v11</option>
                         <option  value="12v12">12v12</option>
                         <option  value="13v13">13v13</option>
                         <option  value="14v14">14v14</option>
                         <option  value="15v15">15v15</option>
                         <option  value="16v16">16v16</option>
                     </select>
        </div>
        <div class="form-group">
            <label>Game</label>
            <select disabled class="form-control" id="game">
                <option></option>
     
                <option selected value="Starcraft II ">Starcraft II </option>
                      </select>
        </div>
        <div class="form-group">
            <label>Start Date</label>
            <input class="form-control" id="start" value="2016-06-30 00:00:00" placeholder="Start Date" />
        </div>
        <div class="form-group">
            <label>Registration End Date</label>
            <input class="form-control" id="registration" value="2016-06-28 00:00:00" placeholder="Registration End Date" />
        </div>
        <div class="form-group">
            <button class="btn btn-success" type="submit">Edit Tournament</button>
            <button class="btn btn-warning" type="reset">Reset</button>
        </div>
        <div class="success">
          <span class="success_text"></span>
        </div>
    </form>                    </div>
                    </div>
     
                </div>
            </div>
        </div>
        <div class="col-lg-8">
            <div class="panel panel-default">
        <div class="panel-heading">
            <i class="fa fa-sitemap"></i> <span class="tournament-teams-heading" data-max-teams="4">Tournament Teams (4 of 4)</span>
                </div>
        <div class="panel-body">
            <div class="table-responsive">
                        <table class="table table-hover tournament-teams">
                    <thead>
                        <tr>
                            <th>Team</th>
                            <th>Options</th>
                        </tr>
                    </thead>
                    <tbody>
                            <tr>
                            <td>AddicT eSport</td>
                            <td>
                                <button type="button" onclick="kickTeam('1', '17')" class="btn btn-danger btn-xs">Kick Team</button>
                            </td>
                        </tr>
                            <tr>
                            <td>AddicT II</td>
                            <td>
                                <button type="button" onclick="kickTeam('3', '17')" class="btn btn-danger btn-xs">Kick Team</button>
                            </td>
                        </tr>
                            <tr>
                            <td>Test</td>
                            <td>
                                <button type="button" onclick="kickTeam('6', '17')" class="btn btn-danger btn-xs">Kick Team</button>
                            </td>
                        </tr>
                            <tr>
                            <td>AddicTr</td>
                            <td>
                                <button type="button" onclick="kickTeam('7', '17')" class="btn btn-danger btn-xs">Kick Team</button>
                            </td>
                        </tr>
                        </tbody>
                 </table>
                            <div class="success team">
                      <span class="success_text team_text"></span>
                    </div>
                </div>
        </div>
    </div>    </div>
    </div>
    <div class="row">
        <div class="col-lg-4">
            <div class="panel panel-default">
        <div class="panel-heading">
            <i class="fa fa-file-o"></i> Round Map Rotation</em>
        </div>
        <div class="panel-body">
            <div class="col-lg-5">
                <form id="addTournamentMap" method="POST">
                <input type="hidden" id="tournament_id" value="17" />
                    <div class="form-group">
                        <label>Map Name <br/><small>(ex: de_dust2)</small></label>
                        <input type="text" class="form-control" id="map" />
                    </div>
                    <button type="submit" class="btn btn-success">Add Map</button>
                </form>
                        <div class="table-responsive">
                   <table class="table table-hover">
                    <thead>
                        <tr>
                          <th>Available</th>
                          <th></th>
                        </tr>
                    </thead>
                    <tbody>
                                        <tr>
                                <td>Pokemon</td>
                                <td><button class="btn btn-danger btn-xs" onclick="deleteMap('17', 'Pokemon');"><i class="fa fa-close"></i></button></td>
                            </tr>
                                  </tbody>
                   </table>
                </div>
                        </div>
            <div class="col-lg-7">
                <form id="addMap" method="POST">
                <input type="hidden" id="tournament_id" value="17" />
                                <div class="table-responsive">
                       <table class="table table-hover">
                        <thead>
                            <tr>
                              <th></th>
                              <th>Map</th>
                            </tr>
                        </thead>
                        <tbody>
                                          <tr>
                             <td>1</td>
                             <td>
                               <select name="round_map" id="round_map" onchange="setMap('17', '1', this.value)" class="form-control">
                                    <option></option>
                                                               <option selected value="Pokemon">Pokemon</option>
                                                          </select>
                             </td>
                            </tr>
                                          <tr>
                             <td>2</td>
                             <td>
                               <select name="round_map" id="round_map" onchange="setMap('17', '2', this.value)" class="form-control">
                                    <option></option>
                                                               <option selected value="Pokemon">Pokemon</option>
                                                          </select>
                             </td>
                            </tr>
                                       </tbody>
                       </table>
                    </div>
                                <div class="success maps_success">
                      <span class="success_text maps_text"></span>
                    </div>
                </form>
            </div>
        </div>
    </div>    </div>
        <div class="col-lg-8">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <i class="fa fa-sitemap"></i> Tournament Bracket
     
                                <div class="pull-right">
                        <button id="generateRound1Matches" style="margin-right:5px;" data-tournament-id="17" data-tournament-teams="4" class="btn btn-primary btn-xs">Generate Round 1 Matchups</a></button>
                        <button id="clearRound1Matches" class="btn btn-warning btn-xs" style="display:none;">Clear Matches</button> 
                    </div>
            </div>
    <div class="panel-body">
    <small>* <em>Round 1</em> matchups can be generated up until a <em>Round 1</em> Match has been completed</small>
    	<main id="tournament">
    		<ul class="round round-1">
    					<li class="spacer">&nbsp;</li>
    		<!-- wrap score inside span element -->
    		<li class="game game-top"></li>
    		<li class="game game-spacer">&nbsp;</li>
    		<li class="game game-bottom "></li>
     
    		<li class="spacer">&nbsp;</li>
     
    		<li class="game game-top"></li>
    		<li class="game game-spacer">&nbsp;</li>
    		<li class="game game-bottom "></li>
     
    		<li class="spacer">&nbsp;</li>
    		</ul>
    		<ul class="round round-2">
    					<li class="spacer">&nbsp;</li>
     
    		<li class="game game-top"></li>
    		<li class="game game-spacer">&nbsp;</li>
    		<li class="game game-bottom "></li>
     
    		<li class="spacer">&nbsp;</li>
    		</ul>
    		<ul class="round round-3">
    					<li class="spacer">&nbsp;</li>
    			<li class="game game-top"></li>
    			<li class="game spacer champion">Tournament Champion</li>
    				</ul>
    	</main>
    </div>            </div>
            </div>
        </div>
    </div>
        <div id="addTournamentTeamsModal" class="modal"></div>        </div>
            <!-- /#page-wrapper -->
     
        </div>
        <!-- /#wrapper -->
     
        <div id="delete-tournament-confirm" title="Delete tournament?" style="display:none;">
    		<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>All corresponding tournament <em>matches, schedule &amp; other</em> data will be permanently deleted.</p>
    	</div>
        <div id="kick-team-confirm" title="Kick Team" style="display:none;">
            <p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>All future team matches will be forfeited. This cannot be undone.</p><p> Are you sure you want to take this action?</p>
        </div>
     
        <!-- Core Scripts - Include with every page -->
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
        <link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css" />
    	<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
        <script src="js/plugins/metisMenu/jquery.metisMenu.js"></script>
     
        <!-- SB Admin Scripts - Include with every page -->
        <script src="js/sb-admin.js"></script>
        <script src="js/ezleague/tournament.js"></script>
        <script src="js/ezleague/teams.js"></script>
        <script src="//cdn.ckeditor.com/4.4.7/standard/ckeditor.js"></script>
    	<script>
    	CKEDITOR.replace( 'body', {
    		toolbar: [
    			[ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink' ],
    			[ 'FontSize', 'TextColor', 'BGColor' ]
    		]
    	});
    	</script>
    </body>
     
    </html>
    Cordialement,

  11. #11
    Invité
    Invité(e)
    Par défaut
    Bonjour,
    Qu'as-tu fait depuis ?

    Que donne
    ?

    N.B Ca fait partie du B-A-Ba du débogage.

Discussions similaires

  1. Optimiser une boucle For Each
    Par zaghi dans le forum VB.NET
    Réponses: 14
    Dernier message: 21/06/2012, 12h19
  2. Optimisation des boucles for
    Par Kikouyou1080 dans le forum Général Python
    Réponses: 5
    Dernier message: 04/06/2010, 18h16
  3. optimiser une boucle for
    Par bakaratoun dans le forum MATLAB
    Réponses: 2
    Dernier message: 28/01/2010, 15h22
  4. Optimiser 2 boucles FOR ?
    Par B&B dans le forum SQL
    Réponses: 6
    Dernier message: 18/04/2008, 16h43
  5. Comment optimiser plusieurs boucles FOR-END imbriquées
    Par totoc1001 dans le forum MATLAB
    Réponses: 26
    Dernier message: 13/05/2007, 18h59

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo