<?php
/*
    ANISEED, NISEED System and Database
    Copyright (C) 2007 Olivier Tassy, Fabrice Daian, Patrick Lemaire

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

*/
	include("connection.php");
//Title before frames_header
print '<title>ANISEED v3.0 - Fate </title>';

    include("frames_header.php");
?>

<?php
    $id=$_GET["idanat"];

	/*Test de la séléection d'une partie anatomique*/
	if ($id=="undefined")
	{
	print "<br><br><center><h2><strong>Error, please select an anatomical part.</strong></h2></center><br><br>";
	include ("frames_footer.php");
	return;
	}

$requete="SELECT \"DEV_STAGE_ID\",\"SPECIES\" from \"ANAT_ENTITY\" where \"ANAT_ID\"='$id'";
$stmt=pg_query($c,$requete);
$row=pg_fetch_array($stmt);
$species=$row["SPECIES"];
$stage=$row["DEV_STAGE_ID"];

?>



  <link rel="stylesheet" type="text/css" media="screen" href="ongletv1.css" title="Version 1" />
<!-- Header pour l'onglet -->
<div id="header">
  <ul>
    <li><a href="anatomy.php?species=<?print $species;?>&dev=<?print $stage;?>&region=<?print $id;?>">Anatomical dictionary</a></li>
    <li><a onclick="this.href='short_hierarchy.php?region=<? print $id;?>&dev=<?print $stage;?>'" href="">Anatomical territory summary card</a></li>
    <li><a onclick="this.href='insitu-result.php?BOOLanat=1&xref=2&idanat=<?print $id;?>:'" href="">In situ</a></li>
    <li id="current"><a href="#">Fate</a></li>


    <li><a href="lineage.php?idanat=<?print $id;?>">Lineage</a></li>
    <!--<li><a onclick="this.href='insitu-result.php?BOOLanat=1&xref=2&idanat=<?print $id;?>:'" href="#">InSitu data</a></li>-->

    <li><a href="position.php?idanat=<?print $id;?>" href="">Biometry</a></li>

    <li><a href="induction.php?idanat=<?print $id;?>" href="">Induction</a></li>
  </ul>
</div>
<!-- EOF Onglet -->
<br><br>



<?

	$requete="select B.\"NAME\" as dev, A.\"NAME\" from \"ANAT_ENTITY\" A, \"DEV_STAGE\" B where A.\"ANAT_ID\"='$id' and A.\"DEV_STAGE_ID\"=B.\"DEV_STAGE_ID\"";
    $stmt = pg_query($c,$requete);
	if ($row=pg_fetch_array($stmt)){
	     print "<br><br><font color=\"#D64242\" size=\"3\"><b>".$row["NAME"]." &nbsp;(".$row["dev"].")</b></font><br><br>";
	}
	
	print '<font color=\"#456898\" size=\"3\"><b>Fates</b></font><br><br>';
	$count=0;
	$requete="select \"KEYWORDS\" from \"FATE\" where \"ANAT_ID\"='$id' order by \"KEYWORDS\"";
    $stmt = pg_query($c,$requete);
	while ($row=pg_fetch_array($stmt)){
	    ++$count;
	    print "<font color=\"#656565\" size=\"-1\">".$row["KEYWORDS"]."</font><br>";
	}
	
	if($count==0)
	    print "<strong>No match</strong>";
?>


<?php
    include("frames_footer.php");
?>