Ahmad Posted May 22, 2011 Report Share Posted May 22, 2011 Dear Forum Members and experts once again need little help for displaying my all schedules using javascript the option already implemented in PhpVms but in Admin section only i need it for pilots now so can anyone just explain me a bit how to work with it and display all of my schedules on schedules page. here is the code for schedules pager in admin section need little tweaking i think to display schedules need some expert advise on this. EDIT---> CODE REMOVED Thanks in Advance Ahmad Quote Link to comment Share on other sites More sharing options...
Ahmad Posted May 23, 2011 Author Report Share Posted May 23, 2011 Update is i have displayed the Pager on my schedules page but it wont showing anything in jgrid table confusion is in here <script type="text/javascript"> $("#grid").jqGrid({ url: '<?php echo actionurl('/schedules/schedulegrid');?>', What URL should i put to fetch data or i have to make .php page for this can someone explain please? Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted May 23, 2011 Moderators Report Share Posted May 23, 2011 Are you using this on the admin side? Quote Link to comment Share on other sites More sharing options...
Ahmad Posted May 23, 2011 Author Report Share Posted May 23, 2011 No Mark i wanted to show it on Main Website/Schedules Page for pilots in place of schedules_result.tpl i have copied all same code which is in ops_schedules.tpl file for admin section but now dont understand how to show my schedules in it how to fetch them from database? Should i have to create another .tpl files or .php file or i can use schedules.php file for it? Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted May 23, 2011 Moderators Report Share Posted May 23, 2011 That's something i have not looked at to be honest, i know Jeff has though but he is a busy man. If i get chance ill try to get the results in that grid on my dev site. Quote Link to comment Share on other sites More sharing options...
Ahmad Posted May 23, 2011 Author Report Share Posted May 23, 2011 Ok Mark No problem but i think you can help me on this for sure http://forum.phpvms.net/topic/5215-pagination-of-screensots/ Quote Link to comment Share on other sites More sharing options...
pkav Posted May 23, 2011 Report Share Posted May 23, 2011 Add this is modules/Schedules.php public function getSchedulesJSON() { echo json_encode((object)SchedulesData::GetSchedules()); } Next If you use firebug or chrome tools you can add this snippet to index.tpl $(document).ready(function(){ $.ajax({ type : 'GET', url : '<?php echo actionurl("/schedules/getSchedulesJSON");?>', dataType : 'jsonp', success : function(results) { console.log(results); } }); }); The above code should return the JSON data, they should be indexed like so [0],[1],[2] and so on. Now you can mash all this data into one of the phpvms lib plugins you mention above. Or do a loop, whatever way you need it done $.each(result, function(index, stuff){}) Hope this makes sense. Quote Link to comment Share on other sites More sharing options...
Ahmad Posted May 23, 2011 Author Report Share Posted May 23, 2011 as you can see here this is the working code of admin section of jgrid table in operations.php file this code of the part is for schedules adding or deleting or showing in admin section. EDIT ---> CODE Removed We need to match the above code i think what you say? Quote Link to comment Share on other sites More sharing options...
Ahmad Posted May 23, 2011 Author Report Share Posted May 23, 2011 i was getting ERROR while using this code in my schedules page public function getSchedulesJSON() { echo json_encode((object)SchedulesData::GetSchedules()); } ERRROR [b]Parse error[/b]: syntax error, unexpected T_PUBLIC in [b]/home/ahmad/public_html/EmiratesVirtual/core/modules/Schedules/Schedules.php[/b] on line [b]244[/b] Quote Link to comment Share on other sites More sharing options...
pkav Posted May 23, 2011 Report Share Posted May 23, 2011 i was getting ERROR while using this code in my schedules page public function getSchedulesJSON() { echo json_encode((object)SchedulesData::GetSchedules()); } ERRROR [b]Parse error[/b]: syntax error, unexpected T_PUBLIC in [b]/home/ahmad/public_html/EmiratesVirtual/core/modules/Schedules/Schedules.php[/b] on line [b]244[/b] What version are you currently using? Also your php specs? [public] keyword is throwing an error which would maybe tell me the author has dis-abled them somehow(for your version of phpvms) or you are using an earlier version of php. I also noted "jsonp" is incorrect, "json" is required in this case, both are valid but for different methods. {note: might be 1 more typo, just got this new laptop and keyboard is driving me nuts, oh dear! } All of the above code is working. Quote Link to comment Share on other sites More sharing options...
Ahmad Posted May 23, 2011 Author Report Share Posted May 23, 2011 YEP the error was resolved now there is no ERROR on the schedules page but no result showing empty tables? Quote Link to comment Share on other sites More sharing options...
pkav Posted May 23, 2011 Report Share Posted May 23, 2011 YEP the error was resolved now there is no ERROR on the schedules page but no result showing empty tables? Yep you need to create that table script or simply copy and paste from the admin one into wherever you are using the script, ie: schedules.tpl, correct? then change the following line url: '<?php echo actionurl('/schedules/schedulegrid');?>', {note: some of the admin functions wont work such as view schedule(id) and so on as those have not been created for the frontend} TO: url: '<?php echo actionurl('/schedules/getSchedulesJSON');?>', Quote Link to comment Share on other sites More sharing options...
Ahmad Posted May 24, 2011 Author Report Share Posted May 24, 2011 Pkav i tried it wih no luck yet changed the URL but nothing showing in the table? no records to show coming there........ Quote Link to comment Share on other sites More sharing options...
pkav Posted May 24, 2011 Report Share Posted May 24, 2011 Pkav i tried it wih no luck yet changed the URL but nothing showing in the table? no records to show coming there........ Ok I may have overlooked something regarding 'jqgrid', leave it with me. As you can see from then only test schedule i have its returning correctly, building the grid is just something I will have to read up on as im not familiar with it 0 // This is the only index being returned which is true index[0] Object { id="1", code="CAV", more...} id "1" code "CAV" flightnum "8783O" depicao "EIDW" arricao "KJFK" route "" route_details "" aircraft "B747-400" flightlevel "220" distance "2758.49" deptime "06:00" arrtime "12:00" flighttime "6" daysofweek "0" price "400" flighttype "P" timesflown "0" notes "" enabled "1" bidid "0" aircraftid "1" registration "897UJKJ" aircraft_minrank "0" aircraftlevel "0" depname "Dublin Airport" deplat "53.4213" deplng "-6.27007" arrname "Kennedy International" arrlat "40.6398" arrlng "-73.7787" Quote Link to comment Share on other sites More sharing options...
Ahmad Posted May 24, 2011 Author Report Share Posted May 24, 2011 Ok no problem take your time i shall wait for your final result thanks in advance....... Quote Link to comment Share on other sites More sharing options...
Ahmad Posted May 24, 2011 Author Report Share Posted May 24, 2011 Now the Current Update is i am able to show the data from database into jgrid table but now i wanted to add option like Add to biid Pilot brief route and the restriction for pilots to fly only those aircraft and schedule which they are assigned to fly according to the ranks set at backened...... can some one help me in this now? Quote Link to comment Share on other sites More sharing options...
Ahmad Posted May 26, 2011 Author Report Share Posted May 26, 2011 Post Mark as Resolved i got it Working by myself by work around with the Codes many thanks goes out to PKAV and Mark for there suggestions......... Regards Ahmad 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.