Jakes
-
Posts
72 -
Joined
-
Last visited
Content Type
Profiles
Forums
phpVMS Resources
Downloads
Posts posted by Jakes
-
-
found it
it is in ops_aircraftbuysell.tpl starting line 14
// Condition for new Plane
$newrd= rand(95, 100);
// Price Calculation for new Plane
$acprice1="$aircraft->weight"*"$aircraft->maxpax"*("$aircraft->cruise"/100)*("$aircraft->range"*0.7 /"$aircraft->cruise");
Hi thomas, this is not the calculation for the condition as in the 'cond' value, but it is the conditions used when calculating the prize of a new plane. You will see there is also a condition for used planes etc.
-
Thanks Jeffrey, for your help! I have tested it, with no luck though, and that gave me second thoughts on the event it is based on, named Pirep_filed. Why I am saying this is, when will the condition be updated? when the pilot press the file pirep button, or when it is approved? Secondly, IF it is updated when the pirep is filed, then, with approval, I guess the condition is updated again? so basically two scripts updating the same condition. So I am back to square 1... Where is the initial code that update the condition....
-
I have tried a different approach:
I figured if you can have a command like this:
if (DB::errno() != 0) return false; CodonCache::delete('all_aircraft');
you could maybe use it the other way around? Like
OperationsData::update('cond');
So here is what I have UNTESTED I have set the condition to write to a value of 50 just for testing purposes. I also decided to go with Aircraft Reg rather than ID. Is that wise?
<?php /** * phpVMS - Virtual Airline Administration Software * Copyright (c) 2008 Nabeel Shahzad * For more information, visit www.phpvms.net * Forums: http://www.phpvms.net/forum * Documentation: http://www.phpvms.net/docs * * phpVMS is licenced under the following license: * Creative Commons Attribution Non-commercial Share Alike (by-nc-sa) * View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/ * */ class Aircraft_Condition extends CodonModule { public function __index() { CodonEvent::addListener('Aircraft_Condition'); } public function EventListener($eventinfo) { if($eventinfo[0] == 'pirep_filed') { $pirepinfo = $eventinfo[2]; } } public static function editAircraft($data) { //Retrieve the aircraft info based on the aircraft id stored in the pirep row $data['registration'] = OperationsData::getAircraftByReg($pirepinfo->registration) if ($pirepinfo->landingrate > -1 && $pirepinfo->landingrate <-2000) { $data('cond') = 50; } $res = DB::query($sql); OperationsData::update('cond'); if (DB::errno() != 0) return false; CodonCache::delete('all_aircraft'); CodonCache::delete('all_aircraft_enabled'); CodonCache::delete('all_aircraft_search'); CodonCache::delete('all_aircraft_search_enabled'); return true; } }}
-
Just going over everything, and wanted to make sure, is this statement correct (I know the figures are insane, but just for testing purposes)
//Figure out the $cond that needs to be placed into the if($pirepinfo->landingrate > -1 && $pirepinfo->landingrate <-2000) $cond = $aircraft->cond -20;
Shouldn't it be:
//Figure out the $cond that needs to be placed into the if($pirepinfo->landingrate > -1)&& ($pirepinfo->landingrate <-2000) $cond = $aircraft->cond -20;
-
Ok, I have this so far, without any error, but it does not overwrite the condition. what did i miss? Is there more to do than just add the module?
<?php /** * phpVMS - Virtual Airline Administration Software * Copyright (c) 2008 Nabeel Shahzad * For more information, visit www.phpvms.net * Forums: http://www.phpvms.net/forum * Documentation: http://www.phpvms.net/docs * * phpVMS is licenced under the following license: * Creative Commons Attribution Non-commercial Share Alike (by-nc-sa) * View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/ * */ class Aircraft_Condition extends CodonModule { public function __index() { CodonEvent::addListener('Aircraft_Condition'); } public function EventListener($eventinfo) { if($eventinfo[0] == 'pirep_filed') $pirepinfo = $eventinfo[2]; //Retrieve the aircraft info based on the aircraft id stored in the pirep row $aircraft = OperationsData::getAircraftByReg($pirepinfo->registration); //Figure out the $cond that needs to be placed into the if($pirepinfo->landingrate > -100 && $pirepinfo->landingrate <-500) $cond = $aircraft->cond -20; //update the 'cond' column using the aircraft id for row identification $update = OperationsData::editAircraft(array('id'=>$pirepinfo->aircraftid, 'cond'=>$cond)); } }
-
Hi Thomas,
Thanks for the response. I found the culprit. the if($eventinfo[0] == 'pirep_filed') was without the last bracket
ok, so no more error, but I have run a test or two, and it does not update the 'cond' value. Maybe I must have the codon module to listen for event before pirep is filed?
here is the code as it is now:
<?php /** * phpVMS - Virtual Airline Administration Software * Copyright (c) 2008 Nabeel Shahzad * For more information, visit www.phpvms.net * Forums: http://www.phpvms.net/forum * Documentation: http://www.phpvms.net/docs * * phpVMS is licenced under the following license: * Creative Commons Attribution Non-commercial Share Alike (by-nc-sa) * View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/ * */ class Aircraft_Condition extends CodonModule { public function __index() { CodonEvent::addListener('Aircraft_Condition'); } public function EventListener($eventinfo) { if($eventinfo[0] == 'pirep_filed') //Retrieve the aircraft info based on the aircraft id stored in the pirep row $aircraft = OperationsData::getAircraftInfo($pirepinfo->aircraftid); //Figure out the $cond that needs to be placed into the if($pirepinfo->landingrate > -200 && $pirepinfo->landingrate <-500) $cond = $aircraft->cond -20; //update the 'cond' column using the aircraft id for row identification $update = OperationsData::editAircraft(array('id'=>$pirepinfo->aircraftid, 'cond'=>$cond)); } }
As soon as the basic condition work, i will add more conditions based on landing rates
-
I guess it is on the right track, but I get the following error:
Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION in /home/jdsarcco/public_html/uvsaaf/core/modules/Aircraft_Condition/Aircraft_Condition.php on line 21
-
Ok I guess it is better to add it's own independent listner.
I am following these documentation and trying to compile an independend module:
This is what I have:
class Aircraft_Condition extends CodonModule { CodonEvent::addListener('Aircraft_Condition'); } public function EventListener($eventinfo) { if($eventinfo[0] == 'pirep_filed' { $pirepinfo = $eventinfo[1]; if($pirepinfo->landingrate > -200 && $pirepinfo->landingrate <-500); return DB::get_row('SELECT cond FROM ' . TABLE_PREFIX . 'aircraft WHERE `id`=' . $AircraftID); $cond = $cond -20 } }
Not working though. I wish I knew more about coding
-
you could try adding a custom pirep field for landing rate
maybe it is possible to hand over that value to the datafield in DB
where do you but this function?
At the moment I am trying to add it to the core/modules/KACARS_Free/kACARS_Free.php module. Is there a better place to add it to?
-
Thanks for the response, gents,
first,
I would be better to add the code to the pirep acceptance code. That way all pireps no matter where they come from would run through the script.Well, manual pireps does not have a landing rate (although I am sure it could file a default of foe example -150) But even if the code is added there, I guess it is basically the same?
I can`t help with the coding but just wanted to say that -7% condition for a almost perfect landing seems a little bit much to me? also -500ft/m isn`t that much to reduce the aircraft condition by -50%!?...so i if you are looking for realistic settings i would reduce this values.The values I have entered is not exact, it must be played around to get the set that works the best. Tanks for the input!
Ok, so now I have this:
public function updateCondition() $Landing = $xml->$xml->pirep->landing, $AircraftID =>$xml->liveupdate->registration, { return DB::get_row('SELECT cond FROM ' . TABLE_PREFIX . 'aircraft WHERE `id`=' . $AircraftID); } } if( $landing > -200 && $landing < -300 ){ $cond = $cond -7 } else if ( $landing > -300 && $landing < -400 ){ $cond = $cond -15 } else if ( $landing > -400 && $landing < -500 ){ $cond = $cond -30 } else if ( $landing > -500 ){ $cond = $cond -50 }
The idea is to get the landing rate from the pirep instead of the DB, as it could not be filed yet
-
Hi there,
I have installed the Step 1 Aircraft buying Mod Version 0.91, and in the database, Under Aircraft, it added a table named 'cond' for aircraft condition.
Is there a way that when filing a pirep with kACARS, it reads the current condition of the aircraft, and based on the landing rate, it write a new condition to the table?
The idea is with a landing with a rate between -200 and -300 to subtract 7% from the condition. From -300 to -400 to subtract 15% from the condition and -400 to -500 subtract 30%. any landing harder than -500 subtract 50%.
I was thinking of the core/modules/KACARS_Free/kACARS_Free.php module, maybe it can be write into that?
my own UNSUCCESFULL and incomplete attempt so far:
//START ADD CONDITION TO LANDING RATE $selsql = "SELECT cond FROM MySQLaircraft where aircraftID=$ac"; $result = mysql_query($selsql); $no_record = mysql_num_rows($result); if($no_record > 0) while($row = mysql_fetch_array($result)) { echo '<tr><td>'.$row['cond'].'</td></tr>'; } if( $landing > -200 && $landing < -300 ) { $cond = $cond -7% } else if ( $landing > -300 && $landing < -400 ) { $cond = $cond -15% } else if ( $landing > -400 && $landing < -500 ) { $cond = $cond -30% } else if ( $landing > -500 ) { $cond = $cond -50% } // END ADD CONDITION TO LANDING RATE
Any help perhaps?
-
wear factor is not yet implemented!
Yes, but somewhere there is a code that calculate the aircraft useage. With this installation there is a table added named "cond" for aircraft condition. And after installation, and all the aircraft are brought, the conditions are not all 100%. Some of my aircraft are 95% even. So where is that condition calculated?
-
Hi Jacques,
I am trying to figure out how the condition is calculated in the first place, but cannot find the file containing that info. will see what I can do
Cheers,
Jakes
-
Hi there,
Thanks for a great modification!
What are the conditions used to calculate the aircraft condition? and in what file is it coded?
Best regards
Jakes
-
Released
DOes anyone have a link to this mod?
-
Hi there,
Is there a way to make a page with a flowchart I can use for indicating Line of command?
Best regards,
-
Hi there,
in the local_config.php there is the option to automatically set users inactive if not active. Mine is set for true -60 days. However, it does not set any pilot inactive at all.
My code as it is now:
# After how long to mark a pilot inactive, in days Config::Set('PILOT_AUTO_RETIRE', true); Config::Set('PILOT_INACTIVE_TIME', 60);
If someone can maybe direct me to the solution for this, i will appreciate it!
Best Regards,
-
Solved
the problem was in the navigation.tpl file in my ObsessBlueskin.
To fix it:
Find:
if(Auth::UserInGroup('Administrators'))
replace with:
if(PilotGroups::group_has_perm(Auth::$usergroups, ACCESS_ADMIN))
-
Hi there,
I have created a new group named Commanding Officers, and I gave the following access:
-
ACCESS_ADMIN
-
MODERATE_PIREP
The idea is to have the group have acces to approve pireps, but nothing else. I also have a test account added to the group, but the admin page is not showing up at all. Do I miss some settings perhaps?
Have a look at
http://www.uvsaaf.fsworld.co.za/index.php
Best regards,
Jakes
-
-
-
It's horribly messy, but for now this should work:
<table cellspacing="0" cellpadding="2" border="0" width="100%"><thead><th>Topic</th><th>Updated</th><th>Posted by</th></thead><tbody> <?php $topics = ForumData::get_new_topics(5); $row = 1; foreach($topics as $topic){ $forum = ForumData::get_forum_name($topic->topic_forumid); $forumcat = ForumData::get_cat_name($forum->forum_cat); if($forumcat->cat_ispublic == 0){ echo ' '; } elseif($forumcat->cat_ispublic != 0){ echo '<tr class="row'.$row.'">'; echo '<td><a href="'.url('Forum/get_topic_posts?id='.$topic->id).'&forum_id='.$topic->topic_forumid.'">'.$topic->topic_title.'</a></td>'; echo '<td>'.date('d/m/Y - g:i a', strtotime($topic->topic_dateupdated)).'</td>'; $updatedby=PilotData::GetPilotData($topic->topic_updatedby); echo '<td>'.PilotData::GetPilotCode($updatedby->code, $topic->topic_updatedby).'</td>'; echo '</tr>'; $row = 1 - $row; }else{ echo '<tr><td colspan="3">No topics!</td></tr>'; } } ?> </tbody></table>
(Cut straight from the code on my own website so if the code is really bad feel free to tidy it up )
Hi there,
I have spend an hour searching for the file to edit to add this snippet on to my web page. If it is not too much of an effort, can you please indicate which file to edit?
-
Got it, installed, and working great, Thank you! Only thing I try to figuer out is how to notify of new posts, in any form
-
Hi there, I want to download and install this mod, but the attachment are unavailable. Can someone maybe help me out?
-
Ok, I have added the code you provided to /core/common/TouchdownStatsData.class.php, and then, I get the following error:
Warning: Invalid argument supplied for foreach() in /home/jdsarcco/public_html/uvsaaf/core/templates/touchdownstats/touchdownstats_index.tpl on line 21What do I miss?
When I enter a statistic value for example 10, it work perfect, but with an airline code, I also get this error.
Link to first 10 stats: http://uvsaaf.fsworld.co.za/index.php/TouchdownStats/top_landings/10'>http://uvsaaf.fsworld.co.za/index.php/TouchdownStats/top_landings/10
Link to error: http://uvsaaf.fsworld.co.za/index.php/TouchdownStats/top_landings/
I guess this should work when placing the airline code instead? here are some of the airlines (Squadrons) we operate:
CEF Central Flying School Langebaaan
CFS 85 Combat Flying School
FFS 44 Squadron
FTS 15 Squadron
HFS 87 Helicopter Flying School
Thank you,
Jakes
Landing rates and condition
in kACARS
Posted
Ok, my question now is this:
in the code below the Aircraft registration is retrieved from the pirep, but the database must write to the ID. now how is the ID coupled to the registration here? Even if you have the pirep read by ID as well, how does the Pirep ID which is
connect to the ID in suppose to write to the DB here:
the entire code: