Moderators mark1million Posted January 31, 2012 Moderators Report Share Posted January 31, 2012 I have had a search about and cant find what im looking for. I want to extend the code a bit in the PIREPData.Class.php to also send a summary to the pilot upon sending in a pirep. This is the send to admin email notification of a new pirep # Send an email to the admin that a PIREP was submitted $sub = "A PIREP has been submitted by {$pilotcode} ({$pirepdata['depicao']} - {$pirepdata['arricao']})"; $message = "A PIREP has been submitted by {$pilotcode} " ."({$pilotinfo->firstname} {$pilotinfo->lastname})\n\n" ."{$pirepdata['code']}{$pirepdata['flightnum']}: {$pirepdata['depicao']} to {$pirepdata['arricao']}\n" ."Aircraft: {$pirepdata['aircraft']}\n" . "Flight Time: {$pirepdata['flighttime']}\n" ."Landing Rate: {$pirepdata['landingrate']}\n"."Filed using: {$pirepdata['source']}\n\n" ."Comment: {$comment}\n\n" ."Click to approve this pirep (admin must be signed in):\n" .adminurl('/pirepadmin/approvepirep/'.$pirepid); $email = Config::Get('EMAIL_NEW_PIREP'); if (empty($email)) { $email = ADMIN_EMAIL; } Util::SendEmail($email, $sub, $message); } Clearly i would not want to send that approve link to the pilot so i can remove that no problem, would it just be a simple case of adding $pilotinfo->email to that Util? Quote Link to comment Share on other sites More sharing options...
freshJet Posted January 31, 2012 Report Share Posted January 31, 2012 I think there's an option in the config. Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted January 31, 2012 Author Moderators Report Share Posted January 31, 2012 Ah ok i dont remember seeing it will go and have a look now. Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted January 31, 2012 Moderators Report Share Posted January 31, 2012 # Send an email to the pilot who submitted that PIREP $sub = "Your flight report - {$pirepdata['depicao']} - {$pirepdata['arricao']}"; $message = "You have filed a PIREP ({$pirepdata['code']}{$pirepdata['flightnum']})" ."({$pilotinfo->firstname} {$pilotinfo->lastname})\n\n" ."{$pirepdata['code']}{$pirepdata['flightnum']}: {$pirepdata['depicao']} to {$pirepdata['arricao']}\n" ."Aircraft: {$pirepdata['aircraft']}\n" . "Flight Time: {$pirepdata['flighttime']}\n" ."Landing Rate: {$pirepdata['landingrate']}\n"."Filed using: {$pirepdata['source']}\n\n" ."Comment: {$comment}\n\n"; $email = $pilotinfo->email; Util::SendEmail($email, $sub, $message); } Mark, this would be the code [NOT TESTED], give this a try and see what happens. Add after the line of code that you posted. first post. Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted January 31, 2012 Author Moderators Report Share Posted January 31, 2012 Thanks Kyle, just got to pick the wife up from work so will test out later (dont want to be late lol). Cheers. Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted January 31, 2012 Moderators Report Share Posted January 31, 2012 # Send an email to the pilot who submitted that PIREP $sub = "Your flight report - {$pirepdata['depicao']} - {$pirepdata['arricao']}"; $message = "You have filed a PIREP ({$pirepdata['code']}{$pirepdata['flightnum']})" ."({$pilotinfo->firstname} {$pilotinfo->lastname})\n\n" ."{$pirepdata['code']}{$pirepdata['flightnum']}: {$pirepdata['depicao']} to {$pirepdata['arricao']}\n" ."Aircraft: {$pirepdata['aircraft']}\n" . "Flight Time: {$pirepdata['flighttime']}\n" ."Landing Rate: {$pirepdata['landingrate']}\n"."Filed using: {$pirepdata['source']}\n\n" ."Comment: {$comment}\n\n"; $email = $pilotinfo->email; Util::SendEmail($email, $sub, $message); } Mark, this would be the code [NOT TESTED], give this a try and see what happens. Add after the line of code that you posted. first post. Thanks Kyle. Just what I was looking for, I'm gonna test it now. Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted January 31, 2012 Moderators Report Share Posted January 31, 2012 It's working just fine. But is it possible to give the info in every line in the email rather than in 1 line? Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted January 31, 2012 Author Moderators Report Share Posted January 31, 2012 Just got back in Just add more \n that will give new lines Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted January 31, 2012 Author Moderators Report Share Posted January 31, 2012 Sorry, This seems to work ."<br /><br />Has been successfully received to the server" Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted January 31, 2012 Moderators Report Share Posted January 31, 2012 Just got back in Just add more \n that will give new lines Nope! Still in one line in the email. Maybe I could use a textarea command? Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted January 31, 2012 Moderators Report Share Posted January 31, 2012 You can create a tpl file and we would have to change the code to make the info of pirep to be parsed. I'll write up a new code and attach a tpl file. Give me a few. Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted January 31, 2012 Moderators Report Share Posted January 31, 2012 You can create a tpl file and we would have to change the code to make the info of pirep to be parsed. I'll write up a new code and attach a tpl file. Give me a few. Thanks Kyle. I'll be waiting Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted January 31, 2012 Moderators Report Share Posted January 31, 2012 Okay, replace the code that you are using from me with this.. (NOT TESTED) //PILOT INFO $pilotfirstname = $pilotinfo->firstname; $pilotlastname= $pilotinfo->lastname; $email = $pilotinfo->email; //PIREP INFO (This all goes into the email, we will need to add those into the TPL) $code = $pirepdata['code']; $flightnum = $pirepdata['flightnum']; $depicao = $pirepdata['depicao']; $arricao = $pirepdata['arricao']; $aircraft = $pirepdata['aircraft']; $flighttime = $pirepdata['flighttime']; $landingrate = $pirepdata['landingrate']; $source = $pirepdata['source']; $comment = $comment; $sub = 'PIREP Report - '.$code.''.$flightnum; $message = Template::Get('email_pirep_info.tpl', true); Util::SendEmail($email, $sub, $message); AND Create a tpl file called email_pirep_info.tpl and place in your core/templates. The forums won't let me upload tpl files. And copy this code and paste into email_pirep_info.tpl... <p>Dear <?php echo $pilotfirstname .' '. $pilotlastname; ?>, </p> <p>Here is your submitted flight report enclosed for your review.</p> <p><b>Flight Number:</b><?php echo $code.''.$flightnum;?> </p> <p><b>Departure:</b><?php echo $depicao;?> </p> <p><b>Arrival:</b><?php echo $arricao;?> </p> <p><b>Aircraft:</b><?php echo $aircraft;?> </p> <p><b>Flight Time:</b><?php echo $flighttime;?> </p> <p><b>Landing Rate:</b><?php echo $landingrate;?> </p> <p><b>Filed By:</b><?php echo $source;?> </p> <p><b>Comments:</b><?php echo $comment;?> </p> And that should work for you. Please test it cause there's no one flying yet and to test it at my VA, lol. I know the code is not so great, but that's a start, lol. Cheers! Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted January 31, 2012 Moderators Report Share Posted January 31, 2012 Okay, replace the code that you are using from me with this.. (NOT TESTED) //PILOT INFO $pilotfirstname = $pilotinfo->firstname; $pilotlastname= $pilotinfo->lastname; $email = $pilotinfo->email; //PIREP INFO (This all goes into the email, we will need to add those into the TPL) $code = $pirepdata['code']; $flightnum = $pirepdata['flightnum']; $depicao = $pirepdata['depicao']; $arricao = $pirepdata['arricao']; $aircraft = $pirepdata['aircraft']; $flighttime = $pirepdata['flighttime']; $landingrate = $pirepdata['landingrate']; $source = $pirepdata['source']; $comment = $comment; $sub = 'PIREP Report - '.$code.''.$flightnum; $message = Template::Get('email_pirep_info.tpl', true); Util::SendEmail($email, $sub, $message); AND Create a tpl file called email_pirep_info.tpl and place in your core/templates. The forums won't let me upload tpl files. And copy this code and paste into email_pirep_info.tpl... <p>Dear <?php echo $pilotfirstname .' '. $pilotlastname; ?>, </p> <p>Here is your submitted flight report enclosed for your review.</p> <p><b>Flight Number:</b><?php echo $code.''.$flightnum;?> </p> <p><b>Departure:</b><?php echo $depicao;?> </p> <p><b>Arrival:</b><?php echo $arricao;?> </p> <p><b>Aircraft:</b><?php echo $aircraft;?> </p> <p><b>Flight Time:</b><?php echo $flighttime;?> </p> <p><b>Landing Rate:</b><?php echo $landingrate;?> </p> <p><b>Filed By:</b><?php echo $source;?> </p> <p><b>Comments:</b><?php echo $comment;?> </p> And that should work for you. Please test it cause there's no one flying yet and to test it at my VA, lol. I know the code is not so great, but that's a start, lol. Cheers! Thanks a lot man. You've done too much I'll give it shot. Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted January 31, 2012 Moderators Report Share Posted January 31, 2012 Okay! the email was sent but it's just showing the tags not the data. Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted January 31, 2012 Moderators Report Share Posted January 31, 2012 Sorry, I made a silly mistake. Try this and put in the php file. //PILOT INFO $pilotfirstname = $pilotinfo->firstname; $pilotlastname= $pilotinfo->lastname; $email = $pilotinfo->email; //PIREP INFO (This all goes into the email, we will need to add those into the TPL) $code = $pirepdata->code; $flightnum = $pirepdata->flightnum; $depicao = $pirepdata->depicao; $arricao = $pirepdata->arricao; $aircraft = $pirepdata->aircraft; $flighttime = $pirepdata->flighttime; $landingrate = $pirepdata->landingrate; $source = $pirepdata->source; $comment = $comment; $email = $pilotinfo->email; $sub = 'PIREP Report - '.$code.''.$flightnum; $message = Template::Get('email_pirep_info.tpl', true); Util::SendEmail($email, $sub, $message); Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted January 31, 2012 Moderators Report Share Posted January 31, 2012 Sorry, I made a silly mistake. Try this and put in the php file. //PILOT INFO $pilotfirstname = $pilotinfo->firstname; $pilotlastname= $pilotinfo->lastname; $email = $pilotinfo->email; //PIREP INFO (This all goes into the email, we will need to add those into the TPL) $code = $pirepdata->code; $flightnum = $pirepdata->flightnum; $depicao = $pirepdata->depicao; $arricao = $pirepdata->arricao; $aircraft = $pirepdata->aircraft; $flighttime = $pirepdata->flighttime; $landingrate = $pirepdata->landingrate; $source = $pirepdata->source; $comment = $comment; $email = $pilotinfo->email; $sub = 'PIREP Report - '.$code.''.$flightnum; $message = Template::Get('email_pirep_info.tpl', true); Util::SendEmail($email, $sub, $message); Okay! I think we're missing something here. The Template::set(...) ?! Quote Link to comment Share on other sites More sharing options...
Strider Posted January 31, 2012 Report Share Posted January 31, 2012 It is working somewhat for me, the email sends, but nothing is shoing up, just the text that was hard coded in. Nothing from the pirep. Where exactly should I place this code? I have the files in the correct place. Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted January 31, 2012 Moderators Report Share Posted January 31, 2012 # Send an email to the pilot who submitted that PIREP //PILOT INFO $pilotfirstname = $pilotinfo->firstname; $pilotlastname= $pilotinfo->lastname; $email = $pilotinfo->email; //PIREP INFO (This all goes into the email, we will need to add those into the TPL) $code = $pirepdata['code']; $flightnum = $pirepdata['flightnum']; $depicao = $pirepdata['depicao']; $arricao = $pirepdata['arricao']; $aircraft = $pirepdata['aircraft']; $flighttime = $pirepdata['flighttime']; $landingrate = $pirepdata['landingrate']; $source = $pirepdata['source']; $comment = $comment; Template::Set('pilotfirstname', $pilotfirstname); Template::Set('pilotlastname', $pilotlastname); Template::Set('code', $code); Template::Set('flightnum', $flightnum); Template::Set('depicao', $depicao); Template::Set('arricao', $arricao); Template::Set('aircraft', $aircraft); Template::Set('flighttime', $flighttime); Template::Set('landingrate', $landingrate); Template::Set('source', $source); Template::Set('comment', $comment); $sub = 'PIREP Report - '.$code.''.$flightnum; $message = Template::Get('email_pirep_info.tpl', true); Util::SendEmail($email, $sub, $message); Okay. Change the code in PIREPData.class.php to the one above. It's tested and working. Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted January 31, 2012 Report Share Posted January 31, 2012 You need to set the data into the template and then get the template. Then use the data inside of the template. SET DATA Template::Set('pilotinfo', $pilotinfo)); Template::Set('flight', $pirepdata); GET TEMPLATE $message = Template::Get('email_pirep_info.tpl', true); USE DATA (inside of template) Hello <?php echo $pilotinfo->firstname.' '.$pilot->lastname?>, </br> Your PIREP for Flight#<?php echo $flight['code'].$flight['flightnum']?>....... SEND EMAIL Util::SendEmail($email, $sub, $message); NOT TESTED but should work. Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted January 31, 2012 Moderators Report Share Posted January 31, 2012 You need to set the data into the template and then get the template. Then use the data inside of the template. SET DATA Template::Set('pilotinfo', $pilotinfo)); Template::Set('flight', $pirepdata); GET TEMPLATE $message = Template::Get('email_pirep_info.tpl', true); USE DATA (inside of template) Hello <?php echo $pilotinfo->firstname.' '.$pilot->lastname?>, </br> Your PIREP for Flight#<?php echo $flight['code'].$flight['flightnum']?>....... SEND EMAIL Util::SendEmail($email, $sub, $message); NOT TESTED but should work. Yes it;s working. But how can I get it to show aircraft name instead of aircraft ID? Quote Link to comment Share on other sites More sharing options...
Jeff Posted February 1, 2012 Report Share Posted February 1, 2012 Here is what I got when a flight was submitted. Flight Number:DL133Departure:KATL Arrival:KMIA Aircraft:63 Flight Time:1.30 Landing Rate:0 Filed By:manual Comments:This is a test flight submission. I would also like to know how to show the aircraft name, and also how to show the Flight Log. Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted February 1, 2012 Moderators Report Share Posted February 1, 2012 Here is what I got when a flight was submitted. I would also like to know how to show the aircraft name, and also how to show the Flight Log. Yes exactly the same here. Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted February 1, 2012 Moderators Report Share Posted February 1, 2012 Okay! Here is what I designed for the .tpl. BTW I'm using FSPAX as my PIREP, so if you guys ever wanted to switch to FSPAX pirep system, let me know and I can give you the required files. We also have the FSPAX pilot pointing system at our airline which I can share as well. Quote Link to comment Share on other sites More sharing options...
Strider Posted February 1, 2012 Report Share Posted February 1, 2012 I got it working now. Thanks. Quote Link to comment Share on other sites More sharing options...
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.