selfhosted/controllers/UserController.php
/**
     * Displays profile page.
     *
     * @return mixed
     */
Displays profile page.
@return mixed
Displays profile page . @return mixed
public function actionProfile()
    {
        $User = SelfHostUsers::findIdentity($this->SelfHostUser->getId());
        $model_changepassword = new ChangePasswordForm();
        if (isset($_POST['ChangePasswordStep1'])) {
            if ($model_changepassword->changePasswordStep1()) {
                Yii::$app->getSession()->setFlash('success', [
                    'message'   => Yii::t('app/flash-messages', 'Profile_ChangePasswordForm_success'),
                    'ttl'       => FLASH_MESSAGES_TTL,
                    'showClose' => true,
                    'alert_action' => 'actionProfile.ChangePasswordForm',
                ]);
            } else {
                Yii::$app->getSession()->setFlash('error', [
                    'message'   => Yii::t('app/flash-messages', 'Profile_ChangePasswordForm_error'),
                    'ttl'       => FLASH_MESSAGES_TTL,
                    'showClose' => true,
                    'alert_action' => 'actionProfile.ChangePasswordForm',
                ]);
            }
            return $this->redirect(['profile']);
        }
        $model_changetimezone = new SetTimeZoneOffsetForm();
        $model_changetimezone->timezone_offset_seconds = $User->static_timezone;
        if ($model_changetimezone->load(Yii::$app->request->post()) && $model_changetimezone->validate()) {
            if ($model_changetimezone->setStaticTimeZone($User)) {
                Yii::$app->getSession()->setFlash('success', [
                    'message'   => Yii::t('app/flash-messages', 'Profile_ChangeTimeZone_success'),
                    'ttl'       => FLASH_MESSAGES_TTL,
                    'showClose' => true,
                    'alert_action' => 'actionProfile.SetTimeZoneOffsetForm',
                ]);
            } else {
                Yii::$app->getSession()->setFlash('error', [
                    'message'   => Yii::t('app/flash-messages', 'Profile_ChangeTimeZone_error'),
                    'ttl'       => FLASH_MESSAGES_TTL,
                    'showClose' => true,
                    'alert_action' => 'actionProfile.SetTimeZoneOffsetForm',
                ]);
            }
            return $this->redirect(['profile']);
        }
        return $this->render('profile', [
            'model_changepassword' => $model_changepassword,
            'model_changetimezone' => $model_changetimezone,
        ]);
    }
public function actionProfile ( ) { $ User = SelfHostUsers :: findIdentity ( $ this -> SelfHostUser -> getId ( ) ) ; $ model_changepassword = new ChangePasswordForm ( ) ; if ( isset ( $ _POST [ 'ChangePasswordStep1' ] ) ) { if ( $ model_changepassword -> changePasswordStep1 ( ) ) { Yii :: $ app -> getSession ( ) -> setFlash ( 'success' , [ 'message' => Yii :: t ( 'app/flash-messages' , 'Profile_ChangePasswordForm_success' ) , 'ttl' => FLASH_MESSAGES_TTL , 'showClose' => true , 'alert_action' => 'actionProfile.ChangePasswordForm' , ] ) ; } else { Yii :: $ app -> getSession ( ) -> setFlash ( 'error' , [ 'message' => Yii :: t ( 'app/flash-messages' , 'Profile_ChangePasswordForm_error' ) , 'ttl' => FLASH_MESSAGES_TTL , 'showClose' => true , 'alert_action' => 'actionProfile.ChangePasswordForm' , ] ) ; } return $ this -> redirect ( [ 'profile' ] ) ; } $ model_changetimezone = new SetTimeZoneOffsetForm ( ) ; $ model_changetimezone -> timezone_offset_seconds = $ User -> static_timezone ; if ( $ model_changetimezone -> load ( Yii :: $ app -> request -> post ( ) ) && $ model_changetimezone -> validate ( ) ) { if ( $ model_changetimezone -> setStaticTimeZone ( $ User ) ) { Yii :: $ app -> getSession ( ) -> setFlash ( 'success' , [ 'message' => Yii :: t ( 'app/flash-messages' , 'Profile_ChangeTimeZone_success' ) , 'ttl' => FLASH_MESSAGES_TTL , 'showClose' => true , 'alert_action' => 'actionProfile.SetTimeZoneOffsetForm' , ] ) ; } else { Yii :: $ app -> getSession ( ) -> setFlash ( 'error' , [ 'message' => Yii :: t ( 'app/flash-messages' , 'Profile_ChangeTimeZone_error' ) , 'ttl' => FLASH_MESSAGES_TTL , 'showClose' => true , 'alert_action' => 'actionProfile.SetTimeZoneOffsetForm' , ] ) ; } return $ this -> redirect ( [ 'profile' ] ) ; } return $ this -> render ( 'profile' , [ 'model_changepassword' => $ model_changepassword , 'model_changetimezone' => $ model_changetimezone , ] ) ; }
Displays profile page.
Displays profile page .
/** @var \common\models\SelfHostUsers $User */ /** Смена пароля */ /** Смена таймзоны */ //var_dump($model_changetimezone->timezone_offset_seconds); /** Вывод страницы настроек профиля */ //'model_changename'     => $model_changename, //'searchModelPayments'  => $searchModelPayments, //'dataProviderPayments' => $dataProviderPayments,