Beispiel #1
0
 public static function setApproveUser($id)
 {
     $modelSave = [];
     $modelPaymentSave = PaymentInformations::findOne(['payment_user_id' => (int) $id]);
     $modelPayment = ApproveInformations::findOne(['payment_user_id' => (int) $id]);
     if (empty($modelPaymentSave)) {
         $modelPaymentSave = new PaymentInformations();
     }
     foreach ($modelPayment as $key => $val) {
         $modelSave[$key] = $val;
     }
     $modelPaymentSave->load($modelSave, '');
     $modelPaymentSave->save();
     $model = Users::find()->where(['user_id' => (int) $id])->one();
     $model->user_status = 'active';
     $model->save();
 }
Beispiel #2
0
 public function actionTrainer($id)
 {
     $model = Users::find()->where(['user_id' => (int) $id])->andWhere("`user_type` != 'student'")->one()->toArray();
     if ($model === null) {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
     switch ($model['user_status']) {
         case 're-approve':
             $u_approve = ApproveInformations::findOne(['payment_user_id' => (int) $id]);
             $u_info = PaymentInformations::findOne(['payment_user_id' => (int) $id]);
             foreach ($u_info as $key => $val) {
                 if (in_array($val, ['updated_at', 'created_at', 'payment_hear', 'payment_comments', 'payment_user_status', 'payment_user_color'])) {
                     break;
                 }
                 @($key_ = $key . '_visible');
                 @($model[$key_] = $u_approve->{$key} !== $val ? true : false);
             }
             return $this->render('trainer_re_approve', ['model' => $model, 'approve' => (Yii::$app->user->identity->user_superadmin || Yii::$app->user->identity->user_approved_trainers != 'disallow') && $model['user_status'] !== 'active']);
             break;
         default:
             return $this->render('trainer_user', ['model' => $model, 'approve' => (Yii::$app->user->identity->user_superadmin || Yii::$app->user->identity->user_approved_trainers != 'disallow') && $model['user_status'] !== 'active']);
     }
 }