/** * StatsTest::testPilotCount() * * @return void */ public function testPilotCount() { $total = DB::get_row('SELECT COUNT(*) AS `total` FROM phpvms_pilots'); $this->assertEquals($total->total, StatsData::PilotCount(), 'StatsData::getPilotCount(NO CODE)'); $airlines = OperationsData::getAllAirlines(true); foreach ($airlines as $airline) { $pilotCount = StatsData::PilotCount($airline->code); $total = DB::get_row('SELECT COUNT(*) AS `total` FROM phpvms_pilots WHERE `code`=\'' . $airline->code . '\' GROUP BY `code`'); $this->assertEquals($total->total, $pilotCount, 'StatsData::getPilotCount(' . $airline->code . ')'); } }
public static function send_vastats() { if (!self::central_enabled()) { return false; } if (self::$debug === false) { $within_timelimit = CronData::check_hoursdiff('update_vainfo', self::$limits['update_vainfo']); if ($within_timelimit == true) { return false; } } self::set_xml('update_vainfo'); self::$xml->addChild('pilotcount', StatsData::PilotCount()); self::$xml->addChild('totalhours', StatsData::TotalHours()); self::$xml->addChild('totalflights', StatsData::TotalFlights()); self::$xml->addChild('totalschedules', StatsData::TotalSchedules()); # Expenses stuff /*$exp_data = FinanceData::getExpensesForMonth(time()); self::$xml->addChild('expenses', $exp_data->total); self::$xml->addChild('expensescost', $exp_data->cost);*/ # Some of the settings self::$xml->addChild('livefuel', Config::Get('FUEL_GET_LIVE_PRICE')); # Package and send CronData::set_lastupdate('update_vainfo'); return self::send_xml(); }
/** * CentralData::send_vastats() * * @return */ public static function send_vastats() { if (!self::central_enabled()) { return false; } if (self::$debug === false) { $within_timelimit = CronData::check_hoursdiff('update_vainfo', self::$limits['update_vainfo']); if ($within_timelimit == true) { return false; } } self::startBody('update_vainfo'); self::addElement(null, 'pilotcount', StatsData::PilotCount()); self::addElement(null, 'totalhours', StatsData::TotalHours()); self::addElement(null, 'totalflights', StatsData::TotalFlights()); self::addElement(null, 'totalschedules', StatsData::TotalSchedules()); $all_news = SiteData::getAllNews(); if (count($all_news) > 0) { $news_parent = self::addElement(null, 'newsitems'); foreach ($all_news as $news) { $body = str_ireplace('<br>', "\n", $news->body); $body = str_ireplace('<br />', "\n", $body); $body = htmlentities(strip_tags($body)); $news_xml = self::addElement($news_parent, 'news', null, array('id' => $news->id, 'subject' => $news->subject, 'body' => $body, 'postdate' => $news->postdate, 'postedby' => $news->postedby)); } } # Some of the settings self::addElement(null, 'livefuel', Config::Get('FUEL_GET_LIVE_PRICE')); # Package and send CronData::set_lastupdate('update_vainfo'); return self::sendToCentral(); }
?> <h3>VA Stats:</h3> <table width="100%"> <tr> <td valign="top" width="33%" nowrap="nowrap"> <strong>Users Online: </strong><?php echo count(StatsData::UsersOnline()); ?> <br /> <strong>Guests Online: </strong><?php echo count(StatsData::GuestsOnline()); ?> </td> <td valign="top" width="33%" nowrap="nowrap" > <strong>Total Pilots: </strong><?php echo StatsData::PilotCount(); ?> <br /> <strong>Total Flights: </strong><?php echo StatsData::TotalFlights(); ?> <br /> <strong>Total Hours Flown: </strong><?php echo StatsData::TotalHours(); ?> </td> <td valign="top" width="33%" nowrap="nowrap" > <strong>Miles Flown: </strong><?php echo StatsData::TotalMilesFlown(); ?> <br />
echo StatsData::TotalHours(); ?> <br /> </div> <?php foreach ($allairlines as $airline) { ?> <h4>Stats for <?php echo $airline->name; ?> </h4> <div class="outlined"> <strong>Total Pilots: </strong><?php echo StatsData::PilotCount($airline->code); ?> <br /> <strong>Total Flights: </strong><?php echo StatsData::TotalFlights($airline->code); ?> <br /> <strong>Total Hours Flown: </strong><?php echo StatsData::TotalHours($airline->code); ?> <br /> </div> <?php } if (is_array($acstats)) {
<form method="post" action="<?php echo adminurl('/massmailer/sendmail'); ?> "> <p> <strong>Subject: </strong> <input type="text" name="subject" value="" /> </p> <p> <strong>Message:</strong> </p> <p> <textarea name="message" id="editor" style="width: 600px; height: 250px;">To: {PILOT_FNAME} {PILOT_LNAME}, </textarea> </p> <p>Select groups to send to:<br /> <?php $total = StatsData::PilotCount(); ?> <input type="checkbox" name="groups[]" value="all" />All Pilots (<?php echo $total; ?> pilots)<br /> <?php foreach ($allgroups as $group) { $total = count(PilotGroups::getUsersInGroup($group->groupid)); echo "<input type=\"checkbox\" name=\"groups[]\" value=\"{$group->groupid}\" />{$group->name} - ({$total} pilots)<br />"; } ?> </p> <p> <input type="submit" name="submit" value="Send Email" />