/**
  * 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;
 }
 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;
 }
Exemple #3
0
 public static function resetpirepcount()
 {
     echo '<h3>Reset PIREP Counts</h3>';
     $all_pilots = PilotData::findPilots(array());
     foreach ($all_pilots as $pilot) {
         $pireps = PIREPData::getReportsByAcceptStatus($pilot->pilotid, PIREP_ACCEPTED);
         $total = count($pireps);
         unset($pireps);
         $code = PilotData::getPilotCode($pilot->code, $pilot->pilotid);
         echo "{$code} - {$pilot->firstname} {$pilot->lastname} - {$total} pireps<br />";
         # Update the pireps table
         PilotData::updateProfile($pilot->pilotid, array('totalpireps' => $total));
     }
     echo 'Completed!';
 }
 /**
  * CentralData::get_pirep_xml()
  * 
  * @param mixed $pirep
  * @return
  */
 protected static function get_pirep_xml($pirep)
 {
     $pilotid = PilotData::getPilotCode($pirep->code, $pirep->pilotid);
     $pirep_xml = self::addElement(null, 'pirep', null, array('uniqueid' => $pirep->pirepid, 'pilotid' => $pilotid, 'pilotname' => $pirep->firstname . ' ' . $pirep->lastname, 'flightnum' => $pirep->code . $pirep->flightnum, 'depicao' => $pirep->depicao, 'arricao' => $pirep->arricao, 'aircraft' => $pirep->aircraft, 'registration' => $pirep->registration, 'flighttime' => $pirep->flighttime_stamp, 'submitdate' => $pirep->submitdate, 'modifieddate' => $pirep->modifieddate, 'flighttype' => $pirep->flighttype, 'load' => $pirep->load, 'fuelused' => $pirep->fuelused, 'fuelprice' => $pirep->fuelprice, 'pilotpay' => $pirep->pilotpay, 'price' => $pirep->price, 'source' => $pirep->source, 'revenue' => $pirep->revenue, 'source' => $pirep->source));
 }
Exemple #5
0
 /**
  * PIREPData::updatePIREPFeed()
  * 
  * @return
  */
 public static function updatePIREPFeed()
 {
     # Load PIREP into RSS feed
     $reports = PIREPData::findPIREPS(array(), 10);
     # Empty the rss file if there are no pireps
     if (!$reports) {
         return false;
     }
     $rss = new RSSFeed('Latest Pilot Reports', SITE_URL, 'The latest pilot reports');
     foreach ($reports as $report) {
         $rss->AddItem('Report #' . $report->pirepid . ' - ' . $report->depicao . ' to ' . $report->arricao, SITE_URL . '/admin/index.php?admin=viewpending', '', 'Filed by ' . PilotData::getPilotCode($report->code, $report->pilotid) . " ({$report->firstname} {$report->lastname})");
     }
     $rss->BuildFeed(LIB_PATH . '/rss/latestpireps.rss');
 }
Exemple #6
0
<?php

if (!defined('IN_PHPVMS') && IN_PHPVMS !== true) {
    die;
}
?>
<h3>Admin Activity Logs</h3>

<?php 
if (!$all_logs) {
    echo 'There is no activity';
    return;
}
?>

<table id="tabledlist" class="tablesorter">
<thead>
<tr>
	<th>Date</th>
	<th>Name</th>
	<th>Message</th>
</tr>
</thead>
<tbody>
<?php 
foreach ($all_logs as $log) {
    echo "<tr>\n\t\t\t<td width=\"5%\" nowrap>{$log->datestamp}</td>\n\t\t\t<td width=\"5%\" nowrap>" . PilotData::getPilotCode($log->code, $log->pilotid) . " - {$log->firstname} {$log->lastname}</td>\n\t\t\t<td>{$log->message}</td>\n\t\t  </tr>";
}
?>
</tbody>
</table>
Exemple #7
0
 /**
  * Profile::editprofile()
  *
  * @return
  */
 public function editprofile()
 {
     if (!Auth::LoggedIn()) {
         $this->set('message', 'You must be logged in to access this feature!');
         $this->render('core_error.tpl');
         return;
     }
     $this->set('userinfo', Auth::$pilot);
     $this->set('pilot', Auth::$pilot);
     $this->set('customfields', PilotData::getFieldData(Auth::$pilotid, true));
     $this->set('bgimages', PilotData::getBackgroundImages());
     $this->set('countries', Countries::getAllCountries());
     $this->set('pilotcode', PilotData::getPilotCode(Auth::$pilot->code, Auth::$pilot->pilotid));
     $this->render('profile_edit.tpl');
 }
        $link_title = 'View Profile';
    }
    ?>
    <p>
        <?php 
    /*  Example, if it's a twitter status update (ACTIVITY_TWITTER),
        then show an image (in this case, a small Twitter icon) */
    if ($activity->type == ACTIVITY_TWITTER) {
        echo '<img src="' . fileurl('/lib/images/twitter.png') . '" alt="twitter update" />';
    }
    ?>
        <?php 
    /*  If there is a pilot associated with this feed update, show their name
        and a link to their profile page */
    if ($activity->pilotid != 0) {
        $pilotCode = PilotData::getPilotCode($activity->code, $activity->pilotid);
        ?>
        
            <a href="<?php 
        echo url('/profile/view/' . $activity->pilotid);
        ?>
">
            <?php 
        echo $pilotCode . ' ' . $activity->firstname . ' ' . $activity->lastname;
        ?>
            </a> 
    
        <?php 
    }
    /* End if pilot ID != 0 */
    ?>
Exemple #9
0
 protected function AddAward()
 {
     if ($this->post->awardid == '' || $this->post->pilotid == '') {
         return;
     }
     # Check if they already have this award
     $award = AwardsData::GetPilotAward($this->post->pilotid, $this->post->awardid);
     if ($award) {
         $this->set('message', Lang::gs('award.exists'));
         $this->render('core_error.tpl');
         return;
     }
     AwardsData::AddAwardToPilot($this->post->pilotid, $this->post->awardid);
     $pilot = PilotData::getPilotData($this->post->pilotid);
     LogData::addLog(Auth::$userinfo->pilotid, 'Added and award to ' . PilotData::getPilotCode($pilot->code, $pilot->pilotid) . ' - ' . $pilot->firstname . ' ' . $pilot->lastname);
 }
//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>
<hr>
<form action="" method="post">
<b>Select Pilot:</b><br />
<select name="old_pilotid">
<option value="0">Select a Pilot</option>
<?php 
foreach ($allpilots as $pilot) {
    if (isset($_POST['old_pilotid'])) {
        if ($_POST['old_pilotid'] === $pilot->id) {
            $selected = 'selected';
        } else {
            $selected = '';
        }
    }
    echo "<option value=\"{$pilot->pilotid}\" {$selected}>";
    echo PilotData::getPilotCode($pilot->code, $pilot->pilotid);
    echo ' - ' . $pilot->pilotid . ' - ' . $pilot->firstname . ' ' . $pilot->lastname;
    echo '</option>';
}
?>
</select>
<br /><br />
<b>Enter new ID - ONLY NUMERIC:</b><br />
<input type="text" name="new_pilotid" value="" />
<br />
<p><b>Are you sure?</b></p>
<input type="submit" name="submit" value="Confirm Change ID" />
</form>
<script type="text/javascript">
var OFFSET = <?php 
echo Config::Get('PILOTID_OFFSET');