本文整理汇总了PHP中PilotData::findPilots方法的典型用法代码示例。如果您正苦于以下问题:PHP PilotData::findPilots方法的具体用法?PHP PilotData::findPilots怎么用?PHP PilotData::findPilots使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PilotData
的用法示例。
在下文中一共展示了PilotData::findPilots方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Pilots::index()
*
* @return
*/
public function index()
{
// Get all of our hubs, and list pilots by hub
$allhubs = OperationsData::GetAllHubs();
if (!$allhubs) {
$allhubs = array();
}
foreach ($allhubs as $hub) {
$this->set('title', $hub->name);
$this->set('icao', $hub->icao);
$pilot_list = PilotData::findPilots(array('p.hub' => $hub->icao));
$this->set('allpilots', $pilot_list);
# deprecated
$this->set('pilot_list', $pilot_list);
$this->render('pilots_list.tpl');
}
$nohub = PilotData::findPilots(array('p.hub' => ''));
if (!$nohub) {
return;
}
$this->set('title', 'No Hub');
$this->set('icao', '');
$this->set('allpilots', $nohub);
# deprecated
$this->set('pilot_list', $nohub);
$this->render('pilots_list.tpl');
}
示例2: sendmail
public function sendmail()
{
$this->checkPermission(EMAIL_PILOTS);
echo '<h3>Sending email</h3>';
if ($this->post->subject == '' || trim($this->post->message) == '') {
$this->set('message', 'You must enter a subject and message!');
$this->render('core_error.php');
return;
}
if (count($this->post->groups) == 0) {
$this->set('message', 'You must select groups to send to!');
$this->render('core_error.php');
return;
}
echo 'Sending email...<br />';
$pilotarray = array();
//Begin the nice long assembly of e-mail addresses
foreach ($this->post->groups as $groupid) {
if ($groupid == 'all') {
$all_pilots = PilotData::findPilots(array());
foreach ($all_pilots as $pilot) {
$pilotarray[$pilot->pilotid] = $pilot;
}
break;
} else {
$tmp = PilotGroups::getUsersInGroup($groupid);
if (count($tmp) == 0 || !is_array($tmp)) {
continue;
}
foreach ($tmp as $pilot) {
$pilotarray[$pilot->pilotid] = $pilot;
}
}
}
$subject = DB::escape($this->post->subject);
$message = stripslashes($this->post->message) . PHP_EOL . PHP_EOL;
# Do some quick fixing of obvious formatting errors
$message = str_replace('<br>', '<br />', $message);
foreach ($pilotarray as $pilot) {
echo 'Sending for ' . $pilot->firstname . ' ' . $pilot->lastname . '<br />';
# Variable replacements
$send_message = str_replace('{PILOT_FNAME}', $pilot->firstname, $message);
$send_message = str_replace('{PILOT_LNAME}', $pilot->lastname, $send_message);
$send_message = str_replace('{PILOT_ID}', PilotData::GetPilotCode($pilot->code, $pilot->pilotid), $send_message);
$send_message = utf8_encode($send_message);
Util::SendEmail($pilot->email, $subject, $send_message);
}
echo 'Complete!';
LogData::addLog(Auth::$userinfo->pilotid, 'Sent pass mail');
return;
}
示例3: changepilotid
/**
* Maintenance::changepilotid()
*
* @return
*/
public function changepilotid()
{
CodonModule::checkPermission(MAINTENANCE);
CodonModule::checkPermission(EDIT_PILOTS);
echo '<h3>Change Pilot ID</h3>';
if (isset($this->post->submit)) {
$error = false;
if (!is_numeric($this->post->new_pilotid)) {
$error = true;
$this->set('message', 'The pilot ID isn\'t numeric!');
$this->render('core_error.php');
return;
}
if ($this->post->new_pilotid < 1) {
$error = true;
$this->set('message', 'You cannot have an ID less than 1');
$this->render('core_error.php');
return;
}
if (empty($this->post->new_pilotid)) {
$error = true;
$this->set('message', 'The pilot ID is blank!');
$this->render('core_error.php');
return;
}
if (empty($this->post->old_pilotid) || $this->post->old_pilotid == 0) {
$error = true;
$this->set('message', 'No pilot selected');
$this->render('core_error.php');
return;
}
$pilot = PilotData::getPilotData($this->post->new_pilotid);
if (is_object($pilot)) {
$error = true;
$this->set('message', 'This ID is already used!');
$this->render('core_error.php');
return;
}
if ($error === false) {
PilotData::changePilotID($this->post->old_pilotid, $this->post->new_pilotid);
$this->set('message', "Pilot ID changed from {$this->post->old_pilotid} to {$this->post->new_pilotid}");
$this->render('core_success.php');
}
}
$this->set('allpilots', PilotData::findPilots(array()));
$this->render('maintenance_changepilotid.php');
}
示例4: changepilotid
public function changepilotid()
{
echo '<h3>Change Pilot ID</h3>';
if (isset($this->post->submit)) {
$error = false;
if (!is_numeric($this->post->new_pilotid)) {
$error = true;
$this->set('message', 'The pilot ID isn\'t numeric!');
$this->render('core_error.tpl');
return;
}
if ($this->post->new_pilotid < 1) {
$error = true;
$this->set('message', 'You cannot have an ID less than 1');
$this->render('core_error.tpl');
return;
}
if (empty($this->post->new_pilotid)) {
$error = true;
$this->set('message', 'The pilot ID is blank!');
$this->render('core_error.tpl');
return;
}
if (empty($this->post->old_pilotid) || $this->post->old_pilotid == 0) {
$error = true;
$this->set('message', 'No pilot selected');
$this->render('core_error.tpl');
return;
}
$pilot = PilotData::getPilotData($this->post->new_pilotid);
if (is_object($pilot)) {
$error = true;
$this->set('message', 'This ID is already used!');
$this->render('core_error.tpl');
return;
}
if ($error === false) {
PilotData::changePilotID($this->post->old_pilotid, $this->post->new_pilotid);
CodonEvent::Dispatch('pilotid_changed', 'Maintenance', array('old_pilotid' => $this->post->old_pilotid, 'new_pilotid' => $this->post->new_pilotid));
$this->set('message', "Pilot ID changed from {$this->post->old_pilotid} to {$this->post->new_pilotid}");
$this->render('core_success.tpl');
}
}
$this->set('allpilots', PilotData::findPilots(array()));
$this->render('maintenance_changepilotid.tpl');
}
示例5: dirname
<?php
include dirname(__FILE__) . '/bootstrap.inc.php';
echo '<pre>';
$pilot = PilotData::findPilots(array('p.totalflights > 0'));
$idx = rand(0, count($pilot) - 1);
$pilot = $pilot[$idx];
RanksData::calculateUpdatePilotRank($pilot->pilotid);
示例6: getpilotsjson
public function getpilotsjson()
{
$page = $this->get->page;
// get the requested page
$limit = $this->get->rows;
// get how many rows we want to have into the grid
$sidx = $this->get->sidx;
// get index row - i.e. user click to sort
$sord = $this->get->sord;
// get the direction
if (!$sidx) {
$sidx = 1;
}
/* Do the search using jqGrid */
$where = array();
if ($this->get->_search == 'true') {
$searchstr = jqgrid::strip($this->get->filters);
$where_string = jqgrid::constructWhere($searchstr);
# Append to our search, add 1=1 since it comes with AND
# from above
$where[] = "1=1 {$where_string}";
}
Config::Set('PILOT_ORDER_BY', "{$sidx} {$sord}");
# Do a search without the limits so we can find how many records
$count = count(PilotData::findPilots($where));
if ($count > 0) {
$total_pages = ceil($count / $limit);
} else {
$total_pages = 0;
}
if ($page > $total_pages) {
$page = $total_pages;
}
$start = $limit * $page - $limit;
// do not put $limit*($page - 1)
if ($start < 0) {
$start = 0;
}
# And finally do a search with the limits
$allpilots = PilotData::findPilots($where, $limit, $start);
if (!$allpilots) {
$allpilots = array();
}
# Form the json header
$json = array('page' => $page, 'total' => $total_pages, 'records' => $count, 'rows' => array());
# Add each row to the above array
foreach ($allpilots as $row) {
$pilotid = PilotData::getPilotCode($row->code, $row->pilotid);
$status = $row->retired == 0 ? 'Active' : 'Retired';
$location = '<img src="' . Countries::getCountryImage($row->location) . '" alt="' . $row->location . '" />';
$edit = '<a href="' . adminurl('/pilotadmin/viewpilots?action=viewoptions&pilotid=' . $row->pilotid) . '">Edit</a>';
$tmp = array('id' => $row->id, 'cell' => array($row->id, $pilotid, $row->firstname, $row->lastname, $row->email, $location, $status, $row->rank, $row->totalflights, $row->totalhours, $row->lastip, $edit));
$json['rows'][] = $tmp;
}
header("Content-type: text/x-json");
echo json_encode($json);
}