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