Пример #1
0
 private function checkyoDelete()
 {
     $identity = \Yii::$app->user->getIdentity();
     $currentTs = time();
     $deleted = 0;
     $arrIds = \Yii::$app->request->post('idCheck', NULL);
     if (empty($arrIds)) {
         $arrIds = \Yii::$app->request->get('idCheck', NULL);
     }
     if (is_array($arrIds) && !empty($arrIds)) {
         foreach ($arrIds as $lst) {
             $queryUser = checkyo::find();
             $checkyo = $queryUser->where(['id' => $lst])->one()->delete();
             $deleted = $deleted + 1;
         }
         if ($deleted > 0) {
             Ui::setMessage("ลบข้อมูลจำนวน  {$deleted} รายการ" + "บันทึกข้อมูลสำเร็จ");
         } else {
             Ui::setMessage('ไม่มีข้อมูลถูกลบ');
         }
     }
 }
Пример #2
0
 public function actionProfile()
 {
     $identity = \Yii::$app->user->getIdentity();
     $profile = User::findOne(['id' => $identity->id]);
     if (empty($profile)) {
         $profile = new User();
     }
     if (\Yii::$app->request->isPost) {
         $profile->attributes = $_POST['User'];
         if ($_POST['password'] && $_POST['password'] == $_POST['confirmPassword']) {
             $profile->setPassword($_POST['password']);
             $profile->generateAuthKey();
         }
         if ($profile->save()) {
             Ui::setMessage("บันทึกข้อมูลเสร็จเรียบร้อย", 'success');
         } else {
             Ui::setMessage('การบันทึกข้อมูลผิดพลาด', 'warning');
         }
     }
     echo $this->render('profile', ['profile' => $profile]);
 }