From 262be7e249593a2764a7c452f70dc5ac68887d5c Mon Sep 17 00:00:00 2001 From: gburri Date: Sun, 28 Sep 2008 19:58:09 +0000 Subject: [PATCH] =?utf8?q?ADD=20informations=20concernant=20les=20jours=20?= =?utf8?q?pendant=20lesquels=20les=20participants=20sont=20pr=C3=A9sent=20?= =?utf8?q?(pas=20fini)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: svn://localhost/cl7/trunk@2 4c3d3983-c6fa-4c6c-9935-18c3bbef1bf0 --- index.php | 3 ++- tools/yaws.conf | 2 +- tx_inscription.php | 19 +++++++++++++++++++ tx_jeux_joues.php | 4 ++-- update_db.php | 34 +++++++++++++++++++++++++++++++--- 5 files changed, 55 insertions(+), 7 deletions(-) diff --git a/index.php b/index.php index 8d6c578..9e1c878 100644 --- a/index.php +++ b/index.php @@ -1,6 +1,7 @@ diff --git a/tx_inscription.php b/tx_inscription.php index 22847f4..742e153 100644 --- a/tx_inscription.php +++ b/tx_inscription.php @@ -93,6 +93,25 @@ else valide?('value="'.$le_participant->info->e_mail.'"'):''); ?> /> + + + présence + + + valide ? $le_participant->info->id : "0")." + "); + while($periode = mysql_fetch_object($res)) + { + echo '

valide || $periode->participant_id ? 'checked="checked"' : '').' id="periode'.$periode->id.'" type="checkbox" />

'; + } + ?> + + remarques diff --git a/tx_jeux_joues.php b/tx_jeux_joues.php index 8908949..304c34b 100644 --- a/tx_jeux_joues.php +++ b/tx_jeux_joues.php @@ -23,7 +23,7 @@ $jeux_query = mysql_query(" while ($jeu = mysql_fetch_object($jeux_query)) { - // est-ce que le participant courant à voté pour ce jeu ? + # est-ce que le participant courant à voté pour ce jeu ? if ($le_participant->valide) { $a_vote = mysql_fetch_row(mysql_query(" @@ -50,7 +50,7 @@ if ($le_participant->valide) echo ''; -// affichage du nombre de vote restant +# affichage du nombre de vote restant if ($le_participant->valide) echo '

Nombre de votes restant : ' . $le_participant->nb_vote_restant() . '

'; diff --git a/update_db.php b/update_db.php index 3cce184..5ff5904 100644 --- a/update_db.php +++ b/update_db.php @@ -55,8 +55,8 @@ function creer_db() "); mysql_query(" CREATE TABLE IF NOT EXISTS jeux_choisis ( - participant_id mediumint(3) unsigned NOT NULL default '0', - jeu_id mediumint(3) unsigned NOT NULL default '0', + participant_id mediumint(3) unsigned NOT NULL, + jeu_id mediumint(3) unsigned NOT NULL, PRIMARY KEY USING BTREE (participant_id,jeu_id), KEY FK_jeu (jeu_id), CONSTRAINT FK_participant FOREIGN KEY (participant_id) REFERENCES participants (id) ON DELETE CASCADE ON UPDATE CASCADE, @@ -74,7 +74,7 @@ function update_db() { # si la table 'config' n'existe pas alors on suppose qu'aucune table n'existe $version = 0; - if(!$version = @mysql_fetch_object(mysql_query("SELECT valeur FROM config WHERE nom = 'version'"))) + if(!$version = (int)@mysql_fetch_object(mysql_query("SELECT valeur FROM config WHERE nom = 'version'"))) { mysql_query("BEGIN TRANSACTION"); creer_db(); @@ -82,6 +82,34 @@ function update_db() mysql_query("COMMIT"); $version = 1; } + + # version 1 -> 2 + if ($version == 1) + { + mysql_query("BEGIN TRANSACTION"); + mysql_query(" + CREATE TABLE IF NOT EXISTS periodes ( + id mediumint(3) unsigned NOT NULL auto_increment, + nom varchar(200) NOT NULL, + PRIMARY KEY (id) + ) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED; + "); + mysql_query("INSERT INTO periodes (nom) VALUES ('Vendredi soir à samedi')"); + mysql_query("INSERT INTO periodes (nom) VALUES ('Samedi à dimanche')"); + mysql_query("INSERT INTO periodes (nom) VALUES ('Dimanche à lundi')"); + mysql_query(" + CREATE TABLE IF NOT EXISTS participations ( + participant_id mediumint(3) unsigned NOT NULL, + periode_id mediumint(3) unsigned NOT NULL, + PRIMARY KEY USING BTREE (participant_id, periode_id), + KEY FK_periode (periode_id), + CONSTRAINT FK_participant_participations FOREIGN KEY (participant_id) REFERENCES participants (id) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT FK_periode_participations FOREIGN KEY (periode_id) REFERENCES periodes (id) ON DELETE CASCADE ON UPDATE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + "); + mysql_query("UPDATE config SET valeur = '2' WHERE nom = 'version')"); + mysql_query("COMMIT"); + } } update_db(); -- 2.43.0