예제 #1
0
function arbreOptionRub($depart, $niveau, $prubrique, $nbprod = 0, $ok = 1, $lang = false)
{
    $rec = "";
    $espace = "";
    $niveau++;
    $trubrique = new Rubrique();
    $query = "select * from {$trubrique->table} where parent=\"{$depart}\"";
    $resul = CacheBase::getCache()->query($query);
    for ($i = 0; $i < $niveau; $i++) {
        $espace .= "&nbsp;&nbsp;&nbsp;";
    }
    if ($resul == "" || count($resul) == 0) {
        return "";
    }
    foreach ($resul as $row) {
        $trubriquedesc = new Rubriquedesc();
        $trubriquedesc->charger($row->id, $lang);
        if (!$trubriquedesc->affichage_back_office_permis()) {
            continue;
        }
        $trubrique->charger($trubriquedesc->rubrique);
        $courante = new Rubrique();
        $courante->charger($prubrique);
        if ($courante->parent == $row->id) {
            $selected = "selected";
        } else {
            $selected = "";
        }
        if ($ok == 0 || $row->id == $prubrique && $ok != -1) {
            $disabled = "disabled=\"disabled\"";
        } else {
            $disabled = "";
        }
        if ($nbprod && $trubrique->nbprod() || !$nbprod) {
            $rec .= "<option value=\"{$row->id}\" {$disabled} {$selected}>" . $espace . $trubriquedesc->titre . "</option>";
        }
        if ($prubrique == $row->id && $ok != -1 || $ok == 0) {
            $rec .= arbreOptionRub($row->id, $niveau, $prubrique, $nbprod, 0, $lang);
        } else {
            $rec .= arbreOptionRub($row->id, $niveau, $prubrique, $nbprod, $ok, $lang);
        }
    }
    return $rec;
}