public function actionList() { $search = new SourceMessageSearch(); $translationForm = new TranslationForm(); $translationForm->language = Yii::$app->request->getQueryParam('language', Yii::$app->language); $search->load(Yii::$app->request->get()); $search->language = $translationForm->language; $data_provider = $search->search(); return $this->render('translation-list', ['data_provider' => $data_provider, 'search_model' => $search, 'translationForm' => $translationForm]); }
/** * Updates an existing SourceMessage model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed */ public function actionUpdate($id) { $model = $this->findModel($id); if ($model->load(Yii::$app->request->post())) { $message = new \app\models\Message(); if ($message->load(Yii::$app->request->post())) { if (!$message->save()) { $error = ""; foreach ($message->getErrors() as $er) { $error = $er->attribute; } Yii::$app->session->setFlash("error", Yii::t('app', "Can not save. \n{}")); } } // return $this->redirect(["index"]); return $this->redirect(['view', 'id' => $model->id]); } $searchModel = new SourceMessageSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('update', ['model' => $model, 'message' => new \app\models\Message(), 'searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }