} else { $stringResponse = $stringResponse . "&namem=" . $mother->getNames() . "&lastname1m=" . $mother->getLastname1() . "&lastname2m=" . $mother->getLastname2(); } if ($gpp === NULL) { $stringResponse = $stringResponse . "&namegpp=&lastname1gpp=&lastname2gpp="; } else { $stringResponse = $stringResponse . "&namegpp=" . $gpp->getNames() . "&lastname1gpp=" . $gpp->getLastname1() . "&lastname2gpp=" . $gpp->getLastname2(); } if ($gmp === NULL) { $stringResponse = $stringResponse . "&namegmp=&lastname1gmp=&lastname2gmp="; } else { $stringResponse = $stringResponse . "&namegmp=" . $gmp->getNames() . "&lastname1gmp=" . $gmp->getLastname1() . "&lastname2gmp=" . $gmp->getLastname2(); } if ($gpm === NULL) { $stringResponse = $stringResponse . "&namegpm=&lastname1gpm=&lastname2gpm="; } else { $stringResponse = $stringResponse . "&namegpm=" . $gpm->getNames() . "&lastname1gpm=" . $gpm->getLastname1() . "&lastname2gpm=" . $gpm->getLastname2(); } if ($gmm === NULL) { $stringResponse = $stringResponse . "&namegmm=&lastname1gmm=&lastname2gmm="; } else { $stringResponse = $stringResponse . "&namegmm=" . $gmm->getNames() . "&lastname1gmm=" . $gmm->getLastname1() . "&lastname2gmm=" . $gmm->getLastname2(); } $baptism = BaptismManager::getSingleBaptism('idOwner', $child->getId()); if ($baptism !== NULL) { $baptismReg = BaptismManager::getSingleBaptismRegistry('id', $baptism->getIdBookRegistry()); $stringResponse = $stringResponse . "&idBap=" . $baptism->getId() . "&dateBap=" . DatabaseManager::databaseDateToSingleDate($baptism->getCelebrationDate()) . "&bookBap=" . $baptismReg->getBook() . "&pageBap=" . $baptismReg->getPage() . "&numbBap=" . $baptismReg->getNumber() . "&"; } else { $stringResponse = $stringResponse . "&idBap=0&dateBap=&bookBap=&pageBap=&numbBap=&"; } echo $stringResponse;
if ($godMother === NULL) { $godMother = new Person(); } //Create a String of options of Last Church $churchString = ""; $churchs = ChurchManager::getAllChurchs('name'); foreach ($churchs as $singleChurch) { if ($singleChurch->getId() === $churchId) { $churchString = $churchString . "<option selected> " . $singleChurch->getName() . "</option>\n"; } else { $churchString = $churchString . "<option> " . $singleChurch->getName() . "</option>\n"; } } $string = str_replace("|ChurchOption|", $churchString, $string); //Get the Baptism Data $baptism = BaptismManager::getSingleBaptism('idOwner', $ownerId); if ($baptism !== NULL) { //Create the String for Churchs of Baptism $churchString = "<option>XXXXXXXXXX</option>"; $churchId = $baptism->getIdChurch(); $baptismId = $baptism->getId(); foreach ($churchs as $singleChurch) { if ($singleChurch->getId() === $churchId) { $churchString = $churchString . "<option selected> " . $singleChurch->getName() . "</option>\n"; } else { $churchString = $churchString . "<option> " . $singleChurch->getName() . "</option>\n"; } } $string = str_replace("|ChurchOptionB|", $churchString, $string); $idBookRegistryB = $baptism->getIdBookRegistry(); $bookRegistryB = BaptismManager::getSingleBaptismRegistry('id', $idBookRegistryB);
$bookRegistry = BaptismManager::getSingleBaptismRegistry('book', $_POST["bookBookRegistryB"], 'page', $_POST["pageBookRegistryB"], 'number', $_POST["numBookRegistryB"]); $baptism = new Baptism('0', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL'); $baptism->setIdCivilRegistry('1'); $celb = DatabaseManager::singleDateToDatabaseDate($_POST["baptismDate"]); $baptism->setCelebrationDate($celb); $church = ChurchManager::getSingleChurch('name', $_POST["baptismChurch"]); if ($church !== NULL) { $baptism->setIdChurch($church->getId()); $baptism->setIdRector(RectorManager::getSingleRector('idActualChurch', $church->getId())->getId()); } $baptism->setIdOwner($child->getId()); $baptism->setIdBookRegistry($bookRegistry->getId()); BaptismManager::addBaptism($baptism); } } else { $baptism = BaptismManager::getSingleBaptism('id', $_POST["baptismId"]); if ($baptism !== NULL) { $celb = DatabaseManager::singleDateToDatabaseDate($_POST["baptismDate"]); $baptism->setCelebrationDate($celb); $church = ChurchManager::getSingleChurch('name', $_POST["baptismChurch"]); if ($church !== NULL) { $baptism->setIdChurch($church->getId()); } BaptismManager::updateBaptism($baptism); $baptismReg = BaptismManager::getSingleBaptismRegistry('id', $baptism->getIdBookRegistry()); $baptismReg->setBook($_POST["bookBookRegistryB"]); $baptismReg->setPage($_POST["pageBookRegistryB"]); $baptismReg->setNumber($_POST["numBookRegistryB"]); BaptismManager::updateBaptismRegistry($baptismReg); } }
require_once __DIR__ . "/../../Backend/SessionManager.php"; require_once __DIR__ . "/../../Backend/BaptismManager.php"; require_once __DIR__ . "/../../Backend/PersonManager.php"; require_once __DIR__ . "/../../Backend/RectorManager.php"; require_once __DIR__ . "/../../Backend/LanguageSupport.php"; //Get File contest from template $string = file_get_contents("template/BaptismInsertion.html"); if (!isset($_GET) || $_GET["id"] === NULL) { echo "<script src='../JS/functions.js'></script><script>href('main.php')</script>"; } //Remplace the nav $string = str_replace("|title|", 'Change Baptism', $string); $string = str_replace("|NavBar|", SessionManager::getNavBar(), $string); //Get The Data of the Baptism $idBaptism = $_GET["id"]; $baptism = BaptismManager::getSingleBaptism('id', $idBaptism); $ownerId = $baptism->getIdOwner(); $owner = PersonManager::getSinglePerson('id', $ownerId); $owner->getIdFather() !== NULL ? $fatherId = $owner->getIdFather() : ($fatherId = 0); $owner->getIdMother() !== NULL ? $motherId = $owner->getIdMother() : ($motherId = 0); $gender = $owner->getGender(); $churchId = $baptism->getIdChurch(); $bornDate = DatabaseManager::databaseDateToSingleDate($baptism->getBornDate()); $bornPlace = $baptism->getBornPlace(); $baptismDate = DatabaseManager::databaseDateToSingleDate($baptism->getCelebrationDate()); //Validate the user SessionManager::validateUserInPage('baptismChange.php', $churchId); $idRector = $baptism->getIdRector(); $objRector = RectorManager::getSingleRector('id', $idRector); $objPerRect = PersonManager::getSinglePerson('id', $objRector->getIdPerson()); $nameRector = $objPerRect->getFullNameBeginName();
<?php require_once __DIR__ . "/../../../Backend/SessionManager.php"; require_once __DIR__ . "/../../../Backend/BaptismManager.php"; if (!isset($_GET) || $_GET["idBaptism"] === NULL) { echo "KO"; } else { $baptism = BaptismManager::getSingleBaptism("id", $_GET["idBaptism"]); if ($baptism === NULL) { echo "KO"; } else { if (!isset($_SESSION) || $_SESSION["user_church"] === NULL) { echo "KO"; } else { //Check for permision if ($_SESSION["user_type"] == 'A' || $_SESSION["user_church"] == $baptism->getIdChurch()) { if (BaptismManager::removeBaptism($baptism)) { echo "OK"; } else { echo "KO"; } } } } }