本文整理匯總了PHP中Current::isControlPanel方法的典型用法代碼示例。如果您正苦於以下問題:PHP Current::isControlPanel方法的具體用法?PHP Current::isControlPanel怎麽用?PHP Current::isControlPanel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Current
的用法示例。
在下文中一共展示了Current::isControlPanel方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: edit
/**
* edit method
*
* @return void
*/
public function edit()
{
$this->helpers[] = 'Users.UserEditForm';
$this->__prepare();
if (Current::isControlPanel()) {
$this->ControlPanelLayout = $this->Components->load('ControlPanel.ControlPanelLayout');
} else {
$this->PageLayout = $this->Components->load('Pages.PageLayout');
}
if (Hash::get($this->viewVars['user'], 'User.id') !== Current::read('User.id')) {
return $this->throwBadRequest();
}
if ($this->request->is('put')) {
$redirectUrl = Hash::get($this->request->data, '_user.redirect');
if (array_key_exists('cancel', $this->request->data)) {
$this->NetCommons->setAppendHtml('<div class="hidden" ng-controller="Users.controller" ' . 'ng-init="showUser(null, ' . Current::read('User.id') . ')"></div>');
return $this->redirect($redirectUrl);
}
//登録処理
if ($this->User->saveUser($this->request->data, true)) {
//正常の場合
$this->NetCommons->setFlashNotification(__d('net_commons', 'Successfully saved.'), array('class' => 'success'));
$this->NetCommons->setAppendHtml('<div class="hidden" ng-controller="Users.controller" ' . 'ng-init="showUser(null, ' . Current::read('User.id') . ')"></div>');
return $this->redirect($redirectUrl);
}
$this->NetCommons->handleValidationError($this->User->validationErrors);
$this->request->data = Hash::merge($this->viewVars['user'], $this->request->data);
} else {
//表示処理
$this->User->languages = $this->viewVars['languages'];
$this->request->data = $this->viewVars['user'];
$redirectUrl = $this->request->referer(true);
}
$this->set('userCancel', SiteSettingUtil::read('UserCancel.use_cancel_feature', false));
$this->set('redirectUrl', $redirectUrl);
$this->set('activeUserId', Hash::get($this->viewVars['user'], 'User.id'));
}