Exemplo n.º 1
0
 public function actionModify()
 {
     $id = $_POST['id'];
     $data = $_POST;
     unset($data['id']);
     $picFile = $_FILES['picture'];
     if ($picFile['error'] == 0) {
         $picPath = File::saveAwardPic($picFile);
         $data['picture'] = $picPath;
     }
     $connection = Yii::$app->db;
     $connection->createCommand()->update("pms_award", $data, ['id' => $id])->execute();
     if (isset($_GET['lang']) && $_GET['lang'] == 'en') {
         return $this->redirect(["index", 'lang' => 'en']);
     }
     return $this->redirect(['index']);
 }