Пример #1
0
 /**
  * Change Account
  *
  * @todo Add Group
  */
 public function actionEditSettings()
 {
     $user = Yii::$app->user->getIdentity();
     $model = new \humhub\modules\user\models\forms\AccountSettings();
     $model->language = $user->language;
     if ($model->language == "") {
         $model->language = Yii::$app->settings->get('defaultLanguage');
     }
     $model->timeZone = $user->time_zone;
     if ($model->timeZone == "") {
         $model->timeZone = Yii::$app->settings->get('timeZone');
     }
     $model->tags = $user->tags;
     $model->show_introduction_tour = Yii::$app->getModule('tour')->settings->contentContainer($user)->get("hideTourPanel");
     $model->visibility = $user->visibility;
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         Yii::$app->getModule('tour')->settings->contentContainer($user)->set('hideTourPanel', $model->show_introduction_tour);
         $user->language = $model->language;
         $user->tags = $model->tags;
         $user->time_zone = $model->timeZone;
         $user->visibility = $model->visibility;
         $user->save();
         Yii::$app->getSession()->setFlash('data-saved', Yii::t('UserModule.controllers_AccountController', 'Saved'));
         return $this->redirect(['edit-settings']);
     }
     return $this->render('editSettings', array('model' => $model, 'languages' => Yii::$app->i18n->getAllowedLanguages()));
 }
Пример #2
0
 /**
  * Change Account
  *
  * @todo Add Group
  */
 public function actionEditSettings()
 {
     $user = Yii::$app->user->getIdentity();
     $model = new \humhub\modules\user\models\forms\AccountSettings();
     $model->language = $user->language;
     if ($model->language == "") {
         $model->language = \humhub\models\Setting::Get('defaultLanguage');
     }
     $model->timeZone = $user->time_zone;
     if ($model->timeZone == "") {
         $model->timeZone = \humhub\models\Setting::Get('timeZone');
     }
     $model->show_introduction_tour = $user->getSetting("hideTourPanel", "tour");
     $model->tags = $user->tags;
     $model->show_introduction_tour = $user->getSetting("hideTourPanel", "tour");
     $model->visibility = $user->visibility;
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         $user->setSetting('hideTourPanel', $model->show_introduction_tour, "tour");
         $user->language = $model->language;
         $user->tags = $model->tags;
         $user->time_zone = $model->timeZone;
         $user->visibility = $model->visibility;
         $user->save();
         Yii::$app->getSession()->setFlash('data-saved', Yii::t('UserModule.controllers_AccountController', 'Saved'));
     }
     return $this->render('editSettings', array('model' => $model, 'languages' => Yii::$app->params['availableLanguages']));
 }