Location: PHPKode > projects > BACKDRAFT Workgroup Management > backoffice/form_change_css.inc.php
<?php
if(!empty($_GET['change_css'])) {
	if($_GET['change_css'] == 1) { 	//selection d'un style css
		if(!empty($_GET['rec']) && $_GET['rec'] == 1) {
			if(isset($_POST['pref_css']) && $_POST['pref_css'] == 1) {
			if(mysql_num_rows(mysql_query("SELECT id FROM preference_membre WHERE id_membre='".$id_membre."'"))){
				mysql_query("UPDATE preference_membre SET id_css = '".$_POST['sel_css']."' WHERE id_membre='".$id_membre."'");
			}else{
				mysql_query("INSERT INTO preference_membre VALUES('','".$id_membre."','','".$_POST['sel_css']."','','','')");
			}}
			$data_css = mysql_fetch_array(mysql_query("SELECT folder FROM css WHERE id = '".$_POST['sel_css']."'"));
			$css = $_SESSION['css'] = $data_css['folder'];
			echo "<table><thead><th> </th><tfoot><td class=\"tfoot\"> </td></tfoot><tr><td><span class=\"alert\"><a class=\"alert\" href=\"index2.php\">Votre choix a &eacute;t&eacute; pris en compte<br/>Cliquer ici pour appliquer le changement !</a></span></td></tr></table>";
		}
?><form name="form_change_css" id="form_change_css" action="ajax.php?place=<?=$place?>&change_css=1&rec=1" method="post">
<table><thead><th>Changer d'habillage</th><th align="right"><img onclick="jsRequest.sendRequest('ajax.php?place=change_css');" class="picto" src="./design/<?=$css?>/img/picto_fermer.gif" alt="Fermer" title="Fermer" border="0" /></th></thead><tfoot><td class="tfoot" colspan="2"> </td></tfoot><tr><td colspan="2">
<label class="title" for="sel_css">Choix de l'habillage</label><?

$req_css = mysql_query("SELECT * FROM css ORDER BY name"); $i=0;
while ($data_css = mysql_fetch_array($req_css)){
$texts[$i] = $data_css['name']." - par ".$data_css['author']." - ".$data_css['size']; $values[$i] = $data_css['id']; $i++;
}
$req_css2 = mysql_fetch_array(mysql_query("SELECT id FROM css WHERE folder='".$css."'"));
print_select_list("sel_css", $texts, $values, '', $req_css2['id'], '', $esc_char = "\"");

?><label class="title" for="pref_css">Enregistrer dans mes pr&eacute;f&eacute;rences</label><input type="checkbox" id="pref_css" name="pref_css" value="1" />
<label class="submit" onclick="jsRequest.sendForm('form_change_css','<?=$place?>');">S&eacute;lectionner</label>
<br /><div align="center" class="lnk"><a onclick="jsRequest.sendRequest('ajax.php?place=<?=$place?>&change_css=2');"><img class="picto" src="./design/<?=$css?>/img/picto_add.gif" alt="Ajouter un style" title="Ajouter un style" border="0" />Ajouter un style</a></div></td>
</tr></table></form><?
}
if($_GET['change_css'] == 2){	 //Ajout de style css
if(!empty($_GET['rec']) && $_GET['rec'] == 2){ 
	if(!empty($_POST['nom_css']) && !empty($_POST['nom_folder_css']) &&  !empty($_POST['auteur_css'])){
		mysql_query("INSERT INTO css VALUES('','".$_POST['nom_css']."','".$_POST['nom_folder_css']."','".$_POST['auteur_css']."','".$_POST['size_css']."',NOW()) ");
		if(!mysql_error()){
			echo "<span class=\"alert\">Le style a bien été ajouté.</span>"; unset($_POST['nom_css'], $_POST['nom_folder_css'],$_POST['auteur_css']);
		}else{
			//echo mysql_error();
			echo "<span class=\"alert\">Une erreur est survenue. Le style css n'a pas pu être ajouté.</span>";
		}
	}
}
?><form name="form_add_css" id="form_add_css" action="ajax.php?place=<?=$place?>&change_css=2&rec=2" method="post">
<table><thead><th>Ajouter un style Css</th><th align="right"><img onclick="jsRequest.sendRequest('ajax.php?place=change_css');" class="picto" src="./design/<?=$css?>/img/picto_fermer.gif" alt="Fermer" title="Fermer" border="0" /></th></thead><tfoot><td colspan="2" class="tfoot"> </td></tfoot><tr><td colspan="2">
<label class="title" for="nom_css">Nom de l'habillage</label><input type="text" id="nom_css" name="nom_css" maxlength="40" value="<? if(!empty($_POST['nom_css'])){ echo $_POST['nom_css']; } ?>" />
<label class="title" for="nom_folder_css">Nom du dossier de la Css</label><input type="text" id="nom_folder_css" name="nom_folder_css" maxlength="30" value="<? if(!empty($_POST['nom_folder_css'])){ echo $_POST['nom_folder_css']; } ?>" />
<label class="title" for="auteur_css">Auteur</label><input type="text" id="auteur_css" name="auteur_css" maxlength="30" value="<? if(!empty($_POST['auteur_css'])){ echo $_POST['auteur_css']; } ?>" />
<label class="title" for="size_css">Taille du fichier css</label><input type="text" id="size_css" name="size_css" maxlength="10" />
<label class="submit" onclick="jsRequest.sendForm('form_add_css','<?=$place?>');">Ajouter</label></td></tr></table></form><?
}
}else{ ?><img onclick="jsRequest.sendRequest('ajax.php?place=change_css&change_css=1');" class="picto" src="./design/<?=$css?>/img/picto_css.gif" alt="Changer d'habillage" title="Changer d'habillage" border="0" /><? } ?>
Return current item: BACKDRAFT Workgroup Management