Jump to content

Display Schedules Using JAVA


Ahmad

Recommended Posts

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

Link to comment
Share on other sites

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?sad.gif

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

YEP the error was resolved now there is no ERROR on the schedules page but no result showing empty tables?sad.gif

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');?>',

Link to comment
Share on other sites

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"



Link to comment
Share on other sites

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?

Link to comment
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...