skymx Posted May 6, 2010 Report Posted May 6, 2010 How can I limit the amount of flight plans (schedules) listed when searching for flight plans? before I added schedules to my site that was NOT a problem, had only a few of them... BUT! Now I have added more than 1,300 schedules and the list is just Too BIG!!! I would like to list in chuncks of 25 for example, or 12, maybe 15 in a page format at a time, not all of them. Is it posible in phpvms to do this, and where is the config file to do it? local.config or app.config? have been searching them, but can´t find any reference to accomplish this. Quote
Administrators Nabeel Posted May 6, 2010 Administrators Report Posted May 6, 2010 Look in the schedules module, it will be int here Quote
TennShadow Posted May 7, 2010 Report Posted May 7, 2010 Look in the schedules module, it will be int here Hi Nabeel, I looked in the core/modules/schedules/schedules.php file and I didn't see anything that jumped out at me. Could you provide any clues what to look for? Quote
Guest lorathon Posted May 7, 2010 Report Posted May 7, 2010 Hi Nabeel, I looked in the core/modules/schedules/schedules.php file and I didn't see anything that jumped out at me. Could you provide any clues what to look for? If you look in the SchedulesData.class.php you will see the call to find schedules. you can limit there public static function findSchedules($params, $count = '', $start = '') { $sql = 'SELECT s.*, a.id as aircraftid, a.name as aircraft, a.registration, a.minrank as aircraft_minrank, a.ranklevel as aircraftlevel, dep.name as depname, dep.lat AS deplat, dep.lng AS deplng, arr.name as arrname, arr.lat AS arrlat, arr.lng AS arrlng FROM '.TABLE_PREFIX.'schedules AS s LEFT JOIN '.TABLE_PREFIX.'airports AS dep ON dep.icao = s.depicao LEFT JOIN '.TABLE_PREFIX.'airports AS arr ON arr.icao = s.arricao LEFT JOIN '.TABLE_PREFIX.'aircraft AS a ON a.id = s.aircraft '; Sample $params['s.enabled'] = 1; $count = 1000; $start = 0; $schedules = SchedulesData::findSchedules($params, $count, $start); The above will return the first 1000 enabled schedules starting at schedule 0 into the the array $schedules. If you look in the SchedulesData.class.php you can find the other params you can stick in there to limit or choose even further. $params = array( 's.depicao' => $this->post->depicao, 's.enabled' => 1, ); The above will take the post data from a form and depicao (Departing ICAO airport) and limit the selection by schedules that depart from the above ICAO that are enabled. Quote
TennShadow Posted May 7, 2010 Report Posted May 7, 2010 Thanks. It figures I was looking at the wrong file. Quote
Guest lorathon Posted May 7, 2010 Report Posted May 7, 2010 I should have added this. If you change the $start you can use it for pagnation. (I have never tried this but it should work) $params['s.enabled'] = 1; $count = 25; $start = 0; $schedules = SchedulesData::findSchedules($params, $count, $start); The above should give you enabled schedules 0-24 $params['s.enabled'] = 1; $count = 25; $start = 25; $schedules = SchedulesData::findSchedules($params, $count, $start); The above should give you enabled schedules 25-49 So if you code it right you should be able to use the above for you own customized pagnation. You can do this with the PIREPS also. This is from the PIREPData.class.php public static function findPIREPS($params, $count = '', $start = '') { $sql = 'SELECT p.*, UNIX_TIMESTAMP(p.submitdate) as submitdate, u.pilotid, u.firstname, u.lastname, u.email, u.rank, a.id AS aircraftid, a.name as aircraft, a.registration, dep.name as depname, dep.lat AS deplat, dep.lng AS deplng, arr.name as arrname, arr.lat AS arrlat, arr.lng AS arrlng FROM '.TABLE_PREFIX.'pireps p LEFT JOIN '.TABLE_PREFIX.'aircraft a ON a.id = p.aircraft LEFT JOIN '.TABLE_PREFIX.'airports AS dep ON dep.icao = p.depicao LEFT JOIN '.TABLE_PREFIX.'airports AS arr ON arr.icao = p.arricao LEFT JOIN '.TABLE_PREFIX.'pilots u ON u.pilotid = p.pilotid '; As you can see it has the same variables available. $count (Number of PIREPS to return) $start (Start point of the return) Quote
Guest lorathon Posted May 7, 2010 Report Posted May 7, 2010 If you look in the following post you will see that I just wrote a pagination for pireps. With a little finesse this can be used for schedules also. http://forum.phpvms.net/topic/2823-pagination/ Quote
Administrators Nabeel Posted May 7, 2010 Administrators Report Posted May 7, 2010 I will also be looking into adding the admin-style pagination for PIREPS in several places (the other pagination thread) Edit NVM, I see you posted there already Quote
skymx Posted May 8, 2010 Author Report Posted May 8, 2010 I will also be looking into adding the admin-style pagination for PIREPS in several places (the other pagination thread) Edit NVM, I see you posted there already Thanks a lot, I will check that, it would be a nice addition to phpvms to have pagination for all those large lists! Quote
tylerj Posted October 21, 2010 Report Posted October 21, 2010 Ok, i dont have scheduledata.class.php or anything close to it. Quote
Guest lorathon Posted October 21, 2010 Report Posted October 21, 2010 /core/common/SchedulesData.class.php Check there Quote
tylerj Posted October 23, 2010 Report Posted October 23, 2010 found it but now the page is giving invalid arguments, can someone put there entire code for that and maybe it will work..? 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.