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

PHP & Base de données Discussion :

Rendre mon calendrier hebdomadaire en langue Française


Sujet :

PHP & Base de données

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2021
    Messages
    4
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 28
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2021
    Messages : 4
    Par défaut Rendre mon calendrier hebdomadaire en langue Française
    Bonjour,
    Je suis débutant en php et html; et je voudrais réaliser un calendrier hebdomadaire où par exemple, un professeur pourrait envoyer des devoirs aux étudiants. Mon code est ci-dessous cependant le calendrier est en anglais et je voudrais le rendre en français. Pourriez vous m'aidez?
    Code html : 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
    <!DOCTYPE html>
    <html lang="fr">
    <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Bootstrap 101 Template</title>
    <!-- Bootstrap -->
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <link rel="stylesheet" href="/css/main.css">
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js">
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js">
    <![endif]-->
    </head>
    <body>
    <h1></h1>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/boostrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
    <?php
    $dt = new DateTime;
    if (isset($_GET['year']) && isset($_GET['week'])) {
    $dt->setISODate($_GET['year'], $_GET['week']);
    } else {
    $dt->setISODate($dt->format('o'), $dt->format('W'));
    }
    $year = $dt->format('o');
    $week = $dt->format('W');
    $month = $dt->format('F');
    $year = $dt->format('Y');
    ?>
    <div classe="container">
    <div class="row">
    <div class="col-md-12">
    <center>
    <h2> <?php echo "$month $year"; ?></h2>
    <a class="btn btn-primary btn-xs" href="<?php echo $_SERVER['PHP_SELF'] . '?week=' . ($week == 1 ? 52 : $week - 1) . '&year=' . ($week == 1 ? $year - 1 : $year); ?>">Semaine précédente</a>
    <!--semaine précédente-->
    <a class="btn btn-primary btn-xs" href="cal.php"> Semaine en cours </a>
    <a class="btn btn-primary btn-xs" href="<?php echo $_SERVER['PHP_SELF'] . '?week=' . ($week == 52 ? 1 : 1 + $week) . '&year=' . ($week == 52 ? 1 + $year : $year); ?>">Semaine prochaine</a>
    <!--semaine suivante -->
    </center>
    <br> </br>
    <table class="table table-bordered">
    <!--<table border="1px">-->
    <tr class="success">
    <?php
    do {
    echo "<td>" . $dt->format('l') . "<br>" . $dt->format('d M Y') . "</td>\n";
    $dt->modify('+1 day');
    } while ($week == $dt->format('W'));
    ?>
    </tr>
    <tr>
    <td width="10%" ; align="center" valign="center">
    <form method="POST" action=""><label>Inserez un devoir: </label> <input type="file" ; name="fichier" /></form>
    </td>
    <td width="10%" ; align="center" valign="center">
    <form method="POST" action=""><label>Inserez un devoir: </label> <input type="file" ; name="fichier" /></form>
    </td>
    <td width="10%" ; align="center" valign="center">
    <form method="POST" action=""><label>Inserez un devoir: </label> <input type="file" ; name="fichier" /></form>
    </td>
    <td width="10%" ; align="center" valign="center">
    <form method="POST" action=""><label>Inserez un devoir: </label> <input type="file" ; name="fichier" /></form>
    </td>
    <td width="10%" ; align="center" valign="center">
    <form method="POST" action=""><label>Inserez un devoir: </label> <input type="file" ; name="fichier" /></form>
    </td>
    <td width="10%" ; align="center" valign="center">
    <Font face=" Z003" ; size="4" ; color="##09214D"><I>Bon week-end! </I></Font>
    </td>
    <td width="10%" ; align="center" valign="center">
    <Font face=" Z003" ; size="4" ; color="##09214D"><I>Bon week-end! </I></Font>
    </td>
    <!-- <td ><img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQiNUa8zKDGHnk27kQ3QkcmHX2qQOA-b0qb6A&usqp=CAU" height="75px" width="150px" /></td>-->
    </tr>
    <tr>
    <td align="center" valign="center"><button class="btn btn-success btn-xs"> <?php echo "Téléchargez un devoir"; ?> </button></td>
    <td align="center" valign="center"><button class="btn btn-success btn-xs"><?php echo "Téléchargez un devoir"; ?> </button></td>
    <td align="center" valign="center"><button class="btn btn-success btn-xs"> <?php echo "Téléchargez un devoir"; ?> </button></td>
    <td align="center" valign="center"><button class="btn btn-success btn-xs"> <?php echo "Téléchargez un devoir"; ?> </button></td>
    <td align="center" valign="center"><button class="btn btn-success btn-xs"> <?php echo "Téléchargez un devoir"; ?></button></td>
    <td align="center" valign="center">
    <Font face=" Z003" ; size="4" ; color="##09214D"><I>Bon week-end! </I></Font>
    </td>
    <td align="center" valign="center">
    <Font face=" Z003" ; size="4" ; color="##09214D"><I>Bon week-end! </I></Font>
    </td>
    </tr>
    </table>
    </div>
    </div>
    </div>
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js">
    <!-- Include all compiled plugins (below), or include individual files as needed
    -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js">
    < /body> <
    /html >

  2. #2
    Expert confirmé
    Avatar de Séb.
    Profil pro
    Inscrit en
    Mars 2005
    Messages
    5 322
    Détails du profil
    Informations personnelles :
    Âge : 47
    Localisation : France

    Informations professionnelles :
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Mars 2005
    Messages : 5 322
    Billets dans le blog
    17
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $month = $dt->format('F');
    Ici tu demandes le mois en toute lettre, en anglais.

    Tu peux créer un tableau associatif de traduction [anglais => français] :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    $months = ['January' => 'Janvier', ...];
    $month = $dt->format('F');
    $month = $months[$month];
    Et éventuellement passer par les numéros de mois pour faciliter la correspondance => $month = $dt->format('n')

    Le principe est le même pour les autres éléments à traduire.

    https://www.php.net/datetime.format

  3. #3
    Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2021
    Messages
    4
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 28
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2021
    Messages : 4
    Par défaut
    Merci beaucoup!!! En effet le mois aNom : Capture d’écran 2021-05-27 à 6.11.26 PM.png
Affichages : 110
Taille : 44,8 Ko bien été modifié par contre par dans le tableau? j'ai pourtant raisonné comme vous me l'avez conseillé.

  4. #4
    Expert confirmé
    Avatar de Séb.
    Profil pro
    Inscrit en
    Mars 2005
    Messages
    5 322
    Détails du profil
    Informations personnelles :
    Âge : 47
    Localisation : France

    Informations professionnelles :
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Mars 2005
    Messages : 5 322
    Billets dans le blog
    17
    Par défaut
    Donne le code mis à jour.

  5. #5
    Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2021
    Messages
    4
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 28
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2021
    Messages : 4
    Par défaut
    Code html : 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
    <!DOCTYPE html>
    <html lang="fr">
     
     
    <head>
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <title>Bootstrap 101 Template</title>
      <!-- Bootstrap -->
      <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">
      <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
      <link rel="stylesheet" href="/css/main.css">
     
      <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
      <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
      <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js">
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js">
    <![endif]-->
    </head>
     
    <body>
      <h1></h1>
      <script src="https://ajax.googleapis.com/ajax/libs/jquery.min.js"></script>
      <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/boostrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
     
     
      <?php
     
     
      $dt = new DateTime;
      if (isset($_GET['year']) && isset($_GET['week'])) {
        $dt->setISODate($_GET['year'], $_GET['week']);
      } else {
        $dt->setISODate($dt->format('o'), $dt->format('W'));
      }
      $year = $dt->format('o');
      $week = $dt->format('W');
      $month = $dt->format('F');
      $year = $dt->format('Y');
      $months = ['January' => 'Janvier', 'February' => 'Février', 'March' => 'Mars', 'April' => 'Avril', 'May' => 'Mai', 'June' => 'Juin', 'July' => 'Juillet', 'August' => 'Aout', 'September' => 'Septembre', 'October' => 'Octobre', 'November' => 'Novembre', 'December' => 'Décembre'];
     
      $month = $dt->format('F');
      $month = $months[$month];
      
      /*$years = ['1' => 'Lundi', '2' => 'Mardi', '3' => 'Mercredi', '4' => 'Jeudi', '5' => 'Vendredi', '6' => 'Samedi', '7' => 'Dimanche'];
      $year = $dt->format('o');
      $year = $years[$year];*/
     
     
      ?>
     
     
      <div classe="container">
        <div class="row">
          <div class="col-md-12">
            <center>
              <h2> <?php echo "$month $year"; ?></h2>
     
              <a class="btn btn-primary btn-xs" href="<?php echo $_SERVER['PHP_SELF'] . '?week=' . ($week == 1 ? 52 : $week - 1) . '&year=' . ($week == 1 ? $year - 1 : $year); ?>">Semaine précédente</a>
              <!--semaine précédente-->
              <a class="btn btn-primary btn-xs" href="cal.php"> Semaine en cours </a>
              <a class="btn btn-primary btn-xs" href="<?php echo $_SERVER['PHP_SELF'] . '?week=' . ($week == 52 ? 1 : 1 + $week) . '&year=' . ($week == 52 ? 1 + $year : $year); ?>">Semaine prochaine</a>
              <!--semaine suivante -->
            </center>
            <br> </br>
            <table class="table table-bordered">
     
              <!--<table border="1px">-->
     
              <tr class="success">
     
                <?php
     
     
                do {
                  echo "<td>"  . $dt->format('N') . "<br>" . $dt->format('d M Y') .  "</td>\n";
                  $dt->modify('+1 day');
                } while ($week == $dt->format('W'));
     
                ?>
     
              </tr>
     
              <tr>
                <td width="10%" ; align="center" valign="center">
                  <form method="POST" action=""><label>Inserez un devoir: </label> <input type="file" ; name="fichier" /></form>
                </td>
                <td width="10%" ; align="center" valign="center">
                  <form method="POST" action=""><label>Inserez un devoir: </label> <input type="file" ; name="fichier" /></form>
                </td>
                <td width="10%" ; align="center" valign="center">
                  <form method="POST" action=""><label>Inserez un devoir: </label> <input type="file" ; name="fichier" /></form>
                </td>
                <td width="10%" ; align="center" valign="center">
                  <form method="POST" action=""><label>Inserez un devoir: </label> <input type="file" ; name="fichier" /></form>
                </td>
                <td width="10%" ; align="center" valign="center">
                  <form method="POST" action=""><label>Inserez un devoir: </label> <input type="file" ; name="fichier" /></form>
                </td>
     
                <td width="10%" ; align="center" valign="center">
                  <Font face=" Z003" ; size="4" ; color="##09214D"><I>Bon week-end! </I></Font>
                </td>
                <td width="10%" ; align="center" valign="center">
                  <Font face=" Z003" ; size="4" ; color="##09214D"><I>Bon week-end! </I></Font>
                </td>
                <!-- <td ><img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQiNUa8zKDGHnk27kQ3QkcmHX2qQOA-b0qb6A&usqp=CAU" height="75px" width="150px" /></td>-->
     
              </tr>
              <tr>
                <td align="center" valign="center"><button class="btn btn-success btn-xs"> <?php echo "Téléchargez un devoir"; ?> </button></td>
                <td align="center" valign="center"><button class="btn btn-success btn-xs"><?php echo "Téléchargez un devoir"; ?> </button></td>
                <td align="center" valign="center"><button class="btn btn-success btn-xs"> <?php echo "Téléchargez un devoir"; ?> </button></td>
                <td align="center" valign="center"><button class="btn btn-success btn-xs"> <?php echo "Téléchargez un devoir"; ?> </button></td>
                <td align="center" valign="center"><button class="btn btn-success btn-xs"> <?php echo "Téléchargez un devoir"; ?></button></td>
                <td align="center" valign="center">
                  <Font face=" Z003" ; size="4" ; color="##09214D"><I>Bon week-end! </I></Font>
                </td>
                <td align="center" valign="center">
                  <Font face=" Z003" ; size="4" ; color="##09214D"><I>Bon week-end! </I></Font>
                </td>
              </tr>
     
            </table>
          </div>
        </div>
      </div>
     
      <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js">
        <!-- Include all compiled plugins (below), or include individual files as needed 
        -->
      <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js">
        < /body> <  /
        html >
    voilà

  6. #6
    Expert confirmé
    Avatar de Séb.
    Profil pro
    Inscrit en
    Mars 2005
    Messages
    5 322
    Détails du profil
    Informations personnelles :
    Âge : 47
    Localisation : France

    Informations professionnelles :
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Mars 2005
    Messages : 5 322
    Billets dans le blog
    17
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    do {
        echo "<td>"  . $dt->format('N') . "<br>" . $dt->format('d M Y') .  "</td>\n";
        $dt->modify('+1 day');
    } while ($week == $dt->format('W'));
    Cela se joue à ce niveau ce coup-ci. Même principe que pour les mois. Avec le lien vers la doc donné plus haut tu devrais t'en sortir pour comprendre

Discussions similaires

  1. [Calendrier] Hebdomadaire des horaires d'accès
    Par celektron dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 3
    Dernier message: 20/02/2006, 21h39
  2. un pack forum en langue française ?
    Par freud dans le forum ASP
    Réponses: 3
    Dernier message: 15/01/2006, 19h52
  3. [Ressource][TXT] dictionnaire de la langue française
    Par Pépé Lélé dans le forum Décisions SGBD
    Réponses: 7
    Dernier message: 26/12/2005, 20h10
  4. [SQL Date] Calendrier hebdomadaire
    Par jacquesh dans le forum Oracle
    Réponses: 4
    Dernier message: 23/11/2005, 11h23
  5. cherche base-> liste de mots de la langue française!!!!
    Par Krost dans le forum Décisions SGBD
    Réponses: 3
    Dernier message: 20/05/2004, 00h24

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