本文整理汇总了PHP中LeftAndMain::save方法的典型用法代码示例。如果您正苦于以下问题:PHP LeftAndMain::save方法的具体用法?PHP LeftAndMain::save怎么用?PHP LeftAndMain::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LeftAndMain
的用法示例。
在下文中一共展示了LeftAndMain::save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save($data, $form)
{
$member = DataObject::get_by_id("Member", $data['ID']);
if (!$member) {
return $this->httpError(404);
}
$origLocale = $member->Locale;
if (!$member->canEdit()) {
$form->sessionMessage(_t('Member.CANTEDIT', 'You don\'t have permission to do that'), 'bad');
return $this->redirectBack();
}
$response = parent::save($data, $form);
if ($origLocale != $data['Locale']) {
$response->addHeader('X-Reload', true);
$response->addHeader('X-ControllerURL', $this->Link());
}
return $response;
}
示例2: save
public function save($urlParams, $form)
{
// Don't save the root folder - there's no database record
if ($_REQUEST['ID'] == 'root') {
FormResponse::status_message('Saved', 'good');
return FormResponse::respond();
}
$form->dataFieldByName('Name')->Value = $form->dataFieldByName('Title')->Value();
return parent::save($urlParams, $form);
}
示例3: save
/**
* Save the content source/item.
*/
public function save($urlParams, $form)
{
// Retrieve the record.
$record = null;
if (isset($urlParams['ID'])) {
$record = ExternalContent::getDataObjectFor($urlParams['ID']);
}
if (!$record) {
return parent::save($urlParams, $form);
}
if ($record->canEdit()) {
// lets load the params that have been sent and set those that have an editable mapping
if ($record->hasMethod('editableFieldMapping')) {
$editable = $record->editableFieldMapping();
$form->saveInto($record, array_keys($editable));
$record->remoteWrite();
} else {
$form->saveInto($record);
$record->write();
}
// Set the form response.
$this->response->addHeader('X-Status', rawurlencode(_t('LeftAndMain.SAVEDUP', 'Saved.')));
} else {
$this->response->addHeader('X-Status', rawurlencode(_t('LeftAndMain.SAVEDUP', 'You don\'t have write access.')));
}
return $this->getResponseNegotiator()->respond($this->request);
}