Baileypellow Posted July 5, 2017 Report Posted July 5, 2017 Hi all, I'm trying to sort out a jumpseat function for my pilots - and I've gotten fairly far. What I need now is a way for VMS to establish the location change and deduct from the pilot's current balance, on the click of a 'Submit' button. <div class="box box-primary"> <div class="box-header with-border"> <h3 class="box-title">Jumpseat</h3> </div> <div class="box-body"> <b>Current Location:</b> <?php $search = array( 'p.pilotid' => Auth::$userinfo->pilotid, 'p.accepted' => PIREP_ACCEPTED ); $reports = PIREPData::findPIREPS($search, 1); if($reports->arricao === null){$jumpseatdep = $userinfo->hub; echo $jumpseatdep;} else {$jumpseatdep = $reports->arricao; echo $jumpseatdep;}?> <hr> <P>Cost per Jumpseat Mile: $0.50</P><hr> <p>Select your destination:</p> <div class="form-group"> <select id="jumpseatdest" name="jumpseatdest" class="form-control"> <option value="">Select All</option> <?php foreach(OperationsData::getAllAirports() as $airport) { echo '<option value="'.$airport->icao.'">'.$airport->icao.' ('.$airport->name.') - Miles: '.round(OperationsData::getAirportDistance($jumpseatdep, $airport->icao)).' - Price: $'.round(OperationsData::getAirportDistance($jumpseatdep, $airport->icao)*0.5).'</option>'; } ?> </select> </div> </div> </div> This is in profile_main.php If what I have done could've been done better, please help! I'm no php whiz. Cheers Quote
tim260 Posted July 5, 2017 Report Posted July 5, 2017 Send me a email: tim@ossenblok.media I can make this for you Quote
Moderators servetas Posted July 5, 2017 Moderators Report Posted July 5, 2017 @tim260 aren't you able to share your suggestions publicly in the forum? Quote
tim260 Posted July 5, 2017 Report Posted July 5, 2017 Just now, servetas said: @tim260 aren't you able to share your suggestions publicly in the forum? I am but I see every developer requesting PMs or emails (dont see you asking them this question btw) so I figured thats kinda the way or working here Quote
Moderators servetas Posted July 5, 2017 Moderators Report Posted July 5, 2017 This is a public forum and it would be better sharing your thoughts publicly so they are useful to others who might have the same question. That's how forums work worldwide. I am requesting PMs or emails when someone is willing to pay in order to have something build up or when an issue is very related to the user's website. Quote
tim260 Posted July 5, 2017 Report Posted July 5, 2017 1 minute ago, servetas said: This is a public forum and it would be better sharing your thoughts publicly so they are useful to others who might have the same question. That's how forums work worldwide. I am requesting PMs or emails when someone is willing to pay in order to have something build up or when an issue is very related to the user's website. I know I've been on the internet for a while no need to act like that I just thought that was a thing here but like I said I have no problem sharing it. Quote
tim260 Posted July 6, 2017 Report Posted July 6, 2017 (edited) On 5-7-2017 at 11:52 AM, Baileypellow said: Hi all, I'm trying to sort out a jumpseat function for my pilots - and I've gotten fairly far. What I need now is a way for VMS to establish the location change and deduct from the pilot's current balance, on the click of a 'Submit' button. This is in profile_main.php If what I have done could've been done better, please help! I'm no php whiz. Cheers Hi, Youve gotten pretty far yourself! My tip would be: Store the location in the database rather than using the last PIREP arrival airport cause otherwise you'd have to insert a PIREP to change the location. Unless you want the jumpseat thing to count as a flown flight by the pilot? Use ternary operators Ternary operators make this: if($reports->arricao === null){$jumpseatdep = $userinfo->hub; echo $jumpseatdep;} else {$jumpseatdep = $reports->arricao; echo $jumpseatdep;}?> Into something more readable like this: $jumpseatdep = (!$reports) ? $userinfo->hub : $reports->arricao; echo $jumpseatdep; As @servetas requested ill share the code publicly. I will post it later today Edited July 6, 2017 by tim260 Quote
tim260 Posted July 6, 2017 Report Posted July 6, 2017 @Baileypellow working example on http://testing.ossenblok.media/jumpseat Note: I created it using the crewcenter theme by Mark Swam so some visual aspects will look different if you're not using that theme. I created a a github repository where you can download it. If you want me to I'll keep it updated Repository link: https://github.com/OssenblokMedia/Jumpseat The only thing you need to do is execute the following query in your database: ALTER TABLE phpvms_pilots ADD position VARCHAR(5) & You can also customize the default price modifier (0.5) by adding the line below to your "local.config.php" Config::Set('JUMPSEAT_MODIFIER','0.5'); Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.