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'); } }
/** * insert one state in the database * * @author Jonathan Sandoval <*****@*****.**> * @param State $state The state to insert * @return boolean If was possible to insert */ static function addState($state = null) { if ($state === null) { return false; } $shortName = $state->getShortName(); $singleState = self::getSingleState('shortName', $shortName); if (self::compareState($singleState, $state) === false) { $tableState = DatabaseManager::getNameTable('TABLE_STATE'); $name = $state->getName(); $country = $state->getCountry(); $query = "INSERT INTO {$tableState}\n (shortName, name, country)\n VALUES \n ('{$shortName}', '{$name}', '{$country}')"; return DatabaseManager::singleAffectedRow($query); } else { return false; } }