function displayData() { $cityTemp = CityManager::getSingleCity('id', $this->church->getIdCity()); if ($cityTemp === NULL) { $cityTemp = new City(); } $stateTemp = CityManager::getSingleState('id', $cityTemp->getIdState()); $cityString = "*************************"; if ($stateTemp === NULL) { $stateTemp = new State(); } else { $cityString = $cityTemp->getName() . ", " . $stateTemp->getShortName(); } $this->SetFont('Arial', 'B', 10); $cellSizeY = 5; for ($i = 0; $i < 3; $i++) { //Get the data necesary of create the document $this->SetXY($x + 100, $i * 60 + $y + 40 - $cellSizeY); $this->Cell(80, $cellSizeY, iconv('utf-8', 'cp1252', $this->church->getName()), 0, 0, 'C'); $this->SetXY($x + 100, $i * 60 + $y + 47 - $cellSizeY); $this->Cell(80, $cellSizeY, iconv('utf-8', 'cp1252', $this->church->getAddress()), 0, 0, 'C'); $this->SetXY($x + 100, $i * 60 + $y + 54 - $cellSizeY); $this->Cell(80, $cellSizeY, iconv('utf-8', 'cp1252', 'CP. ' . $this->church->getPostalCode()), 0, 0, 'C'); $this->SetXY($x + 100, $i * 60 + $y + 61 - $cellSizeY); $this->Cell(80, $cellSizeY, iconv('utf-8', 'cp1252', $cityString), 0, 0, 'C'); } }
<?php require_once __DIR__ . "/../../../Backend/SessionManager.php"; require_once __DIR__ . "/../../../Backend/CityManager.php"; if (!isset($_GET) || $_GET["nameCity"] === NULL) { echo "KO"; die; } $city = new City(0, $_GET["nameCity"], CityManager::getSingleState('name', $_GET["state"])->getId()); if (CityManager::addCity($city)) { echo "OK"; } else { echo "KO"; }