Example #1
0
 public function actionModify()
 {
     //var_dump($_POST);die();
     $id = $_POST['id'];
     $data = $_POST;
     unset($data['id']);
     $photoFile = $_FILES['photo'];
     if ($photoFile['error'] == 0) {
         $photoPath = File::savePhoto($photoFile);
         $data['photo'] = $photoPath;
     }
     $connection = Yii::$app->db;
     $connection->createCommand()->update("pms_people", $data, ['id' => $id])->execute();
     if (isset($_GET['lang']) && $_GET['lang'] == 'en') {
         return $this->redirect(["index", 'lang' => 'en']);
     }
     return $this->redirect(['index']);
 }