本文整理匯總了PHP中PilotData::changePilotID方法的典型用法代碼示例。如果您正苦於以下問題:PHP PilotData::changePilotID方法的具體用法?PHP PilotData::changePilotID怎麽用?PHP PilotData::changePilotID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PilotData
的用法示例。
在下文中一共展示了PilotData::changePilotID方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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');
}
示例2: 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');
}