j ai pu arriver au niveau 2
il me faut une fonction recursive mais je sais pas comment faire
voici le code
=====================================================================
<script language="javascript">
function formation(id_mgr,id_emp)
{
URLE='formation_sub.php' + '<? echo "?PHPSESSID=$PHPSESSID" ?>';
URLE=URLE + '&emp_id_mgr=' + id_mgr;
URLE=URLE + '&id_emp=' + id_emp;
//alert(URLE);
// window.location=URLE;
window.open (URLE, 'Formations', config='height=600, width=800, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no')
}
function subord(id_mgr,id_emp,nom)
{
URLE='<? echo "$PHP_SELF?PHPSESSID=$PHPSESSID" ?>';
URLE=URLE + '&emp_id_mgr=' + id_mgr;
URLE=URLE + '&id_emp=' + id_emp;
URLE=URLE + '&nom_sub=' + nom;
URLE=URLE + '&act=sub';
//alert(URLE);
// window.location=URLE;
F1.action=URLE;
F1.submit();
}
</SCRIPT>
<?
$db = new DataBase;
$db->DbRecord($rec='oracle');
$emp_id_mgr=$_SESSION["matricule"];
$emp_id_mgr='048369';
$subor=array();
$sql1="select NAME from arhi_base_headcount_w_tp a where EMPLOYEE_ID='$emp_id_mgr'";
$Result=$db->DbSelect($sql1, $Column='1');
$nom_m=$Result[0][0];
$sql="select NAME,EMPLOYEE_ID from arhi_base_headcount_w_tp a where DIRECT_REPORT_ID='$emp_id_mgr'";
//echo $sql;
$Result2=$db->DbSelect($sql, $Column='2');
if( count($Result2) > 0)
if ($_GET["act"] == "sub")
{
$empl_id=$_GET["id_emp"];
$nom_sub=$_GET["nom_sub"]."|".$empl_id;
$sqls="select NAME,EMPLOYEE_ID from arhi_base_headcount_w_tp a where DIRECT_REPORT_ID='$empl_id'";
$Result=$db->DbSelect($sqls, $Column='2');
//function Recursive ()
//{
foreach($Result2 as $Field)
{
$vnom=$Field[0]."|".$Field[1];
$subor[$vnom].='';
}
if( count($Result) > 0)
{
$flag=0;
$chaine="array(";
foreach($Result as $Fields)
{
if ($flag==0) $chaine.= "'".$Fields[0]."|".$Fields[1]."'";
else $chaine.= ",'".$Fields[0]."|".$Fields[1]."'";
$flag=1;
}
$chaine.=")";
$chaine = "\$subor[\$nom_sub]=".$chaine.";";
eval($chaine);
echo "<br>";
//Recursive($subor);
//print_r($subor[$empl_id]);
}
}
else
{
foreach($Result2 as $Field)
{
$vnom=$Field[0]."|".$Field[1];
$subor[$vnom].='';
}
}
//}
//Recursive($subor);
print_r($subor);
//foreach($Result2 as $Field)
/*select NAME from arhi_base_headcount_w_tp a where DIRECT_REPORT_ID=''
$Result=$db->DbSelect($Sql, $Column='1');
if( count($Result) > 0)
foreach($Result as $Field)
{
if ($m[1]!=0)
*/
?>
<form name='F1' METHOD="POST" action="">
<table background="<?=$imagesPath?>header/fond_bando2.gif" width="632" border="0" align="center" cellpadding="0" cellspacing="0">
<tr width="632">
<td valign="middle" class="textegrasblanc" width="100%"><img src="<?=$imagesPath?>header/spacer.gif" border="0" width="55" height="25" align="absmiddle"><font class="text">Filtre de recherche</font></td>
</tr>
</table>
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0" background="<?=$imagesPath?>header/fond_gris_m.gif">
<tr><td background="<?=$imagesPath?>header/fond_gris_h.gif"><img src="<?=$imagesPath?>header/spacer.gif" width="500" height="9"></td></tr>
<tr>
<td align='center' width='100%'><table width='90%' border="0" align="center">
<tr>
<td width="5" > </td>
<td width="10" > </td>
<td <font class="text"><b>Manager : </b></font><td ><input type="text" name="nom_manager" value="<? echo $nom_m; ?>" disabled >
<td width="6"></td>
</tr>
<tr>
<td width="5" > </td>
<td colspan="2" <font class="text"><b>Noms Collaborateurs</b></font></td>
</tr>
<?
foreach($subor as $key => $value)
{
$tnomm=explode("|",$key);
if(is_array($value))
{
?>
<tr>
<td ><a href="#" onClick="subord('<? echo $emp_id_mgr ;?>','<? echo $tnomm[1] ;?>','<? echo $tnomm[0] ;?>')" > <img src="moinsOrange" border="0"> </a></td>
<td><a href="#" onClick="formation('<? echo $emp_id_mgr ;?>','<? echo $tnomm[1] ;?>')" > <? echo $tnomm[0];?> </a></td>
</tr>
<?
foreach($value as $key1 => $value1)
{
$tnom=explode("|",$value1);
?>
</tr>
<td></td>
<td> <a href="#" onClick="formation('<? echo $tnomm[1] ;?>','<? echo $tnom[1] ;?>')" ><img src="SommaireO" border="0"> <? echo $tnom[0];?> </a></td>
</tr>
<?
}
}
else
{
?>
<tr>
<td ><a href="#" onClick="subord('<? echo $emp_id_mgr ;?>','<? echo $tnomm[1] ;?>','<? echo $tnomm[0] ;?>')" > <img src="plusOrange" border="0"> </a></td>
<td><a href="#" onClick="formation('<? echo $emp_id_mgr ;?>','<? echo $tnomm[1] ;?>')" > <? echo $tnomm[0];?> </a></td>
</tr>
<?
}
}
?>
</table>
</td>
====================================================
est ce qu il ya quelqu 'un qui peut m'aider