Connor1994 Posted August 20, 2010 Report Posted August 20, 2010 Hi everyone, just wondering if anyone can give me any ideas on how to get a schedule layout like this: thanks, Connor Quote
Administrators Nabeel Posted August 21, 2010 Administrators Report Posted August 21, 2010 Cool idea. Something like; <table> <tr> <td>flight num</td> ... <td>deprt city</td> <?php // We are gonna loop each day of the week for($dayofweek = 0; $dayofweek < 7; $dayofweek++) { // echo our column opening echo '<td>'; // Check if $i (the current day of week) exists if(substr_count($schedule->daysofweek, $dayofweek) > 0) { // there is a flight for sunday , so echo that plane icon out echo 'plane icon'; } // Close that column echo '</td>'; } ?> <td>arrival time</td> ... </tr> </table> Some pseudo code, 1 Quote
Connor1994 Posted August 21, 2010 Author Report Posted August 21, 2010 Thanks a million for your help, would be good if it was an addon, because I think I would mess my site up if I was to do it myself Quote
freshJet Posted June 12, 2011 Report Posted June 12, 2011 *cough* Fly UK *cough* Seriously though, looks nice to have on phpVMS. Edit: DIG. Quote
stuartpb Posted June 12, 2011 Report Posted June 12, 2011 Thanks Nabeel, I've been trying to figure this out for a while. The code worked perfectly, apart from the $schedule->daysofweek bit, I just had to change it to $route Here's a pic: 1 Quote
Ahmad Posted June 12, 2011 Report Posted June 12, 2011 Stuart Can you please share the code with us or maybe if you could post it in code snippets please i would really appreciate it. Regards Ahmad Quote
stuartpb Posted June 13, 2011 Report Posted June 13, 2011 Stuart Can you please share the code with us or maybe if you could post it in code snippets please i would really appreciate it. Regards Ahmad Nabeel has already given the code, and it was the same code I used. The only amendment I made was on this line: if(substr_count($schedule->daysofweek, $dayofweek) > 0) Changed to: if(substr_count($route->daysofweek, $dayofweek) > 0) Then it's just a case of amending the echo output to suit. Quote
freshJet Posted June 13, 2011 Report Posted June 13, 2011 Stuart this isn't the full code. I think Ahmed means to post the FULL code with the php echos etc... Quote
Strider Posted June 13, 2011 Report Posted June 13, 2011 <?php if(!$allroutes) { echo '<p align="center">No routes have been found!</p>'; return; } ?> <script type="text/javascript"> $(document).ready(function() { $('#schedule').dataTable( { "sPaginationType": "full_numbers" } ); } ); </script> <div> <table border="1" class="display" id="schedule"> <thead> <tr id="tablehead"> <th>Flight No.</th> <th>Dep. Time</th> <th>Dep. Airport</th> <th>Sun</th> <th>Mon</th> <th>Tue</th> <th>Wed</th> <th>Thurs</th> <th>Fri</th> <th>Sat</th> <th>Arr. Time</th> <th>Arr. Airport</th> <th>Distance</th> <th>Aircraft</th> <th>Options</th> </tr> </thead> <tbody> <?php foreach($allroutes as $route) { /* Uncomment this code if you want only schedules which are from the last PIREP that pilot filed */ /*if(Auth::LoggedIn()) { $search = array( 'p.pilotid' => Auth::$userinfo->pilotid, 'p.accepted' => PIREP_ACCEPTED ); $reports = PIREPData::findPIREPS($search, 1); // return only one if(is_object($reports)) { # IF the arrival airport doesn't match the departure airport if($reports->arricao != $route->depicao) { continue; } } }*/ /* Skip over a route if it's not for this day of week Left this here, so it can be omitted if your VA doesn't use this. Comment out these two lines if you don't want to. */ /* Check if a 7 is being used for Sunday, since PHP thinks 0 is Sunday */ $route->daysofweek = str_replace('7', '0', $route->daysofweek); if(strpos($route->daysofweek, date('w')) === false) continue; /* END DAY OF WEEK CHECK */ /* This will skip over a schedule if it's been bid on This only runs if the below setting is enabled If you don't want it to skip, then comment out this code below by adding // in front of each line until the END DISABLE SCHEDULE comment below If you do that, and want to show some text when it's been bid on, see the comment below */ if(Config::Get('DISABLE_SCHED_ON_BID') == true && $route->bidid != 0) { continue; } /* END DISABLE SCHEDULE ON BID */ /* Skip any schedules which have aircraft that the pilot is not rated to fly (according to RANK), only skip them if they are logged in. */ if(Config::Get('RESTRICT_AIRCRAFT_RANKS') === true && Auth::LoggedIn()) { /* This means the aircraft rank level is higher than what the pilot's ranklevel, so just do "continue" and move onto the next route in the list */ if($route->aircraftlevel > Auth::$userinfo->ranklevel) { continue; } } /* THIS BEGINS ONE TABLE ROW */ ?> <tr> <td class="center"> <a href="<?php echo url('/schedules/details/'.$route->id);?>"><?php echo $route->code . $route->flightnum?></a> <td><?php echo $route->deptime;?></td> <td class="centre"><?php echo $route->depicao . ' '. $route->depname;?></td> <?php // We are gonna loop each day of the week for($dayofweek = 0; $dayofweek < 7; $dayofweek++) { // echo our column opening echo '<td class="centre">'; // Check if $i (the current day of week) exists if(substr_count($route->daysofweek, $dayofweek) > 0) { // there is a flight for sunday , so echo that plane icon out echo 'Plane Image goes here'; } // Close that column echo '</td>'; } ?> <td><?php echo $route->arrtime;?></td> <td><?php echo $route->arricao .' '. $route->arrname;?></td> <td><?php echo $route->distance . Config::Get('UNITS');?></td> <td><?php echo $route->aircraft; ?></td> <td nowrap> <a href="<?php echo url('/schedules/details/'.$route->id);?>">View Details</a><br /> <a href="<?php echo url('/schedules/brief/'.$route->id);?>">Pilot Brief</a><br /> <?php # Don't allow overlapping bids and a bid exists if(Config::Get('DISABLE_SCHED_ON_BID') == true && $route->bidid != 0) { ?> <a id="<?php echo $route->id; ?>" class="addbid" href="<?php echo actionurl('/schedules/addbid');?>">Add to Bid</a> <?php } else { if(Auth::LoggedIn()) { ?> <a id="<?php echo $route->id; ?>" class="addbid" href="<?php echo url('/schedules/addbid');?>">Add to Bid</a> <?php } } ?> </td> <?php /* END OF ONE TABLE ROW */ } ?> </tbody> </table> </div> <div class="spacer"></div> <hr> There is the full code, for the schedules page. 1 Quote
freshJet Posted June 13, 2011 Report Posted June 13, 2011 Here's mine: http://www.freshjetvirtual.com/index.php/FrontSchedules Quote
Industrialshadow Posted July 3, 2011 Report Posted July 3, 2011 hello i have use your cde above. IWhere do i put the img src? I dont find a way. Thanks for Help Quote
lorlandi Posted July 6, 2011 Report Posted July 6, 2011 Hi, sorry for this question but i have problems to show the plane image, this is the code : { // there is a flight for sunday , so echo that plane icon out // img src="<?php echo SITE_URL?>/lib/skins/Template1/images/inair.png;?"> echo '"<?php echo SITE_URL?>/lib/skins/Template1/images/inair.png;?">'; } I have two options, wich is the correct sentence ?????. Also when activate the first or second option a message with error appear in the page "Parse error: syntax error, unexpected $end in /home/xxxxxxxxxx/xxxxx/schedule_results.tpl on line 172" line 172 is the last but it's a blank row, i tried deleted but the error still there. Any suggestion ??? Thanks for the help. Regards Quote
Strider Posted July 6, 2011 Report Posted July 6, 2011 The unexpected end, just means that the script has ended before it should have. To get the picture to show, you will need to put it in an img tag. { // there is a flight for sunday , so echo that plane icon out // img src="<?php echo SITE_URL?>/lib/skins/Template1/images/inair.png;?"> echo '<img src="<?php echo SITE_URL?>/lib/skins/Template1/images/inair.png;?">" alt=""/>'; } That code will get the image to show. Quote
lorlandi Posted July 6, 2011 Report Posted July 6, 2011 Many thanks for the reply and help, but still have the problem with error message "Parse error: syntax error, unexpected $end in /home/xxxxxxxxxx/xxxxx/schedule_results.tpl on line 172" The complete code is the same than you posted. Thanks anyway Regards Quote
Moderators mark1million Posted July 6, 2011 Moderators Report Posted July 6, 2011 Many thanks for the reply and help, but still have the problem with error message "Parse error: syntax error, unexpected $end in /home/xxxxxxxxxx/xxxxx/schedule_results.tpl on line 172" The complete code is the same than you posted. Thanks anyway Regards Reupload the stock template and modify again. Quote
lorlandi Posted July 7, 2011 Report Posted July 7, 2011 Thanks for the help, i do that, the error message was killed but no image is present, just this words......" alt=" "/>. Also see the attached image. Regards Quote
lorlandi Posted July 7, 2011 Report Posted July 7, 2011 SOLVED, was my mistake. Many Thanks all. Regards Quote
Jeff Posted July 14, 2011 Report Posted July 14, 2011 Thought I'd share how I have mine. It took me a while to figure out how and where to place the items, but hope you like it. I won't share the coding, but it is very easy to figure out how it is done. 1 Quote
freshJet Posted July 16, 2011 Report Posted July 16, 2011 Thought I'd share how I have mine. It took me a while to figure out how and where to place the items, but hope you like it. I won't share the coding, but it is very easy to figure out how it is done. Awesome! 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.