Jump to content

Real manual PIREP


orobouros

Recommended Posts

Hello,

The pilots of my VA do many non scheduled IFR flights, in various places of the world, and a lot of VFR on the same model. It works fine with the KACARS tracker but i would like a real manual PIREP system wich allows pilots to send a PIREP of any kind with the values they choose to enter. The only condition to respect may be that each field must be filled, but i don't want to check if a scheduled flight exists, wich is the case actually.

I've tried some solutions by myself but each time when i test it, it doesn't work. How can i do to allows pilot to send all PIREPS they want manually ?

Here's the pirep_new.php page i've tried to modify without success :

<br /><br />
<?php
if(isset($message))
echo '<div id="error">'.$message.'</div>';
?>
<form action="<?php echo url('/pireps/mine');?>" method="post">
<dl>
<dt>Pilot:</dt>
<dd><strong><?php echo Auth::$userinfo->firstname . ' ' . Auth::$userinfo->lastname;?></strong></dd>

<dt>Select Airline:</dt>
<dd>
 <select name="code" id="code">
  <option value="">Select your airline</option>
 <?php
 foreach($allairlines as $airline)
 {
  $sel = ($_POST['code'] == $airline->code || $bid->code == $airline->code)?'selected':'';

  echo '<option value="'.$airline->code.'" '.$sel.'>'.$airline->code.' - '.$airline->name.'</option>';
 }
 ?>
 </select>
</dd>

<dt>Enter Flight Number:</dt>
<dd><input type="text" name="flightnum" value="<?php if(isset($bid->flightnum)) { echo $bid->flightnum; }?><?php if(isset($_POST['flightnum'])) { echo $_POST['flightnum'];} ?>" /></dd>

<dt>Select Departure Airport:</dt>
<dd>
 <div id="depairport">
 <select id="depicao" name="depicao">
  <option value="">Select a departure airport</option>
  <?php
  foreach($allairports as $airport)
  {
   $sel = ($_POST['depicao'] == $airport->icao || $bid->depicao == $airport->icao)?'selected':'';

   echo '<option value="'.$airport->icao.'" '.$sel.'>'.$airport->icao . ' - '.$airport->name .'</option>';
  }
  ?>
 </select>
 </div>
</dd>

<dt>Select Arrival Airport:</dt>
<dd>
 <div id="arrairport">
 <select id="arricao" name="arricao">
  <option value="">Select an arrival airport</option>
  <?php
  foreach($allairports as $airport)
  {
   $sel = ($_POST['arricao'] == $airport->icao || $bid->arricao == $airport->icao)?'selected':'';

   echo '<option value="'.$airport->icao.'" '.$sel.'>'.$airport->icao . ' - '.$airport->name .'</option>';
  }
  ?>
 </select>
 </div>
</dd>

<dt>Select Aircraft:</dt>
<dd>
 <select name="aircraft" id="aircraft">
  <option value="">Select the aircraft of this flight</option>
 <?php

 foreach($allaircraft as $aircraft)
 {

  /* Skip any aircraft which have aircraft that the pilot
   is not rated to fly (according to RANK)
  */
  if(Config::Get('RESTRICT_AIRCRAFT_RANKS') === true)
  {
   /* This means the aircraft rank level is higher than
 what the pilot's ranklevel, so just do "continue"
 and move onto the next route in the list
 */
   if($aircraft->ranklevel > Auth::$userinfo->ranklevel)
   {
 continue;
   }
  }

  $sel = ($_POST['aircraft'] == $aircraft->name || $bid->registration == $aircraft->registration)?'selected':'';

  echo '<option value="'.$aircraft->id.'" '.$sel.'>'.$aircraft->name.' - '.$aircraft->registration.'</option>';
 }
 ?>
 </select>
</dd>
<?php
// List all of the custom PIREP fields
if(!$pirepfields) $pirepfields = array();
foreach($pirepfields as $field)
{
?>
 <dt><?php echo $field->title ?></dt>
 <dd>
 <?php

 // Determine field by the type

 if($field->type == '' || $field->type == 'text')
 {
 ?>
  <input type="text" name="<?php echo $field->name ?>" value="<?php echo $_POST[$field->name] ?>" />
 <?php
 }
 elseif($field->type == 'textarea')
 {
  echo '<textarea name="'.$field->name.'">'.$field->values.'</textarea>';
 }
 elseif($field->type == 'dropdown')
 {
  $values = explode(',', $field->options);

  echo '<select name="'.$field->name.'">';
  foreach($values as $value)
  {
   $value = trim($value);
   echo '<option value="'.$value.'">'.$value.'</option>';
  }
  echo '</select>'; 
 }
 ?>

 </dd>
<?php
}
?>

<dt>Fuel Used</dt>
<dd><input type="text" name="fuelused" value="<?php echo $_POST['fuelused']; ?>" />
 <p>This is the fuel used on this flight in <?php echo Config::Get('LIQUID_UNIT_NAMES', Config::Get('LiquidUnit'))?></p></dd>

<dt>Flight Time</dt>
<dd><input type="text" name="flighttime" value="<?php echo $_POST['flighttime'] ?>" />
 <p>Enter as hours - "5.30" is five hours and thirty minutes</p></dd>

<dt>Route</dt>
<dd><textarea name="route"><?php echo (!isset($_POST['route'])) ? $bid->route : $_POST['route']; ?></textarea>
 <p>Enter the route flown, or default will be from the schedule</p></dd>

<dt>Comment</dt>
<dd><textarea name="comment"><?php echo $_POST['comment'] ?></textarea></dd>

<dt></dt>
<dd><?php $bidid = ( isset($bid) )? $bid->bidid:$_POST['bid']; ?>
 <input type="hidden" name="bid" value="<?php echo $bidid ?>" />
 <input type="submit" name="submit_pirep" value="File Flight Report" /></dd>
</dl>
</form>

thank you by advance if you have a solution for my problem

Link to comment
Share on other sites

  • 3 years later...

Greetings! 

   I would like to modify this page a bit. would appreciate any help i can get. I dont want pilots to be able to submit manual pireps themselves . Instead, I want admins to submit for them. So the change i need is unlocking the pilot name at the top of the form. additionally, i need to make it a drop-down for all pilots within the VA. Any ideas? 

Link to comment
Share on other sites

  • Administrators
19 hours ago, Shadesb181 said:

Greetings! 

   I would like to modify this page a bit. would appreciate any help i can get. I dont want pilots to be able to submit manual pireps themselves . Instead, I want admins to submit for them. So the change i need is unlocking the pilot name at the top of the form. additionally, i need to make it a drop-down for all pilots within the VA. Any ideas? 

How are the pilots going to get their PIREP information to the admins? Aren't they going to need some type of form to get the info on their flights to the admins? Using the PIREP form allows pilots to submit their info - and then admins can edit, approve or reject them. Additionally, using an ACARS program (like kACARS_Free or others) will accurately track flight times and allow pilots to submit the data without the need to fill out a manual PIREP.

Link to comment
Share on other sites

  • Administrators
1 hour ago, Yash said:

Go to phpvms_install_dir/core/templates/pirep_new.php

At the start of file enter this:


<?php
if(!PilotGroups::group_has_perm(Auth::$usergroups, ACCESS_ADMIN)) {
    Debug::showCritical('Unauthorized access');
    return;
}
?>

 

Regards

While this might prevent regular users (pilots) from using the manual PIREP form, how will admins be able to now enter the pilots ID to input the PIREP data for a specific pilot?

 

Link to comment
Share on other sites

I agree with @ProAvia this is hard pressed to accomplish, I've tried this a long time ago. Since the introductions to the Executive Module, and the Charters OPS Modules, a pilot now has the option of creating a complete Route on his/her own. Eliminating the Hassle of the above. As long as of course said aircraft and airports are already in your databases. On that note, Both Modules are separated from the Main phpvms database, thus allowing pretty much an unlimited creation of routes across the boards. Sorry, not to be rude by any means, but I just don't see the point of this at all.

I've created also as a last resort, I separate Form embedded in my site, A route Request form visible of course only to members. This in itself has been a life save .

Link to comment
Share on other sites

1 hour ago, ProAvia said:

While this might prevent regular users (pilots) from using the manual PIREP form, how will admins be able to now enter the pilots ID to input the PIREP data for a specific pilot?

 

Go to pirep_new.php in core/templates and replace this

<dt>Pilot:</dt>
	<dd><strong><?php echo Auth::$pilot->firstname . ' ' . Auth::$pilot->lastname;?></strong></dd>

with

<dt>Pilot:</dt>
<dd>
  <select name="pilotid">
    <?php
    $pilots = PilotData::getAllPilots();
    foreach($pilots as $pilot){
      echo '<option value="'.$pilot->pilotid.'">'.$pilot->firstname.' '.$pilot->lastname.'</option>';
    }
    ?>
  </select>
</dd>

Now go to core/modules/PIREPS/PIREPS.php

Search for this

protected function SubmitPIREP() {

Below this line replace 

$pilotid = Auth::$pilot->pilotid;

with

$pilotid = $this->post->pilotid;

 

That's it now select your Pilot and File a PIREP for him ;)

 

Link to comment
Share on other sites

On 12/26/2019 at 6:19 AM, Shadesb181 said:

So the change i need is unlocking the pilot name at the top of the form. additionally, i need to make it a drop-down for all pilots within the VA. Any ideas? 

8 hours ago, ProAvia said:

how will admins be able to now enter the pilots ID to input the PIREP data for a specific pilot?

Haven't tested this but this is one way to go about it. Go to here:

https://github.com/DavidJClark/phpvms_5.5.x/blob/master/core/modules/PIREPS/PIREPS.php#L401

And change it to

$pilotid = $this->post->pilotid;

Note: The pilot you are entering for must have a bid already.

Here, https://github.com/DavidJClark/phpvms_5.5.x/blob/master/core/templates/pirep_new.php#L10

You would need to change this to something like this

<dd>
    <select name="pilotid">
        <option value="">Select a Pilot</option>
      	<?php
		$allpilots = PilotData::getAllPilots();
		foreach($allpilots as $pilot) {
   			echo '<option value="'.$pilot->pilotid.'">'.PilotData::getPilotCode($pilot->code, $pilot->pilotid).' - '.$pilot->firstname.' '.$pilot->lastname.'</option>';
		}
		?>
    </select>
</dd>

You may also have to alter the FilePIREPForm() function a little.

This is answering the question, although I would recommend (if you have a lot of pilots) that you use a textbox and a JS AJAX request so that the list isn't really long and would require a lot of scrolling. Hope this helps in some way.

Edit: Looks like Yash got there first.

Edited by web541
  • Thanks 1
Link to comment
Share on other sites

8 hours ago, Yash said:

Go to pirep_new.php in core/templates and replace this


<dt>Pilot:</dt>
	<dd><strong><?php echo Auth::$pilot->firstname . ' ' . Auth::$pilot->lastname;?></strong></dd>

with


<dt>Pilot:</dt>
<dd>
  <select name="pilotid">
    <?php
    $pilots = PilotData::getAllPilots();
    foreach($pilots as $pilot){
      echo '<option value="'.$pilot->pilotid.'">'.$pilot->firstname.' '.$pilot->lastname.'</option>';
    }
    ?>
  </select>
</dd>

Now go to core/modules/PIREPS/PIREPS.php

Search for this


protected function SubmitPIREP() {

Below this line replace 


$pilotid = Auth::$pilot->pilotid;

with


$pilotid = $this->post->pilotid;

 

That's it now select your Pilot and File a PIREP for him ;)

 

YASH Thank you so very much for the help. After editing the files as directed, the pilot name stil shows grayed out.

 

4 hours ago, web541 said:

Haven't tested this but this is one way to go about it. Go to here:

https://github.com/DavidJClark/phpvms_5.5.x/blob/master/core/modules/PIREPS/PIREPS.php#L401

And change it to


$pilotid = $this->post->pilotid;

Note: The pilot you are entering for must have a bid already.

Here, https://github.com/DavidJClark/phpvms_5.5.x/blob/master/core/templates/pirep_new.php#L10

You would need to change this to something like this


<dd>
    <select name="pilotid">
        <option value="">Select a Pilot</option>
      	<?php
		$allpilots = PilotData::getAllPilots();
		foreach($allpilots as $pilot) {
   			echo '<option value="'.$pilot->pilotid.'">'.PilotData::getPilotCode($pilot->code, $pilot->pilotid).' - '.$pilot->firstname.' '.$pilot->lastname.'</option>';
		}
		?>
    </select>
</dd>

You may also have to alter the FilePIREPForm() function a little.

This is answering the question, although I would recommend (if you have a lot of pilots) that you use a textbox and a JS AJAX request so that the list isn't really long and would require a lot of scrolling. Hope this helps in some way.

Edit: Looks like Yash got there first.

web541 thank you for your support too. I attempted using your version of the code, I ended with the same result as YASHs code. Any further support your willing to offer is much appreciated.

Link to comment
Share on other sites

  • Administrators
1 hour ago, Shadesb181 said:

Thank you to everyone else for your comments and ideas. The only reason for this request is in the event something happens with smartCARS we as good administrators can go in and file corrections for our pilots. I don't want them to use as a normal item to circumvent smartCARS.

Maybe the easiest way is to have a rule that ANY manual PIREPS will need to have a comment added as to why the pilot needed to use a manual PIREP instead of smartCARS (and if no comment or invalid reason, reject the PIREP). Even if a pilot files a manual PIREP, an admin must approve it - and can edit or refuse it before the hours are added to the pilots logs.If a pilot continuously tries to use the manual method over smartCARS, just start refusing all their manual PIREPS. I have had this rule in affect for over 5 years - and have only ever received maybe 5 manual PIREPS total in that time.... and ALWAYS with a reason as to why the pilot needed to submit a manual PIREP.

I also don't use "auto-accept" or "approve all" for the PIREPS. Our staff reviews each PIREP for accuracy, fuel burn, flight time, etc). Even an ACARS type PIREP can and does have errors (excessive fuel burns, excess flight time, etc.).

I am still wondering how a pilot is going to get the manual PIREP info to you if you don't have a PIREP form for them to submit the info......

  • Like 1
Link to comment
Share on other sites

7 hours ago, ProAvia said:

Maybe the easiest way is to have a rule that ANY manual PIREPS will need to have a comment added as to why the pilot needed to use a manual PIREP instead of smartCARS (and if no comment or invalid reason, reject the PIREP). Even if a pilot files a manual PIREP, an admin must approve it - and can edit or refuse it before the hours are added to the pilots logs.If a pilot continuously tries to use the manual method over smartCARS, just start refusing all their manual PIREPS. I have had this rule in affect for over 5 years - and have only ever received maybe 5 manual PIREPS total in that time.... and ALWAYS with a reason as to why the pilot needed to submit a manual PIREP.

I also don't use "auto-accept" or "approve all" for the PIREPS. Our staff reviews each PIREP for accuracy, fuel burn, flight time, etc). Even an ACARS type PIREP can and does have errors (excessive fuel burns, excess flight time, etc.).

I am still wondering how a pilot is going to get the manual PIREP info to you if you don't have a PIREP form for them to submit the info......

That's what we do now. Same set of rules actually. As for getting the info, pilots would just speak to an admin. They would still need to provide proof the flight actually happened. Like they do now. We dont accept manual PIREPs for anyone who completes a flight off-line.

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