本文整理汇总了PHP中PilotData::UpdateLastPIREPDate方法的典型用法代码示例。如果您正苦于以下问题:PHP PilotData::UpdateLastPIREPDate方法的具体用法?PHP PilotData::UpdateLastPIREPDate怎么用?PHP PilotData::UpdateLastPIREPDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PilotData
的用法示例。
在下文中一共展示了PilotData::UpdateLastPIREPDate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fileReport
//.........这里部分代码省略.........
/* The schedule does have route information, and it's already been cached */
$pirepdata['route_details'] = $sched->route_details;
}
}
/* This setting forces the next code to automatically
calculate a load value for this current PIREP */
if (Config::Get('PIREP_OVERRIDE_LOAD') == true) {
$pirepdata['load'] == '';
}
# Check the load, if it's blank then look it up
# Based on the aircraft that was flown
if (!isset($pirepdata['load']) || empty($pirepdata['load'])) {
$pirepdata['load'] = FinanceData::getLoadCount($pirepdata['aircraft'], $sched->flighttype);
}
/* If the distance isn't supplied, then calculate it */
if (!isset($pirepdata['distance']) || empty($pirepdata['distance'])) {
$pirepdata['distance'] = OperationsData::getAirportDistance($depapt, $arrapt);
}
/* See if there's a landing rate */
if (!isset($pirepdata['landingrate']) || empty($pirepdata['landingrate'])) {
$pirepdata['landingrate'] = 0;
}
/* Any "raw" parameterized data which needs to be added */
if (isset($pirepdata['rawdata'])) {
$pirepdata['rawdata'] = serialize($pirepdata['rawdata']);
} else {
$pirepdata['rawdata'] = '';
}
/* Escape the comment field */
//$pirepdata['log'] = DB::escape($pirepdata['log']);
if (isset($pirepdata['comment'])) {
$comment = DB::escape($pirepdata['comment']);
unset($pirepdata['comment']);
}
/* Proper timestamp */
$pirepdata['flighttime'] = str_replace(':', '.', $pirepdata['flighttime']);
$pirepdata['flighttime_stamp'] = str_replace('.', ':', $pirepdata['flighttime']) . ':00';
/* Export status as 0 */
$pirepdata['exported'] = 0;
$pirepdata['submitdate'] = 'NOW()';
$pirepdata['modifieddate'] = 'NOW()';
$pirepdata['accepted'] = PIREP_PENDING;
$pirepdata['expenselist'] = '0';
$pirepdata['flighttype'] = $sched->flighttype;
# Do the insert based on the columns here
$cols = array();
$col_values = array();
foreach ($pirepdata as $key => $value) {
if ($key == 'submitdate') {
$value = 'NOW()';
} elseif ($key == 'comment') {
continue;
} else {
$value = "'" . DB::escape($value) . "'";
}
$cols[] = "`{$key}`";
$col_values[] = $value;
}
$cols = implode(', ', $cols);
$col_values = implode(', ', $col_values);
$sql = 'INSERT INTO ' . TABLE_PREFIX . "pireps ({$cols}) VALUES ({$col_values});";
DB::query($sql);
$pirepid = DB::$insert_id;
// Add the comment if its not blank
if ($comment != '') {
self::addComment($pirepid, $pirepdata['pilotid'], $comment);
}
# Update the financial information for the PIREP, true to refresh fuel
self::PopulatePIREPFinance($pirepid, true);
# Do other assorted tasks that are along with a PIREP filing
# Update the flown count for that route
self::UpdatePIREPFeed();
# Update any pilot's information
$pilotinfo = PilotData::getPilotData($pirepdata['pilotid']);
$pilotcode = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid);
PilotData::UpdateLastPIREPDate($pilotinfo->pilotid);
if (Config::Get('EMAIL_SEND_PIREP') === true) {
# Send an email to the admin that a PIREP was submitted
$sub = "A PIREP has been submitted by {$pilotcode} ({$pirepdata['depicao']} - {$pirepdata['arricao']})";
$message = "A PIREP has been submitted by {$pilotcode} " . "({$pilotinfo->firstname} {$pilotinfo->lastname})\n\n" . "{$pirepdata['code']}{$pirepdata['flightnum']}: {$pirepdata['depicao']} to {$pirepdata['arricao']}\n" . "Aircraft: {$pirepdata['aircraft']}\n" . "Flight Time: {$pirepdata['flighttime']}\n" . "Landing Rate: {$pirepdata['landingrate']}\n" . "Filed using: {$pirepdata['source']}\n\n" . "Comment: {$comment}\n\n" . "Click to approve this pirep (admin must be signed in):\n" . adminurl('/pirepadmin/approvepirep/' . $pirepid);
$email = Config::Get('EMAIL_NEW_PIREP');
if (empty($email)) {
$email = ADMIN_EMAIL;
}
Util::SendEmail($email, $sub, $message);
}
/* Add this into the activity feed */
$message = Lang::get('activity.new.pirep');
foreach ($pirepdata as $key => $value) {
$message = str_replace('$' . $key, $value, $message);
}
# Add it to the activity feed
ActivityData::addActivity(array('pilotid' => $pirepdata['pilotid'], 'type' => ACTIVITY_NEW_PIREP, 'refid' => $pirepid, 'message' => htmlentities($message)));
/* Now send data to vaCentral */
CentralData::send_pirep($pirepid);
// Reset this ID back
DB::$insert_id = $pirepid;
self::$pirepid = $pirepid;
return $pirepid;
}