Administrators ProAvia Posted July 5, 2017 Administrators Report Share Posted July 5, 2017 I'm having an issue with the minutes box. The hours displays correctly, but the minutes box displays the number 01, regardless of the actual minute time. Both dropdown boxes display the range as listed below. <?php $r = range(1, 24); $selected = is_null($selected) ? date('H') : $selected; $select = "<select name=deph id=dephour>\n"; foreach ($r as $hour) { if(strlen($hour) <2) { $hour = str_pad($hour, 2, "0", STR_PAD_LEFT); } $select .= "<option value=\"$hour\""; $select .= ($hour==$selected) ? ' selected="selected"' : ''; $select .= ">$hour</option>\n"; } $select .= '</select>'; echo $select; echo":"; $rminutes = range(1, 60); $selected = is_null($selected) ? date('i') : $selected; $selectminutes = "<select name=depm id=dephour>\n"; foreach ($rminutes as $minutes) { if(strlen($minutes) <2) { $minutes = str_pad($minutes, 2, "0", STR_PAD_LEFT); } $selectminutes .= "<option value=\"$minutes\""; $selectminutes .= ($hour==$selected) ? ' selected="selected"' : ''; $selectminutes .= ">$minutes</option>\n"; } $selectminutes .= '</select>'; echo $selectminutes; ?> While not 100% sure, I don't think the current minute is being pulled. I did do some research and this line looks correct. $selected = is_null($selected) ? date('i') : $selected; Yes, I know the ranges should be hours (0, 23) and minutes (0, 59). But am using the default code to try to remedy my issue. Any help is greatly appreciated. TIA! Quote Link to comment Share on other sites More sharing options...
Administrators ProAvia Posted September 5, 2017 Administrators Report Share Posted September 5, 2017 The saga continues...... With the following code, the hours still display correctly, but the minutes box also now displays the hour. <td> <?php date_default_timezone_set('UTC'); $r = range(0, 23); // range of hours $selected = is_null($selected) ? date('H') : $selected; //current hour $select = "<select name=deph id=dephour>\n"; foreach ($r as $hour) { if(strlen($hour) <2) { $hour = str_pad($hour, 2, "0", STR_PAD_LEFT); } $select .= "<option value=\"$hour\""; $select .= ($hour==$selected) ? ' selected="selected"' : ''; $select .= ">$hour</option>\n"; } $select .= '</select>'; echo $select; echo " "; $rminutes = range(0, 59); //range of minutes $selected = is_null($selected) ? date('i') : $selected; //current minute $selectminutes = "<select name=depm id=depmin>\n"; foreach ($rminutes as $minutes) { if(strlen($minutes) <2) { $minutes = str_pad($minutes, 2, "0", STR_PAD_LEFT); } $selectminutes .= "<option value=\"$minutes\""; $selectminutes .= ($minutes==$selected) ? ' selected="selected"' : ''; $selectminutes .= ">$minutes</option>\n"; } $selectminutes .= '</select>'; echo $selectminutes; ?> </td> If I move the entire minutes section to above the hour section, minutes displays in the first box and in the second box. Seems - in either case (hour section first or minutes section first) - that the later section will only display what's in the first section. The time send to simBrief is as listed in the hour and minutes boxes. Anyone have any ideas? The generation of the simBrief package works great, it's just this time issue. Also, once it's working correctly, I'd like to increment the returned minutes time by 30 (add 30 minutes). Quote Link to comment Share on other sites More sharing options...
Moderators shakamonkey88 Posted September 10, 2017 Moderators Report Share Posted September 10, 2017 On 05/09/2017 at 5:13 AM, ProAvia said: The saga continues...... With the following code, the hours still display correctly, but the minutes box also now displays the hour. <td> <?php date_default_timezone_set('UTC'); $r = range(0, 23); // range of hours $selected = is_null($selected) ? date('H') : $selected; //current hour $select = "<select name=deph id=dephour>\n"; foreach ($r as $hour) { if(strlen($hour) <2) { $hour = str_pad($hour, 2, "0", STR_PAD_LEFT); } $select .= "<option value=\"$hour\""; $select .= ($hour==$selected) ? ' selected="selected"' : ''; $select .= ">$hour</option>\n"; } $select .= '</select>'; echo $select; echo " "; $rminutes = range(0, 59); //range of minutes $selected = is_null($selected) ? date('i') : $selected; //current minute $selectminutes = "<select name=depm id=depmin>\n"; foreach ($rminutes as $minutes) { if(strlen($minutes) <2) { $minutes = str_pad($minutes, 2, "0", STR_PAD_LEFT); } $selectminutes .= "<option value=\"$minutes\""; $selectminutes .= ($minutes==$selected) ? ' selected="selected"' : ''; $selectminutes .= ">$minutes</option>\n"; } $selectminutes .= '</select>'; echo $selectminutes; ?> </td> If I move the entire minutes section to above the hour section, minutes displays in the first box and in the second box. Seems - in either case (hour section first or minutes section first) - that the later section will only display what's in the first section. The time send to simBrief is as listed in the hour and minutes boxes. Anyone have any ideas? The generation of the simBrief package works great, it's just this time issue. Also, once it's working correctly, I'd like to increment the returned minutes time by 30 (add 30 minutes). Hey, I looked at your site and can see that you now have this working correctly. How did you do it? Regards, Quote Link to comment Share on other sites More sharing options...
Administrators ProAvia Posted September 10, 2017 Administrators Report Share Posted September 10, 2017 (edited) I was waiting a few days to test it out before posting back here. Change $selected = is_null($selected) ? date('H') : $selected; //current hour to $selected = date('H'); //current hour and change $selected = is_null($selected) ? date('i') : $selected; //current minute to $selected = date('i'); //current minute I also moved the echo statements to the end of the code area. Here's the entire section of the schedule_briefing.php file..... <td> <?php date_default_timezone_set('UTC'); {$r = range(0, 23); // range of hours $selected = date('H'); //current hour //$selected = is_null($selected) ? date('H') : $selected; //current hour $select = "<select name=deph id=dephour>\n"; foreach ($r as $hour) { if(strlen($hour) <2) { $hour = str_pad($hour, 2, "0", STR_PAD_LEFT); } $select .= "<option value=\"$hour\""; $select .= ($hour==$selected) ? ' selected="selected"' : ''; $select .= ">$hour</option>\n"; } $select .= '</select>';} {$rminutes = range(0, 59); //range of minutes $selected = date('i'); //current minute //$selected = is_null($selected) ? date('i') : $selected; //current minute $selectminutes = "<select name=depm id=depmin>\n"; foreach ($rminutes as $minutes) { if(strlen($minutes) <2) { $minutes = str_pad($minutes, 2, "0", STR_PAD_LEFT); } $selectminutes .= "<option value=\"$minutes\""; $selectminutes .= ($minutes==$selected) ? ' selected="selected"' : ''; $selectminutes .= ">$minutes</option>\n"; } $selectminutes .= '</select>';} echo $select; echo " "; echo $selectminutes; ?> </td> I don't know why it works or if it will cause other issues down the line. The time is now correct and the simBrief OFP uses this time in its report. Hoping someone can explain what the sections I deleted/changed are supposed to do. Edited September 12, 2017 by ProAvia Quote Link to comment Share on other sites More sharing options...
CarlosEduardo2409 Posted September 20, 2017 Report Share Posted September 20, 2017 My "Generate OFP" not work Quote Link to comment Share on other sites More sharing options...
CarlosEduardo2409 Posted September 21, 2017 Report Share Posted September 21, 2017 (edited) @ahughes3 @Vangelis @web541 What do I have to download from Vangelis' SimBrief? Can you do a small text tutorial? Because it has modules, templates, js, schedule_brienfing, and I do not know if it has to put everything ... I also do not know what to edit and also the template is in .tpl mine is .php And what do you have to add i the layout.php file? I saw that vangelis had spoken on the front page Edited September 21, 2017 by CarlosEduardo2409 Quote Link to comment Share on other sites More sharing options...
web541 Posted September 21, 2017 Report Share Posted September 21, 2017 You will need to first email Simbrief to get your API Key, but the rest is pretty straight forward. Yes, you will need the Simbrief module for this to work. Refer to these clear instructions to get it working https://github.com/vangelisb/Simbrief/tree/master/phpvms Quote Link to comment Share on other sites More sharing options...
CarlosEduardo2409 Posted September 21, 2017 Report Share Posted September 21, 2017 (edited) 52 minutes ago, web541 said: Você precisará primeiro enviar um e-mail para o Simbrief para obter sua chave da API, mas o resto é bastante simples. Sim, você precisará do módulo Simbrief para que isso funcione. Consulte estas instruções claras para fazê-lo funcionar https://github.com/vangelisb/Simbrief/tree/master/phpvms I followed the steps all right but this one giving error. But I still do not have the API I've requested, is that why this is giving this error? And where is this layout.tpl and core_htmlhead.tpl? Mine is .php I'm using your crew center skin. @web541 Error: http://prntscr.com/go3o9d / http://prntscr.com/go3of3 I'm sorry if I wrote wrong, because I'm Brazilian. I'm using google translator Edited September 21, 2017 by CarlosEduardo2409 Quote Link to comment Share on other sites More sharing options...
Members Vangelis Posted September 22, 2017 Members Report Share Posted September 22, 2017 did you read the https://github.com/vangelisb/Simbrief/blob/master/phpvms/ReadMe.txt ? it has clearly instructions how to do it, if you still dont understand then you will have to find someone with basic file upload and editing knowledge Quote Link to comment Share on other sites More sharing options...
CarlosEduardo2409 Posted September 24, 2017 Report Share Posted September 24, 2017 On 22/09/2017 at 3:51 AM, Vangelis said: did you read the https://github.com/vangelisb/Simbrief/blob/master/phpvms/ReadMe.txt ? it has clearly instructions how to do it, if you still dont understand then you will have to find someone with basic file upload and editing knowledge I read, I did everything as written, but it is still not working and when I click on generate the flight plan nothing happened, but I already have the api and put it in the right place, also uninstalled and installed everything again several leaks. One of the main mistakes is this (Warning: simplexml_load_file(): http://www.simbrief.com/ofp/flightplans/xml/:1: parser error : Document is empty in /storage/ssd2/921/2877921/public_html/core/modules/SimBrief/SimBrief.php on line 12) and the button that does not work. Pls help-me @Vangelis Quote Link to comment Share on other sites More sharing options...
Members Vangelis Posted September 25, 2017 Members Report Share Posted September 25, 2017 I dont think you followed all the instructions but in order to help you you need to tell us your website link Quote Link to comment Share on other sites More sharing options...
CarlosEduardo2409 Posted September 25, 2017 Report Share Posted September 25, 2017 (edited) . Edited September 25, 2017 by CarlosEduardo2409 Quote Link to comment Share on other sites More sharing options...
CarlosEduardo2409 Posted September 25, 2017 Report Share Posted September 25, 2017 (edited) Ops, I do not know what happened but when I went to the demo user try again it worked out, but thanks for your help @Vangelis and @web541 Edited September 25, 2017 by CarlosEduardo2409 Quote Link to comment Share on other sites More sharing options...
Michael2015 Posted November 8, 2017 Report Share Posted November 8, 2017 After clicking on the generate button nothing happens Quote Link to comment Share on other sites More sharing options...
Administrators ProAvia Posted November 8, 2017 Administrators Report Share Posted November 8, 2017 Did you install the following module first? Did you get an API key from simBrief and enter it in the correct place? Quote Link to comment Share on other sites More sharing options...
Michael2015 Posted November 8, 2017 Report Share Posted November 8, 2017 mmm no i dont have an API and the module do you mean the OFP brief or a module as well Quote Link to comment Share on other sites More sharing options...
Michael2015 Posted November 8, 2017 Report Share Posted November 8, 2017 8 minutes ago, ProAvia said: Did you install the following module first? Did you get an API key from simBrief and enter it in the correct place? i have the tailored OFP and also i have emailed for a API key where do i place the API key Quote Link to comment Share on other sites More sharing options...
Administrators ProAvia Posted November 8, 2017 Administrators Report Share Posted November 8, 2017 This module: https://github.com/vangelisb/Simbrief/tree/master/phpvms And you will also need to contact simBrief for an API key in order to implement this. Quote Link to comment Share on other sites More sharing options...
Administrators ProAvia Posted November 8, 2017 Administrators Report Share Posted November 8, 2017 2 minutes ago, Michael2015 said: i have the tailored OFP and also i have emailed for a API key where do i place the API key You will need to install the module I linked to above. The instructions state where to enter the API key. Quote Link to comment Share on other sites More sharing options...
Michael2015 Posted November 8, 2017 Report Share Posted November 8, 2017 right well the link for the download didint work Quote Link to comment Share on other sites More sharing options...
Administrators ProAvia Posted November 8, 2017 Administrators Report Share Posted November 8, 2017 The link in my post - just a few posts above this one - works fine. It takes you to Github, where you can download the module. If you're using phpVMS 5.5.2, you may have to adapt the module from .tpl to .php .... but that's pretty easy. Quote Link to comment Share on other sites More sharing options...
Michael2015 Posted November 8, 2017 Report Share Posted November 8, 2017 21 minutes ago, ProAvia said: The link in my post - just a few posts above this one - works fine. It takes you to Github, where you can download the module. If you're using phpVMS 5.5.2, you may have to adapt the module from .tpl to .php .... but that's pretty easy. easy your talking to a basic coder who is in the procress ar you on discord Quote Link to comment Share on other sites More sharing options...
Michael2015 Posted November 16, 2017 Report Share Posted November 16, 2017 Also i have been awaiting for a while now for the API Quote Link to comment Share on other sites More sharing options...
IrfaanKhan Posted December 17, 2017 Report Share Posted December 17, 2017 (edited) hi guys can you please assist, i have installed everything properly as per the instructions given in Read me file and it was working fine but i changed the template to work with my website skin it is giving this error nothing happens when click Generate OFP. Uncaught TypeError: Cannot read property 'value' of undefined at do_simbriefsubmit (simbrief.apiv1.js:116) at simbriefsubmit (simbrief.apiv1.js:86) at HTMLButtonElement.onclick (5273:918) do_simbriefsubmit @ simbrief.apiv1.js:116 simbriefsubmit @ simbrief.apiv1.js:86 onclick @ 5273:918 Regards Irfaan Khan Edited December 18, 2017 by IrfaanKhan Quote Link to comment Share on other sites More sharing options...
William Posted April 20, 2020 Report Share Posted April 20, 2020 I'm sorry if this has been discussed previously but I read all the posts and don't think there's an answer to my question. We have the script up and working as it should but my question is as follow: Is there a way to have only the aircraft called by the Bid already selected in the Brief window? For instance if the Bid is AAL200 scheduled with an Airbus A320, I would like to already have the A320 pre-selected instead of the pull down menu with 300 other aircraft. Appreciate it if anyone has any input in regard. Thanks for the great work! Will Quote Link to comment Share on other sites More sharing options...
fullmetalsleeve Posted May 10, 2020 Report Share Posted May 10, 2020 Besides trying to register on this bloody forum, my issue is: After clicking the Generate OFP button, it redirects to website/SimBrief but that isn't found and I'm not using rewrite. Any help? Quote Link to comment Share on other sites More sharing options...
xrb936 Posted October 25, 2020 Report Share Posted October 25, 2020 On 4/5/2016 at 4:20 PM, web541 said: I could be wrong, but according to the github files, he has specified to use the ICAO as the value so it should be like this <select class="dispinput" name="type"> <?php $equipment = OperationsData::getAllAircraft(true); if(!$equipment) $equipment = array(); foreach($equipment as $equip) { echo '<option value="'.$equip->icao.'">'.$equip->name.'</option>'; } ?> </select> And I've also specified (true) to allow the query to attach only the aircraft that are enabled, of course you can remove that to search every aircraft like above --------------------------------- Again, not sure if this is the case, but you may find yourself with duplicates of many aircraft as it's pulling each aircraft from the database. Instead, what i recommend doing is using this in your form <select class="dispinput" name="type"> <?php $equipment = OperationsData::getAllAircraftSingle(true); if(!$equipment) $equipment = array(); foreach($equipment as $equip) { echo '<option value="'.$equip->icao.'">'.$equip->icao.' - '.$equip->name.'</option>'; } ?> </select> and in OperationsData.class.php in core/common place this anywhere in that file (under the getAllAircraft($onlyenabled == false) function for neatness) public static function getAllAircraftSingle($onlyenabled = false) { if ($onlyenabled == true) { $sql = "SELECT * FROM ".TABLE_PREFIX."aircraft a LEFT JOIN ".TABLE_PREFIX."ranks r ON r.rankid = a.minrank WHERE enabled = 1 GROUP BY(a.icao) ORDER BY a.icao ASC"; } else { $sql = "SELECT * FROM ".TABLE_PREFIX."aircraft a LEFT JOIN ".TABLE_PREFIX."ranks r ON r.rankid = a.minrank GROUP BY(a.icao) ORDER BY a.icao ASC"; } $all_aircraft = DB::get_results($sql); if(!$all_aircraft) { $all_aircraft = array(); } return $all_aircraft; } And that should work by giving you a different entry for each icao and specifying (true) will work as above as well but it will only show the icao if the whole fleet with that icao has been enabled Don't know why, but looks like this modification will only show me an empty dropdown menu. If I revert the code back to original one, it will work, but instead shows me all my fleets. 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.