本文整理匯總了PHP中PilotData::SaveFields方法的典型用法代碼示例。如果您正苦於以下問題:PHP PilotData::SaveFields方法的具體用法?PHP PilotData::SaveFields怎麽用?PHP PilotData::SaveFields使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PilotData
的用法示例。
在下文中一共展示了PilotData::SaveFields方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: savepro
public function savepro()
{
if ($this->post->firstname == '' || $this->post->lastname == '') {
$this->set('message', 'The first or lastname cannot be blank!');
$this->render('core_error.tpl');
return;
}
$params = array('firstname' => $this->post->firstname, 'lastname' => $this->post->lastname, 'email' => $this->post->email, 'hub' => $this->post->hub, 'retired' => $this->post->retired, 'totalflights' => $this->post->totalflights, 'totalpay' => floatval($this->post->totalpay), 'transferhours' => $this->post->transferhours);
PilotData::updateProfile($this->post->pilotid, $params);
PilotData::SaveFields($this->post->pilotid, $_POST);
/* Don't calculate a pilot's rank if this is set */
if (Config::Get('RANKS_AUTOCALCULATE') == false) {
PilotData::changePilotRank($this->post->pilotid, $this->post->rank);
} else {
RanksData::calculateUpdatePilotRank($this->post->pilotid);
}
StatsData::UpdateTotalHours();
$this->set('message', 'Profile updated successfully');
$this->render('core_success.tpl');
$this->set('pilots', PilotData::getAllPilots());
$this->render('/pm/pilot_manager.php');
if ($this->post->resend_email == 'true') {
$this->post->id = $this->post->pilotid;
$this->resendemail(false);
}
$pilot = PilotData::getPilotData($this->post->pilotid);
LogData::addLog(Auth::$userinfo->pilotid, 'Updated profile for ' . PilotData::getPilotCode($pilot->code, $pilot->pilotid) . ' ' . $pilot->firstname . ' ' . $pilot->lastname);
return;
break;
}
示例2: save_profile_post
protected function save_profile_post()
{
if (!Auth::LoggedIn()) {
$this->set('message', 'You must be logged in to access this feature!');
$this->render('core_error.tpl');
return;
}
$userinfo = Auth::$userinfo;
//TODO: check email validity
if ($this->post->email == '') {
return;
}
$params = array('code' => Auth::$userinfo->code, 'email' => $this->post->email, 'location' => $this->post->location, 'hub' => Auth::$userinfo->hub, 'bgimage' => $this->post->bgimage, 'retired' => false);
PilotData::updateProfile($userinfo->pilotid, $params);
PilotData::SaveFields($userinfo->pilotid, $_POST);
# Generate a fresh signature
PilotData::GenerateSignature($userinfo->pilotid);
PilotData::SaveAvatar($userinfo->code, $userinfo->pilotid);
$this->set('message', 'Profile saved!');
$this->render('core_success.tpl');
}
示例3: viewpilots
public function viewpilots()
{
/* This function is called for *ANYTHING* in that popup box
Preset all of the template items in this function and
call them in the subsequent templates
Confusing at first, but easier than loading each tab
independently via AJAX. Though may be an option later
on, but can certainly be done by a plugin (Add another
tab through AJAX). The hook is available for whoever
wants to use it
*/
switch ($this->post->action) {
case 'changepassword':
$this->ChangePassword();
return;
break;
case 'deletepilot':
$pilotid = $this->post->pilotid;
$pilotinfo = PilotData::getPilotData($pilotid);
PilotData::DeletePilot($pilotid);
CodonEvent::Dispatch('pilot_deleted', 'PilotAdmin', $pilot);
$this->set('message', Lang::gs('pilot.deleted'));
$this->render('core_success.tpl');
LogData::addLog(Auth::$userinfo->pilotid, 'Deleted pilot ' . PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid) . ' ' . $pilotinfo->firstname . ' ' . $pilotinfo->lastname);
break;
/* These are reloaded into the #pilotgroups ID
so the entire groups list is refreshed
*/
/* These are reloaded into the #pilotgroups ID
so the entire groups list is refreshed
*/
case 'addgroup':
$this->AddPilotToGroup();
$this->SetGroupsData($this->post->pilotid);
$this->render('pilots_groups.tpl');
return;
break;
case 'removegroup':
$this->RemovePilotGroup();
$this->SetGroupsData($this->post->pilotid);
$this->render('pilots_groups.tpl');
return;
break;
case 'saveprofile':
if ($this->post->firstname == '' || $this->post->lastname == '') {
$this->set('message', 'The first or lastname cannot be blank!');
$this->render('core_error.tpl');
return;
}
if (intval($this->post->retired) == 1) {
$retired = true;
} else {
$retired = false;
}
$params = array('code' => $this->post->code, 'firstname' => $this->post->firstname, 'lastname' => $this->post->lastname, 'email' => $this->post->email, 'location' => $this->post->location, 'hub' => $this->post->hub, 'retired' => $retired, 'totalhours' => $this->post->totalhours, 'totalflights' => $this->post->totalflights, 'totalpay' => floatval($this->post->totalpay), 'payadjust' => floatval($this->post->payadjust), 'transferhours' => $this->post->transferhours, 'comment' => $this->post->comment);
PilotData::updateProfile($this->post->pilotid, $params);
PilotData::SaveFields($this->post->pilotid, $_POST);
/* Don't calculate a pilot's rank if this is set */
if (Config::Get('RANKS_AUTOCALCULATE') == false) {
PilotData::changePilotRank($this->post->pilotid, $this->post->rank);
} else {
RanksData::calculateUpdatePilotRank($this->post->pilotid);
}
StatsData::UpdateTotalHours();
$this->set('message', 'Profile updated successfully');
$this->render('core_success.tpl');
$pilot = PilotData::getPilotData($this->post->pilotid);
LogData::addLog(Auth::$userinfo->pilotid, 'Updated profile for ' . PilotData::getPilotCode($pilot->code, $pilot->pilotid) . ' ' . $pilot->firstname . ' ' . $pilot->lastname);
return;
break;
}
if ($this->get->action == 'viewoptions') {
$this->ViewPilotDetails();
return;
}
$this->ShowPilotsList();
}