function get_subents($id) { global $tabent; array_push($tabent, $id); $query = 'SELECT `ENT_ID`,`ENT_PARENTID` FROM `ENTITES` WHERE `ENT_PARENTID`="' . $id . '"'; $result = mysql_query($query) or die(mysql_error()); $n = mysql_num_rows($result); for ($i = 0; $i < $n; $i++) { $id = mysql_result($result, $i, "ENT_ID"); get_subents($id); } for ($i = 0; $i < count($tabent); $i++) { if ($i == 0) { $tmp .= '(' . $tabent[$i]; } else { $tmp .= ',' . $tabent[$i]; } } return $tmp . ')'; }
$tpl->set_var('p_mobile', $data['AEP_MOBILE']); $tpl->set_var('p_fonction', $data['AEP_FONCTION']); $tpl->parse('personnes_block', 'personnes', true); } } // ------------------------------------------------ // ------------------------------------------------ // suppression ------------------------------- if ($_GET['action'] == 'supprimer') { if ($_GET['cat_id']) { $tabcat = array(); $where = get_subcats($_GET['cat_id']); $db->query('DELETE FROM `CATEGORIES` WHERE `CAT_ID` IN ' . $where); } elseif ($_GET['ent_id']) { $tabent = array(); $where = get_subents($_GET['ent_id']); $db->query('DELETE FROM `ENTITES` WHERE `ENT_ID` IN ' . $where); } } // ------------------------------------------- $tabcat = array(); $tabent = array(); // ON NAVIGUE DANS LES CATEGORIE if ($_GET['cat']) { // fonction permettant de récuperer tout les id des cats parents $tabcat = chemin_categorie($_GET['cat']); // on cache la partie "personne" $tpl->set_var('div_pdisp', 'none'); // On affiche la description de la cat $db->query('SELECT `CAT_DESCRIPTION` FROM `CATEGORIES` WHERE `CAT_ID`="' . (int) $_GET['cat'] . '"'); $data = $db->fetch_array();