Jump to content

Recommended Posts

Posted

I'm not one to do scripting, so if I could get some help, would be great. I'll ask questions regarding what I'm doing in this post.

First off, how is a module created that shows up in the admin area as well as frontpage? Next, how can I show only 1 of each of the aicraft in the fleet on a page?

edit: All this is going to be in the same module

Posted

For the fleet page I use this: http://forum.phpvms.net/topic/1522-fleet-table/ , with a query like this:

$sql = 'SELECT a.*, a.name AS aircraft,
				   COUNT(p.pirepid) AS routesflown,
				   SUM(p.distance) AS distance,
				   SEC_TO_TIME(SUM(p.flighttime*60*60)) AS totaltime,
				   AVG(p.distance) AS averagedistance,
				   AVG(p.flighttime) as averagetime
				  FROM   '.TABLE_PREFIX.'aircraft a
					LEFT OUTER JOIN '.TABLE_PREFIX.'pireps p ON (p.aircraft = a.id)
				  GROUP BY a.icao ORDER BY a.registration';

in the php page.

Modules are either on the admin panel or pilot/public side, not both at the same time. You will need to create a separate module for the admin panel.

Posted

For the fleet page I use this: http://forum.phpvms.net/topic/1522-fleet-table/ , with a query like this:

$sql = 'SELECT a.*, a.name AS aircraft,
				   COUNT(p.pirepid) AS routesflown,
				   SUM(p.distance) AS distance,
				   SEC_TO_TIME(SUM(p.flighttime*60*60)) AS totaltime,
				   AVG(p.distance) AS averagedistance,
				   AVG(p.flighttime) as averagetime
				  FROM   '.TABLE_PREFIX.'aircraft a
					LEFT OUTER JOIN '.TABLE_PREFIX.'pireps p ON (p.aircraft = a.id)
				  GROUP BY a.icao ORDER BY a.registration';

in the php page.

Modules are either on the admin panel or pilot/public side, not both at the same time. You will need to create a separate module for the admin panel.

Ok, is the .tpl files the seperation?

Edit: Is there a class or function that's cleaner than pulling direct sql?

Posted

Download that and you'll see why I pasted what I pasted.

Ok, I see why you had me look at that. And I appreciate the help that I'm getting :-)

That sql code, can it be put into a class file? Or should it just be labeled whatever.class.php or .tpl?

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...