Exemplo n.º 1
0
 public function actionCreate()
 {
     $model = new Group();
     if ($model->load(Yii::$app->request->post())) {
         $model->tag = str_replace('"', '\'', Yii::$app->request->post()['Group']['tag']);
         if (Yii::$app->user->isGuest) {
             Yii::$app->session['groupToSave'] = $model;
             Alert::add(Yii::t('msg', 'Zaloguj się lub zarejestruj, aby dokończyć dodawanie organizacji.'), Alert::TYPE_INFO);
             return $this->redirect(['site/login']);
         }
         if ($model->saveGroup()) {
             //            Alert::add(Yii::t('msg', 'Organization successfully added, now it must be accepted by administrator.'));
             Alert::add('Organizacja została pomyślnie dodana, teraz możesz w swoim panelu edytować stronę organizacji.');
             return $this->goHome();
         }
         Alert::add(Yii::t('msg', 'Something goes wrong, try again or contact us.'), Alert::TYPE_ERROR);
     }
     return $this->render('create', ['model' => $model]);
 }