Beispiel #1
0
 public function Ajouter()
 {
     // Ouverture de la transaction si on ne l'ai pas déjà.
     $retour = parent::Ajouter();
     if ($retour !== false) {
         // On copie les libellés pour la nouvelle langue.
         $mListeLibelles = new MListeLibelles();
         $mListeLibelles->AjouterJointure(COL_LANGUE, COL_ID, 0, SQL_CROSS_JOIN);
         $mListeLibelles->AjouterColInsertionExt(0, COL_ID, COL_ID);
         $mListeLibelles->AjouterColInsertionExt(0, COL_LIBELLE, COL_LIBELLE);
         $mListeLibelles->AjouterColInsertionExt(0, COL_TYPELIBELLE, COL_TYPELIBELLE);
         $mListeLibelles->AjouterColInsertionExt(0, COL_LANGUEORIGINELLE, COL_LANGUEORIGINELLE);
         $mListeLibelles->AjouterColInsertionExt(1, COL_LANGUE, COL_ID);
         $mListeLibelles->AjouterFiltreEgal(COL_LANGUE, GSession::Langue(COL_ID));
         $mListeLibelles->AjouterFiltreEgalPourJointure(1, COL_ID, $this->Id());
         $mListeLibelles->Ajouter();
         $mListeLibelles = new MListeLibellesLibres();
         $mListeLibelles->AjouterJointure(COL_LANGUE, COL_ID, 0, SQL_CROSS_JOIN);
         $mListeLibelles->AjouterColInsertionExt(0, COL_ID, COL_ID);
         $mListeLibelles->AjouterColInsertionExt(0, COL_LIBELLE, COL_LIBELLE);
         $mListeLibelles->AjouterColInsertionExt(0, COL_TYPELIBELLE, COL_TYPELIBELLE);
         $mListeLibelles->AjouterColInsertionExt(0, COL_LANGUEORIGINELLE, COL_LANGUEORIGINELLE);
         $mListeLibelles->AjouterColInsertionExt(1, COL_LANGUE, COL_ID);
         $mListeLibelles->AjouterFiltreEgal(COL_LANGUE, GSession::Langue(COL_ID));
         $mListeLibelles->AjouterFiltreEgalPourJointure(1, COL_ID, $this->Id());
         $mListeLibelles->Ajouter();
         $mListeLibelles = new MListeLibellesTextes();
         $mListeLibelles->AjouterJointure(COL_LANGUE, COL_ID, 0, SQL_CROSS_JOIN);
         $mListeLibelles->AjouterColInsertionExt(0, COL_ID, COL_ID);
         $mListeLibelles->AjouterColInsertionExt(0, COL_LIBELLE, COL_LIBELLE);
         $mListeLibelles->AjouterColInsertionExt(0, COL_TYPELIBELLE, COL_TYPELIBELLE);
         $mListeLibelles->AjouterColInsertionExt(0, COL_LANGUEORIGINELLE, COL_LANGUEORIGINELLE);
         $mListeLibelles->AjouterColInsertionExt(1, COL_LANGUE, COL_ID);
         $mListeLibelles->AjouterFiltreEgal(COL_LANGUE, GSession::Langue(COL_ID));
         $mListeLibelles->AjouterFiltreEgalPourJointure(1, COL_ID, $this->Id());
         $mListeLibelles->Ajouter();
         $mListeLibelles = new MListeLibellesTextesLibres();
         $mListeLibelles->AjouterJointure(COL_LANGUE, COL_ID, 0, SQL_CROSS_JOIN);
         $mListeLibelles->AjouterColInsertionExt(0, COL_ID, COL_ID);
         $mListeLibelles->AjouterColInsertionExt(0, COL_LIBELLE, COL_LIBELLE);
         $mListeLibelles->AjouterColInsertionExt(0, COL_TYPELIBELLE, COL_TYPELIBELLE);
         $mListeLibelles->AjouterColInsertionExt(0, COL_LANGUEORIGINELLE, COL_LANGUEORIGINELLE);
         $mListeLibelles->AjouterColInsertionExt(1, COL_LANGUE, COL_ID);
         $mListeLibelles->AjouterFiltreEgal(COL_LANGUE, GSession::Langue(COL_ID));
         $mListeLibelles->AjouterFiltreEgalPourJointure(1, COL_ID, $this->Id());
         $mListeLibelles->Ajouter();
     }
     return $retour;
 }
Beispiel #2
0
 public function Ajouter()
 {
     // Ouverture de la transaction si on ne l'ai pas déjà.
     $dejaEnTransaction = GBase::EstEnTransaction();
     if ($dejaEnTransaction === false) {
         GBase::DemarrerTransaction();
     }
     // On inscrit le nouveau libellé dans la base avec l'id max + 1 comme id.
     $mLibelle = $this->LibelleObj();
     $mLibelle->AjouterColInsertionMax(COL_ID, 1);
     $retour = $mLibelle->Ajouter();
     if ($retour !== false) {
         // On récupère l'id max qui est l'id de notre libellé.
         $mLibelle->AjouterColSelectionMax(COL_ID);
         $retour = $mLibelle->Charger();
         if ($retour !== false) {
             // Fermeture de la transaction si on ne l'était pas déjà.
             if ($dejaEnTransaction === false) {
                 GBase::ValiderTransaction();
             }
             // On copie le libellé pour toutes les autres langues.
             $mListeLibelles = new MListeLibelles();
             $mListeLibelles->AjouterJointure(COL_LANGUE, COL_ID, 0, SQL_CROSS_JOIN);
             $mListeLibelles->AjouterColInsertionExt(0, COL_ID, COL_ID);
             $mListeLibelles->AjouterColInsertionExt(0, COL_LIBELLE, COL_LIBELLE);
             $mListeLibelles->AjouterColInsertionExt(0, COL_TYPELIBELLE, COL_TYPELIBELLE);
             $mListeLibelles->AjouterColInsertionExt(0, COL_LANGUEORIGINELLE, COL_LANGUEORIGINELLE);
             $mListeLibelles->AjouterColInsertionExt(1, COL_LANGUE, COL_ID);
             $mListeLibelles->AjouterFiltreEgal(COL_ID, $mLibelle->Id());
             $mListeLibelles->AjouterFiltreDifferentPourJointure(1, COL_ID, GSession::Langue(COL_ID));
             $mListeLibelles->Ajouter();
             $this->Libelle(NULL, $mLibelle->Id());
             // On ajoute ensuite l'objet normalement.
             return parent::Ajouter();
         }
     }
     if ($dejaEnTransaction === false) {
         GBase::AnnulerTransaction();
     }
     return $retour;
 }