本文整理汇总了PHP中PilotData类的典型用法代码示例。如果您正苦于以下问题:PHP PilotData类的具体用法?PHP PilotData怎么用?PHP PilotData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PilotData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: acarsdata
public function acarsdata()
{
$output = '';
CodonEvent::Dispatch('refresh_acars', 'XML');
$flights = ACARSData::GetACARSData();
$xml = new SimpleXMLElement('<livemap/>');
if (!$flights) {
$flights = array();
}
foreach ($flights as $flight) {
$pilot = $xml->addChild('aircraft');
$pilot->addAttribute('flightnum', $flight->flightnum);
$pilot->addAttribute('lat', $flight->lat);
$pilot->addAttribute('lng', $flight->lng);
$pilot->addChild('pilotid', PilotData::GetPilotCode($flight->code, $flight->pilotid));
$pilot->addChild('pilotname', $flight->firstname . ' ' . $flight->lastname);
$pilot->addChild('flightnum', $flight->flightnum);
$pilot->addChild('lat', $flight->lat);
$pilot->addChild('lng', $flight->lng);
$pilot->addChild('depicao', $flight->depicao);
$pilot->addChild('arricao', $flight->arricao);
$pilot->addChild('phase', $flight->phasedetail);
$pilot->addChild('alt', $flight->alt);
$pilot->addChild('gs', $flight->gs);
$pilot->addChild('distremain', $flight->distremain);
$pilot->addChild('timeremain', $flight->timeremain);
}
header('Content-type: text/xml');
echo $xml->asXML();
}
开发者ID:ryanunderwood,项目名称:phpVMS,代码行数:30,代码来源:XML.php
示例2: testTimesAdded
public function testTimesAdded()
{
echo '<h3>Checking Times</h3>';
$sql = 'SELECT `flighttime`
FROM ' . TABLE_PREFIX . 'pireps
WHERE `accepted`=' . PIREP_ACCEPTED;
$results = DB::get_results($sql);
$this->added_time = 0;
foreach ($results as $row) {
$this->added_time = Util::AddTime($this->added_time, $row->flighttime);
}
heading('Time added, all PIREPS at once');
$this->assertNotEqual(0, $this->added_time);
heading('Time added, pilot by pilot');
// Now calculate by PIREP
$allpilots = PilotData::GetAllPilots();
$total = 0;
foreach ($allpilots as $pilot) {
$p_hours = PilotData::getPilotHours($pilot->pilotid);
$total = Util::AddTime($total, $p_hours);
}
$this->assertNotEqual(0, $total);
heading('Comparing pilot to pilot vs all PIREPS');
$this->assertEqual($total, $this->added_time);
heading('Compare to STAT total hours');
StatsData::UpdateTotalHours();
$this->assertEqual($total, StatsData::TotalHours());
echo '<br />';
}
开发者ID:deanstalker,项目名称:phpVMS,代码行数:29,代码来源:times_test.php
示例3: pushToTwitter
/**
* ActivityData::pushToTwitter()
*
* @param mixed $params
* @return void
*/
public static function pushToTwitter($params)
{
require_once CORE_LIB_PATH . '/twitteroauth/twitteroauth.php';
$params = array_merge(array('pilotid' => '', 'type' => '', 'refid' => '', 'message' => ''), $params);
$message = '';
# These defaults will be ignored
$lat = -120;
$long = -120;
if (!empty($params['pilotid'])) {
$pilot = PilotData::getPilotData($params['pilotid']);
$message .= PilotData::getPilotCode($pilot->code, $pilot->pilotid) . ' ' . $pilot->firstname . ' ' . $pilot->lastname . ' ';
}
$message .= $params['message'] . ' ';
# Show a new PIREP, also get the airport information
if ($params['type'] == ACTIVITY_NEW_PIREP) {
$message .= url('/pireps/view/' . $params['refid']);
$pirep = PIREPData::findPIREPS(array('pirepid' => $params['refid']), 1);
$pirep = $pirep[0];
$airport = OperationsData::getAirportInfo($pirep->arricao);
$lat = $airport->lat;
$long = $airport->lng;
} elseif ($params['type'] == ACTIVITY_NEW_PILOT) {
$message .= url('/profile/view/' . $params['pilotid']);
$airport = OperationsData::getAirportInfo($pilot->hub);
$lat = $airport->lat;
$long = $airport->lng;
}
$tweet = new TwitterOAuth(Config::get('TWITTER_CONSUMER_KEY'), Config::get('TWITTER_CONSUMER_SECRET'), Config::get('TWITTER_OAUTH_TOKEN'), Config::get('TWITTER_OAUTH_SECRET'));
$status = $tweet->post('statuses/update', array('status' => $message, 'lat' => $lat, 'long' => $long, 'trim_user' => true));
return $status;
}
开发者ID:Galihom,项目名称:phpVMS,代码行数:37,代码来源:ActivityData.class.php
示例4: testTimesAdded
public function testTimesAdded()
{
$sql = 'SELECT `flighttime`
FROM ' . TABLE_PREFIX . 'pireps
WHERE `accepted`=' . PIREP_ACCEPTED;
$results = DB::get_results($sql);
if (!$results) {
$this->markTestSkipped('No PIREPs to test against');
}
$this->added_time = 0;
foreach ($results as $row) {
$this->added_time = Util::AddTime($this->added_time, $row->flighttime);
}
$this->assertNotEqual(0, $this->added_time);
// Now calculate by PIREP
$allpilots = PilotData::GetAllPilots();
$total = 0;
foreach ($allpilots as $pilot) {
$p_hours = PilotData::getPilotHours($pilot->pilotid);
$total = Util::AddTime($total, $p_hours);
}
$this->assertNotEqual(0, $total);
$this->assertEqual($total, $this->added_time);
StatsData::UpdateTotalHours();
$this->assertEqual($total, StatsData::TotalHours());
}
开发者ID:Galihom,项目名称:phpVMS,代码行数:26,代码来源:TimesTest.php
示例5: savepro
public function savepro()
{
if ($this->post->firstname == '' || $this->post->lastname == '') {
$this->set('message', 'The first or lastname cannot be blank!');
$this->render('core_error.tpl');
return;
}
$params = array('firstname' => $this->post->firstname, 'lastname' => $this->post->lastname, 'email' => $this->post->email, 'hub' => $this->post->hub, 'retired' => $this->post->retired, 'totalflights' => $this->post->totalflights, 'totalpay' => floatval($this->post->totalpay), 'transferhours' => $this->post->transferhours);
PilotData::updateProfile($this->post->pilotid, $params);
PilotData::SaveFields($this->post->pilotid, $_POST);
/* Don't calculate a pilot's rank if this is set */
if (Config::Get('RANKS_AUTOCALCULATE') == false) {
PilotData::changePilotRank($this->post->pilotid, $this->post->rank);
} else {
RanksData::calculateUpdatePilotRank($this->post->pilotid);
}
StatsData::UpdateTotalHours();
$this->set('message', 'Profile updated successfully');
$this->render('core_success.tpl');
$this->set('pilots', PilotData::getAllPilots());
$this->render('/pm/pilot_manager.php');
if ($this->post->resend_email == 'true') {
$this->post->id = $this->post->pilotid;
$this->resendemail(false);
}
$pilot = PilotData::getPilotData($this->post->pilotid);
LogData::addLog(Auth::$userinfo->pilotid, 'Updated profile for ' . PilotData::getPilotCode($pilot->code, $pilot->pilotid) . ' ' . $pilot->firstname . ' ' . $pilot->lastname);
return;
break;
}
开发者ID:parkho,项目名称:Pilot-Manager-V2.2,代码行数:30,代码来源:Pilotmanager.php
示例6: testDeleteUser
function testDeleteUser()
{
$result = PilotData::DeletePilot($this->pilotid);
$this->assertTrue($result, 'Deleting pilot');
# Verify deletion
$data = PilotData::GetPilotData($this->pilotid);
$this->assertFalse($data, "Pilot still exists");
# Last test, add a line break
echo "<br />";
}
开发者ID:ryanunderwood,项目名称:phpVMS,代码行数:10,代码来源:registration_test.php
示例7: sendmail
public function sendmail()
{
$this->checkPermission(EMAIL_PILOTS);
echo '<h3>Sending email</h3>';
if ($this->post->subject == '' || trim($this->post->message) == '') {
$this->set('message', 'You must enter a subject and message!');
$this->render('core_error.php');
return;
}
if (count($this->post->groups) == 0) {
$this->set('message', 'You must select groups to send to!');
$this->render('core_error.php');
return;
}
echo 'Sending email...<br />';
$pilotarray = array();
//Begin the nice long assembly of e-mail addresses
foreach ($this->post->groups as $groupid) {
if ($groupid == 'all') {
$all_pilots = PilotData::findPilots(array());
foreach ($all_pilots as $pilot) {
$pilotarray[$pilot->pilotid] = $pilot;
}
break;
} else {
$tmp = PilotGroups::getUsersInGroup($groupid);
if (count($tmp) == 0 || !is_array($tmp)) {
continue;
}
foreach ($tmp as $pilot) {
$pilotarray[$pilot->pilotid] = $pilot;
}
}
}
$subject = DB::escape($this->post->subject);
$message = stripslashes($this->post->message) . PHP_EOL . PHP_EOL;
# Do some quick fixing of obvious formatting errors
$message = str_replace('<br>', '<br />', $message);
foreach ($pilotarray as $pilot) {
echo 'Sending for ' . $pilot->firstname . ' ' . $pilot->lastname . '<br />';
# Variable replacements
$send_message = str_replace('{PILOT_FNAME}', $pilot->firstname, $message);
$send_message = str_replace('{PILOT_LNAME}', $pilot->lastname, $send_message);
$send_message = str_replace('{PILOT_ID}', PilotData::GetPilotCode($pilot->code, $pilot->pilotid), $send_message);
$send_message = utf8_encode($send_message);
Util::SendEmail($pilot->email, $subject, $send_message);
}
echo 'Complete!';
LogData::addLog(Auth::$userinfo->pilotid, 'Sent pass mail');
return;
}
开发者ID:phpmods,项目名称:phpvms_5.5.x,代码行数:51,代码来源:MassMailer.php
示例8: post_module_load
function post_module_load()
{
/* Misc tasks which need to get done */
/* If the setting to auto-retired pilots is on, then do that
and only check every 24 hours
*/
if (Config::Get('USE_CRON') == false) {
if (Config::Get('PILOT_AUTO_RETIRE') == true) {
$within_timelimit = CronData::check_hoursdiff('find_retired_pilots', '24');
if ($within_timelimit === false) {
PilotData::findRetiredPilots();
CronData::set_lastupdate('find_retired_pilots');
}
}
if (Config::Get('CLOSE_BIDS_AFTER_EXPIRE') === false) {
$within_timelimit = CronData::check_hoursdiff('check_expired_bids', '24');
if ($within_timelimit === false) {
SchedulesData::deleteExpiredBids();
CronData::set_lastupdate('check_expired_bids');
}
}
/* Expenses, make sure they're all populated */
$within_timelimit = CronData::check_hoursdiff('populate_expenses', 18);
if ($within_timelimit === false) {
FinanceData::updateAllExpenses();
CronData::set_lastupdate('populate_expenses');
}
/* And finally, clear expired sessions */
Auth::clearExpiredSessions();
}
if (Config::Get('TWITTER_AIRLINE_ACCOUNT') != '') {
$within_timelimit = CronData::check_hoursdiff('twitter_update', '3');
if ($within_timelimit === false) {
ActivityData::readTwitter();
CronData::set_lastupdate('twitter_update');
}
}
// @TODO: Clean ACARS records older than one month
if (Config::Get('MAINTENANCE_MODE') == true && !Auth::LoggedIn() && !PilotGroups::group_has_perm(Auth::$usergroups, FULL_ADMIN)) {
Template::Show('maintenance.tpl');
die;
}
return true;
}
开发者ID:Galihom,项目名称:phpVMS,代码行数:44,代码来源:bootstrap.inc.php
示例9: post_module_load
function post_module_load()
{
/* Misc tasks which need to get done */
/* If the setting to auto-retired pilots is on, then do that
and only check every 24 hours
*/
if (Config::Get('USE_CRON') === true) {
if (Config::Get('PILOT_AUTO_RETIRE') == true) {
$within_timelimit = CronData::check_hoursdiff('find_retired_pilots', '24');
if ($within_timelimit == false) {
PilotData::findRetiredPilots();
CronData::set_lastupdate('find_retired_pilots');
}
}
if (Config::Get('CLOSE_BIDS_AFTER_EXPIRE') === false) {
$within_timelimit = CronData::check_hoursdiff('check_expired_bids', '24');
if ($within_timelimit == false) {
SchedulesData::deleteExpiredBids();
CronData::set_lastupdate('check_expired_bids');
}
}
/* Expenses, make sure they're all populated */
$within_timelimit = CronData::check_hoursdiff('populate_expenses', '18');
if ($within_timelimit == false) {
FinanceData::updateAllExpenses();
CronData::set_lastupdate('populate_expenses');
}
/* And finally, clear expired sessions */
Auth::clearExpiredSessions();
}
// @TODO: Clean ACARS records older than one month
if (Config::Get('MAINTENANCE_MODE') == true && !Auth::LoggedIn() && !PilotGroups::group_has_perm(Auth::$usergroups, FULL_ADMIN)) {
echo '<html><head><title>Down for maintenance - ' . SITE_NAME . '</title></head><body>';
Debug::showCritical(Config::Get('MAINTENANCE_MESSAGE'), 'Down for maintenance');
echo '</body></html>';
die;
}
return true;
}
开发者ID:deanstalker,项目名称:phpVMS,代码行数:39,代码来源:bootstrap.inc.php
示例10: FilePIREP
/**
* File a PIREP from an ACARS program
*
* @param mixed $pilotid The pilot ID of the pilot filing the PIREP
* @param mixed $data This is the data structure with the PIREP info
* @return bool true/false
*
*/
public static function FilePIREP($pilotid, $data)
{
if (!is_array($data)) {
self::$lasterror = 'PIREP data must be array';
return false;
}
# Call the pre-file event
#
if (CodonEvent::Dispatch('pirep_prefile', 'PIREPS', $_POST) == false) {
return false;
}
# File the PIREP report
#
$ret = PIREPData::FileReport($data);
# Set them as non-retired
PilotData::setPilotRetired($pilotid, 0);
if (!$ret) {
return false;
}
self::$pirepid = DB::$insert_id;
# Call the event
#
CodonEvent::Dispatch('pirep_filed', 'PIREPS', $_POST);
# Close out a bid if it exists
#
$bidid = SchedulesData::GetBidWithRoute($pilotid, $data['code'], $data['flightnum']);
if ($bidid) {
SchedulesData::RemoveBid($bidid->bidid);
}
return true;
}
开发者ID:deanstalker,项目名称:phpVMS,代码行数:39,代码来源:ACARSData.class.php
示例11: testDeleteUser
/**
* UserTest::testDeleteUser()
*
* @return void
*/
public function testDeleteUser()
{
$pilot = PilotData::getPilotByEmail('[email protected]');
$this->assertObjectHasAttribute('pilotid', $pilot, 'PilotData::getPilotByEmail');
$result = PilotData::deletePilot($pilot->pilotid);
$data = PilotData::GetPilotData($pilot->pilotid);
$this->assertFalse($data, "Pilot still exists");
}
开发者ID:Galihom,项目名称:phpVMS,代码行数:13,代码来源:UserTest.php
示例12: write_template
protected function write_template($name, $save_as)
{
$this->set('pilotcode', PilotData::GetPilotCode(Auth::$userinfo->code, Auth::$userinfo->pilotid));
$this->set('userinfo', Auth::$userinfo);
$acars_config = Template::GetTemplate($name, true);
$acars_config = str_replace("\n", "\r\n", $acars_config);
Util::downloadFile($acars_config, $save_as);
return;
# Set the headers so the browser things a file is being sent
header('Content-Type: text/plain');
header('Content-Disposition: attachment; filename="' . $save_as . '"');
header('Content-Length: ' . strlen($acars_config));
echo $acars_config;
}
开发者ID:ryanunderwood,项目名称:phpVMS,代码行数:14,代码来源:FSFK.php
示例13: define
*
* @author Nabeel Shahzad
* @copyright Copyright (c) 2008, Nabeel Shahzad
* @link http://www.phpvms.net
* @license http://creativecommons.org/licenses/by-nc-sa/3.0/
*/
/* This is the maintenance cron file, which can run nightly.
You should either point to this file directly in your web-host's control panel
Or add an entry into the crontab file. I recommend running this maybe 2-3am,
*/
define('ADMIN_PANEL', true);
include dirname(dirname(__FILE__)) . '/core/codon.config.php';
Auth::$userinfo->pilotid = 0;
error_reporting(E_ALL);
ini_set('display_errors', 'on');
/* Clear expired sessions */
Auth::clearExpiredSessions();
/* Update any expenses */
FinanceData::updateAllExpenses();
if (Config::Get('PILOT_AUTO_RETIRE') == true) {
/* Find any retired pilots and set them to retired */
PilotData::findRetiredPilots();
CronData::set_lastupdate('find_retired_pilots');
}
if (Config::Get('CLOSE_BIDS_AFTER_EXPIRE') === false) {
SchedulesData::deleteExpiredBids();
CronData::set_lastupdate('check_expired_bids');
}
MaintenanceData::optimizeTables();
MainController::Run('Maintenance', 'resetpirepcount');
MainController::Run('Maintenance', 'resethours');
开发者ID:ryanunderwood,项目名称:phpVMS,代码行数:31,代码来源:maintenance.php
示例14: addUser
/**
* Add a User
*
* $data = array(
* 'firstname' => '',
* 'lastname' => '',
* 'email' => '',
* 'password' => '',
* 'code' => '',
* 'location' => '',
* 'hub' => '',
* 'confirm' => false);
*/
public static function addUser($data)
{
/*$data = array(
'firstname' => '',
'lastname' => '',
'email' => '',
'password' => '',
'code' => '',
'location' => '',
'hub' => '',
'confirm' => false);*/
$exists = self::CheckUserEmail($data['email']);
if (is_object($exists)) {
self::$error = 'Email already exists';
return false;
}
//Set the password, add some salt
$salt = md5(date('His'));
$password = md5($data['password'] . $salt);
//Stuff it into here, the confirmation email will use it.
self::$salt = $salt;
$code = DB::escape(strtoupper($data['code']));
$firstname = DB::escape(ucwords($data['firstname']));
$lastname = DB::escape(ucwords($data['lastname']));
$location = DB::escape(strtoupper($data['location']));
//Add this stuff in
if ($data['confirm'] === true) {
$confirm = 1;
} else {
$confirm = 0;
}
$sql = "INSERT INTO " . TABLE_PREFIX . "pilots (firstname, lastname, email,\n\t\t\t\t\tcode, location, hub, password, salt, confirmed, joindate, lastip)\n\t\t\t\t VALUES ('{$firstname}', '{$lastname}', '{$data['email']}', '{$code}',\n\t\t\t\t\t\t\t'{$location}', '{$data['hub']}', '{$password}', '{$salt}', {$confirm}, NOW(), '{$_SERVER['REMOTE_ADDR']}')";
$res = DB::query($sql);
if (DB::errno() != 0) {
if (DB::errno() == 1062) {
self::$error = 'This email address is already registered';
return false;
}
self::$error = DB::error();
return false;
}
//Grab the new pilotid, we need it to insert those "custom fields"
$pilotid = DB::$insert_id;
RanksData::CalculateUpdatePilotRank($pilotid);
PilotData::GenerateSignature($pilotid);
/* Add them to the default group */
$defaultGroup = SettingsData::getSettingValue('DEFAULT_GROUP');
PilotGroups::addUsertoGroup($pilotid, $defaultGroup);
// For later
self::$pilotid = $pilotid;
//Get customs fields
$fields = self::GetCustomFields();
if (!$fields) {
return true;
}
foreach ($fields as $field) {
$value = Vars::POST($field->fieldname);
$value = DB::escape($value);
if ($value != '') {
$sql = "INSERT INTO " . TABLE_PREFIX . "fieldvalues (fieldid, pilotid, value)\n\t\t\t\t\t\t\tVALUES ({$field->fieldid}, {$pilotid}, '{$value}')";
DB::query($sql);
}
}
return true;
}
开发者ID:rallin,项目名称:phpVMS,代码行数:78,代码来源:RegistrationData.class.php
示例15: edit_pirep_post
protected function edit_pirep_post()
{
if ($this->post->code == '' || $this->post->flightnum == '' || $this->post->depicao == '' || $this->post->arricao == '' || $this->post->aircraft == '' || $this->post->flighttime == '') {
$this->set('message', 'You must fill out all of the required fields!');
$this->render('core_error.tpl');
return false;
}
$pirepInfo = PIREPData::getReportDetails($this->post_action->pirepid);
if (!$pirepInfo) {
$this->set('message', 'Invalid PIREP!');
$this->render('core_error.tpl');
return false;
}
$this->post->fuelused = str_replace(' ', '', $this->post->fuelused);
$this->post->fuelused = str_replace(',', '', $this->post->fuelused);
$fuelcost = $this->post->fuelused * $this->post->fuelunitcost;
# form the fields to submit
$data = array('pirepid' => $this->post->pirepid, 'code' => $this->post->code, 'flightnum' => $this->post->flightnum, 'leg' => $this->post->leg, 'depicao' => $this->post->depicao, 'arricao' => $this->post->arricao, 'aircraft' => $this->post->aircraft, 'flighttime' => $this->post->flighttime, 'load' => $this->post->load, 'price' => $this->post->price, 'pilotpay' => $this->post->pilotpay, 'fuelused' => $this->post->fuelused, 'fuelunitcost' => $this->post->fuelunitcost, 'fuelprice' => $fuelcost, 'expenses' => $this->post->expenses);
if (!PIREPData::UpdateFlightReport($this->post->pirepid, $data)) {
$this->set('message', 'There was an error editing your PIREP');
$this->render('core_error.tpl');
return false;
}
PIREPData::SaveFields($this->post->pirepid, $_POST);
//Accept or reject?
$this->post->id = $this->post->pirepid;
$submit = strtolower($this->post->submit_pirep);
// Add a comment
if (trim($this->post->comment) != '' && $submit != 'reject pirep') {
PIREPData::AddComment($this->post->pirepid, Auth::$userinfo->pilotid, $this->post->comment);
}
if ($submit == 'accept pirep') {
$this->approve_pirep_post();
} elseif ($submit == 'reject pirep') {
$this->reject_pirep_post();
}
StatsData::UpdateTotalHours();
# Update a pilot's stats
PilotData::updatePilotStats($pirepInfo->pilotid);
LogData::addLog(Auth::$userinfo->pilotid, 'Edited PIREP #' . $this->post->id);
return true;
}
开发者ID:ryanunderwood,项目名称:phpVMS,代码行数:42,代码来源:PIREPAdmin.php
示例16: testPIREPRejected
/**
* SchedulePIREPTest::testPIREPRejected()
*
* @return void
*/
public function testPIREPRejected()
{
$this->resetPilot();
$sched = $this->findSchedule();
Config::Set('PIREP_CHECK_DUPLICATE', false);
Config::Set('EMAIL_SEND_PIREP', false);
# Update this schedule to only pay per-hour
SchedulesData::editScheduleFields($sched->id, array('payforflight' => 0));
$sched = $this->findSchedule();
$this->assertEquals(0, $sched->payforflight, 'Pay per-flight set to 0');
$pirep_test = array('pilotid' => $this->samplePilotID, 'code' => $sched->code, 'flightnum' => $sched->flightnum, 'route' => $sched->route, 'depicao' => $sched->depicao, 'arricao' => $sched->arricao, 'aircraft' => $sched->aircraft, 'flighttime' => $sched->flighttime, 'submitdate' => 'NOW()', 'fuelused' => 6000, 'source' => 'unittest', 'comment' => 'Test Flight');
# Update Pilot Pay to be set to zero
PilotData::updateProfile($this->samplePilotID, array('totalpay' => 0));
$pilot_data = PilotData::getPilotData($this->samplePilotID);
$this->assertEquals($pilot_data->totalpay, 0, 'Reset Pilot Pay to 0');
# File the flight report
$pirepid = PIREPData::fileReport($pirep_test);
$this->assertGreaterThan(0, $pirepid, PIREPData::$lasterror);
$pirepdata = PIREPData::findPIREPS(array('p.pirepid' => $pirepid));
$this->assertGreaterThan(0, count($pirepdata), 'No PIREPs returned');
# Work on one...
$pirepdata = $pirepdata[0];
# Verify the little bits of this PIREP....
$this->assertEquals(PILOT_PAY_HOURLY, $pirepdata->paytype, 'PIREP Pay Type');
$this->assertEquals($pilot_data->payrate, $pirepdata->pilotpay, 'PIREP Pay Amount');
# Check the pilot pay
$pilot_data = PilotData::getPilotData($this->samplePilotID);
$this->assertEquals(0, $pilot_data->totalpay, 'Check pilot pay after PIREP FILE');
# Reject the PIREP and then check the pilot pay
$status = PIREPData::changePIREPStatus($pirepdata->pirepid, PIREP_REJECTED);
$pirepdata = PIREPData::findPIREPS(array('p.pirepid' => $pirepid));
$this->assertEquals(PIREP_REJECTED, $pirepdata[0]->accepted, 'changePIREPStatus to ACCEPTED');
$pirepdata = $pirepdata[0];
# Check the schedule flown count:
$post_accept = $this->findSchedule();
$this->assertEquals($sched->timesflown, $post_accept->timesflown, "Schedule increment count");
$post_pilot_data = PilotData::getPilotData($this->samplePilotID);
$this->assertEquals(0, $post_pilot_data->totalpay, 'Check pilot pay after PIREP REJECT');
$this->assertEquals($pilot_data->totalflights, $post_pilot_data->totalflights, 'Total Flights');
# Delete the PIREP
PIREPData::deletePIREP($pirepid);
# Verify delete
$data = PIREPData::findPIREPS(array('p.pirepid' => $pirepid));
$this->assertEmpty($data, 'PIREPDdata::deletePIREP()');
}
开发者ID:Galihom,项目名称:phpVMS,代码行数:50,代码来源:SchedulePIREPTest.php
示例17: write_config
/**
* Write out a config file to the user, give the template name and
* the filename to save the template as to the user
*
* @param mixed $template_name Template to use for config (fspax_config.php)
* @param mixed $save_as File to save as (xacars.ini)
* @return mixed Nothing, sends the file to the user
*
*/
public function write_config($template_name, $save_as)
{
if (!Auth::LoggedIn()) {
echo 'You are not logged in!';
exit;
}
$this->set('pilotcode', PilotData::GetPilotCode(Auth::$pilot->code, Auth::$pilot->pilotid));
$this->set('userinfo', Auth::$pilot);
$this->set('pilot', Auth::$pilot);
$acars_config = Template::GetTemplate($template_name, true);
$acars_config = str_replace("\n", "\r\n", $acars_config);
Util::downloadFile($acars_config, $save_as);
}
开发者ID:BogusCurry,项目名称:phpvms_5.5.x,代码行数:22,代码来源:ACARS.php
示例18: RecentFrontPage
public function RecentFrontPage($count = 5)
{
$this->set('pilots', PilotData::GetLatestPilots($count));
$this->render('frontpage_recentpilots.tpl');
}
开发者ID:deanstalker,项目名称:phpVMS,代码行数:5,代码来源:Pilots.php
示例19: calculateUpdatePilotRank
public static function calculateUpdatePilotRank($pilotid)
{
/* Don't calculate a pilot's rank if this is set */
if (Config::Get('RANKS_AUTOCALCULATE') == false) {
return;
}
$pilotid = intval($pilotid);
$allranks = self::GetAllRanks();
$pilot = PilotData::GetPilotData($pilotid);
$pilothours = $pilot->totalhours;
if (Config::Get('TRANSFER_HOURS_IN_RANKS') == true) {
$pilothours += $pilot->transferhours;
}
$i = 0;
foreach ($allranks as $rank) {
$i++;
if ($pilothours >= intval($rank->minhours)) {
$rank_level = $i;
$last_rank = $rank->rank;
$last_rankid = $rank->rankid;
}
}
$update = array('rankid' => $last_rankid, 'rank' => $last_rank, 'ranklevel' => $rank_level);
PilotData::updateProfile($pilot->pilotid, $update);
}
开发者ID:ryanunderwood,项目名称:phpVMS,代码行数:25,代码来源:RanksData.class.php
示例20: create_acars_flight
protected static function create_acars_flight($flight)
{
if (is_object($flight)) {
$flight = (array) $flight;
}
// If a unique was specified
if (isset($flight['unique_id'])) {
$flight['id'] = $flight['unique_id'];
}
$acars_xml = self::$xml->addChild('flight');
$acars_xml->addChild('unique_id', $flight['id']);
$acars_xml->addChild('pilotid', PilotData::GetPilotCode($flight['code'], $flight['pilotid']));
$acars_xml->addChild('pilotname', $flight['pilotname']);
$acars_xml->addChild('flightnum', $flight['flightnum']);
$acars_xml->addChild('aircraft', $flight['aircraft']);
$acars_xml->addChild('lat', $flight['lat']);
$acars_xml->addChild('lng', $flight['lng']);
$acars_xml->addChild('depicao', $flight['depicao']);
$acars_xml->addChild('arricao', $flight['arricao']);
$acars_xml->addChild('deptime', $flight['deptime']);
$acars_xml->addChild('arrtime', $flight['arrtime']);
$acars_xml->addChild('heading', $flight['heading']);
$acars_xml->addChild('phase', $flight['phasedetail']);
$acars_xml->addChild('alt', $flight['alt']);
$acars_xml->addChild('gs', $flight['gs']);
$acars_xml->addChild('distremain', $flight['distremain']);
$acars_xml->addChild('timeremain', $flight['timeremaining']);
$acars_xml->addChild('client', $flight['client']);
$acars_xml->addChild('lastupdate', $flight['lastupdate']);
}
开发者ID:ryanunderwood,项目名称:phpVMS,代码行数:30,代码来源:CentralData.class.php
注:本文中的PilotData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论