Location: PHPKode > scripts > TAF > taf/html/take.php
<!DOCTYPE HTML PUBLIC "-//SQ//DTD HTML 2.0 HoTMetaL + extensions//EN">
<HTML>
<HEAD>
<TITLE>Taches - prendre en charge</TITLE></HEAD>
<BODY LEFTMARGIN="0" TOPMARGIN="0" BACKGROUND="/13a.jpg">
<? include "$DOCUMENT_ROOT/page-header.shtml" ?>
<? include "$DOCUMENT_ROOT/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 it.id='$id';";
  /* $sql="select * from item where 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>Date d&eacute;but</td>";
    echo "<td>Priorit&eacute;</td>";
    echo "<td>Cat&eacute;gorie</td>";
    echo "<td>Perso</td>";
    echo "<td>D&eacute;tail</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");
    $owner=pg_result($sql_res, 0, "owner");
    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 ...
   */
  if ($delete == 1 && $owner == $REMOTE_USER)
    $sql="delete from item where id='$id';";
  else
    $sql="update item set owner = '$REMOTE_USER' where 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