本文整理汇总了PHP中FOFInput::getData方法的典型用法代码示例。如果您正苦于以下问题:PHP FOFInput::getData方法的具体用法?PHP FOFInput::getData怎么用?PHP FOFInput::getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FOFInput
的用法示例。
在下文中一共展示了FOFInput::getData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: applySave
/**
* Common method to handle apply and save tasks
*
* @return boolean Returns true on success
*/
protected final function applySave()
{
// Load the model
$model = $this->getThisModel();
if (!$model->getId()) {
$model->setIDsFromRequest();
}
$id = $model->getId();
$data = $this->input->getData();
if (!$this->onBeforeApplySave($data)) {
return false;
}
// Set the layout to form, if it's not set in the URL
if (is_null($this->layout)) {
$this->layout = 'form';
}
// Do I have a form?
$model->setState('form_name', 'form.' . $this->layout);
$status = $model->save($data);
if ($status && $id != 0) {
JResponse::setHeader('Status', '201 Created', true);
// Try to check-in the record if it's not a new one
$status = $model->checkin();
if ($status) {
$status = $this->onAfterApplySave();
}
}
$this->input->set('id', $model->getId());
if (!$status) {
// Redirect on error
$id = $model->getId();
if ($customURL = $this->input->get('returnurl', '', 'string')) {
$customURL = base64_decode($customURL);
}
if (!empty($customURL)) {
$url = $customURL;
} elseif ($id != 0) {
$url = 'index.php?option=' . $this->component . '&view=' . $this->view . '&task=edit&id=' . $id . $this->getItemidURLSuffix();
} else {
$url = 'index.php?option=' . $this->component . '&view=' . $this->view . '&task=add' . $this->getItemidURLSuffix();
}
$this->setRedirect($url, '<li>' . implode('</li><li>', $model->getErrors()) . '</li>', 'error');
return false;
} else {
$session = JFactory::getSession();
$session->set($model->getHash() . 'savedata', null);
return true;
}
}
示例2: applySave
/**
* Common method to handle apply and save tasks
*
* @return boolean Returns true on success
*/
protected final function applySave()
{
// Load the model
$model = $this->getThisModel();
if (!$model->getId()) {
$model->setIDsFromRequest();
}
$id = $model->getId();
$data = $this->input->getData();
$this->onBeforeApplySave($data);
$status = $model->save($data);
if ($status && $id != 0) {
JResponse::setHeader('Status', '201 Created', true);
// Try to check-in the record if it's not a new one
$status = $model->checkin();
if ($status) {
$status = $this->onAfterApplySave();
}
}
$this->input->set('id', $model->getId());
if (!$status) {
// Redirect on error
$id = $model->getId();
if ($customURL = $this->input->get('returnurl', '', 'string')) {
$customURL = base64_decode($customURL);
}
$url = !empty($customURL) ? $customURL : 'index.php?option=' . $this->component . '&view=' . $this->view . '&task=edit&id=' . $id;
$this->setRedirect($url, '<li>' . implode('</li><li>', $model->getErrors()), 'error') . '</li>';
return false;
} else {
$session = JFactory::getSession();
$session->set($model->getHash() . 'savedata', null);
return true;
}
}