<?php
echo "<div > ";
$lmitems = mysql_query("select * from leftmenu order by \"order\"");
$lmitemcount = mysql_num_rows($lmitems);
$k=0;
for($i=0;$i<$lmitemcount;$i++) if(mysql_result($lmitems,$i,5) <=$permis){
//$toptable[0][$i*2]="<td><img src=\"".$design_path.mysql_result($lmitems,$i,4)." \"></td>\n";
//$toptable[0][$i*2+1]="<td class=\"left_menu\">".mysql_result($lmitems,$i,1)."</td>\n";
$lmsitemsstr = "select * from leftsubmenu where parent=".mysql_result($lmitems,$i,0)." order by \"order\"";
$lmsitems = mysql_query($lmsitemsstr);
$lmsitemcount = mysql_num_rows($lmsitems);
if($k<$lmsitemcount) $k = $lmsitemcount;
//for($j=0;$j<$lmsitemcount;$j++) {
// if(mysql_result($lmsitems,$j,3)<=$permis) {
//$toptable[$j+1][$i*2]="<td> </td>\n";
//if( mysql_result($lmsitems,$j,5)!="" ) ;// echo"<td><p class=\"left_menu_item\"><a href=\"".mysql_result($lmsitems,$j,5)."\" class=\"left_menu_item\" target=\"blanc\"></a></p></td>\n";
//else echo "<td><p class=\"left_menu_item\"><a href=\"?lsm=".mysql_result($lmsitems,$j,0)."\" class=\"left_menu_item\"></a></p></td>\n";
//if( mysql_result($lmsitems,$j,5)!="" ) $toptable[$j+1][$i*2+1] =$toptable[$j+1][$i*2+1]."<td><p class=\"left_menu_item\"><a href=\"".mysql_result($lmsitems,$j,5)."\" class=\"left_menu_item\" target=\"blanc\">".mysql_result($lmsitems,$j,1)."</a></p></td>\n";
//else $toptable[$j+1][$i*2+1] =$toptable[$j+1][$i*2+1]."<td><p class=\"left_menu_item\"><a href=\"?lsm=".mysql_result($lmsitems,$j,0)."\" class=\"left_menu_item\">".mysql_result($lmsitems,$j,1)."</a></p></td>\n";
// }
//}
}
for($i=0;$i<$lmitemcount;$i++) if(mysql_result($lmitems,$i,5) <=$permis){
$toptable[0][$i*2]="<td><img src=\"".$design_path.mysql_result($lmitems,$i,4)." \"></td>\n";
$toptable[0][$i*2+1]="<td class=\"left_menu\">".mysql_result($lmitems,$i,1)."</td>\n";
$lmsitemsstr = "select * from leftsubmenu where parent=".mysql_result($lmitems,$i,0)." order by \"order\"";
$lmsitems = mysql_query($lmsitemsstr);
//$lmsitemcount = mysql_num_rows($lmsitems);
//if($k<$lmsitemcount) $k = $lmsitemcount;
for($j=0;$j<$k;$j++) {
if(mysql_result($lmsitems,$j,3)<=$permis) {
$toptable[$j+1][$i*2]="<td> </td>\n";
//if( mysql_result($lmsitems,$j,5)!="" ) ;// echo"<td><p class=\"left_menu_item\"><a href=\"".mysql_result($lmsitems,$j,5)."\" class=\"left_menu_item\" target=\"blanc\"></a></p></td>\n";
//else echo "<td><p class=\"left_menu_item\"><a href=\"?lsm=".mysql_result($lmsitems,$j,0)."\" class=\"left_menu_item\"></a></p></td>\n";
if(mysql_result($lmsitems,$j,1)!="") {
if( mysql_result($lmsitems,$j,5)!="" ) $toptable[$j+1][$i*2+1] =$toptable[$j+1][$i*2+1]."<td><p class=\"left_menu_item\"><a href=\"".mysql_result($lmsitems,$j,5)."\" class=\"left_menu_item\" target=\"blanc\">".mysql_result($lmsitems,$j,1)."</a></p></td>\n";
else $toptable[$j+1][$i*2+1] =$toptable[$j+1][$i*2+1]."<td><p class=\"left_menu_item\"><a href=\"?lsm=".mysql_result($lmsitems,$j,0)."\" class=\"left_menu_item\">".mysql_result($lmsitems,$j,1)."</a></p></td>\n";
}
else $toptable[$j+1][$i*2+1]="<td> </td>\n";
}
}
}
echo "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n";
for($i=0;$i<$k+1;$i++) {
echo " <tr>\n";
for($j=0;$j<$lmitemcount*2;$j++) {
echo $toptable[$i][$j];
}
echo " </tr>\n";
}
echo "</table>";
echo "</div>";
?>