Jump to content

Aaron

Members
  • Posts

    184
  • Joined

  • Last visited

Everything posted by Aaron

  1. then can I just add an If statement to my roster and newest pilots page so it only shows pilots that have been accepted? Anybody have the code for that?
  2. I think u can "create another airline" for EK and upon registration put the airline field hidden and always set to UAE, and then when u make your routes just select the EK airline and then the flight number and your UAE pilots should still be able to file it. If you need help with the code let me know, I use the hidden airline field if u need I can paste it in and tell u where it goes, and another airline can simply be created in the admin panel somewhere.
  3. How do you change it so it doesn't assign the pid or show a pilot in the new pilots section until the registration is confirmed? I saw a post about it before but couldnt find it
  4. holly ****, I took out a ',' after flightlevel and it works. That's a real piss off considering I've been troubleshooting for months. Thanks for all the help guys
  5. Thank you, here's what it gave me. Is it posible that it doesn't like that my pilot id has 0's in front? You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE flightnum='001'' at line 7
  6. It's a military VA so the pilot id will always = the flightnum and this form will allow them to update the database for their own custom flight. There are no schedules for Canforce, it'll all be custom flights once the forms up.
  7. Narrowed down the issues, now everything works fine except for the updating of the database. I know this because I put some "echo $flightnum" and other things on that page and they showed up. So it gets the variables, but isn't updating the database. Here's the relevant code: public function save_booking($depicao, $arricao, $route, $aircraft, $flightlevel, $flightnum) { $query = "UPDATE phpvms_schedules SET depicao='$depicao', arricao='$arricao', route='$route', aircraft='$aircraft', flightlevel='$flightlevel', WHERE flightnum='$flightnum'"; DB::query($query); } }
  8. I fixed it added the code below: <?php if($customfields) { foreach($customfields as $field) { if($field->fieldname=='TRAINING_NOTES') { } else { .....
  9. Found this in the settingsdata, notice the section in comments, I tryed using that but it kept giving syntax error, I put a 0 on the end of the public and showinregister, so that when the numbers in there are equal to or greater than 0 I want it to show up in profile, the training notes I already put to -1 for both. Any ideas? public static function getField($fieldid) { $fieldid = intval($fieldid); return DB::get_row("SELECT * FROM '.TABLE_PREFIX.'customfields WHERE fieldid='.$fieldid'"); } /* Edit a custom field to be used in a profile $data= array('fieldid'=>, 'title'=>, 'value'=>, 'type'=>, 'public'=>, 'showinregistration'=>); */
  10. I've made the custom field, I want only admins to be able to see it but it still shows up in the edit user profile page in the pilot center, I dont want it to show up ther so what do I do, I think it's something in here I need to change: /core/common/SettingsData.class.php
  11. Couldn't find link on your profile, I fixed it myself. In /admin/templates/pilots_details.tpl replace the ranks section with this one: <tr> <td>Current Rank</td> <td> <?php if(Config::Get('RANKS_AUTOCALCULATE') == false) { $allranks = RanksData::GetAllRanks(); echo '<select name="rank">'; foreach($allranks as $rank) { if($pilotinfo->rank == $rank->rank) $sel = ' selected'; else $sel = ''; echo '<option value="'.$rank->rank.'" '.$sel.'>'.$rank->rank.'</option>'; // echo "<option value=\"{$rank->rankid}\" {$sel}>{$rank->rank}</option>"; } echo '</select>'; } else { echo $pilotinfo->rank; } ?></td> </tr>
  12. I added a training notes row in the database, looking for the code to display it now
  13. I believe TS Veiwer is the only way to do it. I get mine from instantteamspeak.com and they have a smaller one that I use on my homepage, but unless you get ts from them then as far as I know, tsviewer is it. Check out my teamspeak display her: http://www.canforce.org
  14. I managed to fix it on mine awhile back and forgot to post here how I did it. Go in the .tpl file with the form, and you need to add the following right before the submit button, at least I'm pretty sure thats what I did. <input type="hidden" name="pilotid" value="<?php echo $pilotinfo->pilotid;?>" /> <input type="hidden" name="action" value="saveprofile" /> <input type="submit" name="submit" value="Save Changes" />
  15. I fixed the module so it is displayed with no error, but it doesn't work I think it's most liekely because it cant find the pilot ID, I replaced the code relating to the pilot ID in the booking_form.tpl with the following: ... <form action="http://www.canforce.org/index.php/booking" method="post" enctype="multipart/form-data"> <?php $pilotid = Auth::$userinfo->pilotid; $flightnum = PilotData::parsePilotID($pilotid); ?> <input type="hidden" name="flightnum" value="<?php echo $flightnum ?>" /> <b>Departure Airport ICAO:</b> <input name="depicao" /><br /> ...
  16. Still need help, I think I'm getting closer, I need this working by February 4th because thats our first event. Also, not a huge problem, I have it set because admins have ID 00x and pilots have ID 1xx, does anybody know how to get the ID offset and make it so the pilot id is the right length, so instead of being CFC1 it will be CFC001, what I've got now should work but isn't great. Heres the files I made so far. Core/templates/booking_form.tpl <?php // //@author Aaron Schpitzer //@copyright Copyright (c) 2009-2012, Aaron Schpitzer //@license http://creativecommons.org/licenses/by-nc-sa/3.0/ ?> <p><span style="color: rgb(128,0,0)"><strong><span style="font-size: 36px">Book a Flight</span></strong></span></p> <form action="http://www.canforce.org/index.php/booking" method="post" enctype="multipart/form-data"> if(PilotGroups::group_has_perm(Auth::$usergroups, ACCESS_ADMIN)) { ?> <input type="hidden" name="flightnum" value="00<?php echo $pilotid?>" /> <?php } else { ?> <input type="hidden" name="flightnum" value="<?php echo $pilotid?>" />; <?php } <b>Departure Airport ICAO:</b> <input name="depicao" /><br /> <b>Arrival Airport ICAO:</b> <input name="arricao" /><br /> <b>Aircraft:</b> <select id="aircraft" name="aircraft"> <option selected="selected" value="12">CC-130 Hercules</option> <option value="13">CC-130J Hercules</option> <option value="17">CC-150 Polaris</option> <option value="4">CC-144 Challenger</option> <option value="7">CT-142 Dash-8</option> <option value="1">CP-140 Aurora</option> <option value="20">CC-138 Twin Otter</option> <option value="22">CU-170 Heron</option> <option value="10">CT-156 Harvard II</option> <option value="8">CC-177 Globemaster III</option> <option value="3">CC-115 Buffalo</option> <option value="2">CP-140A Arcturus</option> <option value="19">CT-114 Tutor</option> <option value="11">CT-155 Hawk</option> <option value="14">CF-18 Hornet</option> <option value="16">F-35 Lightning II</option> <option value="18">CH-124 Sea King</option> <option value="9">CH-146 Griffon</option> <option value="6">CH-149 Cormorant</option> <option value="15">CH-139 Jet Ranger</option> <option value="21">CH-148 Cyclone</option> <option value="5">CH-147D Chinook</option></select> <br /> <b>Route:</b> <input name="route" /><br /> <b>Altitude:</b> <input name="flightlevel" /><br /> <input type="hidden" name="action" value="save_booking" /> <input type="submit" value="Submit" /></form> core/common/BookingData.class.php <?php // //@author Aaron Schpitzer //@copyright Copyright (c) 2009-2012, Aaron Schpitzer //@license http://creativecommons.org/licenses/by-nc-sa/3.0/ class BookingData extends Codondata { public function current_booking($flightnum) { $query = "SELECT * FROM phpvms_schedules WHERE flightnum='$flightnum'"; return DB::get_results($query); } public function save_booking($depicao, $arricao, $route, $aircraft, $flightlevel, $flightnum) { $query = "UPDATE phpvms_schedules SET depicao='$depicao', arricao='$arricao', route='$route', aircraft='$aircraft', flightlevel='$flightlevel', WHERE flightnum='$flightnum'"; DB::query($query); } core/modules/booking/booking.php <?php // //@author Aaron Schpitzer //@copyright Copyright (c) 2009-2012, Aaron Schpitzer //@license http://creativecommons.org/licenses/by-nc-sa/3.0/ class Booking extends CodonModule { public function index() { $this->set('pilotcode', PilotData::GetPilotCode(Auth::$userinfo->code, Auth::$userinfo->pilotid)); ?> <?php $flightnum = $_POST[flightnum]; $schedule = array(); $schedule = BookingData::current_booking($flightnum); $this->set('schedule', $schedule); $this->show('booking_form.tpl'); } public function save_booking() { $schedule = array(); $schedule['flightnum'] = DB::escape($this->post->flightnum); $schedule['depicao'] = DB::escape($this->post->depicao); $schedule['arricao'] = DB::escape($this->post->arricao); $schedule['aircraft'] = DB::escape($this->post->aircraft); $schedule['route'] = DB::escape($this->post->route); $schedule['flightlevel'] = DB::escape($this->post->flightlevel); BookingData::save_booking($schedule['depicao'], $schedule['arricao'], $schedule['aircraft'], $schedule['route'], $schedule['flightlevel'], $schedule['flightnum'], $this->show('/booking_form.tpl') } public function thankyou() { ?> Your booking was successfully added to our system! <?php } } ?> IT'S NOT WORKING STILL, GIVES SYNTAX ERROR: Parse error: syntax error, unexpected '}' in /home/canforce/public_html/core/modules/Booking/Booking.php on line 39 ANYBODY KNOW WHERE THIS ERROR COME FROM AND PLZ LET ME KNOW IF U SEE OTHER ERRORS
  17. So now what Ive got is a booking.class.php in the common folder that has the function that updates the database, I put all the stuff that gets the pilots id and that sort of thing in the module booking.php and I made a .tpl that has the html form in it. Now how do I put them together to make them work?
  18. I think I might have possible solution, just an idea. It does display the correct/incorrect options once completed the exam, so if we just add a mailto, it would email the admins the results and the admins can deal with it from there. There's most likely a way to email the pilots their results too, but I think that's too complicated for me, I'll take a look though
  19. I'll file it on gihub then I guess, whatever it is. If anybody else has any ideas please let me know, my VA almost fully functional except for the rank thing and a little booking module that I'm making.
  20. I'm not sure what you mean Tom. I'm a bit of a noob, I'm ok at editing but suck at creating. I thought it was in a class, "class Booking extends CodonModule". Also, What are the .tpl files for? I understand regular php just fine, its just I dont get how the functions and classes and .tpl work together. Couldn't I just make a module with the functions, and then the index function can be the booking form, then when you click it, it activates another function that updates the database and displays a booking confirmed page. It's a quite simple little module I want to make. I just dont understand the different files I need to make, no admin stuff needed, just to submit the form.
×
×
  • Create New...