当前位置: 首页>>代码示例>>PHP>>正文


PHP Current::write方法代码示例

本文整理汇总了PHP中Current::write方法的典型用法代码示例。如果您正苦于以下问题:PHP Current::write方法的具体用法?PHP Current::write怎么用?PHP Current::write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Current的用法示例。


在下文中一共展示了Current::write方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: login

 /**
  * ログイン処理
  *
  * @return void
  * @throws InternalErrorException
  **/
 public function login()
 {
     //ページタイトル
     $this->set('pageTitle', __d('auth', 'Login'));
     //メールを送れるかどうか
     $this->set('isMailSend', $this->ForgotPass->isMailSendCommon('auth', 'auth'));
     if ($this->request->is('post')) {
         //Auth->login()を実行すると、$this->UserがUsers.UserからModelAppに置き換わってしまい、
         //エラーになるため、変数に保持しておく。
         $User = $this->User;
         $this->Auth->authenticate['all']['scope'] = array('User.status' => '1');
         if ($this->Auth->login()) {
             $User->updateLoginTime($this->Auth->user('id'));
             Current::write('User', $this->Auth->user());
             if ($this->Auth->user('language') !== UserAttributeChoice::LANGUAGE_KEY_AUTO) {
                 $this->Session->write('Config.language', $this->Auth->user('language'));
             }
             $this->Auth->loginRedirect = $this->SiteSetting->getDefaultStartPage();
             return $this->redirect($this->Auth->redirect());
         }
         $this->NetCommons->setFlashNotification(__d('auth', 'Invalid username or password, try again'), array('class' => 'danger', 'interval' => NetCommonsComponent::ALERT_VALIDATE_ERROR_INTERVAL), 400);
         //$this->redirect($this->Auth->loginAction);
     }
 }
开发者ID:s-nakajima,项目名称:Auth,代码行数:30,代码来源:AuthController.php

示例2: getUserAttribures

 /**
  * UserAttribureデータ取得
  *
  * @return array
  */
 public function getUserAttribures()
 {
     if ($this->__userAttributes) {
         return $this->__userAttributes;
     }
     //モデルのロード
     $this->loadModels(['UserAttribute' => 'UserAttributes.UserAttribute']);
     //SiteSettingデータ取得
     Current::write('User.role_key', SiteSettingUtil::read('AutoRegist.role_key'));
     //UserAttributeデータ取得
     $this->__userAttributes = $this->UserAttribute->getUserAttriburesForAutoUserRegist(array('OR' => array('UserAttributeSetting.user_attribute_key' => array(UserAttribute::LOGIN_ID_FIELD, UserAttribute::PASSWORD_FIELD), array('UserAttributeSetting.required' => true, 'UserAttributeSetting.data_type_key' => array(DataType::DATA_TYPE_CHECKBOX, DataType::DATA_TYPE_RADIO, DataType::DATA_TYPE_SELECT)), array('UserAttributeSetting.required' => true, 'UserAttributeSetting.only_administrator_editable' => false), 'UserAttributeSetting.auto_regist_display' => true)));
     return $this->__userAttributes;
 }
开发者ID:s-nakajima,项目名称:Auth,代码行数:18,代码来源:AutoUserRegist.php

示例3: update

 /**
  * パスワード登録
  *
  * @return void
  **/
 public function update()
 {
     if ($this->request->is('put')) {
         if ($this->ForgotPass->savePassowrd($this->request->data)) {
             $this->NetCommons->setFlashNotification(__d('net_commons', 'Successfully saved.'), array('class' => 'success'));
             $this->Session->delete('ForgotPass');
             $this->Auth->authenticate['all']['scope'] = array('User.status' => '1');
             if ($this->Auth->login()) {
                 $this->User->updateLoginTime($this->Auth->user('id'));
                 Current::write('User', $this->Auth->user());
                 $this->Auth->loginRedirect = $this->SiteSetting->getDefaultStartPage();
                 return $this->redirect($this->Auth->redirect());
             }
             return $this->redirect('/auth/auth/login');
         }
         $this->NetCommons->handleValidationError($this->ForgotPass->validationErrors);
     } else {
         $this->request->data['User']['id'] = $this->Session->read('ForgotPass.user_id');
     }
 }
开发者ID:s-nakajima,项目名称:Auth,代码行数:25,代码来源:ForgotPassController.php

示例4: _testGetQueryOptions

 /**
  * getQueryOptions()のテスト
  *
  * @param int $userId ユーザID
  * @param int $status ステータス
  * @param array $options オプション
  * @param array $expected 期待値
  * @dataProvider dataProviderByFlatWOStatus
  * @return void
  */
 protected function _testGetQueryOptions($userId, $status, $options, $expected)
 {
     $model = $this->_modelName;
     $methodName = $this->_methodName;
     //データ生成
     if ($userId) {
         Current::write('User.id', $userId);
     }
     //テスト実施
     $result = $this->{$model}->find('all', Hash::merge(array('fields' => array('Topic.id', 'Topic.content_key', 'Topic.category_id', 'TopicReadable.id', 'TopicReadable.user_id', 'TopicUserStatus.id', 'Category.id')), $this->{$model}->{$methodName}($status, $options)));
     //チェック
     $this->assertEquals($result, $expected);
 }
开发者ID:s-nakajima,项目名称:Topics,代码行数:23,代码来源:TopicGetQueryOptionsTestCase.php


注:本文中的Current::write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。