public function actionIndex()
 {
     $isPage = \Yii::$app->request->get('is_page');
     $levelName = Level::getOneLevelNameById(\Yii::$app->user->identity->level_id);
     $photo = UsersInfo::getPhotoByUserId(\Yii::$app->user->id);
     $messageCount = MessagesUsers::getCountByUserIdAndType(\Yii::$app->user->id);
     $trainModel = TrainUsers::getAllTrainByUserId(Yii::$app->user->id, $isPage);
     if (!empty($trainModel)) {
         foreach ($trainModel as $key => $val) {
             $trainModel[$key]['userInfo'] = UsersInfo::findOne(['user_id' => $val['train_user_id']]);
             $trainModel[$key]['userEducation'] = UsersEducation::findOne(['user_id' => $val['train_user_id']]);
             $trainModel[$key]['userLevel'] = UsersLevel::findOne(['user_id' => Yii::$app->user->id, 'level_id' => Yii::$app->user->identity->level_id, 'status' => UsersLevel::TRAIN]);
         }
     }
     $activityModel = ActivityUsers::getAllActivityByUserId(Yii::$app->user->id, $isPage);
     if (!empty($activityModel)) {
         foreach ($activityModel as $key => $val) {
             $activityModel[$key]['enrollCount'] = ActivityUsers::getEnrollCountByActivityId($val['id']);
         }
     }
     $currentTrain = TrainUsers::getTrainByUserId(\Yii::$app->user->id);
     $currentActivity = ActivityUsers::getActivityByUserId(\Yii::$app->user->id);
     if (!empty($activityModel)) {
         $countActivity = 1;
     } else {
         $countActivity = 0;
     }
     $data = ['levelName' => $levelName, 'trainModel' => $trainModel, 'currentTrain' => $currentTrain, 'activityModel' => $activityModel, 'currentActivity' => $currentActivity, 'countActivity' => $countActivity, 'photo' => $photo, 'messageCount' => $messageCount];
     return $this->render('index', ['data' => $data]);
 }