Jump to content

Schedules Results page [SOLVED]


TAV1702

Recommended Posts

Hi everyone. I am working on yet another little project that I could use a hand with.

In the schedule results.tpl file, I have added the following to show what type of flight it is, Cargo, Passenger, or charter.

<?php echo ($route->flighttype=='') ? '' : '<strong>Flight Type: </strong>'.$route->flighttype.'<br />' ?>

Now I am curious. Can an if statement be included so say if flghttype = C echo Cargo?

Right now the way I have it, it simply shows the results as C, P, or H.

I would like to add another code like the one above to show how much it pays for that flight but have yet to get that one to work. Maybe I can ix the code from the schedules are in the admin panel?

So in all, the schedule results page would show on the left like

SYX1067 (KMKE - KSDF)

Departure: 8:05 AM CDT Arrival: 10:45 AM EDT

Equipment: B1900D (N801SK) Distance: 303.318nm

Days Flown: T W Th F

Flight Type: Charter

Pay for Flight: $765

Link to comment
Share on other sites

Yes, you could use a series of if statements:

<?php echo 'Flight Type: ';
if($route->flighttype=='P')
  echo 'Passenger<br />';
elseif($route-flighttype=='C')
  echo 'Cargo<br />';
...?>

You can also use a switch statement:

<?php echo 'Flight Type: ';
switch($route->flighttype)
{
  case 'C':
     echo 'Cargo<br />';
     break;
  case 'P':
     echo 'Passenger<br />';
     break;
  ...
}?>

  • Like 1
Link to comment
Share on other sites

The top one actually works out pretty good as far as the passengers part goes. It seems to ignore the Cargo and charter flights.

If you have any ideas, I am game to try. I am also working on this as we speak. If I get it to work, I will let you know.

Thanks for helping out on this one.

Ray

Link to comment
Share on other sites

Ok so I tweaked it a tad and now I got it to echo charter as well, issue is, I did away with the elseif and went with another else echo and now all non passenger flights show up as Charter. I had figured that was going to be the result but tried it anyhow.

<?php echo '<strong>Flight Type: </strong>';
           if($route->flighttype=='P')
           echo 'Passenger<br />';
              elseif($route-flighttype=='C')
                 echo 'Cargo<br />';
		   else echo 'Charter<br />'; ?>

Link to comment
Share on other sites

Got it!

I had a typo. I debugged it and now she works.

<?php echo '<strong>Flight Type: </strong>';
           if($route->flighttype=="P"){
                  echo "Passenger<br />";
           } elseif($route->flighttype=="C"){
                  echo "Cargo<br />";
		  } else { echo "Charter<br />"; 
			}
		?>

Now if Nabeel or some kind soul would chime in and tell us how to pull up the Flight Value part, I would be happier then could possibly be. :D

Thanks for pointing me down the right path Nuclear.

Link to comment
Share on other sites

You know what...... I just noticed, it is showing ticket price for passengers or cargo charge. Ijust saw one flight valued at $2.95 lol I wonder how many pilots would turn down that job. :D And at $2.95 that same flight actually pays the pilot like $1100 I believe it was.

That works if we wish to show how much we are charging the passenger or cargo for the flight. I need to figure out how to make it show me how much cash the pilot will be paid for said flight. Not sure if we can do that or not with the pilot pay by the hour or per flight. I am sure there is a way though. The trick is to figure it out.

Link to comment
Share on other sites

I un-marked this one as solved. It is kind of solved. I have played with code until I was blue in the face and I can not get this to pull the pilot pay for a flight one. Using the code suggested above, it does pull either the ticket price or cargo per unit charge and echos it, but it will not show the actual pilot pay.

Link to comment
Share on other sites

Did you try $route->pilotpay?

If you do:

echo '<pre>'; print_r($route); echo '</pre>';

It will tell you all of the contents of the $route variable, you can pick and chose what you want

Nope I don't think I traveled down that road Nabeel. I'll give that a go here in a few minutes. I think I tried every thing but that one. ;)

Link to comment
Share on other sites

  • 3 weeks later...

Ray...

I added this code and i get a blank number after the "$"

AC.gif

AC1144 (CYQB - CYYZ)

Departure: 1:15 Arrival: 2:42

Equipment: CRJ-700 (AC-CRJ7) Distance: 395.813nm

Days Flown: M T W Th F S Su

Airline: Air Canada Jazz

Flight Type: Passenger

Price: $135

Flight Value: $ <----------------It is blank

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...