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

EDI, CMS, Outils, Scripts et API PHP Discussion :

[Calendrier] date francaise


Sujet :

EDI, CMS, Outils, Scripts et API PHP

  1. #1
    Candidat au Club
    Inscrit en
    Juillet 2009
    Messages
    7
    Détails du profil
    Informations forums :
    Inscription : Juillet 2009
    Messages : 7
    Points : 2
    Points
    2
    Par défaut [Calendrier] date francaise
    désolé pour mes anciens post qui n'ont pas l'air de fonctionner. Je vous disait donc que j'étais un débutant voulant mettre un calendrier sur son site et que j'avais des soucis pour mettre la fonction schedule en français et pour transférer l'authentification sur une autre page. Voici le code en espérant que vous pourrez m'aider ou me conseiller:

    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
    <?php
    //on se connecte a la base de données
    $Host ="localhost";
    $User ="root";
    $DataBaseName ="agenda";
    $TableName ="calendrier";
     
    mysql_connect($Host,$User);
    mysql_select_db($DataBaseName);
     
    //on créé la base de donneée automatiquement si ce n'est deja fait (histoire de pouvoir l'utiliser sur n'importe quel server.
    $Tables = mysql_query("show tables like '" . $TableName . "'");
     
    if(mysql_fetch_row($Tables) == false)
      {
     
    //on rentre la requete SQL de creation de la BdD
     
      $create = "create table " . $TableName .
                "(" .
                "id int primary key auto_increment, " .
                "text text, " .
                "day int, " .
                "month int, " .
                "year int " .
                ")";
    //on execute la requete créée
     
      mysql_query($create);
      }
     
    $Entered_UserName = "";
    $Entered_PassWord = "";
     
    if(isset($HTTP_COOKIE_VARS["UserName"]) &&
       isset($HTTP_COOKIE_VARS["PassWord"]))
      {
      $Entered_UserName = $HTTP_COOKIE_VARS["UserName"];
      $Entered_PassWord = $HTTP_COOKIE_VARS["PassWord"];
      }
     
    $isLogged = true;
     
    if($Entered_UserName != $User || $Entered_PassWord != $PassWord)
       $isLogged = false;
     
    //Execute MySQL queries if someone is logged in.
    if($isLogged == true)
      {
      if(param("save") != "")
        {
        for($week_day = 0; $week_day < 7; $week_day++)
           {
           $day = abs(param("day" . $week_day));
           $month = abs(param("month" . $week_day));
           $year = abs(param("year" . $week_day));
           $text = trim(param("text" . $week_day));
     
           $Select = "select count(id) from " . $TableName . " where day = " . $day .
                     " and month = " . $month .
                     " and year = " . $year;
     
           $entries = mysql_query($Select);
           $entry = mysql_fetch_array($entries);
     
           if($entry[0] < 1)
             {
             if($text != "")
               {
               $Insert = "insert into " . $TableName . " (text, day, month, year) values ('" . $text . "', " .
                         $day . ", " . $month . ", " . $year . ")";
               //Si il n'y a aucun enregistrement pour cette date, on va en creer un
               mysql_query($Insert);
               }
             }
           else
             {
             if($text != "")
               {
               $Update = "update " . $TableName . " set text ='" . $text . "' where day = " . $day .
                         " and month = " . $month . " and year = " . $year;
     
               mysql_query($Update);
               }
             else
               {
               $Delete = "delete from " . $TableName . " where day = " . $day .
                         " and month = " . $month . " and year = " . $year;
               //On supprime l'entrée dans la base de donnée
               mysql_query($Delete);
               }
             }
           }
        }
      }
     
    function schedule($date)
             {
             //If no parameter is passed use the current date.
             if($date == null)
                $date = getDate();
     
             $day = $date["mday"];
             $week_day = $date["wday"];
             $month = $date["mon"];
             $month_name = $date["month"];
             $year = $date["year"];
     
             $today = getDate(mktime(0, 0, 0, $month, $day, $year));
     
             $sunday = $day - $week_day;
             $saturday = $day + (6 - $week_day);
     
             $schedule_html = "<table height=\"100%\" width=\"100%\" cellspacing=\"20\">\n";
     
             $schedule_html .= "<tr><td align=\"right\" valign=\"top\">\n";
     
             global $previous_month;
             global $this_month;
             global $next_month;
     
             $previous_month = getDate(mktime(0, 0, 0, $month - 1, 1, $year));
             $this_month = getDate(mktime(0, 0, 0, $month, 1, $year));
             $next_month = getDate(mktime(0, 0, 0, $month + 1, 1, $year));
     
             $first_week_day = $this_month["wday"];
             $days_in_this_month = round(($next_month[0] - $this_month[0]) / (60 * 60 * 24));
     
             $schedule_html .= "<table>\n";
     
             $schedule_html .= "<tr><td align=\"center\" class=\"calendar_cell\">" .
                               "<a class=\"calendar_date\" " .
                               "href=\"" . $_SERVER["PHP_SELF"] . "?month=" . $previous_month["mon"] . "&year=" . $previous_month["year"] . "\"><</a></td>\n";
     
             $schedule_html .= "<td colspan=\"5\" align=\"center\" class=\"calendar_cell\">" .
                               "<font class=\"calendar_month\">" . $month_name . " " . $year . "</font></td>\n";
     
             $schedule_html .= "<td align=\"center\" class=\"calendar_cell\">" .
                               "<a class=\"calendar_date\" " .
                               "href=\"" . $_SERVER["PHP_SELF"] . "?month=" . $next_month["mon"] . "&year=" . $next_month["year"] . "\">></a></td></tr>\n";
     
             $schedule_html .= "<tr>\n";
     
             //Fill the first week of the month with the appropriate number of blanks.
             for($week_day = 0; $week_day < $first_week_day; $week_day++)
                {
                $schedule_html .= "<td class=\"calendar_cell\">&nbsp;</td>";
                }
     
             $week_day = $first_week_day;
             for($day_counter = 1; $day_counter <= $days_in_this_month; $day_counter++)
                {
                $week_day %= 7;
     
                if($week_day == 0)
                   $schedule_html .= "</tr><tr>\n";
     
                //Do something different for the current day.
                if($day == $day_counter)
                   $schedule_html .= "<td class=\"calendar_current_cell\" align=\"center\"><font class=\"calendar_current_date\">" . $day_counter . "</font></td>\n";
                else
                   $schedule_html .= "<td align=\"center\" class=\"calendar_cell\">&nbsp;" .
                                     "<a class=\"calendar_date\" href=\"" . $_SERVER["PHP_SELF"] . "?day=" . $day_counter . "&month=" . $month . "&year=" . $year . "\">" .
                                     $day_counter . "</a>&nbsp;</td>\n";
     
                $week_day++;
                }
     
             $schedule_html .= "</tr>\n";
             $schedule_html .= "</table>\n";
     
             $schedule_html .= "<br /><br />\n";
     
             //Login.
             global $isLogged;
     
             $schedule_html .= "<table align=\"right\">\n";
     
             if($isLogged == true)
               {
               $schedule_html .= "<tr>";
               $schedule_html .= "<td>";
               $schedule_html .= "<input type=\"hidden\" name=\"save\" value=\"yes\" />";
               $schedule_html .= "<input type=\"button\" value=\"log out\" class=\"calendar_cell\" ";
               $schedule_html .= "onclick=\"clearCookie('UserName');";
               $schedule_html .= "clearCookie('PassWord');";
               $schedule_html .= "document.EmptyForm.submit();\" />";
               $schedule_html .= "</td>";
               $schedule_html .= "<td width=\"33%\"></td>";
               $schedule_html .= "<td>";
               $schedule_html .= "<input type=\"button\" value=\"save\" class=\"calendar_cell\" ";
               $schedule_html .= "onclick=\"document.save.submit();\" />";
               $schedule_html .= "</td>";
               $schedule_html .= "</tr>\n";
               }
             else
               {
               $schedule_html .= "<form name=\"login\">";
               $schedule_html .= "<tr>";
               $schedule_html .= "<td align=\"right\">";
               $schedule_html .= "<input type=\"text\" name=\"UserName\" class=\"calendar_cell\" />";
               $schedule_html .= "</td>";
               $schedule_html .= "</tr>";
               $schedule_html .= "<tr>";
               $schedule_html .= "<td align=\"right\">";
               $schedule_html .= "<input type=\"password\" name=\"PassWord\" class=\"calendar_cell\" />";
               $schedule_html .= "</td>";
               $schedule_html .= "</tr>";
               $schedule_html .= "<tr>";
               $schedule_html .= "<td align=\"right\">";
               $schedule_html .= "<input type=\"button\" value=\"log in\" class=\"calendar_cell\" ";
               $schedule_html .= "onclick=\"setCookie('UserName', document.login.UserName.value);";
               $schedule_html .= "setCookie('PassWord', document.login.PassWord.value);";
               $schedule_html .= "document.EmptyForm.submit();\" />";
               $schedule_html .= "</td>";
               $schedule_html .= "</tr>";
               $schedule_html .= "</form>\n";
               }
     
             $schedule_html .= "<form name=\"EmptyForm\" method=\"post\">\n";
             $schedule_html .= "</form>\n";
     
             $schedule_html .= "</table>\n";
     
             $schedule_html .= "</td>\n";
     
             $schedule_html .= "<td valign=\"top\" width=\"100%\"><table width=\"100%\" cellpadding=\"10\">\n";
     
             if($isLogged == true)
               {
               $schedule_html .= "<form name=\"save\" method=\"post\">\n";
               $schedule_html .= "<input type=\"hidden\" name=\"save\" value=\"save\">\n";
               }
     
     
             for($index = $sunday; $index <= $saturday; $index++)
                {
                $date = getDate(mktime(0, 0, 0, $month, $index, $year));
     
                $schedule_date = "schedule_date";
                $schedule_entry = "schedule_entry";
                if(($month > $date["mon"] && $year == $date["year"]) || $year > $date["year"])
                  {
                  $schedule_date = "schedule_date_previous";
                  $schedule_entry = "schedule_entry_previous";
                  }
                if(($month < $date["mon"] && $year == $date["year"]) || $year < $date["year"])
                  {
                  $schedule_date = "schedule_date_next";
                  $schedule_entry = "schedule_entry_next";
                  }
     
                $schedule_html .= "<tr><td align=\"right\" class=\"" . $schedule_date . "\">";
     
                $schedule_html .= $date["weekday"] . " " .
                                  $date["month"] . " " .
                                  $date["mday"] . ", " .
                                  $date["year"] . "\n";
     
                $schedule_html .= "</br>\n";
     
                $schedule_text = getSchedule($date["mday"], $date["mon"], $date["year"]);
     
                $readonly = "readonly";
                if($isLogged == true)
                   $readonly = "";
     
                if($isLogged == true)
                  {
                  $schedule_html .= "<input type=\"hidden\" name=\"day" . $date["wday"] . "\" value=\"" . $date["mday"] . "\" />\n";
                  $schedule_html .= "<input type=\"hidden\" name=\"month" . $date["wday"] . "\" value=\"" . $date["mon"] . "\" />\n";
                  $schedule_html .= "<input type=\"hidden\" name=\"year" . $date["wday"] . "\" value=\"" . $date["year"] . "\" />\n";
                  }
     
                $schedule_html .= "<textarea wrap=\"off\" name=\"text" . $date["wday"] . "\" class=\"" .
                                  $schedule_entry . "\" style=\"width:100%;overflow:auto;\" rows=\"" .
                                  rows($schedule_text) . "\" " . $readonly . ">\n" .
                                  $schedule_text . "</textarea>\n";
     
                $schedule_html .= "</td></tr>\n";
                }
     
             if($isLogged == true)
                $schedule_html .= "</form>\n";
     
             $schedule_html .= "</table></td></tr>\n";
     
             $schedule_html .= "</table>\n";
     
             return($schedule_html);
             }
     
    function getSchedule($day, $month, $year)
             {
             global $TableName;
     
             $Select = "select text from " . $TableName . " where " .
                       "day = " . $day . " and " .
                       "month = " . $month . " and " .
                       "year = " . $year;
     
             $Schedule = mysql_query($Select);
     
             if($Text = mysql_fetch_assoc($Schedule))
               {
               return($Text["text"]);
               }
             else
               {
               return("");
               }
             }
     
    function rows($text)
             {
             return(substr_count($text, "\n") + 1);
             }
     
    function param($Name)
             {
             global $HTTP_GET_VARS;
             global $HTTP_POST_VARS;
     
             if(isset($HTTP_GET_VARS[$Name]))
                return($HTTP_GET_VARS[$Name]);
     
             if(isset($HTTP_POST_VARS[$Name]))
                return($HTTP_POST_VARS[$Name]);
     
             return("");
             }
     
    $day = param("day");
    $month = param("month");
    $year = param("year");
    $date = null;
     
    if($year != "")
      {
      if($day == "")
         $day = 1;
      if($month == "")
         $month = 1;
     
      $date = getDate(mktime(0, 0, 0, $month, $day, $year));
      }
     
    $agenda = schedule($date);
     
    $previous_month;
    $this_month;
    $next_month;
     
    ?>
     
    <html>
    	<head>
    		<title>agenda calendar</title>
    	</head>
    	<body>
    		<?= $agenda ?>
    	</body>
    </html>

  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
    Points : 44 155
    Points
    44 155
    Par défaut
    Pourrais-tu être plus précis sur ce qui ne fonctionne pas ?
    Que veux-tu obtenir precisemment et qu'obtiens-tu à la place ?
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  3. #3
    Candidat au Club
    Inscrit en
    Juillet 2009
    Messages
    7
    Détails du profil
    Informations forums :
    Inscription : Juillet 2009
    Messages : 7
    Points : 2
    Points
    2
    Par défaut
    j'obtient des dates a l'anglase comme "february"au lieu de fevrier, Wednesday July 29, 2009 au lieu de Mercredi 29 juillet 2009 par exemple. voila voila
    Merci de votre attention.

  4. #4
    Membre actif Avatar de Alshten
    Homme Profil pro
    Développeur Web
    Inscrit en
    Novembre 2005
    Messages
    157
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Novembre 2005
    Messages : 157
    Points : 233
    Points
    233
    Par défaut
    Pour avoir les dates localisées, utilise setlocale pour spécifier ta langue et strftime pour construire tes dates.

  5. #5
    Candidat au Club
    Inscrit en
    Juillet 2009
    Messages
    7
    Détails du profil
    Informations forums :
    Inscription : Juillet 2009
    Messages : 7
    Points : 2
    Points
    2
    Par défaut
    merci je vais voir ca, c'est gentil

  6. #6
    Candidat au Club
    Inscrit en
    Juillet 2009
    Messages
    7
    Détails du profil
    Informations forums :
    Inscription : Juillet 2009
    Messages : 7
    Points : 2
    Points
    2
    Par défaut
    heu je suis un bon gros débutant et en fait je vois pas trop comment implementer cette fonction a celle de
    Code php : 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
    function schedule($date)
             {
             //If no parameter is passed use the current date.
             if($date == null)
                $date = getDate();
     
             $day = $date["mday"];
             $week_day = $date["wday"];
             $month = $date["mon"];
             $month_name = $date["month"];
             $year = $date["year"];
     
             $today = getDate(mktime(0, 0, 0, $month, $day, $year));
     
             $sunday = $day - $week_day;
             $saturday = $day + (6 - $week_day);
     
             $schedule_html = "<table height=\"100%\" width=\"100%\" cellspacing=\"20\">\n";
     
             $schedule_html .= "<tr><td align=\"right\" valign=\"top\">\n";
     
             global $previous_month;
             global $this_month;
             global $next_month;
     
             $previous_month = getDate(mktime(0, 0, 0, $month - 1, 1, $year));
             $this_month = getDate(mktime(0, 0, 0, $month, 1, $year));
             $next_month = getDate(mktime(0, 0, 0, $month + 1, 1, $year));
     
             $first_week_day = $this_month["wday"];
             $days_in_this_month = round(($next_month[0] - $this_month[0]) / (60 * 60 * 24));
     
             $schedule_html .= "<table>\n";
     
             $schedule_html .= "<tr><td align=\"center\" class=\"calendar_cell\">" .
                               "<a class=\"calendar_date\" " .
                               "href=\"" . $_SERVER["PHP_SELF"] . "?month=" . $previous_month["mon"] . "&year=" . $previous_month["year"] . "\"><</a></td>\n";
     
             $schedule_html .= "<td colspan=\"5\" align=\"center\" class=\"calendar_cell\">" .
                               "<font class=\"calendar_month\">" . $month_name . " " . $year . "</font></td>\n";
     
             $schedule_html .= "<td align=\"center\" class=\"calendar_cell\">" .
                               "<a class=\"calendar_date\" " .
                               "href=\"" . $_SERVER["PHP_SELF"] . "?month=" . $next_month["mon"] . "&year=" . $next_month["year"] . "\">></a></td></tr>\n";
     
             $schedule_html .= "<tr>\n";
     
             //Fill the first week of the month with the appropriate number of blanks.
             for($week_day = 0; $week_day < $first_week_day; $week_day++)
                {
                $schedule_html .= "<td class=\"calendar_cell\">&nbsp;</td>";
                }
     
             $week_day = $first_week_day;
             for($day_counter = 1; $day_counter <= $days_in_this_month; $day_counter++)
                {
                $week_day %= 7;
     
                if($week_day == 0)
                   $schedule_html .= "</tr><tr>\n";
     
                //Do something different for the current day.
                if($day == $day_counter)
                   $schedule_html .= "<td class=\"calendar_current_cell\" align=\"center\"><font class=\"calendar_current_date\">" . $day_counter . "</font></td>\n";
                else
                   $schedule_html .= "<td align=\"center\" class=\"calendar_cell\">&nbsp;" .
                                     "<a class=\"calendar_date\" href=\"" . $_SERVER["PHP_SELF"] . "?day=" . $day_counter . "&month=" . $month . "&year=" . $year . "\">" .
                                     $day_counter . "</a>&nbsp;</td>\n";
     
                $week_day++;
                }
     
             $schedule_html .= "</tr>\n";
             $schedule_html .= "</table>\n";
     
             $schedule_html .= "<br /><br />\n";
     
             //Login.
             global $isLogged;
     
             $schedule_html .= "<table align=\"right\">\n";
     
             if($isLogged == true)
               {
               $schedule_html .= "<tr>";
               $schedule_html .= "<td>";
               $schedule_html .= "<input type=\"hidden\" name=\"save\" value=\"yes\" />";
               $schedule_html .= "<input type=\"button\" value=\"log out\" class=\"calendar_cell\" ";
               $schedule_html .= "onclick=\"clearCookie('UserName');";
               $schedule_html .= "clearCookie('PassWord');";
               $schedule_html .= "document.EmptyForm.submit();\" />";
               $schedule_html .= "</td>";
               $schedule_html .= "<td width=\"33%\"></td>";
               $schedule_html .= "<td>";
               $schedule_html .= "<input type=\"button\" value=\"save\" class=\"calendar_cell\" ";
               $schedule_html .= "onclick=\"document.save.submit();\" />";
               $schedule_html .= "</td>";
               $schedule_html .= "</tr>\n";
               }
             else
               {
               $schedule_html .= "<form name=\"login\">";
               $schedule_html .= "<tr>";
               $schedule_html .= "<td align=\"right\">";
               $schedule_html .= "<input type=\"text\" name=\"UserName\" class=\"calendar_cell\" />";
               $schedule_html .= "</td>";
               $schedule_html .= "</tr>";
               $schedule_html .= "<tr>";
               $schedule_html .= "<td align=\"right\">";
               $schedule_html .= "<input type=\"password\" name=\"PassWord\" class=\"calendar_cell\" />";
               $schedule_html .= "</td>";
               $schedule_html .= "</tr>";
               $schedule_html .= "<tr>";
               $schedule_html .= "<td align=\"right\">";
               $schedule_html .= "<input type=\"button\" value=\"log in\" class=\"calendar_cell\" ";
               $schedule_html .= "onclick=\"setCookie('UserName', document.login.UserName.value);";
               $schedule_html .= "setCookie('PassWord', document.login.PassWord.value);";
               $schedule_html .= "document.EmptyForm.submit();\" />";
               $schedule_html .= "</td>";
               $schedule_html .= "</tr>";
               $schedule_html .= "</form>\n";
               }
     
             $schedule_html .= "<form name=\"EmptyForm\" method=\"post\">\n";
             $schedule_html .= "</form>\n";
     
             $schedule_html .= "</table>\n";
     
             $schedule_html .= "</td>\n";
     
             $schedule_html .= "<td valign=\"top\" width=\"100%\"><table width=\"100%\" cellpadding=\"10\">\n";
     
             if($isLogged == true)
               {
               $schedule_html .= "<form name=\"save\" method=\"post\">\n";
               $schedule_html .= "<input type=\"hidden\" name=\"save\" value=\"save\">\n";
               }
     
     
             for($index = $sunday; $index <= $saturday; $index++)
                {
                $date = getDate(mktime(0, 0, 0, $month, $index, $year));
     
                $schedule_date = "schedule_date";
                $schedule_entry = "schedule_entry";
                if(($month > $date["mon"] && $year == $date["year"]) || $year > $date["year"])
                  {
                  $schedule_date = "schedule_date_previous";
                  $schedule_entry = "schedule_entry_previous";
                  }
                if(($month < $date["mon"] && $year == $date["year"]) || $year < $date["year"])
                  {
                  $schedule_date = "schedule_date_next";
                  $schedule_entry = "schedule_entry_next";
                  }
     
                $schedule_html .= "<tr><td align=\"right\" class=\"" . $schedule_date . "\">";
     
                $schedule_html .= $date["weekday"] . " " .
                                  $date["month"] . " " .
                                  $date["mday"] . ", " .
                                  $date["year"] . "\n";
     
                $schedule_html .= "</br>\n";
     
                $schedule_text = getSchedule($date["mday"], $date["mon"], $date["year"]);
     
                $readonly = "readonly";
                if($isLogged == true)
                   $readonly = "";
     
                if($isLogged == true)
                  {
                  $schedule_html .= "<input type=\"hidden\" name=\"day" . $date["wday"] . "\" value=\"" . $date["mday"] . "\" />\n";
                  $schedule_html .= "<input type=\"hidden\" name=\"month" . $date["wday"] . "\" value=\"" . $date["mon"] . "\" />\n";
                  $schedule_html .= "<input type=\"hidden\" name=\"year" . $date["wday"] . "\" value=\"" . $date["year"] . "\" />\n";
                  }
     
                $schedule_html .= "<textarea wrap=\"off\" name=\"text" . $date["wday"] . "\" class=\"" .
                                  $schedule_entry . "\" style=\"width:100%;overflow:auto;\" rows=\"" .
                                  rows($schedule_text) . "\" " . $readonly . ">\n" .
                                  $schedule_text . "</textarea>\n";
     
                $schedule_html .= "</td></tr>\n";
                }
     
             if($isLogged == true)
                $schedule_html .= "</form>\n";
     
             $schedule_html .= "</table></td></tr>\n";
     
             $schedule_html .= "</table>\n";
     
             return($schedule_html);
             }

  7. #7
    Candidat au Club
    Inscrit en
    Juillet 2009
    Messages
    7
    Détails du profil
    Informations forums :
    Inscription : Juillet 2009
    Messages : 7
    Points : 2
    Points
    2
    Par défaut
    bon ok j'ai résolu mon probleme en faisant une bete correspondance de tableaux un soucis persiste par contre quand je veux passer de decembre a janvier, janvier n'apparait pas :S
    pouvez vous encore aider un pauvre ignorant tel que moi ? revoila mon
    Code php : 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
    <?php 
    function schedule($date)
             {
             setlocale (LC_TIME, 'fr_FR.utf8','fra');
    		 //Si aucun parametre n'est entré on utilise la date d'aujourd'hui
             if($date == null)
                $date = getdate();
    			$mois=array('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre');
    			$jour=array('lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi','dimanche');
     
             $day = $date["mday"];
             $week_day = $date["wday"];
             $month = $date["mon"];
             $month_name = $mois[$date["mon"]];
             $year = $date["year"];
     
             $today = getDate(mktime(0, 0, 0, $month, $day, $year));
     
             $sunday = $day - $week_day;
             $saturday = $day + (6 - $week_day);
     
             $schedule_html = "<table height=\"100%\" width=\"100%\" cellspacing=\"20\">\n";
     
             $schedule_html .= "<tr><td align=\"right\" valign=\"top\">\n";
     
             global $previous_month;
             global $this_month;
             global $next_month;
     
             $previous_month = getDate(mktime(0, 0, 0, $month-1, 1, $year));
             $this_month = getDate(mktime(0, 0, 0, $month, 1, $year));
             $next_month = getDate(mktime(0, 0, 0, $month + 1, 1, $year));
     
             $first_week_day = $this_month["wday"];
             $days_in_this_month = round(($next_month[0] - $this_month[0]) / (60 * 60 * 24));
     
             $schedule_html .= "<table>\n";
     
             $schedule_html .= "<tr><td align=\"center\" class=\"calendar_cell\">" .
                               "<a class=\"calendar_date\" " .
                               "href=\"" . $_SERVER["PHP_SELF"] . "?month=" . $previous_month["mon"] . "&year=" . $previous_month["year"] . "\"><</a></td>\n";
     
             $schedule_html .= "<td colspan=\"5\" align=\"center\" class=\"calendar_cell\">" .
                               "<font class=\"calendar_month\">" . $month_name . " " . $year . "</font></td>\n";
     
             $schedule_html .= "<td align=\"center\" class=\"calendar_cell\">" .
                               "<a class=\"calendar_date\" " .
                               "href=\"" . $_SERVER["PHP_SELF"] . "?month=" . $next_month["mon"] . "&year=" . $next_month["year"] . "\">></a></td></tr>\n";
     
             $schedule_html .= "<tr>\n";
     
             //Fill the first week of the month with the appropriate number of blanks.
             for($week_day = 0; $week_day < $first_week_day; $week_day++)
                {
                $schedule_html .= "<td class=\"calendar_cell\">&nbsp;</td>";
                }
     
             $week_day = $first_week_day;
             for($day_counter = 1; $day_counter <= $days_in_this_month; $day_counter++)
                {
                $week_day %= 7;
     
                if($week_day == 0)
                   $schedule_html .= "</tr><tr>\n";
     
                //Do something different for the current day.
                if($day == $day_counter)
                   $schedule_html .= "<td class=\"calendar_current_cell\" align=\"center\"><font class=\"calendar_current_date\">" . $day_counter . "</font></td>\n";
                else
                   $schedule_html .= "<td align=\"center\" class=\"calendar_cell\">&nbsp;" .
                                     "<a class=\"calendar_date\" href=\"" . $_SERVER["PHP_SELF"] . "?day=" . $day_counter . "&month=" . $month . "&year=" . $year . "\">" .
                                     $day_counter . "</a>&nbsp;</td>\n";
     
                $week_day++;
                }
     
             $schedule_html .= "</tr>\n";
             $schedule_html .= "</table>\n";
     
             $schedule_html .= "<br /><br />\n";
     
             //Login.
             global $isLogged;
     
             $schedule_html .= "<table align=\"right\">\n";
     
             if($isLogged == true)
               {
               $schedule_html .= "<tr>";
               $schedule_html .= "<td>";
               $schedule_html .= "<input type=\"hidden\" name=\"save\" value=\"yes\" />";
               $schedule_html .= "<input type=\"button\" value=\"log out\" class=\"calendar_cell\" ";
               $schedule_html .= "onclick=\"clearCookie('UserName');";
               $schedule_html .= "clearCookie('PassWord');";
               $schedule_html .= "document.EmptyForm.submit();\" />";
               $schedule_html .= "</td>";
               $schedule_html .= "<td width=\"33%\"></td>";
               $schedule_html .= "<td>";
               $schedule_html .= "<input type=\"button\" value=\"save\" class=\"calendar_cell\" ";
               $schedule_html .= "onclick=\"document.save.submit();\" />";
               $schedule_html .= "</td>";
               $schedule_html .= "</tr>\n";
               }
             else
               {
               $schedule_html .= "<form name=\"login\">";
               $schedule_html .= "<tr>";
               $schedule_html .= "<td align=\"right\">";
               $schedule_html .= "<input type=\"text\" name=\"UserName\" class=\"calendar_cell\" />";
               $schedule_html .= "</td>";
               $schedule_html .= "</tr>";
               $schedule_html .= "<tr>";
               $schedule_html .= "<td align=\"right\">";
               $schedule_html .= "<input type=\"password\" name=\"PassWord\" class=\"calendar_cell\" />";
               $schedule_html .= "</td>";
               $schedule_html .= "</tr>";
               $schedule_html .= "<tr>";
               $schedule_html .= "<td align=\"right\">";
               $schedule_html .= "<input type=\"button\" value=\"log in\" class=\"calendar_cell\" ";
               $schedule_html .= "onclick=\"setCookie('UserName', document.login.UserName.value);";
               $schedule_html .= "setCookie('PassWord', document.login.PassWord.value);";
               $schedule_html .= "document.EmptyForm.submit();\" />";
               $schedule_html .= "</td>";
               $schedule_html .= "</tr>";
               $schedule_html .= "</form>\n";
               }
     
             $schedule_html .= "<form name=\"EmptyForm\" method=\"post\">\n";
             $schedule_html .= "</form>\n";
     
             $schedule_html .= "</table>\n";
     
             $schedule_html .= "</td>\n";
     
             $schedule_html .= "<td valign=\"top\" width=\"100%\"><table width=\"100%\" cellpadding=\"10\">\n";
     
             if($isLogged == true)
               {
               $schedule_html .= "<form name=\"save\" method=\"post\">\n";
               $schedule_html .= "<input type=\"hidden\" name=\"save\" value=\"save\">\n";
               }
     
     
             for($index = $sunday; $index <= $saturday; $index++)
                {
                $date = getDate(mktime(0, 0, 0, $month, $index, $year));
     
                $schedule_date = "schedule_date";
                $schedule_entry = "schedule_entry";
                if(($month > $date["mon"] && $year == $date["year"]) || $year > $date["year"])
                  {
                  $schedule_date = "schedule_date_previous";
                  $schedule_entry = "schedule_entry_previous";
                  }
                if(($month < $date["mon"] && $year == $date["year"]) || $year < $date["year"])
                  {
                  $schedule_date = "schedule_date_next";
                  $schedule_entry = "schedule_entry_next";
                  }
     
                $schedule_html .= "<tr><td align=\"right\" class=\"" . $schedule_date . "\">";
     
    //representation de la date pour les commentaires
    			$schedule_html .= $jour[$date["wday"]] . " " .
                                  $date["mday"] . " " .
    							  $mois[$date["mon"]] . " " .
     
                                  $date["year"] . "\n";
     
                $schedule_html .= "</br>\n";
     
                $schedule_text = getSchedule($date["mday"], $date["mon"], $date["year"]);
     
                $readonly = "readonly";
                if($isLogged == true)
                   $readonly = "";
     
                if($isLogged == true)
                  {
                  $schedule_html .= "<input type=\"hidden\" name=\"day" . $date["wday"] . "\" value=\"" . $date["mday"] . "\" />\n";
                  $schedule_html .= "<input type=\"hidden\" name=\"month" . $date["wday"] . "\" value=\"" . $date["mon"] . "\" />\n";
                  $schedule_html .= "<input type=\"hidden\" name=\"year" . $date["wday"] . "\" value=\"" . $date["year"] . "\" />\n";
                  }
     
                $schedule_html .= "<textarea wrap=\"off\" name=\"text" . $date["wday"] . "\" class=\"" .
                                  $schedule_entry . "\" style=\"width:100%;overflow:auto;\" rows=\"" .
                                  rows($schedule_text) . "\" " . $readonly . ">\n" .
                                  $schedule_text . "</textarea>\n";
     
                $schedule_html .= "</td></tr>\n";
                }
     
             if($isLogged == true)
                $schedule_html .= "</form>\n";
     
             $schedule_html .= "</table></td></tr>\n";
     
             $schedule_html .= "</table>\n";
     
             return($schedule_html);
             }

  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
    Points : 44 155
    Points
    44 155
    Par défaut
    Les mois vont de 1 à 12 et les jours de la semaine commencent le dimanche :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    $mois=array(1=>'janvier', 2=>'février', 3=>'mars', ....
    $jour=array('dimanche', 'lundi', ....
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  9. #9
    Candidat au Club
    Inscrit en
    Juillet 2009
    Messages
    7
    Détails du profil
    Informations forums :
    Inscription : Juillet 2009
    Messages : 7
    Points : 2
    Points
    2
    Par défaut
    ben je pense que c'est ce que j'ai fais et toujours un soucis...

  10. #10
    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
    Points : 44 155
    Points
    44 155
    Par défaut
    Ce n'est pas en tout cas ce qu'il y a dans le code que tu nous a montré.
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

Discussions similaires

  1. C# 2.0 : Regex Date Francaise
    Par chnew dans le forum ASP.NET
    Réponses: 6
    Dernier message: 06/08/2012, 18h51
  2. composant calendrier (date)
    Par khallouk_soft dans le forum Struts 1
    Réponses: 2
    Dernier message: 22/12/2006, 10h07
  3. Calendrier - Date Time Picker Access 2003 SP2
    Par odelayen dans le forum Access
    Réponses: 2
    Dernier message: 01/09/2006, 13h09
  4. date francaise, anglaise
    Par exyacc dans le forum MS SQL Server
    Réponses: 2
    Dernier message: 27/01/2006, 17h54
  5. [VBA Excel] convertir une date francaise au format anglais
    Par loacast dans le forum Macros et VBA Excel
    Réponses: 6
    Dernier message: 15/12/2005, 17h52

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