Bonjour à tous
J'ai réalisé un organigramme que j'essaye d'améliorer mais je bute sur une fonction qui permettra de développement uniquement l'arbre du service choisi sur une nouvelle page.
C'est à dire que si l'utilisateur clique sur le libelle du service, l'arbre du service sélectionné s'affiche dans une nouvelle page sans que les id_mères n'apparaissent.
Je ne sais pas comment abordé cela si quelqu'un peut m'aider
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <?php function in_parent($in_parent, $store_all_id, $con, $niv) { if (in_array($in_parent, $store_all_id)) { $result = mysqli_query($con, "SELECT * FROM tree where reporte_id = $in_parent"); echo $in_parent == 0 ? "<ul class='tree'>" : "<ul>"; while ($row = mysqli_fetch_array($result)) { echo "<li"; if ($row['hide']) echo " class='thide'"; echo "> <div id=".$row['id']." class='bloc'> <p><a class='libelle' href=''>".$row['libelle']."</a></br></p> <!-- <div id=cache><img src='".$row['lien_photo']."' class='photo''/></div> --> <p class='poste'>".$row['fonction']."</p> <p class='info'>".$row['prenom']." ".$row['nom']."</br></br> Tel: ".$row['tel']."</br></br>".$row['email']."</p> </div>"; in_parent($row['id'], $store_all_id, $con, $niv); echo "</li>"; } echo "</ul>"; } } ?> <!DOCTYPE HTML> <html> <head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Organigramme</title> <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Cabin:400,700,600"/> <link href="style.css" rel="stylesheet" type="text/css"> <link href='styleIE.css' rel='stylesheet' type='text/css'/> <script src="js/jquery-1.11.1.min.js"></script> <script src="js/jquery-migrate-1.2.1.min.js"></script> <script src="js/jquery-ui.js"></script> <script src="js/jquery.tree.js"></script> <script> $(document).ready(function() { $('.tree').tree_structure( <?php if(isset($_GET['user']) && $_GET['user'] == 'superadmin') { echo "{ 'add_option': true, 'edit_option': true, 'delete_option': true, 'confirm_before_delete': true, 'animate_option': true, 'fullwidth_option': true, 'align_option': 'center', 'draggable_option': true }"; } ?>); }); </script> </head> <body> <?php include 'header.php'; include_once 'db.php'; ?> <?php $store_all_id = array(); $id_result = mysqli_query($con, "SELECT * FROM tree"); while ($all_id = mysqli_fetch_array($id_result)) { array_push($store_all_id, $all_id['reporte_id']); } echo "<div class='orga'>"; in_parent(0, $store_all_id, $con, 0); echo "</div>"; mysqli_close($con); ?> </body> </html>
Code sql : Sélectionner tout - Visualiser dans une fenêtre à part
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 CREATE DATABASE tree; USE tree; CREATE TABLE IF NOT EXISTS `tree` ( `id` int(10) NOT NULL AUTO_INCREMENT, `libelle` varchar(40) NOT NULL, `nom` varchar(30) NOT NULL, `prenom` varchar(30) NOT NULL, `tel` varchar(10) NOT NULL, `email` varchar(40) NOT NULL, `fonction` varchar(50) NOT NULL, `lien_photo` varchar(40) DEFAULT 'images/profil-vide.gif', `style` int(2) NOT NULL, `reporte_id` int(10) NOT NULL, `hide` tinyint(1) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=18 ; -- -- Contenu de la table `tree` -- INSERT INTO `tree` (`id`, `libelle`, `nom`, `prenom`, `tel`, `email`, `fonction`, `lien_photo`, `style`, `reporte_id`, `hide`) VALUES (1, 'Direction Generale', 'azer', 'azer', '0123456789', 'azer@azer.fr', 'Directeur General', 'images/profil-vide.gif', 0, 0, 0), (2, 'Ressource Humaine', 'azer', 'azer', '0123456789', 'email@azer.fr', 'Directeur', 'images/profil-vide.gif', 0, 1, 1), (3, 'Finances', 'azer azer', 'azer', '0123456789', 'email@azer.fr', 'Directeur', 'images/profil-vide.gif', 0, 1, 1), (4, 'Systeme d''information', 'azer', 'azer', '0123456789', 'email@azer.fr', 'Directeur', 'images/profil-vide.gif', 0, 1, 1), (5, 'Technique', 'azer', 'azer azer', '0123456789', 'email@azer.fr', 'Directeur', 'images/profil-vide.gif', 0, 1, 1), (6, 'Operation Sol', 'azer', 'azer', '0123456789', 'email@azer.fr', 'Directeur', 'images/profil-vide.gif', 0, 1, 1), (7, 'Operation Aerienne', 'azer', 'azer', '0123456789', 'email@azer.fr', 'Directeur', 'images/profil-vide.gif', 0, 1, 1), (8, 'Marketing', 'azer', 'azer', '0123456789', 'email@azer.fr', 'Directeur', 'images/profil-vide.gif', 0, 1, 1), (9, 'Commercial', 'azer', 'azer', '0123456789', 'email@azer.fr', 'Directeur', 'images/profil-vide.gif', 0, 1, 1), (11, 'Departement', 'azer', 'azer Sophie', '0123456789', 'email@azer.fr', '', 'images/profil-vide.gif', 0, 2, 1), (12, 'Developpement', 'azer', 'azer', '0123456789', 'email@azer.fr', '', 'images/profil-vide.gif', 0, 2, 1), (13, 'Droit Social', 'azer', 'azer', '0123456789', 'email@azer.fr', '', 'images/profil-vide.gif', 0, 2, 1), (14, 'Relations Sociales', 'azer', 'azer', '0123456789', 'email@azer.fr', '', 'images/profil-vide.gif', 0, 2, 1), (15, 'Services Generaux', 'azer', 'azer', '0123456789', 'email@azer.fr', '', 'images/profil-vide.gif', 0, 2, 1), (16, 'Comptabilite', 'azer', 'azer', '0123456789', 'email@azer.fr', '', 'images/profil-vide.gif', 0, 3, 1), (17, 'Controle Gestion', 'azer', 'azer', '0123456789', 'email@azer.fr', '', 'images/profil-vide.gif', 0, 3, 1);
Merci !
Partager