En fr agenda

Signaler
Messages postés
43
Date d'inscription
lundi 15 septembre 2008
Statut
Membre
Dernière intervention
25 août 2012
-
Messages postés
43
Date d'inscription
lundi 15 septembre 2008
Statut
Membre
Dernière intervention
25 août 2012
-
Bonjour,
svp est ce qu'il y aurait quelqu'un qui pourait m'aider à passer les jours et mois de cet agenda en francais :

<?

$Host = "";
$User = "";
$PassWord = "";
$DataBaseName = "";
$TableName = "";

mysql_connect($Host, $User, $PassWord);
mysql_select_db($DataBaseName);

//This below will create your table for you if it does not exist.
//Feel free to comment it out once the table is created.
$Tables = mysql_query("show tables like '" . $TableName . "'");




if(mysql_fetch_row($Tables) === false)
{
$create = "create table " . $TableName .
"(" .
"id int primary key auto_increment, " .
"text text, " .
"day int, " .
"month int, " .
"year int " .
")";

mysql_query($create);
}



if(isset($_COOKIE["ID_UTILISATEUR"]))
{
$isLogged = true;
}
else
{
$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 = param("day" . $week_day);
$month = param("month" . $week_day);
$year = param("year" . $week_day);
$text = trim(param("text" . $week_day));

$Select mysql_query(" select count(id) from agenda where day '" . $day ."
' and month = '" . $month ."
' and year = '" . $year. "'");


$entry = mysql_fetch_array($Select);


if($entry[0] < 1)
{
if($text != "")
{
$Insert = "insert into " . $TableName . " (text, day, month, year, idutilisateur) values ('" . $text . "', " .
$day . ", " . $month . ", " . $year . " , " . $_COOKIE['ID_UTILISATEUR'] .")";
//If there is no entry in the table for that day, create it.
mysql_query($Insert);
}
}
else
{
if($text != "")
{
$Update "update " . $TableName . " set text'" . $text . "' where day = " . $day .
" and month " . $month . " and year " . $year. " and idutilisateur = " . $_COOKIE['ID_UTILISATEUR'] ;

mysql_query($Update);
}
else
{
$Delete "delete from " . $TableName . " where day " . $day .
" and month " . $month . " and year " . $year. " and idutilisateur = " . $_COOKIE['ID_UTILISATEUR'] ;
//No point in keeping empty records in the table.
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 = "\n\";

$schedule_html .= \"----
\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 .= "----, \" .
\"<</td>\n\";
//voir pour faire un lien en ajax
$schedule_html .= \"" .
"" . $month_name . " " . $year . ", \n\";

$schedule_html .= \"" .
">, \n\";

$schedule_html .= \"----
\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 .= \", \";
}

$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 .= \"----
\n\";

//Do something different for the current day.
if($day == $day_counter)
$schedule_html .= \"" . $day_counter . ", \n\";
else
$schedule_html .= \"" .
"" .
$day_counter . ", \n\";

$week_day++;
}

$schedule_html .= \"\n\";
$schedule_html .= "
\n";

$schedule_html .= "

\n";

//Login.
global $isLogged;

$schedule_html .= "\n\";

if($isLogged == true)
{
$schedule_html .= \"----
\";
$schedule_html .= \"";
$schedule_html .= "";
$schedule_html .= ", \";
$schedule_html .= \", \";
$schedule_html .= \"";
$schedule_html .= "";
$schedule_html .= ", \";
$schedule_html .= \"\n\";
}
else
{
header(\"Location: index.php\");
}

$schedule_html .= \"<form name=\\"EmptyForm\\" method=\\"post\\">\n\";
$schedule_html .= \"</form>\n\";

$schedule_html .= "
\n";

$schedule_html .= "</td>\n";

$schedule_html .= "<td valign="top" width="100%">\n\";

if($isLogged == true)
{
$schedule_html .= \"<form name=\\"save\\" method=\\"post\\">\n\";
$schedule_html .= \"\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 .= \"----
";

$schedule_html .= $date["weekday"] . " " .
$date["month"] . " " .
$date["mday"] . ", " .
$date["year"] . "\n";

$schedule_html .= "\n";

$schedule_text = getSchedule($date["mday"], $date["mon"], $date["year"]);

$readonly = "readonly";
if($isLogged == true)
$readonly = "";

if($isLogged == true)
{
$schedule_html .= "\n";
$schedule_html .= "\n";
$schedule_html .= "\n";
}

$schedule_html .= "<textarea wrap=\"off\" name=\"text" . $date["wday"] . "\" style=\"width:100%;overflow:auto;\" rows=\"" .
rows($schedule_text) . "\" " . $readonly . ">\n" .
$schedule_text . "</textarea>\n";

$schedule_html .= ", \n\";
}

if($isLogged == true)
$schedule_html .= \"</form>\n\";

$schedule_html .= "
</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. " and idutilisateur " . $_COOKIE['ID_UTILISATEUR'] ;;

$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;

?>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<script src="Scripts/ajax.js" type="text/javascript"></script>
<script src="Scripts/heure.js" type="text/javascript"></script>
<script src="Scripts/ongletmenu.js" type="text/javascript"></script>

</head>



<? include('navig.php'); ?>






<?php echo $agenda; ?>








</html>
A voir également:

5 réponses

Messages postés
2380
Date d'inscription
lundi 4 février 2002
Statut
Membre
Dernière intervention
29 décembre 2012
16
Il faut faire quoi ?? J'ai rien compris..
S.
Messages postés
43
Date d'inscription
lundi 15 septembre 2008
Statut
Membre
Dernière intervention
25 août 2012

c'est un script agenda le probleme et que les mois et jours sont en anglais et je les voudrai en francais
Messages postés
2483
Date d'inscription
jeudi 30 novembre 2006
Statut
Membre
Dernière intervention
14 janvier 2011
18
Salut,

C'est pas l'appli (l'agenda) qui est en anglais, mais PHP : http://php.net/setlocale

--
Neige

Souvent la réponse à votre question se trouve dans la doc. Commencez par là ;)
Messages postés
43
Date d'inscription
lundi 15 septembre 2008
Statut
Membre
Dernière intervention
25 août 2012

Oui mais je n sais pas ou placer le setlocal on m a conseille de le mettre en début de page mais ça ne change rien du tout, est ce qu il faut apliquer la fonction a chaque champ ? Et même ça je sais pas faire
Messages postés
43
Date d'inscription
lundi 15 septembre 2008
Statut
Membre
Dernière intervention
25 août 2012

voilà j'ai mi ça en debut de mon code php :
setlocale (LC_TIME, 'fr_FR');
mais ça ne change rien