本文整理汇总了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');
}