示例#1
0
function chemin_categorie($id)
{
    global $tabcat;
    // ajout dans ce tableau temporaire
    array_push($tabcat, $id);
    $query = 'SELECT `CAT_ID`,`CAT_PARENTID` FROM `CATEGORIES` WHERE `CAT_ID`="' . $id . '"';
    $result = mysql_query($query) or die(mysql_error());
    $row = mysql_fetch_array($result);
    $id = $row['CAT_ID'];
    $parentid = $row['CAT_PARENTID'];
    if ($parentid != 0) {
        chemin_categorie($parentid);
    }
    return $tabcat;
}
示例#2
0
        $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();
    $contenu = '<h2>Description</h2>' . "\n";
    $contenu .= stripslashes($data['CAT_DESCRIPTION']);
    $tpl->set_var('contenu', $contenu);
} elseif ($_GET['ent']) {
    $sql = 'SELECT * FROM ENTITES WHERE ENT_ID="' . $_GET['ent'] . '"';
    $rep = $db->query($sql);
    $data = $db->fetch_array();
    // on récupere les ids des entités parentes
    $tabent = chemin_entite($_GET['ent']);
    // on affiche le calque des personnes