| 12
 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
 
 | <?php
 
header('Content-Type: text/xml;charset=iso-8859-1');
 
// pour savoir qui est connecté
$user = $_COOKIE['pre'];
//va me permetre d'effectuer l'action particulière selon ces param passés en XMLHttpRequest
$action = $_REQUEST['act'];
$idNote = $_REQUEST['id'];
 
include("../include/connDbOrba.php");
 
switch ($action)
{
case "upd" :
 
$updNote = "UPDATE notes 
SET effectue = 'oui'
WHERE idNote = '$idNote'";
 
$maUpdateNotes = mysql_query($updNote,$connexion)or die( "ERREUR MYSQL numéro: ".mysql_errno()."<br>Type de cette erreur: ".mysql_error()."<br>\n" );
 
break;
 
case "del" :
 
$delNote = "DELETE FROM notes WHERE idNote = '$idNote'";
 
$maDeleteNotes = mysql_query($delNote,$connexion)or die( "ERREUR MYSQL numéro: ".mysql_errno()."<br>Type de cette erreur: ".mysql_error()."<br>\n" );
 
break;
 
}
 
// requete pour afficher les taches de l'utilisateur.
$AfficherNotes = "SELECT idNote, commentaires, effectue, DATE_FORMAT(dateExp, '%d/%m/%Y') AS dateExpFormat FROM notes WHERE user = '$user' ORDER BY dateExp DESC";
$maRequeteNotes = mysql_query($AfficherNotes,$connexion)or die( "ERREUR MYSQL numéro: ".mysql_errno()."<br>Type de cette erreur: ".mysql_error()."<br>\n" );
 
//génération du div avec les taches de l'utilisateur
print "<div id=\"taches\">
<span class=\"creaTache\"><img src =\"clients/images/add.gif\" align=\"absmiddle\"/><a href=\"new_tache.php\" rel=\"gb_page_center[510, 280]\" title=\"Tâche - Création\">Créer une tâche</a></span>
<table border=\"0\" cellpadding=\"3\" cellspacing=\"2\" width=\"100%\">";
 
while ($monResultatNotes = mysql_fetch_array($maRequeteNotes))
{
	if ($monResultatNotes['effectue'] == "oui") //si la tache a été effectué je lui affecte une class CSS particulière et affiche ou non le bouton valider.
	{
	$class = "tacheFaite";
	$btnValider = "";
	}
	else
	{
	$class = "tacheNonFaite";
	$btnValider = "<img src=\"clients/images/valideTache.gif\" border=\"0\" onClick =\"identifier('".$monResultatNotes['idNote']."','upd')\" style=\"cursor:pointer\" title=\"Valider la tâche\"/>";
	}
 
	//afiche les tâches
	print "<tr>
	<td class=\"".$class."\">".$monResultatNotes['dateExpFormat']." - ".$monResultatNotes['commentaires']."</td>
	<td class=\"icons\"><a href =\"new_tache.php?id=".$monResultatNotes['idNote']."\" rel=\"gb_page_center[510, 280]\"><img src=\"clients/images/editTache.gif\" border=\"0\" rel=\"gb_page_center[3510, 280]\" title=\"Modifier la tâche\"/></a>".$btnValider."<img src=\"clients/images/deleteTache.gif\" border=\"0\" title=\"Supprimer la tâche\" onClick =\"identifier('".$monResultatNotes['idNote']."','del')\" style=\"cursor:pointer\"/></td>
	</tr>";
}
 
print "</table></div>" ;
 
?> | 
Partager