Jump to content
ahughes3

SimBrief form to tailor OFP result

Recommended Posts

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!

Share this post


Link to post
Share on other sites

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 "&nbsp;";
						
                    $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).

Share this post


Link to post
Share on other sites
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 "&nbsp;";
						
                    $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,

Share this post


Link to post
Share on other sites

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 "&nbsp;";
					
					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 by ProAvia

Share this post


Link to post
Share on other sites

@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 by CarlosEduardo2409

Share this post


Link to post
Share on other sites
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 by CarlosEduardo2409

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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 

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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 

Share this post


Link to post
Share on other sites

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 by IrfaanKhan

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...