margin-top: 1px;
margin-bottom: 0px;
}
+#contenu .inscrits .participe {
+ text-align: center;
+ background-image: url(../images/fond2.png);
+ background-repeat: repeat;
+}
+#contenu .inscrits .participe:before {
+ content: "×";
+}
#informations {
margin: 5px;
if($titre[1] && (ip2long($REMOTE_ADDR) & ip2long($MASK_RESEAU)) != (ip2long($IP_SERVEUR) & ip2long($MASK_RESEAU)))
*/
-include_once("php/config.php");
include_once("php/class_participant.php");\r
include_once("php/connexion.php");
+include_once("php/config.php");
include_once("php/controller.php");
$MENU = array(
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
if ($message_utilisateur) echo '<meta name="messageUtilisateur" content="'.$message_utilisateur.'" />';
+ echo '<meta name="cout_periode" content="'.$config->get('cout_periode').'" />';
+ echo '<meta name="cout_total" content="'.$config->get('cout_total').'" />';
?>
<title>Corcelles-Lan 7</title>\r
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" ></link>\r
$('a#contactPifou').attr('href', util.rot13('znvygb:tert.oheev@tznvy.pbz'));
$('a#contactLePiaf').attr('href', util.rot13('znvygb:tyrcvns695@zfa.pbz'));
- $('#formulaireInscription input[name="periodes[]"]').change(function() {
+ /*$('#formulaireInscription input[name="periodes[]"]').change(function() {
cl7.maj_prix_inscription();
- });
+ });*/
// met à jour le prix d'inscription
cl7.maj_prix_inscription();\r
\r
else # Sinon c'est l'id
$res = mysql_query("SELECT * FROM participants WHERE id = " . addslashes($v1));\r
- if (mysql_num_rows($res) == 0)\r
+ if (mysql_error() || mysql_num_rows($res) == 0)\r
{\r
$this->valide = FALSE;\r
}\r
*/\r
static function nombre_participant_max_atteint()\r
{\r
- global $NB_MAX_PARTICIPANT;\r
+ global $config;\r
$res_SQL = mysql_query("SELECT COUNT(*) FROM participants");\r
$nb_participant = mysql_fetch_row($res_SQL);\r
\r
- return $nb_participant[0] >= $NB_MAX_PARTICIPANT;\r
+ return $nb_participant[0] >= $config->get('nb_max_participant');\r
}\r
\r
/**\r
*/\r
static function nombre_place_restante()\r
{\r
- global $NB_MAX_PARTICIPANT;\r
+ global $config;\r
$res_SQL = mysql_query("SELECT COUNT(*) FROM participants");\r
$nb_participant = mysql_fetch_row($res_SQL);\r
\r
- return $NB_MAX_PARTICIPANT - $nb_participant[0];\r
+ return $config->get('nb_max_participant') - $nb_participant[0];\r
}
}
<?php # encoding:utf-8\r
-/**\r
- * Paramètres du site CL7.\r
- */\r
-\r
-# Parametres MySQL\r
-$SQL_HOTE = "localhost";\r
-$SQL_LOGIN = "cl7";\r
-$SQL_PASS = "123soleil";\r
-$NOM_BASE = "corcelles_lan7";\r
+class Config
+{
+ function Config()
+ {
+ $config_req = mysql_query("SELECT nom, valeur FROM config");
+ while ($val = mysql_fetch_object($config_req))
+ $this->config[$val->nom] = $val->valeur;
+ }
+
+ function get($nom)
+ {
+ return $this->config[$nom];
+ }
+
+ private $config;
+}
-$COUT_PERIODE = 15;
-$COUT_TOTAL = 40;
-\r
-# nombre maximum de participant\r
-$NB_MAX_PARTICIPANT = 25;\r
-\r
-# nombre de votes possibles par participants \r
-$NB_VOTES_JEUX = 3;\r
-\r
-# mettre à TRUE pour cloturer les inscriptions\r
-$INSCRIPTIONS_TERMINEES = FALSE;\r
-\r
-# si la partie pizza est visible\r
-$PIZZA_VISIBLE = 0;\r
-\r
-# si on peut commander des pizza (mettre a 0 lorsque on telephone pour commander ! ;)\r
-$PIZZA_PEUT_COMMANDER = 1;\r
+$config = new Config();\r
?>\r
--- /dev/null
+<?php # encoding:utf-8\r
+# Parametres de connexion MySQL\r
+$SQL_HOTE = "localhost";\r
+$SQL_LOGIN = "cl7";\r
+$SQL_PASS = "123soleil";\r
+$NOM_BASE = "corcelles_lan7";\r
+?>\r
* Produit une variable globale nommée '$le_participant'.\r
*/
\r
-include_once("config.php");
+include_once("config_bd.php");
include_once("class_participant.php");\r
$lien_mysql = mysql_connect($SQL_HOTE, $SQL_LOGIN, $SQL_PASS);
mysql_query("DELETE FROM jeux_choisis WHERE participant_id = " . $le_participant->info->id);\r
\r
# traite les trois premiers votes\r
- for ($i = 0; $i < count($votes) && $i < $NB_VOTES_JEUX ; $i++)\r
+ for ($i = 0; $i < count($votes) && $i < $config->get('nb_votes_jeux'); $i++)\r
{\r
mysql_query("INSERT INTO jeux_choisis (participant_id, jeu_id) VALUES (".$le_participant->info->id.", ".(int)$votes[$i].")");\r
}\r
\r
function selection_pizzas()\r
{\r
- global $PIZZA_PEUT_COMMANDER;\r
+ global $config;\r
global $le_participant;\r
$requ = mysql_query("select * from pizzas order by nom");\r
echo '<h1>commande de pizza</h1>';\r
\r
- if ($PIZZA_PEUT_COMMANDER)\r
+ if ($config->get('pizza_peut_commander'))\r
{\r
if ($le_participant->info->pizza != null)\r
echo '<br>Vous avez deja commandé une pizza ! mais vous pouvez encore changez votre choix:';\r
\r
include_once("traitement_pre_affichage.php");\r
\r
-$res = mysql_query("SELECT pseudo, nom, prenom, age, clan_nom, clan_tag, remarques FROM participants ORDER by clan_nom, clan_tag, pseudo");\r
-\r
+$participants = mysql_query("
+ SELECT id, pseudo, nom, prenom, clan_nom, clan_tag, remarques
+ FROM participants
+ ORDER by clan_nom, clan_tag, pseudo
+");\r
+
+$periodes = mysql_query("SELECT nom_abrege FROM periodes ORDER BY id");\r
$debut_table = '\r
<table class="inscrits">\r
<tr>\r
<th>pseudo</th>\r
<th>nom</th>\r
- <th>prénom</th>\r
- <th>age</th>\r
- <th>remarques</th>\r
+ <th>prénom</th>';
+while($periode = mysql_fetch_object($periodes))
+ $debut_table .= '<th>'.$periode->nom_abrege.'</th>';\r
+$debut_table .= '<th>remarques</th>\r
</tr>';\r
\r
$clan_courant = null;\r
\r
-while($participant = mysql_fetch_object($res))\r
+while($participant = mysql_fetch_object($participants))\r
{ \r
if ($clan_courant !== $participant->clan_nom)\r
{\r
echo ($participant->clan_nom != '' ? '</table><h1>'.traitement_pre_affichage($participant->clan_nom).'</h1>' : ''), $debut_table;\r
$clan_courant = $participant->clan_nom;\r
- }\r
+ }
+
+ $participations = mysql_query("
+ SELECT periodes.nom, participations.participant_id FROM periodes
+ LEFT JOIN participations ON periodes.id = participations.periode_id AND participations.participant_id = ".$participant->id."
+ ORDER BY id
+ ");\r
\r
echo '<tr>';\r
echo '<td>', htmlentities($participant->clan_tag, ENT_QUOTES, "UTF-8"), traitement_pre_affichage($participant->pseudo), '</td>';\r
echo '<td>', traitement_pre_affichage($participant->nom), '</td>';\r
- echo '<td>', traitement_pre_affichage($participant->prenom), '</td>';\r
- echo '<td>', traitement_pre_affichage($participant->age), '</td>';\r
+ echo '<td>', traitement_pre_affichage($participant->prenom), '</td>';
+ while ($participation = mysql_fetch_object($participations))
+ echo '<td '.($participation->participant_id == $participant->id ? 'class="participe"' : '').'></td>';
+ \r
echo '<td>', traitement_pre_affichage($participant->remarques), '</td>';\r
echo '</tr>';\r
}\r
CREATE TABLE IF NOT EXISTS periodes (
id mediumint(3) unsigned NOT NULL auto_increment,
nom varchar(200) NOT NULL,
+ nom_abrege varchar(20) NOT NULL DEFAULT '',
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("INSERT INTO periodes (nom, nom_abrege) VALUES ('vendredi soir à samedi', 'v->s')");
+ mysql_query("INSERT INTO periodes (nom, nom_abrege) VALUES ('samedi à dimanche', 's->d')");
+ mysql_query("INSERT INTO periodes (nom, nom_abrege) VALUES ('dimanche à lundi', 'd->l')");
mysql_query("
CREATE TABLE IF NOT EXISTS participations (
participant_id mediumint(3) unsigned NOT NULL,
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')");
+ $participations = mysql_query("SELECT participants.id as participant_id, periodes.id as periode_id FROM participants, periodes");
+ while ($participation = mysql_fetch_object($participations))
+ {
+ mysql_query("
+ INSERT INTO participations (participant_id, periode_id)
+ VALUES (".$participation->participant_id.",".$participation->periode_id.")"
+ );
+ }
+ mysql_query("UPDATE config SET valeur = '2' WHERE nom = 'version'");
+
+ mysql_query("INSERT INTO config (nom, valeur) VALUES ('cout_periode', '15')");
+ mysql_query("INSERT INTO config (nom, valeur) VALUES ('cout_total', '40')");
+ mysql_query("INSERT INTO config (nom, valeur) VALUES ('nb_max_participant', '25')");
+ mysql_query("INSERT INTO config (nom, valeur) VALUES ('nb_votes_jeux', '3')");
+ mysql_query("INSERT INTO config (nom, valeur) VALUES ('inscription_terminees', 'FALSE')");
+ mysql_query("INSERT INTO config (nom, valeur) VALUES ('pizza_visible', 'FALSE')");
+ mysql_query("INSERT INTO config (nom, valeur) VALUES ('pizza_peut_commander', 'TRUE')");
+
mysql_query("COMMIT");
}
}
--- /dev/null
+# fichier décrivant les éléments à ne pas copier lors de la mise ne prod.
+# voir "mise_en_prod.sh"
+
+.*/
+doc/
+TODO
+tools/
+/cl7_urlrewrite.erl
\ No newline at end of file
--- /dev/null
+#/bin/bash
+
+ADRESSE=gburri@euphorik.ch
+REP=/var/www/lans/cl7
+
+cd ../urlrewrite
+erlc cl7_urlrewrite.erl
+cd ..
+rsync -r --delete --exclude-from=tools/exclude . $ADRESSE:$REP
+ssh $ADRESSE "cd $REP; php-cgi php/update_db.php && rm php/update_db.php"
\ No newline at end of file