Location: PHPKode > scripts > TAF > taf/html/done.php
<!DOCTYPE HTML PUBLIC "-//SQ//DTD HTML 2.0 HoTMetaL + extensions//EN">
<HTML>
<HEAD>
<TITLE>Taches - terminer</TITLE></HEAD>
<BODY LEFTMARGIN="0" TOPMARGIN="0" BACKGROUND="/13a.jpg">
<?
  virtual("/page-header.shtml");
  virtual("/section-header.shtml");
?>

<?
  echo "<H1 ALIGN=center>T&acirc;ches pour $REMOTE_USER</H1>";
?>

<?
  /*
   * On se connecte à la base, et on ne joue que si ça marche
   */
  $conn = pg_connect("dbname=tafdb");
  if (!$conn)
  {
     echo "<h2>Une erreur est survenue</h2>";
     echo "<p>Acc&egrave;s &agrave; la base impossible.</p>";
     echo " retour &agrave; l'<a href='./'>accueil</a>";
     echo "<HR WIDTH='50%'>\n";
     include "$DOCUMENT_ROOT/section-footer.shtml";
     include "$DOCUMENT_ROOT/page-footer.shtml";
     echo "</BODY></HTML>";
     exit;
  }

  /*
   * Les requêtes SQL qui vont bien ...
   */
  $sql="SET DateStyle TO 'European';";
  pg_Exec($sql);

  /*
   * On récupère d'abord ce qui concerne le chtit gars...
   */
  $sql="select *,ca.value as cavalue, pr.value as prvalue from item it, priority pr, category ca where pr.id = priority_id and ca.id = category_id and owner='$REMOTE_USER' and it.id='$id';";
  $sql_res = pg_Exec($conn, $sql);
  $sql_count = pg_NumRows($sql_res);
  if ((!$sql_res) || ($sql_count != 1))
  {
     echo "<h2>Une erreur est survenue</h2>";
     echo "<p>Contenu de la base erronn&eacute;.</p>";
     echo " retour &agrave; l'<a href='./'>accueil</a>";
     echo "<HR WIDTH='50%'>\n";
     include "$DOCUMENT_ROOT/section-footer.shtml";
     include "$DOCUMENT_ROOT/page-footer.shtml";
     echo "</BODY></HTML>";
     exit;
  }
  else
  {

    /*
     * Et là, on, va afficher le résultat pour le chtit gars ...
     */
    echo "<h2>T&acirc;che s&eacute;lectionn&eacute;e</h2>";
    echo "\n";
    echo "<table border=0><tr bgcolor=green>";
    echo "<td><font color=white>Date d&eacute;but</font></td>";
    echo "<td><font color=white>Priorit&eacute;</font></td>";
    echo "<td><font color=white>Cat&eacute;gorie</font></td>";
    echo "<td><font color=white>Perso</font></td>";
    echo "<td><font color=white>D&eacute;tail</font></td>";
    echo "</tr>\n";

    echo "<tr>";
    $item_id=pg_result($sql_res, 0, "id");
    echo "<td>";
    echo pg_result($sql_res, 0, "startdate");
    echo "</td><td>";
    echo pg_result($sql_res, 0, "prvalue");
    echo "</td><td>";
    echo pg_result($sql_res, 0, "cavalue");
    echo "</td><td>";
    $perso=pg_result($sql_res, 0, "private");
    if ($perso == '1')
    {
      echo "Oui";
    }
    else
    {
      echo "Non";
    }
    echo "</td><td><pre>";
    echo pg_result($sql_res, 0, "detail");
    echo "</pre></td></tr>\n";
    echo "</table>";
  }

  /*
   * Et on peut faire la modif ...
   */
  $sql="update item set enddate = 'now', closed = '1' where owner='$REMOTE_USER' and id='$id';";
  $sql_res = pg_Exec($conn, $sql);
  if (!$sql_res)
  {
     echo "<h2>Une erreur est survenue</h2>";
     echo "<p>Modification de la base impossible.</p>";
  }
?>

<p><b>Traitement termin&eacute;</b>. Vous pouvez revenir &agrave;
<a href="./">la liste</a>.
<? include "$DOCUMENT_ROOT/section-footer.shtml" ?>
<? include "$DOCUMENT_ROOT/page-footer.shtml" ?>
</BODY></HTML>
Return current item: TAF