本文整理汇总了PHP中OperationsData::AddAirport方法的典型用法代码示例。如果您正苦于以下问题:PHP OperationsData::AddAirport方法的具体用法?PHP OperationsData::AddAirport怎么用?PHP OperationsData::AddAirport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OperationsData
的用法示例。
在下文中一共展示了OperationsData::AddAirport方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SiteSetup
public static function SiteSetup()
{
/*$_POST['SITE_NAME'] == '' || $_POST['firstname'] == '' || $_POST['lastname'] == ''
|| $_POST['email'] == '' || $_POST['password'] == '' || $_POST['vaname'] == ''
|| $_POST['vacode'] == ''*/
// first add the airline
$_POST['vacode'] = strtoupper($_POST['vacode']);
if (!OperationsData::AddAirline($_POST['vacode'], $_POST['vaname'])) {
self::$error = DB::$error;
return false;
}
// Add an initial airport/hub, because I love KJFK so much
$data = array('icao' => 'KJFK', 'name' => 'Kennedy International', 'country' => 'USA', 'lat' => '40.6398', 'lng' => '-73.7787', 'hub' => false, 'fuelprice' => 0);
$ret = OperationsData::AddAirport($data);
// Add the user
$data = array('firstname' => $_POST['firstname'], 'lastname' => $_POST['lastname'], 'email' => $_POST['email'], l, 'password' => $_POST['password'], 'code' => $_POST['vacode'], 'location' => 'US', 'hub' => 'KJFK', 'confirm' => true);
if (!RegistrationData::AddUser($data)) {
self::$error = DB::$error;
return false;
}
// Add a rank
RanksData::updateRank(1, 'New Hire', 0, fileurl('/lib/images/ranks/newhire.jpg'), 18.0);
# Add to admin group
$pilotdata = PilotData::GetPilotByEmail($_POST['email']);
if (!PilotGroups::AddUsertoGroup($pilotdata->pilotid, 'Administrators')) {
self::$error = DB::$error;
return false;
}
# Add the final settings in
SettingsData::SaveSetting('SITE_NAME', $_POST['SITE_NAME']);
SettingsData::SaveSetting('ADMIN_EMAIL', $_POST['email']);
SettingsData::SaveSetting('GOOGLE_KEY', $_POST['googlekey']);
return true;
}
示例2: add_airport_post
protected function add_airport_post()
{
if ($this->post->icao == '' || $this->post->name == '' || $this->post->country == '' || $this->post->lat == '' || $this->post->lng == '') {
$this->set('message', 'Some fields were blank!');
$this->render('core_error.tpl');
return;
}
if ($this->post->hub == 'true') {
$this->post->hub = true;
} else {
$this->post->hub = false;
}
$data = array('icao' => $this->post->icao, 'name' => $this->post->name, 'country' => $this->post->country, 'lat' => $this->post->lat, 'lng' => $this->post->lng, 'hub' => $this->post->hub, 'chartlink' => $this->post->chartlink, 'fuelprice' => $this->post->fuelprice);
OperationsData::AddAirport($data);
if (DB::errno() != 0) {
if (DB::$errno == 1062) {
// Duplicate entry
$this->set('message', 'This airport has already been added');
} else {
$this->set('message', 'There was an error adding the airport');
}
$this->render('core_error.tpl');
return;
}
/*$this->set('message', 'The airport has been added');
$this->render('core_success.tpl');*/
LogData::addLog(Auth::$userinfo->pilotid, 'Added the airport "' . $this->post->icao . ' - ' . $this->post->name . '"');
}
示例3: RetrieveAirportInfo
/**
* Retrieve Airport Information
*/
public static function RetrieveAirportInfo($icao)
{
$icao = strtoupper($icao);
if (Config::Get('AIRPORT_LOOKUP_SERVER') == 'geonames') {
$url = Config::Get('GEONAME_API_SERVER') . '/searchJSON?maxRows=1&style=medium&featureCode=AIRP&type=json&q=' . $icao;
} elseif (Config::Get('AIRPORT_LOOKUP_SERVER') == 'phpvms') {
$url = Config::Get('PHPVMS_API_SERVER') . '/index.php/airport/get/' . $icao;
}
# Updated to use CodonWebServer instead of simplexml_load_url() straight
# Could cause errors
$file = new CodonWebService();
$contents = @$file->get($url);
$reader = json_decode($contents);
if ($reader->totalResultsCount == 0 || !$reader) {
return false;
} else {
if (isset($reader->geonames)) {
$apt = $reader->geonames[0];
} elseif (isset($reader->airports)) {
$apt = $reader->airports[0];
}
// Add the AP
$data = array('icao' => $icao, 'name' => $apt->name, 'country' => $apt->countryName, 'lat' => $apt->lat, 'lng' => $apt->lng, 'hub' => false, 'fuelprice' => $apt->jeta);
OperationsData::AddAirport($data);
}
return self::GetAirportInfo($icao);
}