Jump to content

simpilot

Administrators
  • Posts

    2773
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by simpilot

  1. Are you using the Util::AddTime function? I thought that was supposed to change it all to minutes. Looks like it is in tenths to me, or the addition function is off.
  2. @Mark Some of those events are already available in the system, ie - pilot accepted is dispatched on line 535 of the PIlotAdmin file on the admin side. The only catch to that is to catch the hook you must be listening on the admin side. CodonEvent::Dispatch('pilot_approved', 'PilotAdmin', $pilot); also in that file is; CodonEvent::Dispatch('pilot_rejected', 'PilotAdmin', $pilot); //line 565 There is no event for delete pilot yet, you could add something like CodonEvent::Dispatch('pilot_deleted', 'PilotAdmin', $pilot); in the delete pilot function, probably on line 79 would be best. A retired pilot event would require a little more work, looking quickly, you would have to add it into the saveprofile function, an if statement tied to the retired field would have to be intergrated. I'll have to look at it a little more.
  3. Place the new skin folder in the root/lib/skins/ folder, you will see the default crystal folder there. Then when you goto the general settings option in the admin panel you should have a dropdown that includes the new skin, choose it, hit save and you should be good to go.
  4. You can create your own admin module just as you can on the pilot side. Just place it in the admin/modules folder. To automatically add your link under the addons section of the admin menu put this in your new module file public function NavBar() { echo '<li><a href="'.SITE_URL.'/admin/index.php/mymodule">My Module</a></li>'; } As long as the base phpVMS application never comes up with an admin module with the same name, updates will not affect the custom module.
  5. echo '<td align=center>'; if($pirep->status == 0){echo 'Pending';} elseif($pirep->status == 1){echo 'Approved';} else {echo 'Rejected';} echo '</td>';
  6. if($pirep->status == 0){echo 'Pending';} elseif($pirep->status == 1){echo 'Approved';} else {echo 'Rejected';}
  7. It is on the admin side, PilotAdmin.php on line 535 is the dispather for the hook. CodonEvent::Dispatch('pilot_approved', 'PilotAdmin', $pilot); The catch here is that the hook is only available on the admin side, so you will need to build another module to reside in the admin tree to catch that hook, it can however share the data class.
  8. The easiest fix would be to just round the number using number format echo number_format($row->totalhours); Or an equation could be written to collapse the tenths to minutes and add an hour to the total etc....
  9. The navdata.sql table is still a work in progress, some of the data is outdated and/or incorrect. Some type of live database is being sought at this point, but there is not much available on the open source level.
  10. Check the cpanel logs and see what ip's have logged in to the panel. Most likely someone has the password and went into the database and manually assigned themselves as an admin to gain access to the va site. If it were someone with more info and knowledge than that there probably would not be anything left of the site at all. phpVMS also logs some info in the admin section, if it were news and such posted you should be able to see what id posted it. Mark speaks the truth as well, change everything as far as logins, even if you think it has not been compromised.
  11. It looks like the script is thinking you have not run a query because when it gets to if (!mysql_query($sql,$con)) there is no value assigned to $sql. Is the data showing up in the database? I think you need to change mysql_query("UPDATE mydatabase SET fullid_name = '$_POST[username]' WHERE s_client_name = '$_POST[pilotid]'"); to $ sql = "UPDATE mydatabase SET fullid_name = '$_POST[username]' WHERE s_client_name = '$_POST[pilotid]'";
  12. Something like $query = "SELECT pilotid, (totalhours + transferhours) AS totalhours FROM phpvms_pilots ORDER BY totalhours DESC LIMIT $howmany"; will work. You can leave the echo ($row->totalhours + $row->transferhours); on line 70 of tp_index as echo $row->totalhours; because the sql call will already be adding and sorting the hours for you.
  13. You can follow the structure you quoted above and just change the call to the database to collect only records from the year you want and the loop thorugh and average them. The native cache function probably should be used if the va has a substantial number of pireps, if not it will slow things down everytime someone views that page for the server to recalculate the stat. WHERE YEAR(submitdate) = '2010'
  14. I think your second theory may be closer to a solution than the first, as you are correct that once you start changing core files updates can become daunting. What about a seperate module with a hook to catch any activation, deactivation, or deletion. That way the module would not be affected by an update. If I am following correctly, for starters you want to register and activate the pilot in the forum when his application is approved. I used the registration_accepted hook to tell the SMF register module to register the pilot with the forum. Something like this may be the start class ForumRegister extends CodonModule { public function __construct() { CodonEvent::addListener('ForumRegister', array('registration_complete')); } public function EventListener($eventinfo) { if($eventinfo[0] == 'registration_complete') { $this->forum_register($eventinfo); } } public function forum_register($eventinfo) { ForumRegisterData::forum_register($eventinfo); } } then include your db functions in a data class function forum_register($eventinfo) { $sql = "sql call to insert pilot in forum table"; DB::query($sql); }
  15. That should work Mark, as long as the table is in the same database as your phpVMS install. If not wou will have to connect to the correct one and run a separate query, but could do it within that overall function.
  16. simpilot

    VAForum 2

    @Tom I have been messing with the permission system but the way it is built in to phpVMS right now has created somewhat of a limit. The concept of how it is built is outlined here -> http://www.litfuel.net/tutorials/bitwise.htm I have spent enough time on it to make me cross-eyed but have yet to be able to add custom, or additional permission sets beyond what is built into the system now without destroying what is there, which means rebuilding all the existing permission values. I have had to resort to connecting values I needed to existing ones in the system. ie - I tied the events module in the admin panel at my va to the edit_schedules permission. I think a custom permissions set built as a sql table may be the best answer, then use a data model to check the table for perms, similar to the groups table now existing in the database. Sorry for the long post....
  17. Are you logged in when you are accessing the schedules? If not, it will skip the requirement. It should be working if it is completely uncommented. Make sure the commenst before the start of the script are closed prior to the snip itself.
  18. It starts in the PilotAdmin.php controller in /admin/modules/PilotAdmin/ on lines 70 - 83 case 'deletepilot': $pilotid = $this->post->pilotid; $pilotinfo = PilotData::getPilotData($pilotid); PilotData::DeletePilot($pilotid); $this->set('message', Lang::gs('pilot.deleted')); $this->render('core_success.tpl'); LogData::addLog(Auth::$userinfo->pilotid, 'Deleted pilot '.PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid).' '.$pilotinfo->firstname .' ' .$pilotinfo->lastname); break; and the data model is in PilotData.class.php on lines 507 - 531 public static function deletePilot($pilotid) { $sql = array(); unset(self::$pilot_data[$pilotid]); $sql[] = 'DELETE FROM '.TABLE_PREFIX.'acarsdata WHERE pilotid='.$pilotid; $sql[] = 'DELETE FROM '.TABLE_PREFIX.'bids WHERE pilotid='.$pilotid; $sql[] = 'DELETE FROM '.TABLE_PREFIX.'pireps WHERE pilotid='.$pilotid; $sql[] = 'DELETE FROM '.TABLE_PREFIX.'pilots WHERE pilotid='.$pilotid; # These SHOULD delete on cascade, but incase they don't $sql[] = 'DELETE FROM '.TABLE_PREFIX.'fieldvalues WHERE pilotid='.$pilotid; $sql[] = 'DELETE FROM '.TABLE_PREFIX.'groupmembers WHERE pilotid='.$pilotid; $sql[] = 'DELETE FROM '.TABLE_PREFIX.'pirepcomments WHERE pilotid='.$pilotid; foreach($sql as $query) { $res = DB::query($query); } if(DB::errno() != 0) return false; return true; }
  19. You can use the native awards data function for indivdual pilots and add the count command -> echo count(AwardsData::GetPilotAwards($pilotid)); You will have to set the $pilotid to whatever variable you have available for the pilot id in the template you are working in. For example, in the pilot_public_profile.tpl it would need to be -> echo count(AwardsData::GetPilotAwards($userinfo->pilotid));
  20. I just tried it in a clean install and it seems to work for me. Make sure you have the entire code uncommented. It should look like the snip below. if(Auth::LoggedIn()) { $search = array( 'p.pilotid' => Auth::$userinfo->pilotid, 'p.accepted' => PIREP_ACCEPTED ); $reports = PIREPData::findPIREPS($search, 1); // return only one if(is_object($reports)) { # IF the arrival airport doesn't match the departure airport if($reports->arricao != $route->depicao) { continue; } } }
  21. simpilot

    Error

    That error usually means your sql server is bound up, try restarting it. It should clear itself then.
  22. simpilot

    Rank Order

    Looks like you have a custom module named "rank", the code that you are pulling the data from should be in there, or at least the call for it. If it using the native phpVMS function; RanksData::getAllRanks() you would find the line to change in the RanksData.class.php file on line 46; ORDER BY r.minhours ASC'; but this function should already be ordering from biggest to smallest using the ASC command, so my guess is that it is a custom function within the rank module or a custom data class and you should find something similar to what I have shown here except using the DESC command or no ORDER BY command at all.
  23. Your best bet would probably be to build a module around your code. The module will already be connected to the database, I am assuming you are using the same db as your phpvms install is, so you would not have to make the connection and such. Build a model class in the common folder to get the data you want, put it together in the module (controller), then use a template to just display the page you would like. You could also use the pages function and try a php include function, but that is not always a stable method.
  24. simpilot

    Rank Order

    You need to change the sql command that is loading the $ranks variable. It is probably ending in something like ORDER BY minhours ASC Change the ASC to DESC and it should reverse the order.
  25. simpilot

    Signatures

    You can add all the backgrounds you would like in the signatures/backgrounds/ folder and when the pilot goes to edit their profile there will be a dropdown with all the background file names to chose from.
×
×
  • Create New...