當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Current::isControlPanel方法代碼示例

本文整理匯總了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'));
 }
開發者ID:akagane99,項目名稱:Users,代碼行數:42,代碼來源:UsersController.php


注:本文中的Current::isControlPanel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。