本文整理汇总了PHP中PilotData::getPilotData方法的典型用法代码示例。如果您正苦于以下问题:PHP PilotData::getPilotData方法的具体用法?PHP PilotData::getPilotData怎么用?PHP PilotData::getPilotData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PilotData
的用法示例。
在下文中一共展示了PilotData::getPilotData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: testEditUserData
/**
* UserTest::testEditUserData()
*
* @return void
*/
public function testEditUserData()
{
$pilot = PilotData::getPilotByEmail('unittest@email.com');
$this->assertObjectHasAttribute('pilotid', $pilot, 'PilotData::getPilotByEmail');
# Check a save profile
$save = PilotData::updateProfile($pilot->pilotid, array('email' => 'unittest2@email.com', 'location' => 'PK'));
$this->assertTrue($save, DB::error());
# Verify if data was written, and if it differs
$changeset1 = PilotData::getPilotData($pilot->pilotid);
$this->assertEquals('PK', $changeset1->location);
unset($data);
}
示例4: view
/**
* Profile::view()
*
* @param string $pilotid
* @return
*/
public function view($pilotid = '')
{
$pilotid = PilotData::parsePilotID($pilotid);
$pilot = PilotData::getPilotData($pilotid);
$this->title = 'Profile of ' . $pilot->firstname . ' ' . $pilot->lastname;
$this->set('userinfo', $pilot);
$this->set('pilot', $pilot);
$this->set('allfields', PilotData::getFieldData($pilotid, false));
$pirep_list = PIREPData::getAllReportsForPilot($pilotid);
$this->set('pireps', $pirep_list);
$this->set('pirep_list', $pirep_list);
$this->set('pilotcode', PilotData::getPilotCode($pilot->code, $pilot->pilotid));
$this->set('allawards', AwardsData::getPilotAwards($pilot->pilotid));
$this->render('pilot_public_profile.tpl');
$this->render('pireps_viewall.tpl');
}
示例5: view
/**
* This is the public profile for the pilot
*/
public function view($pilotid = '')
{
if (!is_numeric($pilotid)) {
preg_match('/^([A-Za-z]*)(\\d*)/', $pilotid, $matches);
$code = $matches[1];
$pilotid = intval($matches[2]) - Config::Get('PILOTID_OFFSET');
}
$userinfo = PilotData::getPilotData($pilotid);
$this->title = 'Profile of ' . $userinfo->firstname . ' ' . $userinfo->lastname;
$this->set('userinfo', $userinfo);
$this->set('allfields', PilotData::GetFieldData($pilotid, false));
$this->set('pireps', PIREPData::GetAllReportsForPilot($pilotid));
$this->set('pilotcode', PilotData::GetPilotCode($userinfo->code, $userinfo->pilotid));
$this->set('allawards', AwardsData::GetPilotAwards($userinfo->pilotid));
$this->render('pilot_public_profile.tpl');
$this->render('pireps_viewall.tpl');
}
示例6: view
/**
* Profile::view()
*
* @param string $pilotid
* @return
*/
public function view($pilotid = '')
{
#replacement for OFC charts - Google Charts API - simpilot
$this->set('chart_url', ChartsData::build_pireptable($pilotid, 30));
#end
$pilotid = PilotData::parsePilotID($pilotid);
$pilot = PilotData::getPilotData($pilotid);
$this->title = 'Profile of ' . $pilot->firstname . ' ' . $pilot->lastname;
$this->set('userinfo', $pilot);
$this->set('pilot', $pilot);
$this->set('allfields', PilotData::getFieldData($pilotid, false));
$pirep_list = PIREPData::getAllReportsForPilot($pilotid);
$this->set('pireps', $pirep_list);
$this->set('pirep_list', $pirep_list);
$this->set('pilotcode', PilotData::getPilotCode($pilot->code, $pilot->pilotid));
$this->set('allawards', AwardsData::getPilotAwards($pilot->pilotid));
$this->render('pilot_public_profile.tpl');
$this->render('pireps_viewall.tpl');
}
示例7: strtotime
$slot_time = $slot_time + $event->slot_interval * 60;
}
echo '</td>';
} else {
echo '<td>Available Signups</td>';
echo '<td align="left">';
$slot_time = strtotime($event->time);
$slots = 1;
while ($slots <= $event->slot_limit) {
$test = date('G:i', $slot_time);
$check2 = EventsData::signup_time($event->id, $test);
if (!$check2) {
echo date('G:i', $slot_time) . ' - <a href="' . SITE_URL . '/index.php/events/signup?eid=' . $event->id . '&pid=' . Auth::$userinfo->pilotid . '&time=' . date('G:i', $slot_time) . '">Open</a><br />';
$slots++;
} else {
$pilot = PilotData::getPilotData($check2->pilot_id);
echo date('G:i', $slot_time) . ' - ';
echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid) . ' - ';
echo $pilot->firstname . ' ' . $pilot->lastname . '<br />';
}
$slot_time = $slot_time + $event->slot_interval * 60;
}
echo '</td>';
?>
</tr>
<?php
}
}
?>
</table>
<br />
示例8: Smarty
<?php
/*Cologne International Pilot Profile Page
* VERSION: 1.0
* DATE: 2015.12.25
* AUTHOR: BASTIAN WAGNER
*/
require './smarty/libs/Smarty.class.php';
//Smarty einbinden
require '../phpvms/core/codon.config.php';
// phpVMS config file einbinden
//Neue Smarty Instanz erstellen
$tpl = new Smarty();
//Pilot-Basisinformationen aus URL und phpVMS auslesen
$pilotid = $_GET["id"];
$userinfo = PilotData::getPilotData($pilotid);
//Alle Daten des Piloten in Variablen speichern
//PilotID
$pilotcode = PilotData::GetPilotCode($userinfo->code, $userinfo->pilotid);
//Pilot Name
$name = $userinfo->firstname . ' ' . $userinfo->lastname;
//Rang Bild
$rankimg = $userinfo->rankimage;
//Rang
$rank = $userinfo->rank;
//Flüge insg.
$totalflights = $userinfo->totalflights;
//Stunden insg.
$totalhours = Util::AddTime($userinfo->totalhours, $userinfo->transferhours);
//Landesflagge
$countryflag = Countries::getCountryImage($userinfo->location);
示例9: changepilotid
/**
* Maintenance::changepilotid()
*
* @return
*/
public function changepilotid()
{
CodonModule::checkPermission(MAINTENANCE);
CodonModule::checkPermission(EDIT_PILOTS);
echo '<h3>Change Pilot ID</h3>';
if (isset($this->post->submit)) {
$error = false;
if (!is_numeric($this->post->new_pilotid)) {
$error = true;
$this->set('message', 'The pilot ID isn\'t numeric!');
$this->render('core_error.php');
return;
}
if ($this->post->new_pilotid < 1) {
$error = true;
$this->set('message', 'You cannot have an ID less than 1');
$this->render('core_error.php');
return;
}
if (empty($this->post->new_pilotid)) {
$error = true;
$this->set('message', 'The pilot ID is blank!');
$this->render('core_error.php');
return;
}
if (empty($this->post->old_pilotid) || $this->post->old_pilotid == 0) {
$error = true;
$this->set('message', 'No pilot selected');
$this->render('core_error.php');
return;
}
$pilot = PilotData::getPilotData($this->post->new_pilotid);
if (is_object($pilot)) {
$error = true;
$this->set('message', 'This ID is already used!');
$this->render('core_error.php');
return;
}
if ($error === false) {
PilotData::changePilotID($this->post->old_pilotid, $this->post->new_pilotid);
$this->set('message', "Pilot ID changed from {$this->post->old_pilotid} to {$this->post->new_pilotid}");
$this->render('core_success.php');
}
}
$this->set('allpilots', PilotData::findPilots(array()));
$this->render('maintenance_changepilotid.php');
}
示例10: updateFlightData
/**
* Update a pilot's flight data, ie after a pirep
*
* @param int $pilotid Pilot ID
* @param int $flighttime Number of hours.minutes to increment by
* @param int $numflights Number of flights (default 1)
* @return bool Success
*
*/
public static function updateFlightData($pilotid, $flighttime, $numflights = 1)
{
# Update the flighttime
$pilotdata = PilotData::getPilotData($pilotid);
$flighttime = Util::AddTime($pilotdata->totalhours, $flighttime);
if ($numflights == '') {
$numflights = 1;
}
$params = array('totalhours' => $flighttime, 'totalflights' => $pilotdata->totalflights + $numflights);
return self::updateProfile($pilotid, $params);
}
示例11: populatePIREPFinance
/**
* Populate the PIREP with the fianancial info needed
*
* @param mixed $pirep Either a PIREP ID or the row
* @param bool $reset_fuel Reset the fuel costs or not?
* @return
*/
public static function populatePIREPFinance($pirep, $reset_fuel = false)
{
if (!is_object($pirep) && is_numeric($pirep)) {
$pirep = PIREPData::getReportDetails($pirep);
if (!$pirep) {
self::$lasterror = 'PIREP does not exist';
return false;
}
}
# Set the PIREP ID
$pirepid = $pirep->pirepid;
$sched = SchedulesData::getScheduleByFlight($pirep->code, $pirep->flightnum, '');
if (!$sched) {
self::$lasterror = 'Schedule does not exist. Please update this manually.';
return false;
}
$pilot = PilotData::getPilotData($pirep->pilotid);
# Get the load factor for this flight
if ($pirep->load == '' || $pirep->load == 0) {
$pirep->load = FinanceData::getLoadCount($pirep->aircraft, $sched->flighttype);
}
// Fix for bug #62, check the airport fuel price as 0 for live
//$depapt = OperationsData::getAirportInfo($pirep->depicao);
if ($pirep->fuelunitcost == '' || $pirep->fuelunitcost == 0 || $reset_fuel == true) {
$pirep->fuelunitcost = FuelData::getFuelPrice($pirep->depicao);
}
# Check the fuel
if ($pirep->fuelprice != '' || $reset_fuel == true) {
$pirep->fuelprice = FinanceData::getFuelPrice($pirep->fuelused, $pirep->depicao);
}
# Get the expenses for a flight
$total_ex = 0;
$expense_list = '';
/* Account for any fixed-cost percentages */
$allexpenses = FinanceData::getFlightExpenses();
if (is_array($allexpenses)) {
foreach ($allexpenses as $ex) {
$total_ex += $ex->cost;
}
}
/* Account for any per-flight %age expenses */
$all_percent_expenses = FinanceData::getFlightPercentExpenses();
$gross = floatval($sched->price) * floatval($pirep->load);
if (is_array($all_percent_expenses)) {
foreach ($all_percent_expenses as $ex) {
$cost = str_replace('%', '', $ex->cost);
$percent = $cost / 100;
$total = $gross * $percent;
$total_ex += $total;
}
}
/* Set the pilotpay here - if it was a per-schedule payment,
then set the pilot pay to that, otherwise, set it to the
total amount paid... */
# Handle pilot pay
if (!empty($sched->payforflight)) {
$pilot->payrate = $sched->payforflight;
$payment_type = PILOT_PAY_SCHEDULE;
} else {
$payment_type = PILOT_PAY_HOURLY;
}
$data = array('price' => $sched->price, 'load' => $pirep->load, 'fuelprice' => $pirep->fuelprice, 'expenses' => $total_ex, 'pilotpay' => $pilot->payrate, 'flighttime' => $pirep->flighttime);
$revenue = self::getPIREPRevenue($data, $payment_type);
/* Now update the PIREP */
$fields = array('price' => $sched->price, 'load' => $pirep->load, 'gross' => $gross, 'fuelprice' => $pirep->fuelprice, 'fuelunitcost' => $pirep->fuelunitcost, 'expenses' => $total_ex, 'pilotpay' => $pilot->payrate, 'paytype' => $payment_type, 'revenue' => $revenue);
if (isset($data['load']) && $data['load'] != '') {
$fields['load'] = $data['load'];
}
return self::editPIREPFields($pirepid, $fields);
}
示例12: changepilotid
public function changepilotid()
{
echo '<h3>Change Pilot ID</h3>';
if (isset($this->post->submit)) {
$error = false;
if (!is_numeric($this->post->new_pilotid)) {
$error = true;
$this->set('message', 'The pilot ID isn\'t numeric!');
$this->render('core_error.tpl');
return;
}
if ($this->post->new_pilotid < 1) {
$error = true;
$this->set('message', 'You cannot have an ID less than 1');
$this->render('core_error.tpl');
return;
}
if (empty($this->post->new_pilotid)) {
$error = true;
$this->set('message', 'The pilot ID is blank!');
$this->render('core_error.tpl');
return;
}
if (empty($this->post->old_pilotid) || $this->post->old_pilotid == 0) {
$error = true;
$this->set('message', 'No pilot selected');
$this->render('core_error.tpl');
return;
}
$pilot = PilotData::getPilotData($this->post->new_pilotid);
if (is_object($pilot)) {
$error = true;
$this->set('message', 'This ID is already used!');
$this->render('core_error.tpl');
return;
}
if ($error === false) {
PilotData::changePilotID($this->post->old_pilotid, $this->post->new_pilotid);
CodonEvent::Dispatch('pilotid_changed', 'Maintenance', array('old_pilotid' => $this->post->old_pilotid, 'new_pilotid' => $this->post->new_pilotid));
$this->set('message', "Pilot ID changed from {$this->post->old_pilotid} to {$this->post->new_pilotid}");
$this->render('core_success.tpl');
}
}
$this->set('allpilots', PilotData::findPilots(array()));
$this->render('maintenance_changepilotid.tpl');
}
示例13: foreach
//Creative Commons Attribution Non-commercial Share Alike (by-nc-sa)
//To view full license text visit http://creativecommons.org/licenses/by-nc-sa/3.0/
//
//@author David Clark (simpilot)
//@copyright Copyright (c) 2009-2010, David Clark
//@license http://creativecommons.org/licenses/by-nc-sa/3.0/
?>
<h3>Event Attendance Pilot Statistics</h3>
<center>
<table width="100%" border="1px">
<tr>
<td>Pilot</td>
<td># Of Events Attended</td>
</tr>
<?php
if (!$rankings) {
echo '<tr><td colspan="2">No Rankings Available</td></tr>';
} else {
foreach ($rankings as $rank) {
$pilot = PilotData::getPilotData($rank->pilot_id);
echo '<tr><td>' . PilotData::getPilotCode($pilot->code, $pilot->pilotid) . ' - ' . $pilot->firstname . ' ' . $pilot->lastname . '</td><td>' . $rank->ranking . '</td></tr>';
}
}
?>
</table>
</center>
<hr />
<a href="<?php
echo SITE_URL;
?>
/index.php/events"><b>Return To Events Listing</b></a>
示例14: calculateUpdatePilotRank
public static function calculateUpdatePilotRank($pilotid, $ranks_list = null)
{
/* Don't calculate a pilot's rank if this is set */
if (Config::Get('RANKS_AUTOCALCULATE') == false) {
return;
}
if ($ranks_list === null) {
$ranks_list = self::getAllRanks();
}
$pilotid = intval($pilotid);
$pilot = PilotData::getPilotData($pilotid);
$pilothours = $pilot->totalhours;
if (Config::Get('TRANSFER_HOURS_IN_RANKS') == true) {
$pilothours += $pilot->transferhours;
}
$i = 0;
foreach ($ranks_list 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);
if ($pilot->rank != $last_rank) {
$message = Lang::get('activity.pilot.promotion');
$message = str_replace('$rank', $last_rank, $message);
# Add it to the activity feed
ActivityData::addActivity(array('pilotid' => $pilotid, 'type' => ACTIVITY_PROMOTION, 'refid' => $pilotid, 'message' => htmlentities($message)));
}
}
示例15: 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()');
}