/** * Save building. */ function execute() { $buildingDao =& DAORegistry::getDAO('BuildingDAO'); $schedConf =& Request::getSchedConf(); if (isset($this->buildingId)) { $building =& $buildingDao->getBuilding($this->buildingId); } if (!isset($building)) { $building = new Building(); } $building->setSchedConfId($schedConf->getId()); $building->setName($this->getData('name'), null); // Localized $building->setAbbrev($this->getData('abbrev'), null); // Localized $building->setDescription($this->getData('description'), null); // Localized // Update or insert building if ($building->getId() != null) { $buildingDao->updateBuilding($building); } else { $buildingDao->insertBuilding($building); } }
$staticData->setTechnologies($technologies); $productionModsArr = $productionModConn->getAllProductionMods(); $productionModLinks = array(); foreach ($productionModsArr as $productionModArr) { $productionMod = new ProductionMod($productionModArr[0], $productionModArr[1], $productionModArr[2], $productionModArr[3], $productionModArr[4], $productionModArr[5], $productionModArr[6]); $productionMods[$productionMod->getId()] = $productionMod; if ($productionMod->getTargetClassId() == 'Building') { $productionModLinks[$productionMod->getTargetId()][] = $productionMod; } } $buildingsArr = $buildingConn->getAllBuildings(); foreach ($buildingsArr as $buildingArr) { $buildingName = $terms[$buildingArr[1]]->getString(); $buildingDescription = $terms[$buildingArr[13]]->getString(); $building = new Building($buildingArr[0], $buildingName, $buildingArr[2], $buildingArr[3], $buildingArr[4], $buildingArr[5], $buildingArr[6], explode(",", $buildingArr[7]), explode(",", $buildingArr[8]), explode(",", $buildingArr[9]), explode(",", $buildingArr[10]), $buildingArr[11], $buildingArr[12], $buildingDescription, $buildingArr[14], $buildingArr[15]); if (isset($productionModLinks[$building->getId()])) { $building->setProductionMods($productionModLinks[$building->getId()]); } $buildings[$building->getId()] = $building; } $staticData->setBuildings($buildings); $playersArr = $playerConn->getAllPlayers(); foreach ($playersArr as $playerArr) { $player = new Player($playerArr[0], $playerArr[1], $playerArr[2], $playerArr[3], $playerArr[4], $playerArr[5], $playerArr[6], $playerArr[7], explode(",", $playerArr[8]), $playerArr[9], $playerArr[10]); $players[$player->getId()] = $player; } $staticData->setPlayers($players); $resourcesArr = $resourceConn->getAllResources(); foreach ($resourcesArr as $resourceArr) { $resourceName = $terms[$resourceArr[1]]->getString(); $resource = new Resource($resourceArr[0], $resourceName, $resourceArr[2], $resourceArr[3], $resourceArr[4], $resourceArr[5]);