Jump to content

help me pls


Henrique

Recommended Posts

could you help me with this error? 

( Warning: Creating default object from empty value in C:\Program Files (x86)\Ampps\www\core\templates\randomsearch.php on line 12 ) 

<?php
/*
* phpVMS Module: Random Itinerary Builder
* Coding by Jeffrey Kobus
* www.fs-products.net
* Verion 1.3
* Dated: 03/22/2011
*/

$pilotid = Auth::$userinfo->pilotid;
$last_location = PIREPData::getLastReports($pilotid, 1);
if(!$last_location) $last_location->arricao = Auth::$userinfo->hub;
$last_name = OperationsData::getAirportInfo($last_location->arricao);
$equipment = OperationsData::GetAllAircraftSearchList(true);
$airlines = OperationsData::getAllAirlines(true);
?>

<table border = "0">
  <tr>
	<th scope="col">Random Itinerary from Current Location</th>
  </tr>
  <tr><form name="randomflights" id="randomflights" action="<?php echo SITE_URL?>/index.php/randomflights/getRandomFlights" method="post">
    <td>Current Location Preselected </td>
      <table>
        <tr>
			<td width ="25%"><b>Current Location:</b></td>
			<td width ="75%"><select id="depicao" name="depicao">
				<option value="<?php echo $last_location->arricao?>"><?php echo $last_location->arricao?> (<?php echo $last_name->name?>)</option>
			</td>		
		</tr>
		<tr>
			<td width ="25%"><b>Airline:</b></td>
            <td width ="75%"><select id="airline" name="airline">               
	            <option value="">Select Airline</option>
            <?php
                if(!$airlines) $airlines = array();
                foreach($airlines as $airline)
                {
                        echo '<option value="'.$airline->code.'">'.$airline->name.'</option>';
                }
            ?>
            </td>
        </tr>
		<tr>
			<td width ="25%"><b>Aircraft:</b></td>
            <td width ="75%"><select id="equipment" name="equipment">               
	            <option value="">Select Equipment</option>
            <?php
                if(!$equipment) $equipment = array();
                foreach($equipment as $equip)
                {
                        echo '<option value="'.$equip->icao.'">'.$equip->name.'</option>';
                }
            ?>
            </td>
        </tr>
		<tr>
			<td width ="25%"><b>Number of Flights:</b></td>
			<td width ="75%"><select id="count" name="count">			  
			  <option value="3">3</option>
			  <option value="5">5</option>
			  <option value="15">15</option>			  		
			</select></td>
			<td><input type="submit" name="submit" value="Find Random Flights"></td>
		</tr>
	  </table>	  	
    </form>
  </tr>
</table>

 

Edited by Henrique
Link to comment
Share on other sites

  • Administrators

Don't turn off error reporting - work to fix the issue first and foremost.

What version of phpVMS? What version of PHP?

Change

$pilotid = Auth::$userinfo->pilotid;
$last_location = PIREPData::getLastReports($pilotid, 1);
if(!$last_location) $last_location->arricao = Auth::$userinfo->hub;
$last_name = OperationsData::getAirportInfo($last_location->arricao);
$equipment = OperationsData::GetAllAircraftSearchList(true);
$airlines = OperationsData::getAllAirlines(true);
?>

To

$pilotid = Auth::$userinfo->pilotid;
$last_location = PIREPData::getLastReports($pilotid, 1);
if(!$last_location) $last_location = new StdClass();
if(!$last_location) $last_location->arricao = Auth::$userinfo->hub;
$last_name = OperationsData::getAirportInfo($last_location->arricao);
$equipment = OperationsData::GetAllAircraftSearchList(true);
$airlines = OperationsData::getAllAirlines(true);
?>

I think that's the only change necessary. I'm on mobile right now and can't easily do a file compare to be sure. If the above doesn't fix it, I will do a file compare once I am near my computer.

Edited by ProAvia
Link to comment
Share on other sites

8 minutes ago, ProAvia said:

Don't turn off error reporting - work to fix the issue first and foremost.

What version of phpVMS? What version of PHP?

Change


$pilotid = Auth::$userinfo->pilotid;
$last_location = PIREPData::getLastReports($pilotid, 1);
if(!$last_location) $last_location->arricao = Auth::$userinfo->hub;
$last_name = OperationsData::getAirportInfo($last_location->arricao);
$equipment = OperationsData::GetAllAircraftSearchList(true);
$airlines = OperationsData::getAllAirlines(true);
?>

To


$pilotid = Auth::$userinfo->pilotid;
$last_location = PIREPData::getLastReports($pilotid, 1);
if(!$last_location) $last_location = new StdClass();
if(!$last_location) $last_location->arricao = Auth::$userinfo->hub;
$last_name = OperationsData::getAirportInfo($last_location->arricao);
$equipment = OperationsData::GetAllAircraftSearchList(true);
$airlines = OperationsData::getAllAirlines(true);
?>

I think that's the only change necessary. I'm on mobile right now and can't easily do a file compare to be sure. If the above doesn't fix it, I will do a file compare once I am near my computer.

My version: php 5.5 simpilot

he adds icao and doesn't scale!  https://prnt.sc/oxbes2

 

Edited by Henrique
Link to comment
Share on other sites

  • Administrators

5.5.2 - that is the same version I use. Not sure what you mean by "he adds icao and doesn't scale".

As far as current location being blank, you must fly at least one flight to a destination in your db for that field to show your current location. I guess there may be a way around that, but my pilots can't use the random flights generator until they reach a certain rank - and will have flown several flights before then.

Did you try what I posted and did the error disappear?

Edited by ProAvia
Link to comment
Share on other sites

10 minutes ago, ProAvia said:

5.5.2 - that is the same version I use. Not sure what you mean by "he adds icao and doesn't scale".

As far as current location being blank, you must fly at least one flight to a destination in your db for that field to show your current location. I guess there may be a way around that, but my pilots can't use the random flights generator until they reach a certain rank - and will have flown several flights before then.

Did you try what I posted and did the error disappear?

this location went blank when I put your code :(

Link to comment
Share on other sites

  • Administrators

There are only 3 files for the RandomFlights module

  • In /templates/randomsearch.php - the change I listed above is the only code change in mine from the original file.
  • In /template/randomflights.php - my file is the same as the original
  • In /modules/Randomflights/RandomFlights.php - my file is the same as the original

Have you actually completed at least one flight to a destination in your DB with the pilot sign-on you are using to test the module? I just checked mine, and with a sign-on that has not completed a flight, the current location is blank - but with a sign-on that has completed at least one flight, the current location is listed.So, basically, that pilot needs at least one PIREP submitted and approve that landed at an airport in your DB before the current location will show in Random Flights.

 

Link to comment
Share on other sites

1 hour ago, ProAvia said:

There are only 3 files for the RandomFlights module

  • In /templates/randomsearch.php - the change I listed above is the only code change in mine from the original file.
  • In /template/randomflights.php - my file is the same as the original
  • In /modules/Randomflights/RandomFlights.php - my file is the same as the original

Have you actually completed at least one flight to a destination in your DB with the pilot sign-on you are using to test the module? I just checked mine, and with a sign-on that has not completed a flight, the current location is blank - but with a sign-on that has completed at least one flight, the current location is listed.So, basically, that pilot needs at least one PIREP submitted and approve that landed at an airport in your DB before the current location will show in Random Flights.

 

I think my module is outdated, could you send me what you use?

Link to comment
Share on other sites

  • Administrators

Your module is NOT outdated. It's the exact same one I have. I went thru each file and changed any references in the files from tpl to php and then made sure all the file names ended in php. And then I added the code line I posted above. If I provided my files to you, the end result would be the same.

You still haven't answered my question.... Has the pilot filed at least one PIREP. Until the pilot files at least one PIREP, the current location will remain empty - that's just the way the module works. The module looks at PIREP data to get the last arrival point and uses that as the pilots current location.

Edited by ProAvia
Link to comment
Share on other sites

  • Administrators

Great

Another option would be to write additional code so that if the pilot hasn't filed at least one PIREP, the module would then get the pilots assigned hub as the current location.... But you are on your own there, as that's beyond my present skill set.

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...