public function Modifier() { // On modifie le menu. $retour = parent::Modifier(); $retourServ = true; $retourTyGr = true; // On modifie la liste de contexte que doit charger le menu. $listeServeurs = $this->ListeServeurs(); if ($listeServeurs !== NULL) { // Suppression de l'ancienne liste. $retourServ = $listeServeurs->Supprimer(); // Ajout de la nouvelle si tout s'est bien passé. if ($retourServ !== false) { $listeServeurs->SetListeChampValeur(COL_JEU, $this->Id()); $retourServ = $listeServeurs->Ajouter(); } } // On modifie la liste de fonctionnalités auxquelles le menu est lié. $listeTypesGroupes = $this->ListeTypesGroupes(); if ($listeTypesGroupes !== NULL) { $retourTyGr = $listeTypesGroupes->Supprimer(); if ($retourTyGr !== false) { $listeTypesGroupes->SetListeChampValeur(COL_JEU, $this->Id()); $retourTyGr = $listeTypesGroupes->Ajouter(); } } return $retour && $retourServ && $retourTyGr; }
public function Modifier() { // Ouverture de la transaction si on ne l'ai pas déjà. $dejaEnTransaction = GBase::EstEnTransaction(); if ($dejaEnTransaction === false) { GBase::DemarrerTransaction(); } $retour = true; $ancienOrdre = NULL; $nouvelOrdre = $this->Ordre(); if ($nouvelOrdre !== NULL) { // On récupère l'ordre de l'élément. $this->AjouterColSelection(COL_ORDRE); $retour = $this->Charger(); $ancienOrdre = $this->Ordre(); $this->Ordre($nouvelOrdre); } if ($ancienOrdre === NULL && $nouvelOrdre !== NULL) { GLog::LeverException(EXM_0214, $this->GetNom() . '::Modifier, impossible de récupérer l\'ordre de l\'élément d\'id [' . $this->Id() . '].'); $retour = false; } $log = true; // On modifie l'élément. if ($retour !== false) { $retour = parent::Modifier(); // Si l'ordre de l'élément à changé, on modifie les éléments qui en sont impactés. if ($retour !== false && $nouvelOrdre !== NULL && $nouvelOrdre !== $ancienOrdre) { // On récupère la liste relative au type d'élément afin de modifier l'ordre si besoin. $mListe = $this->GetNouvelleListe(); if ($mListe === NULL) { GLog::LeverException(EXM_0213, $this->GetNom() . '::Modifier, impossible de récupérer un objet liste.'); $retour = false; } else { // Si l'ancien ordre est supérieur au nouveau. if ($nouvelOrdre < $ancienOrdre) { $mListe->AjouterColModificationExt(0, COL_ORDRE, COL_ORDRE, 1); $mListe->AjouterFiltreEntre(COL_ORDRE, $nouvelOrdre, $ancienOrdre - 1); $mListe->AjouterFiltreDifferent(COL_ID, $this->Id()); $retour = $mListe->Modifier(); } else { $mListe->AjouterColModificationExt(0, COL_ORDRE, COL_ORDRE, -1); $mListe->AjouterFiltreEntre(COL_ORDRE, $ancienOrdre + 1, $nouvelOrdre); $mListe->AjouterFiltreDifferent(COL_ID, $this->Id()); $retour = $mListe->Modifier(); } } } else { $log = false; } } // Si on a créé nous même la transaction dans cette fonction, on commit ou rollback suivant le résultat. if ($dejaEnTransaction === false) { if ($retour === false) { GBase::AnnulerTransaction(); } else { GBase::ValiderTransaction(); } } if ($retour === false && $log === true) { GLog::LeverException(EXM_0215, $this->GetNom() . '::Modification, échec de la modification en base.'); } return $retour; }
public function Modifier() { $langueId = GSession::Langue(COL_ID); $mLibelle = NULL; // On ne modifie le libellé que pour notre langue. if ($this->Libelle() !== NULL && $langueId !== NULL) { $mLibelle = $this->AjouterJointure(COL_DESCRIPTION, COL_ID); if ($mLibelle->Langue()->Id() !== NULL) { $langueId = $mLibelle->Langue()->Id(); } $mLibelle->LangueOriginelle()->Id($langueId); $mLibelle->AjouterColModification(COL_LIBELLE); $mLibelle->AjouterColModification(COL_LANGUEORIGINELLE); $mLibelle->AjouterColCondition(COL_LANGUE, $langueId); $mLibelle->ModifierSurJointure(true); } $retour = parent::Modifier(); if ($retour !== false && $mLibelle !== NULL && $langueId !== NULL) { // On modifie le libellé pour toutes les autres langues qui ont comme langue d'origine notre langue. $mListeLibelles = new MListeLibelles(); $mListeLibelles->AjouterColModification(COL_LIBELLE, $mLibelle->Libelle()); $mListeLibelles->AjouterFiltreEgal(COL_ID, $mLibelle->Id()); $mListeLibelles->AjouterFiltreEgal(COL_LANGUEORIGINELLE, $langueId); $mListeLibelles->AjouterFiltreDifferent(COL_LANGUE, $langueId); $retour = $mListeLibelles->Modifier(); } return $retour; }