M-Queiroz Posted June 21, 2010 Report Share Posted June 21, 2010 hello how poso add these hours and minutes on Add Schedule minutes or hours will not enter anyone know <tr> <td valign="top"><strong>Horário de Partida</strong> </td> <td><select gtbfieldid="47" name="deptime" id="<?php echo $schedule->deptime?>" /> <option selected="selected">-</option> <option>01</option> <option>02</option> <option>03</option> <option>04</option> <option>05</option> <option>06</option> <option>07</option> <option>08</option> <option>09</option> <option>10</option> <option>11</option> <option>12</option> <option>13</option> <option>14</option> <option>15</option> <option>16</option> <option>17</option> <option>18</option> <option>19</option> <option>20</option> <option>21</option> <option>22</option> <option>23</option> <option>24</option> </select> <select gtbfieldid="48" name="deptime" id="<?php echo $schedule->deptime?>" /> <option selected="selected">-</option> <option>00</option> <option>05</option> <option>10</option> <option>15</option> <option>20</option> <option>25</option> <option>30</option> <option>35</option> <option>40</option> <option>45</option> <option>50</option> <option>55</option> </select> (Todas as vezes em Zulu)</td> </td> </tr> <tr> <td valign="top"><strong>Horário de Chegada</strong> </td> <td><select gtbfieldid="49" name="arrtime" value="<?php echo $schedule->arrtime?>" /> <option selected="selected">-</option> <option>01</option> <option>02</option> <option>03</option> <option>04</option> <option>05</option> <option>06</option> <option>07</option> <option>08</option> <option>09</option> <option>10</option> <option>11</option> <option>12</option> <option>13</option> <option>14</option> <option>15</option> <option>16</option> <option>17</option> <option>18</option> <option>19</option> <option>20</option> <option>21</option> <option>22</option> <option>23</option> <option>24</option> </select> <select gtbfieldid="50" name="arrtime" value="<?php echo $schedule->arrtime?>" /> <option selected="selected">-</option> <option>00</option> <option>05</option> <option>10</option> <option>15</option> <option>20</option> <option>25</option> <option>30</option> <option>35</option> <option>40</option> <option>45</option> <option>50</option> <option>55</option> </select> (Todas as vezes em Zulu)</td> <p>Please enter time as: HH::MM Timezone (eg: 17:30 EST, or 5:30 PM EST)</p> </td> </tr> Quote Link to comment Share on other sites More sharing options...
AUZ Posted June 21, 2010 Report Share Posted June 21, 2010 Not that I know much about coding but here's my 2c if I may, From what I see, the database for deptime and arrtime are singular entires only, from the code you provided, it appears that both HH MM have the same "arrtime" value when infact HH should be "arrtimehh" and MM should be "arrtimemm" if and only if the database had those two additional entries available, as it stands, the MM will override the HH as a single value. Not that I advise it, but maybe if you enter arrtimehh and arrtimemm into the database and add the values to whichever dataclass.php the form refers to, it may just work. Also, you may need to add the : in the HH to make it correctly formated; <option>01:</option> plus <option>05</option> equals 01:05 I maybe totally off the mark and apologise if so, just can't sleep at the moment and may just something I have said has triggered a thought and got you back to the drawboard with new ideas Regards Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted June 21, 2010 Report Share Posted June 21, 2010 Auz is correct. You would need to do a combining of the two before sticking it into the DB. It would also be easier and less work to iterate through the minutes and hours to form the otptions. To preload with existing data you would need to split the $schedule->deptime <?php $deptime = explode($schedule->deptime, "."); // $deptime[0] is hours // $deptime[1] is minutes $arrtime = explode($schedule->arrtime, "."); // $arrtime[0] is hours // $arrtime[1] is minutes ?> You will then need to selection drop downs for the form The following shows the departure time hours selection <select id="deptime_hours" name="deptime_hours"> <?php $i = 0; while ($i < 24) { $selected = ''; if ($deptime[0] == $i) $selected = 'selected'; // This checks if during an edit it will select the data already attached to the schedule echo '<option value = "'.$i.'" '.$selected.'><'.$i.'</option>'; $i++; }?> </select> Where ever it is sent the two will need to be combined <?php $deptime = $this->post->deptime_hours.'.'.$this->post->deptime_minutes; ?> Quote Link to comment Share on other sites More sharing options...
M-Queiroz Posted June 21, 2010 Author Report Share Posted June 21, 2010 Auz is correct. You would need to do a combining of the two before sticking it into the DB. It would also be easier and less work to iterate through the minutes and hours to form the otptions. To preload with existing data you would need to split the $schedule->deptime <?php $deptime = explode($schedule->deptime, "."); // $deptime[0] is hours // $deptime[1] is minutes $arrtime = explode($schedule->arrtime, "."); // $arrtime[0] is hours // $arrtime[1] is minutes ?> You will then need to selection drop downs for the form The following shows the departure time hours selection <select id="deptime_hours" name="deptime_hours"> <?php $i = 0; while ($i < 24) { $selected = ''; if ($deptime[0] == $i) $selected = 'selected'; // This checks if during an edit it will select the data already attached to the schedule echo '<option value = "'.$i.'" '.$selected.'><'.$i.'</option>'; $i++; }?> </select> Where ever it is sent the two will need to be combined <?php $deptime = $this->post->deptime_hours.'.'.$this->post->deptime_minutes; ?> here giving this error would you ride a code of exmplo do not think I quite understand this code will work behind ops_scheduleform.tpl Quote Link to comment Share on other sites More sharing options...
M-Queiroz Posted June 29, 2010 Author Report Share Posted June 29, 2010 I add the altitude but the hours it very difficult I have done everything I put what I have done <div id="wrapper"> <h3><?php echo $title?></h3> <form name="form" action="<?php echo adminurl('/operations/schedules');?>" method="post"> <table width="100%" class="tablesorter"> <tr> <td valign="top"><strong>Code: </strong></td> <td> <select name="code"> <?php foreach($allairlines as $airline) { if($airline->code == $schedule->code) $sel = 'selected'; else $sel = ''; echo '<option value="'.$airline->code.'" '.$sel.'>'.$airline->code.' - '.$airline->name.'</option>'; } ?> </select> </td> </tr> <tr> <td><strong>Flight Number:</strong></td> <td> <input name="flightnum" type="text" value="<?php echo $schedule->flightnum;?>" size="3" maxlength="4" /></td> </tr> <tr> <td width="3%" nowrap><strong>Departure Airport:</strong></td> <td><input name="depicao" class="airport_select" id="depicao" onclick="" value="<?php echo $schedule->depicao;?>" size="3" maxlength="4" /> </td> </tr> <tr> <td><strong>Arrival Airport:</strong></td> <td><input name="arricao" class="airport_select" id="arricao" onclick="" value="<?php echo $schedule->arricao;?>" size="3" /> </td> </tr> <tr> <td valign="top"><strong>Departure Time:</strong> </td> <td><input name="deptime" type="text" value="<?php echo $schedule->deptime?>" size="4" maxlength="5" /> <p>Please enter time as: HH:MM Timezone (eg: 17:30 EST, or 5:30 PM EST)</p> </td> </tr> <tr> <td valign="top"><strong>Arrival Time:</strong> </td> <td><input name="arrtime" type="text" value="<?php echo $schedule->arrtime?>" size="4" maxlength="5" /> <p>Please enter time as: HH:MM Timezone (eg: 17:30 EST, or 5:30 PM EST)</p> </td> </tr> <tr> <td valign="top"><strong>Days of Week: </strong></td> <td> <input type="checkbox" name="Check_ctr" value="yes" onclick="Check(document.form.daysofweek)" /> <b>Check All</b> <?php /*$days = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'); */ $days = Config::Get('DAYS_LONG'); for($i=0; $i<=6; $i++) { # Add blank string to typecast from int to string, otherwise it won't search if(strpos($schedule->daysofweek, $i.'') === false) $checked = ''; else $checked = 'checked'; echo '<input type="checkbox" id="daysofweek" name="daysofweek[]" value="'.$i.'" '.$checked.'>'.$days[$i].' '; } ?><br /> <script language="JavaScript"> function Check(chk) { if(document.form.Check_ctr.checked==true){ for (i = 0; i < chk.length; i++) chk[i].checked = true ; }else{ for (i = 0; i < chk.length; i++) chk[i].checked = false ; } } </script></td> </tr> <tr> <td valign="top"><strong>Distance:</strong> </td> <td><input name="distance" type="text" id="distance" value="<?php echo $schedule->distance?>" /> <p><a href="#" onclick="calcDistance(); return false;">Calculate Distance</a>. Leaving blank or 0 (zero) will automatically calculate the distance.</p></td> </tr> <tr> <td valign="top"><strong>Flight Time:</strong> </td> <td><input name="flighttime" type="text" value="<?php echo $schedule->flighttime?>" size="3" /> <p>Please enter as HH:MM</p> </td> </tr> <tr> <td><strong>Equipment: </strong></td> <td><select name="aircraft"> <?php foreach($allaircraft as $aircraft) { if($aircraft->registration == $schedule->registration) $sel = 'selected'; else $sel = ''; echo '<option value="'.$aircraft->id.'" '.$sel.'>'.$aircraft->name.' ('.$aircraft->registration.')</option>'; } ?> </select> </td> </tr> <tr> <td valign="top"><strong>Flight Level:</strong></td> <td>FL <select id="adults" name="flightlevel"> <option value="<?php echo $schedule->flightlevel?>"><?php echo $schedule->flightlevel?></option> <option value="5000">5000</option> <option value="6000">6000</option> <option value="7000">7000</option> <option value="7500">7500</option> <option value="8000">8000</option> <option value="8500">8500</option> <option value="9000">9000</option> <option value="10000">10000</option> <option value="10500">10500</option> <option value="11000">11000</option> <option value="11500">11500</option> <option value="12000">12000</option> <option value="13000">13000</option> <option value="14000">14000</option> <option value="15000">15000</option> <option value="16000">16000</option> <option value="17000">17000</option> <option value="18000">18000</option> <option value="19000">19000</option> <option value="20000">20000</option> <option value="21000">21000</option> <option value="22000">22000</option> <option value="23000">23000</option> <option value="24000">24000</option> <option value="25000">25000</option> <option value="26000">26000</option> <option value="27000">27000</option> <option value="28000">28000</option> <option value="29000">29000</option> <option value="30000">30000</option> <option value="31000">31000</option> <option value="32000">32000</option> <option value="33000">33000</option> <option value="34000">34000</option> <option value="35000">35000</option> <option value="36000">36000</option> <option value="37000">37000</option> <option value="38000">38000</option> <option value="39000">39000</option> <option value="40000">40000</option> <option value="41000">41000</option> <option value="42000">42000</option> </select> <p>Please enter as a full-numeric altitude. Should be in feet, to remain accurate with any ACARS.</p> </td> </tr> <tr> <td valign="top"><strong>Flight Type</strong></td> <td><select name="flighttype"> <?php foreach($flighttypes as $flightkey=>$flighttype) { if($schedule->flighttype == $flightkey) $sel = 'selected'; else $sel = ''; ?> <option value="<?php echo $flightkey?>" <?php echo $sel; ?>><?php echo $flighttype?> Flight</option> <?php } ?> </select> </td> </tr> <tr> <td valign="top"><strong>Route (optional)</strong></td> <td><textarea name="route" style="width: 60%; height: 75px" id="route"><?php echo $schedule->route?></textarea> <p><a id="dialog" class="preview" href="<?php echo SITE_URL?>/admin/action.php/operations/viewmap?type=preview">View Route</a></p> </td> </tr> <tr> <td valign="top"><strong>Price</strong> </td> <td><strong>$</strong> <input type="text" name="price" value="<?php echo $schedule->price?>" /> <p>This is the ticket price, or price per <?php echo Config::Get('CARGO_UNITS'); ?> for a cargo flight.</p> </td> </tr> <tr> <td valign="top"><strong>Notes</strong></td> <td valign="top" style="padding-top: 0px"> Any notes about the flight, including frequency, dates flown, etc.<br /><br /> <textarea name="notes" style="width: 60%; height: 150px"><?php echo $schedule->notes?></textarea> </td> </tr> <tr> <td valign="top"><strong>Enabled?</strong></td> <?php $checked = ($schedule->enabled==1 || !$schedule)?'CHECKED':''; ?> <td><input type="checkbox" id="enabled" name="enabled" <?php echo $checked ?> /></td> </td> </tr> <tr> <td></td> <td><input type="hidden" name="action" value="<?php echo $action?>" /> <input type="hidden" name="id" value="<?php echo $schedule->id?>" /> <input type="submit" name="submit" value="<?php echo $title?>" /> </td> </tr> </table> </form> </div> <script type="text/javascript"> $(".preview").click(function() { depicao=$("#depicao").val(); arricao=$("#arricao").val(); route=escape($("#route").val()); url = this.href +"&depicao="+depicao +"&arricao="+arricao +"&route="+route; $('#jqmdialog').jqm({ajax: url}).jqmShow(); return false; }); <?php $airport_list = array(); foreach($allairports as $airport) { $airport->name = addslashes($airport->name); $airport_list[] = "{label:\"{$airport->icao} ({$airport->name})\", value: \"{$airport->icao}\"}"; } $airport_list = implode(',', $airport_list); ?> var airport_list = [<?php echo $airport_list; ?>]; $(".airport_select").autocomplete({ source: airport_list, minLength: 2, delay: 0 }); </script> Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted June 29, 2010 Administrators Report Share Posted June 29, 2010 I think this is what you are trying to do -> http://www.pastebin.org/366807 Quote Link to comment Share on other sites More sharing options...
M-Queiroz Posted June 29, 2010 Author Report Share Posted June 29, 2010 ok it would be almost wanted to divide the hours of minutes I saw your changes and noticed that is not showing the hours that are already en route when we edtar Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted June 29, 2010 Administrators Report Share Posted June 29, 2010 ok it would be almost wanted to divide the hours of minutes I saw your changes and noticed that is not showing the hours that are already en route when we edtar I added the option to show the existing time when editing a schedule but if you seperate the hours and minuites (not a big deal) you will have to change some code in the module as well to combine it back together for the db insert. new code here -> http://www.pastebin.org/366905 Quote Link to comment Share on other sites More sharing options...
M-Queiroz Posted June 29, 2010 Author Report Share Posted June 29, 2010 simpilot myth thanks for your help was perfect need we are here to help, too. Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted June 30, 2010 Moderators Report Share Posted June 30, 2010 I added the option to show the existing time when editing a schedule but if you seperate the hours and minuites (not a big deal) you will have to change some code in the module as well to combine it back together for the db insert. new code here -> http://www.pastebin.org/366905 Thanks simpilot! That's what we need for the VA. 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.