1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
| <?php
session_start() ;
if($_SESSION['Droit'])
{
$racine_site=$_SERVER['DOCUMENT_ROOT'];
include $racine_site.'/mvi_conf_annu_2008.php';
include $racine_site.$annu_path.'connexion.inc';
$nbreligne=0;
$vic="";
if (isset($_GET['nl']))
{
$nl_societe=$_GET['nl'];
}
if (isset($_GET['autoappel']))
{
$requette="DELETE FROM `ann_societe_secteur` WHERE nl_societe=$nl_societe";
$resultat=mysql_query($requette,$connexion);
$req="SELECT * FROM `ann_secteur_activite`";
$res=mysql_query($req,$connexion);
$nbreligne =mysql_num_rows($res);
$i=0;
while ($i<$nbreligne)
{
$nl=mysql_result($res,$i,"nl");
if (isset($_POST['act'.$nl])){
$vic=$_POST['act'.$nl];
if ($vic==1){
$requette="INSERT INTO `ann_societe_secteur` (`nl_societe`,`nl_secteur`) VALUES ($nl_societe,$nl)";
$resultat=mysql_query($requette,$connexion);
}
}
$i++;
}
//mysql_free_result($resultat);
mysql_close($connexion);
header ("Location: page.php?nl=$nl_societe");
}
}
else
{
header ("Location: loginboffice.php");
}?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Activites</title>
<link rel="StyleSheet" href="dtree.css" type="text/css" />
<script type="text/javascript" src="dtree.js"></script>
<style type="text/css">
<!--
.style2 {font-family: Arial, Helvetica, sans-serif}
.style32 {font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
}
.style4 {font-family: Arial, Helvetica, sans-serif; font-size: 12px; }
-->
</style>
</head>
<body>
<form name="activite" method="post" action="activites.php?autoappel=true&nl=<?php echo $nl_societe ?>">
<div class="dtree">
<p><a href="javascript: d.openAll();">open all</a> | <a href="javascript: d.closeAll();">close all</a></p>
<p><span class="style2"><span style="font-size: 24px; font-weight: bold;">
</span></span></p>
<script type="text/javascript">
<!--
d = new dTree('d');
d.add(0,-1,'Activites');
<?php
$req="SELECT * FROM ann_secteur_activite";
$res=mysql_query($req,$connexion);
$nbreligne =mysql_num_rows($res);
$i=0;
$k=1;
while ($i<$nbreligne)
{
$activite = mysql_result($res,$i,"libelle_fr");
$nl_parent=mysql_result($res,$i,"nl_parent");
$nl=mysql_result($res,$i,"nl");?>
<?php $req="SELECT * FROM `ann_societe_secteur` where nl_secteur=$nl and nl_societe=$nl_societe";
$ressecteur=mysql_query($req,$connexion);
$nbrelignesecteur =mysql_num_rows($ressecteur);
$nl_secteur=0;
$m = 0;
if ($nbrelignesecteur>=1){
$nl_secteur = mysql_result($ressecteur,$m,"nl_secteur");
}
if ($nl_secteur==$nl){?>
d.add(<?php echo $nl ?>,<?php echo $nl_parent ?>,'<input type="checkbox" name="act<?php echo $nl?>" value="1" OnClick="ChangeValueOnCheckbox(document.activite.act<?php echo $nl?>)" checked /><?php echo str_replace("'","",$activite)?>','#');
<?php
}
else{?>
d.add(<?php echo $nl ?>,<?php echo $nl_parent ?>,'<input type="checkbox" name="act<?php echo $nl?>" value="0" OnClick="ChangeValueOnCheckbox(document.activite.act<?php echo $nl?>)" /><?php echo str_replace("'","",$activite)?>','#');
<?php }
$k++;
$i++;
}
mysql_free_result($res);
mysql_close($connexion);
?>
document.write(d);
//-->
function ChangeValueOnCheckbox(ccbox)
{
if(ccbox.checked==true)
{ccbox.value=1
}
else
{ccbox.value=0
}
}
</script>
<input type="submit" name="Submit" value="Valider" />
<font face="Arial"><span class="style32"><span class="style4">
<input type="button" name="Submit3" value="Fermer" onclick="window.close()" />
</span></span></font></div>
</form>
</body>
</html> |
Partager