public function add($title, $parent)
 {
     $rubriquedesc = new Rubriquedesc();
     $rubriquedesc->titre = $title;
     if ($rubriquedesc->titre !== '') {
         if (!is_numeric($parent) && $parent < 1) {
             $parent = 0;
         }
         $this->parent = $parent;
         $this->ligne = 1;
         $this->classement = $this->getMaxRanking($parent) + 1;
         $this->id = parent::add();
         $rubriquedesc->rubrique = $this->id;
         $rubriquedesc->lang = ActionsLang::instance()->get_id_langue_courante();
         $rubriquedesc->chapo = '';
         $rubriquedesc->description = '';
         $rubriquedesc->postscriptum = '';
         $rubriquedesc->id = $rubriquedesc->add();
         $caracteristique = new Caracteristique();
         $qCarac = "select * from {$caracteristique->table}";
         $rCarac = $caracteristique->query($qCarac);
         while ($rCarac && ($theCarac = $caracteristique->fetch_object($rCarac))) {
             $rubcaracteristique = new Rubcaracteristique();
             $rubcaracteristique->rubrique = $this->id;
             $rubcaracteristique->caracteristique = $theCarac->id;
             $rubcaracteristique->add();
         }
         $rubriquedesc->reecrire();
         ActionsModules::instance()->appel_module("ajoutrub", new Rubrique($this->id));
         redirige("rubrique_modifier.php?id=" . $this->id);
     } else {
         throw new TheliaAdminException("impossible to add new category", TheliaAdminException::CATEGORY_ADD_ERROR, null, $rubriquedesc);
     }
 }
function ajouter($parent, $lang, $titre, $chapo, $description, $postscriptum, $lien, $ligne)
{
    $rubrique = new Rubrique();
    $rubrique->parent = $parent;
    $rubrique->lien = $lien;
    if ($ligne != "") {
        $rubrique->ligne = 1;
    } else {
        $rubrique->ligne = 0;
    }
    if ($parent == "") {
        $parent = 0;
    }
    $lastid = $rubrique->add();
    $rubrique->charger($lastid);
    $rubrique->maj();
    $rubriquedesc = new Rubriquedesc();
    $rubriquedesc->rubrique = $lastid;
    $rubriquedesc->lang = $lang;
    $rubriquedesc->titre = $titre;
    $rubriquedesc->chapo = $chapo;
    $rubriquedesc->description = $description;
    $rubriquedesc->postscriptum = $postscriptum;
    $rubriquedesc->add();
    $caracteristique = new Caracteristique();
    $query = "select * from {$caracteristique->table}";
    $resul = $caracteristique->query($query);
    $rubcaracteristique = new Rubcaracteristique();
    while ($resul && ($row = $caracteristique->fetch_object($resul))) {
        $rubcaracteristique->rubrique = $lastid;
        $rubcaracteristique->caracteristique = $row->id;
        $rubcaracteristique->add();
    }
    $rubriquedesc->reecrire();
    ActionsModules::instance()->appel_module("ajoutrub", $rubrique);
    redirige("" . $_SERVER['PHP_SELF'] . "?id=" . $lastid);
}