Jump to content

Recommended Posts

Posted

If you like the structure of mine, ill be happy to post the code here, i got it from somewhere on these massive forums anyways :D

PS. just looking at your pilot roster, those rank images look unreal, great job ;)

Tylor

Posted
  On 1/1/2012 at 11:21 AM, Tylor Eddy said:

If you like the structure of mine, ill be happy to post the code here, i got it from somewhere on these massive forums anyways :D

PS. just looking at your pilot roster, those rank images look unreal, great job ;)

Tylor

If you want the image set, I can give them to you. About the roster code, that is exactly what I am looking for.Please share!!

Posted
  On 1/1/2012 at 7:40 PM, flyalaska said:

If you want the image set, I can give them to you. About the roster code, that is exactly what I am looking for.Please share!!

Thats ok, i was merly commenting on how they look ;)

as for my roster, you can find the basics below, i have take out all my styling so you can add your touch :)

<div id="content">
<?php $roster = PilotData::getAllPilots();  ?>
<?php
  if(!$roster)
  {
     echo 'There are no pilots!';
     return;
  }
?>
<table>
 <table id="tabledlist" class="other"> 

<thead>
<tr>
  <th width="160px">Pilot ID</th>
  <th width="220px">Name</th>
  <th width="120px">Rank</th>
  <th width="50px">Flights</th>
  <th width="100px">Hours</th>
  <th width="100px">HUB</th>
  <th width="128px">Vatsim ID</th>
  <th width="50px">Status</th>
</tr>
</thead>
<tbody>
<?php foreach($roster as $pilot) {
 if($pilot->retired == 1) { continue; }
?>
<tr>
  <TD ALIGN="center">
      <img src="<?php echo Countries::getCountryImage($pilot->location);?>"
        alt="<?php echo Countries::getCountryName($pilot->location);?>" align="absmiddle" />
 <a href="<?php echo SITE_URL?>/index.php/profile/view/<?php echo $pilot->pilotid?>">
        <?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a>
  </td>
  <TD ALIGN="left"> 


     <?php echo $pilot->firstname.' '.$pilot->lastname?>
  </td>
  <TD ALIGN="center"><img src="<?php echo $pilot->rankimage?>" alt="<?php echo $pilot->rank;?>" /></td>
  <TD ALIGN="center"><?php echo $pilot->totalflights?></td>
  <TD ALIGN="center"><?php echo Util::AddTime($pilot->totalhours, $pilot->transferhours); ?></td>
  <TD ALIGN="center"><?php echo $pilot->hub?></td>
  <td><div align="center">
     <?php $fieldvalue = PilotData :: GetFieldValue ( $pilot -> pilotid , 'Vatsim ID' );
if( $fieldvalue != '' )
{
echo '<a href="http://stats.vatsim.net/search_id.php?id=' . $fieldvalue . '" target="_blank">' . $fieldvalue . '</a></a>' ;
}
else
{
echo '<img src="http://yourwebsite.com/images/inactiveicon.png" width="20" height="18" border="0" alt="" /></a>' ;
}
?>
   </div></td>
  <TD ALIGN="center"><?php if($pilot->retired == 0) { ?>
<img src="http://yourwebsite.com/images/activeicon.png" alt="Active" />
	<?php } else { ?>
<img src="http://yourwebsite.com/images/inactiveicon.png" alt="Inactive" />
<?php } ?></td>

</td>

</tr>
<?php } ?>
</tbody>
</table>
</div>

Above is everything you'll need, i'll let you make all the changes you feel necessary ;)

Regards

Tylor

  • 6 months later...
Posted
  On 1/2/2012 at 4:23 AM, Tylor Eddy said:

Thats ok, i was merly commenting on how they look wink.gif

as for my roster, you can find the basics below, i have take out all my styling so you can add your touch smile.gif

<div id="content">
<?php $roster = PilotData::getAllPilots();  ?>
<?php
  if(!$roster)
  {
  echo 'There are no pilots!';
  return;
  }
?>
<table>
 <table id="tabledlist" class="other">

<thead>
<tr>
  <th width="160px">Pilot ID</th>
  <th width="220px">Name</th>
  <th width="120px">Rank</th>
  <th width="50px">Flights</th>
  <th width="100px">Hours</th>
  <th width="100px">HUB</th>
  <th width="128px">Vatsim ID</th>
  <th width="50px">Status</th>
</tr>
</thead>
<tbody>
<?php foreach($roster as $pilot) {
 if($pilot->retired == 1) { continue; }
?>
<tr>
  <TD ALIGN="center">
   <img src="<?php echo Countries::getCountryImage($pilot->location);?>"
	 alt="<?php echo Countries::getCountryName($pilot->location);?>" align="absmiddle" />
 <a href="<?php echo SITE_URL?>/index.php/profile/view/<?php echo $pilot->pilotid?>">
	 <?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a>
  </td>
  <TD ALIGN="left">


  <?php echo $pilot->firstname.' '.$pilot->lastname?>
  </td>
  <TD ALIGN="center"><img src="<?php echo $pilot->rankimage?>" alt="<?php echo $pilot->rank;?>" /></td>
  <TD ALIGN="center"><?php echo $pilot->totalflights?></td>
  <TD ALIGN="center"><?php echo Util::AddTime($pilot->totalhours, $pilot->transferhours); ?></td>
  <TD ALIGN="center"><?php echo $pilot->hub?></td>
  <td><div align="center">
  <?php $fieldvalue = PilotData :: GetFieldValue ( $pilot -> pilotid , 'Vatsim ID' );
if( $fieldvalue != '' )
{
echo '<a href="http://stats.vatsim.net/search_id.php?id=' . $fieldvalue . '" target="_blank">' . $fieldvalue . '</a></a>' ;
}
else
{
echo '<img src="http://yourwebsite.com/images/inactiveicon.png" width="20" height="18" border="0" alt="" /></a>' ;
}
?>
</div></td>
  <TD ALIGN="center"><?php if($pilot->retired == 0) { ?>
<img src="http://yourwebsite.com/images/activeicon.png" alt="Active" />
	<?php } else { ?>
<img src="http://yourwebsite.com/images/inactiveicon.png" alt="Inactive" />
<?php } ?></td>

</td>

</tr>
<?php } ?>
</tbody>
</table>
</div>

Above is everything you'll need, i'll let you make all the changes you feel necessary wink.gif

Regards

Tylor

I have tried bue I had this error:

errorvvq.png

All same pilot...

Posted
  On 7/16/2012 at 10:50 PM, cgentil said:

I have tried bue I had this error:

errorvvq.png

All same pilot...

Are you asking why the images are not showing? If so, have you changed the image links to your own website URL?

You need to change:

<img src="http://yourwebsite.com/images/activeicon.png" alt="Active" />

And

<img src="http://yourwebsite.com/images/inactiveicon.png" alt="Inactive" />

to your images.

Kindest Regards,

James

Posted
  On 7/17/2012 at 12:31 PM, James142 said:

Are you asking why the images are not showing? If so, have you changed the image links to your own website URL?

You need to change:

<img src="http://yourwebsite.com/images/activeicon.png" alt="Active" />

And

<img src="http://yourwebsite.com/images/inactiveicon.png" alt="Inactive" />

to your images.

Kindest Regards,

James

No I'am asking why I have only 1 pilot in company and in roster I have lot of pilots (but is only 1 pilot)...

  • Moderators
Posted

What do you mean only 1 pilot in company?

If you have a link, please post in here so we can get an idea on what your issue is really.

Cheers!

  • Moderators
Posted
  On 7/19/2012 at 10:00 PM, cgentil said:

Somehow, you must have two foreach in the code. Remove one of them and it should only show one.

  On 7/19/2012 at 10:02 PM, cgentil said:

One more question how I hide "view details" if pilots not logged in?

In schedules

http://teste90.netne.../schedules/view

EDIT: details or an error with message "you aren't logged in" ;)

You can do this...

<?php
if(!Auth::LoggedIn())
{
?>
<strong>Log in first before booking!</strong>
<?php
}
else
{
?>
<a href="<?php echo url('/schedules/details/'.$route->id);?>">View Details</a><br />
<?php
}
?>

Cheers!

Posted
  On 1/2/2012 at 4:23 AM, Tylor Eddy said:

Thats ok, i was merly commenting on how they look wink.gif

as for my roster, you can find the basics below, i have take out all my styling so you can add your touch smile.gif

<div id="content">
<?php $roster = PilotData::getAllPilots(); ?>
<?php
if(!$roster)
{
echo 'There are no pilots!';
return;
}
?>
<table>
<table id="tabledlist" class="other">

<thead>
<tr>
<th width="160px">Pilot ID</th>
<th width="220px">Name</th>
<th width="120px">Rank</th>
<th width="50px">Flights</th>
<th width="100px">Hours</th>
<th width="100px">HUB</th>
<th width="128px">Vatsim ID</th>
<th width="50px">Status</th>
</tr>
</thead>
<tbody>
<?php foreach($roster as $pilot) {
if($pilot->retired == 1) { continue; }
?>
<tr>
<TD ALIGN="center">
<img src="<?php echo Countries::getCountryImage($pilot->location);?>"
alt="<?php echo Countries::getCountryName($pilot->location);?>" align="absmiddle" />
<a href="<?php echo SITE_URL?>/index.php/profile/view/<?php echo $pilot->pilotid?>">
<?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a>
</td>
<TD ALIGN="left">


<?php echo $pilot->firstname.' '.$pilot->lastname?>
</td>
<TD ALIGN="center"><img src="<?php echo $pilot->rankimage?>" alt="<?php echo $pilot->rank;?>" /></td>
<TD ALIGN="center"><?php echo $pilot->totalflights?></td>
<TD ALIGN="center"><?php echo Util::AddTime($pilot->totalhours, $pilot->transferhours); ?></td>
<TD ALIGN="center"><?php echo $pilot->hub?></td>
<td><div align="center">
<?php $fieldvalue = PilotData :: GetFieldValue ( $pilot -> pilotid , 'Vatsim ID' );
if( $fieldvalue != '' )
{
echo '<a href="http://stats.vatsim.net/search_id.php?id=' . $fieldvalue . '" target="_blank">' . $fieldvalue . '</a></a>' ;
}
else
{
echo '<img src="http://yourwebsite.com/images/inactiveicon.png" width="20" height="18" border="0" alt="" /></a>' ;
}
?>
</div></td>
<TD ALIGN="center"><?php if($pilot->retired == 0) { ?>
<img src="http://yourwebsite.com/images/activeicon.png" alt="Active" />
	<?php } else { ?>
<img src="http://yourwebsite.com/images/inactiveicon.png" alt="Inactive" />
<?php } ?></td>

</td>

</tr>
<?php } ?>
</tbody>
</table>
</div>

Above is everything you'll need, i'll let you make all the changes you feel necessary wink.gif

Regards

Tylor

This is the code, what I have to edit?

Thanks.

Posted
  On 7/19/2012 at 10:22 PM, Kyle (Vansers) said:

Somehow, you must have two foreach in the code. Remove one of them and it should only show one.

You can do this...

<?php
if(!Auth::LoggedIn())
{
?>
<strong>Log in first before booking!</strong>
<?php
}
else
{
?>
<a href="<?php echo url('/schedules/details/'.$route->id);?>">View Details</a><br />
<?php
}
?>

Cheers!

But is possible do anything like this: http://teste90.netne.net/index.php/profile ?

An error when anybody open page without log in?

Regards!

  • Moderators
Posted

Clear out the pilot_list.tpl file, and put this code in the pilot_list.tpl

<div id="content">
<?php $roster = PilotData::getAllPilots(); ?>
<?php
if(!$roster)
{
echo 'There are no pilots!';
return;
}
?>
<table>
<table id="tabledlist" class="other">
<thead>
<tr>
<th width="160px">Pilot ID</th>
<th width="220px">Name</th>
<th width="120px">Rank</th>
<th width="50px">Flights</th>
<th width="100px">Hours</th>
<th width="100px">HUB</th>
<th width="128px">Vatsim ID</th>
<th width="50px">Status</th>
</tr>
</thead>
<tbody>
<?php foreach($roster as $pilot) {
if($pilot->retired == 1) { continue; }
?>
<tr>
<TD ALIGN="center">
<img src="<?php echo Countries::getCountryImage($pilot->location);?>"
alt="<?php echo Countries::getCountryName($pilot->location);?>" align="absmiddle" />
<a href="<?php echo SITE_URL?>/index.php/profile/view/<?php echo $pilot->pilotid?>">
<?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a>
</td>
<TD ALIGN="left">

<?php echo $pilot->firstname.' '.$pilot->lastname?>
</td>
<TD ALIGN="center"><img src="<?php echo $pilot->rankimage?>" alt="<?php echo $pilot->rank;?>" /></td>
<TD ALIGN="center"><?php echo $pilot->totalflights?></td>
<TD ALIGN="center"><?php echo Util::AddTime($pilot->totalhours, $pilot->transferhours); ?></td>
<TD ALIGN="center"><?php echo $pilot->hub?></td>
<td><div align="center">
<?php $fieldvalue = PilotData :: GetFieldValue ( $pilot -> pilotid , 'Vatsim ID' );
if( $fieldvalue != '' )
{
echo '<a href="http://stats.vatsim.net/search_id.php?id=' . $fieldvalue . '" target="_blank">' . $fieldvalue . '</a></a>' ;
}
else
{
echo '<img src="http://yourwebsite.com/images/inactiveicon.png" width="20" height="18" border="0" alt="" /></a>' ;
}
?>
</div></td>
<TD ALIGN="center"><?php if($pilot->retired == 0) { ?>
    <img src="http://yourwebsite.com/images/activeicon.png" alt="Active" />
		    <?php } else { ?>
    <img src="http://yourwebsite.com/images/inactiveicon.png" alt="Inactive" />
    <?php } ?></td>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>

Then with the schedule part...

<?php
if(!Auth::LoggedIn())
{
?>
<div id="error">Log in first before booking!</div>
<?php
}
else
{
?>
<a href="<?php echo url('/schedules/details/'.$route->id);?>">View Details</a><br />
<?php
}
?>

Cheers!

Posted

Don't work.

Check: http://teste90.netne...ndex.php/pilots

And for schedules page I want, a error in page (all page if pilot if not logged in), I think a code for Schedules.php...

Like this:

erroryl.png

I think code like this in Schedules.php

class Profile extends CodonModule
{

public function index()
{
if(!Auth::LoggedIn())
{
$this->set('message', 'You must be logged in to access this feature!');
$this->render('core_error.tpl');
return;
}

I've tried, but i've got a error: Parse error: syntax error, unexpected T_PUBLIC in /home/public_html/core/modules/Schedules/Schedules.php on line 31

  • Moderators
Posted

cgentil,

Can you paste from the start of Schedules.php up to line 100?

You may be missing a { or } to close out the function or something.

Cheers

  • Moderators
Posted

The rank image in signature, I think that part of the the phpVMS Beta. I wouldn't bother using Beta right now since it's not stable yet for VA operations yet.

Posted

There is:

<?php
/**
* phpVMS - Virtual Airline Administration Software
* Copyright (c) 2008 Nabeel Shahzad
* For more information, visit www.phpvms.net
* Forums: http://www.phpvms.net/forum
* Documentation: http://www.phpvms.net/docs
*
* phpVMS is licenced under the following license:
*   Creative Commons Attribution Non-commercial Share Alike (by-nc-sa)
*   View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/
*
* @author Nabeel Shahzad
* @copyright Copyright (c) 2008, Nabeel Shahzad
* @link http://www.phpvms.net
* @license http://creativecommons.org/licenses/by-nc-sa/3.0/
*/

class Schedules extends CodonModule
{
public function index()
{
$this->view();
}

public function view()
{
if(isset($this->post->action) && $this->post->action == 'findflight')
{
$this->FindFlight();
return;
}

$this->showSchedules();
}

public function detail($routeid='')
{
$this->details($routeid);
}

public function details($routeid = '')
{
//$routeid = $this->get->id;

if(!is_numeric($routeid))
{
preg_match('/^([A-Za-z]{3})(\d*)/', $routeid, $matches);
$code = $matches[1];
$flightnum = $matches[2];

$params = array('s.code'=>$code, 's.flightnum'=>$flightnum);
}
else
{
$params = array('s.id' => $routeid);
}

$schedule = SchedulesData::getScheduleDetailed($routeid);
$this->set('schedule', $schedule);
$this->render('schedule_details.tpl');
$this->render('route_map.tpl');
}

public function brief($routeid = '')
{ 
if($routeid == '')
{
$this->set('message', 'You must be logged in to access this feature!');
$this->render('core_error.tpl');
return;
}

$schedule = SchedulesData::getScheduleDetailed($routeid);
$this->set('schedule', $schedule);
$this->render('schedule_briefing.tpl');
}

public function boardingpass($routeid)
{
if($routeid == '')
{
$this->set('message', 'You must be logged in to access this feature!');
$this->render('core_error.tpl');
return;
}

$schedule = SchedulesData::getScheduleDetailed($routeid);

$this->set('schedule', $schedule);
$this->render('schedule_boarding_pass.tpl');
}

public function bids()
{
if(!Auth::LoggedIn()) return;

$this->set('bids', SchedulesData::GetBids(Auth::$userinfo->pilotid));
$this->render('schedule_bids.tpl');
}

public function addbid()
{
if(!Auth::LoggedIn()) return;

$routeid = $this->get->id;

if($routeid == '')
{
echo 'No route passed';
return;
}

// See if this is a valid route
$route = SchedulesData::findSchedules(array('s.id' => $routeid));

if(!is_array($route) && !isset($route[0]))
{
echo 'Invalid Route';
return;
}

CodonEvent::Dispatch('bid_preadd', 'Schedules', $routeid);

/* Block any other bids if they've already made a bid
*/
if(Config::Get('DISABLE_BIDS_ON_BID') == true)
{
$bids = SchedulesData::getBids(Auth::$userinfo->pilotid);

# They've got somethin goin on
if(count($bids) > 0)
{
echo 'You have already a flight assigned';
return;
}
}

$ret = SchedulesData::AddBid(Auth::$userinfo->pilotid, $routeid);
CodonEvent::Dispatch('bid_added', 'Schedules', $routeid);

if($ret == true)
{
echo 'Flight assigned';
}
else
{
echo 'Flight already assigned';
}
}

public function removebid()
{
if(!Auth::LoggedIn()) return;

SchedulesData::RemoveBid($this->post->id);
}

public function showSchedules()
{
$depapts = OperationsData::GetAllAirports();
$equip = OperationsData::GetAllAircraftSearchList(true);

$this->set('depairports', $depapts);
$this->set('equipment', $equip);

$this->render('schedule_searchform.tpl');

# Show the routes. Remote this to not show them.
$this->set('allroutes', SchedulesData::GetSchedules());

$this->render('schedule_list.tpl');
}

public function findFlight()
{

if($this->post->depicao != '')
{
$params = array('s.depicao' => $this->post->depicao);
}

if($this->post->arricao != '')
{
$params = array('s.arricao' => $this->post->arricao);
}

if($this->post->equipment != '')
{
$params = array('a.name' => $this->post->equipment);
}

if($this->post->distance != '')
{
if($this->post->type == 'greater')
$value = '> ';
else
$value = '< ';

$value .= $this->post->distance;

$params = array('s.distance' => $value);
}

$params['s.enabled'] = 1;
$this->set('allroutes', SchedulesData::findSchedules($params));
$this->render('schedule_results.tpl');
}

public function statsdaysdata($routeid)
{
$routeinfo = SchedulesData::findSchedules(array('s.id'=>$routeid));
$routeinfo = $routeinfo[0];

// Last 30 days stats
$data = PIREPData::getIntervalDataByDays(
array(
'p.code' => $routeinfo->code, 
'p.flightnum' => $routeinfo->flightnum,
), 30);

$this->create_line_graph('Schedule Flown Counts', $data);
}

protected function create_line_graph($title, $data)
{ 
if(!$data)
{
$data = array();
}

$titles = array();
$bar_titles = array();
foreach($data as $val)
{
$titles[] = $val->ym;
$values[] = floatval($val->total);
}

OFCharts::add_data_set($titles, $values);
echo OFCharts::create_line_graph($title);
}
}

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.

×
×
  • Create New...