<?
// display the project list
require("../phpDocMaker.conf.inc");
require("configColor.inc");
require("disp.def");
htmlHead("",$style);
$connection=doConnection();
if(!isset($type)) // test if a type and an id variable was send
{
$type=$defaultType;
}
if(!isset($disp[$type]))
{
echo "Error: wrong type: $type<br>";
}
else
{
$tableD=$disp[$type]["table"];
$nameD=$disp[$type]["name"];
$withDescr=$disp[$type]["descr"];
$withId=$disp[$type]["id"];
$listeLink=$disp[$type]["link"];
$linkType=$disp[$type]["linkType"];
if($withDescr == "with" && isset($id))
{
$result=ExecRequest("select * from $tableD where id_$tableD=$id",$connection);
if(mysql_num_rows($result)!=0) //test if the module associated with id_module exist
{
$obj=mysql_fetch_object($result);
$name=ucFirst($nameD);
echo "<center><h1><b>$name $obj->name</b></h1></center>\n";
echo "<table class='forumline'>\n";
foreach($field as $tableF => $dispString)
{
eval("\$valS=\$obj->$tableF;");
if($valS!="")
{
echo "<tr bgcolor=$TRColor height=25>\n";
echo "<td bgcolor=$headColor>$dispString</td><td bgcolor=$cellColor width=400>" . parseDescription($valS,$connection) ."</td></tr>\n";
}
}
/*if( $obj->description != "")
{
echo "<tr bgcolor=$TRColor height=25>\n";
echo "<td bgcolor=$headColor>Description</td><td bgcolor=$cellColor width=400>" . parseDescription($obj->description,$connection) ."</td></tr>\n";
}
if( $obj->version!= "")
{
echo "<tr bgcolor=$TRColor height=25>\n";
echo "<td bgcolor=$headColor>Version</td><td bgcolor=$cellColor>$obj->version</td></tr>\n";
}
if( $obj->developer != "")
{
echo "<tr bgcolor=$TRColor height=25>\n";
echo "<td bgcolor=$headColor>Developper</td><td bgcolor=$cellColor>$obj->developer</td></tr>\n";
}*/
// creating the list of possible up type
$upType=-1;
$upId=-1;
foreach($disp as $name=>$val)
if(count($val["link"])!=0)
foreach($val["link"] as $key=>$link)
if($link==$type)
{
$tbl=$val["table"];
if(isset($obj->link_type)) // upper class is defined by link_type
{
if($obj->id_link != -1)
{
$upId=$obj->id_link;
$upType=$obj->link_type;
}
}
else
{
if($tbl!="")
{
eval("\$idTmp=\$obj->id_$tbl;");
if($idTmp!=-1)
{
$upType=$name;
$upId=$idTmp;
}
}
else
$upType=$name;
}
}
if($upType!=-1 )
{
echo "<tr bgcolor=$TRColor height=25>\n";
$tbl=$disp[$upType]["table"];
if($tbl != "")
echo "<td bgcolor=$headColor>Associate with $upType</td><td bgcolor=$cellColor>";
else
echo "<td bgcolor=$headColor> </td><td bgcolor=$cellColor>";
// try to find up object
if($tbl != "")
{
$reqFind="select name from $tbl where id_$tbl='$upId'";
if($findObject=mysql_fetch_object(ExecRequest($reqFind,$connection)))
{
echo "<a href='genDisp.php?type=$upType&id=$upId'>$findObject->name</a>";
}
else
{
echo " ";
}
}
else
echo "<a href='genDisp.php?type=$upType'>Retour</a>";
echo "</td></tr>\n";
}
echo "</table><p>\n";
}
else
{
echo "Error: wrong id<br>";
}
}
if(($withId=="without" || ($withId=="with" && isset($id))) && count($listeLink)!=0)
{
foreach($listeLink as $key=>$link)
{
$linkTable=$disp[$link]["table"];
$linkName=$disp[$link]["name"];
$name=plurWord($linkName);
$linkRequest="select * from $linkTable where 1 ";
if($linkType == "set")
{
$linkRequest.=" and link_type='".$tableD."' ";
if($withId=="with")
$linkRequest.= " and id_link=$id ";
}
else
{
if($withId=="with")
$linkRequest.=" and id_$tableD=$id";
}
$linkResult=ExecRequest($linkRequest,$connection);
/*echo "<center><table class='forumline' width=600>\n";
echo "<tr bgcolor=$TRColor height=25 >\n";
echo "<td bgcolor=$headColor width=100%><center><b>Name of the ".$linkName."s</b></center></td>\n";
echo "</tr>\n";*/
if(mysql_num_rows($linkResult)!=0)
{
echo "<center><h2>List of ".$name." linked</h2></center>\n";
echo "<center><table class='forumline' width=600>\n";
echo "<tr bgcolor=$TRColor height=25 >\n";
echo "<td bgcolor=$headColor width=100%><center><b>Name of the ".$linkName."s</b></center></td>\n";
echo "</tr>\n";
while($linkVal=mysql_fetch_object($linkResult))
{
echo "<tr bgcolor=$cellColor>\n";
echo "<td bgcolor=$cellColor>";
eval("\$idLink=\$linkVal->id_$linkTable;");
echo " <a href='genDisp.php?id=$idLink&type=$link'>$linkVal->name</a>";
echo "</td>\n";
echo "</tr>\n";
}
echo "</table></center>\n";
}
else
{
/*echo "<tr bgcolor=$msgColor height=25 >\n";
echo "<td bgcolor=$msgColor><center>No $linkName defined</center></td>\n";
echo "</tr>\n";*/
}
//echo "</table></center>\n";
}
}
}
?>