本文整理匯總了PHP中PilotData::UpdateFlightHours方法的典型用法代碼示例。如果您正苦於以下問題:PHP PilotData::UpdateFlightHours方法的具體用法?PHP PilotData::UpdateFlightHours怎麽用?PHP PilotData::UpdateFlightHours使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PilotData
的用法示例。
在下文中一共展示了PilotData::UpdateFlightHours方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: resethours
/**
* Maintenance::resethours()
*
* @return
*/
public function resethours()
{
CodonModule::checkPermission(MAINTENANCE);
echo '<h3>Updating Total Hours Count</h3>';
$total = 0;
echo '<p>Calculating hours for all pilots: <br />';
$allpilots = PilotData::GetAllPilots();
foreach ($allpilots as $pilot) {
$hours = PilotData::UpdateFlightHours($pilot->pilotid);
$total = Util::AddTime($total, $hours);
echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid) . " - found {$hours} flight hours for number <br />";
}
echo "Pilots have a total of <strong>{$total} hours</strong><br /><br />";
echo "<strong>Now counting from PIREPS</strong><br />";
StatsData::UpdateTotalHours();
echo 'Found ' . StatsData::TotalHours() . ' total hours, updated<br /></p>';
LogData::addLog(Auth::$userinfo->pilotid, 'Reset hours');
}
示例2: foreach
if ($version < 11700) {
echo '<p>Updating your database...</p>';
Installer::add_to_config('TRANSFER_HOURS_IN_RANKS', false, 'Include the transfer hours in ranks');
Installer::sql_file_update(SITE_ROOT . '/install/update_700.sql');
# Specific Checks
$sql = 'SELECT *
FROM ' . TABLE_PREFIX . "settings\n\t\t\t\t\tWHERE name='TOTAL_HOURS'";
$res = DB::get_row($sql);
if (!$res) {
$sql = "INSERT INTO `phpvms_settings` (`friendlyname`, `name`, `value`,`descrip`,`core`)\n\t\t\tVALUES ('Total Hours', 'TOTAL_HOURS', '', 'These are the total hours your VA has flown', '0')";
DB::query($sql);
}
echo '<strong>Updating hours</strong><br />';
$allpilots = PilotData::GetAllPilots();
foreach ($allpilots as $pilot) {
$hours = PilotData::UpdateFlightHours($pilot->pilotid);
$total = Util::AddTime($total, $hours);
}
echo "Pilots have a total of <strong>{$total} hours</strong><br /><br />";
echo "<strong>Updating PIREPS Hours</strong><br />";
StatsData::UpdateTotalHours();
echo 'Found ' . StatsData::TotalHours() . ' total hours, updated<br />';
}
if ($version < 20854) {
Installer::add_to_config('USERS_ONLINE_TIME', 20, 'The StatsData::UserOnline() function - how many minutes to check');
Installer::sql_file_update(SITE_ROOT . '/install/update_854.sql');
}
Installer::sql_file_update(SITE_ROOT . '/install/update.sql');
OperationsData::updateAircraftRankLevels();
/* Add them to the default group */
$allpilots = PilotData::GetAllPilots();