Administrators ProAvia Posted July 5, 2017 Administrators Report 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
Administrators ProAvia Posted September 5, 2017 Administrators Report 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
Moderators shakamonkey88 Posted September 10, 2017 Moderators Report 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
Administrators ProAvia Posted September 10, 2017 Administrators Report 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
CarlosEduardo2409 Posted September 20, 2017 Report Posted September 20, 2017 My "Generate OFP" not work Quote
CarlosEduardo2409 Posted September 21, 2017 Report 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
web541 Posted September 21, 2017 Report 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
CarlosEduardo2409 Posted September 21, 2017 Report 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
Members Vangelis Posted September 22, 2017 Members Report 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
CarlosEduardo2409 Posted September 24, 2017 Report 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
Members Vangelis Posted September 25, 2017 Members Report 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
CarlosEduardo2409 Posted September 25, 2017 Report Posted September 25, 2017 (edited) . Edited September 25, 2017 by CarlosEduardo2409 Quote
CarlosEduardo2409 Posted September 25, 2017 Report 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
Michael2015 Posted November 8, 2017 Report Posted November 8, 2017 After clicking on the generate button nothing happens Quote
Administrators ProAvia Posted November 8, 2017 Administrators Report 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
Michael2015 Posted November 8, 2017 Report 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
Michael2015 Posted November 8, 2017 Report 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
Administrators ProAvia Posted November 8, 2017 Administrators Report 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
Administrators ProAvia Posted November 8, 2017 Administrators Report 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
Michael2015 Posted November 8, 2017 Report Posted November 8, 2017 right well the link for the download didint work Quote
Administrators ProAvia Posted November 8, 2017 Administrators Report 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
Michael2015 Posted November 8, 2017 Report 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
Michael2015 Posted November 16, 2017 Report Posted November 16, 2017 Also i have been awaiting for a while now for the API Quote
IrfaanKhan Posted December 17, 2017 Report 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
William Posted April 20, 2020 Report 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
fullmetalsleeve Posted May 10, 2020 Report 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
xrb936 Posted October 25, 2020 Report 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
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.