function setclassementcaracdisp($idcaracteristique, $idcaracdispdesc, $classement, $lang)
{
    $caracdispdesc = new Caracdispdesc();
    if ($caracdispdesc->charger($idcaracdispdesc, $lang)) {
        if ($classement == $caracdispdesc->classement) {
            return;
        }
        if ($classement > $caracdispdesc->classement) {
            $offset = -1;
            $between = "{$caracdispdesc->classement} and {$classement}";
        } else {
            $offset = 1;
            $between = "{$classement} and {$caracdispdesc->classement}";
        }
        $caracdisp = new Caracdisp();
        $query = "\n\t\t\t\tselect\n\t\t\t\t\tid\n\t\t\t\tfrom\n\t\t\t\t\t{$caracdispdesc->table}\n\t\t\t\twhere\n\t\t\t\t\tlang={$lang}\n\t\t\t\tand\n\t\t\t\t\tcaracdisp in (select id from {$caracdisp->table} where caracteristique = {$idcaracteristique})\n\t\t\t\tand\n\t\t\t\t\tclassement BETWEEN {$between}\n\t\t\t";
        $resul = $caracdispdesc->query($query);
        $ddd = new Caracdispdesc();
        while ($resul && ($row = $caracdispdesc->fetch_object($resul))) {
            if ($ddd->charger($row->id, $lang)) {
                $ddd->classement += $offset;
                $ddd->maj();
            }
        }
        $caracdispdesc->classement = $classement;
        $caracdispdesc->maj();
    }
}
 public function modifier($titre, $chapo, $description, $affiche, $caracdisp, $lang)
 {
     $this->verifyLoaded();
     $caracdesc = new Caracteristiquedesc($this->id, $lang);
     $caracdesc->titre = $titre;
     $caracdesc->chapo = nl2br($chapo);
     $caracdesc->description = nl2br($description);
     $this->affiche = $affiche != "" ? 1 : 0;
     $this->maj();
     if ($caracdesc->id) {
         $caracdesc->maj();
     } else {
         $caracdesc->lang = $lang;
         $caracdesc->caracteristique = $this->id;
         $caracdesc->add();
     }
     ActionsModules::instance()->appel_module("modcaracteristique", new Caracteristique($this->id));
     //Caracdispdesc
     if (!empty($caracdisp) && is_array($caracdisp)) {
         foreach ($caracdisp as $id => $value) {
             $caracdispdesc = new Caracdispdesc();
             $caracdispdesc->charger_caracdisp($id, $lang);
             $caracdispdesc->titre = $value;
             if ($caracdispdesc->id) {
                 $caracdispdesc->maj();
             } else {
                 $caracdispdesc->caracdisp = $id;
                 $caracdispdesc->lang = $lang;
                 $caracdispdesc->classement = $this->getMaxCaracdispRank($this->id, $lang) + 1;
                 $caracdispdesc->add();
             }
             $caracdisp = new Caracdisp($id);
             ActionsModules::instance()->appel_module("modcaracdisp", $caracdisp);
         }
     }
     redirige("caracteristique_modifier.php?id=" . $this->id . "&lang=" . $lang);
 }