Example #1
0
 public function actionStatistics()
 {
     $totalUser = User::model()->countByAttributes(array('status' => User::STATUS_NORMAL));
     $advancedUser = User::model()->countByAttributes(array('status' => User::STATUS_NORMAL, 'role' => array(User::ROLE_DELEGATE, User::ROLE_ORGANIZER, User::ROLE_ADMINISTRATOR)));
     $uncheckedUser = User::model()->countByAttributes(array('status' => User::STATUS_NORMAL, 'role' => array(User::ROLE_UNCHECKED)));
     $userPerDay = round($totalUser / ceil((time() - strtotime('2014-06-06')) / 86400), 2);
     $totalRegistration = Registration::model()->with('user')->count('user.status=' . User::STATUS_NORMAL);
     $acceptedRegistration = Registration::model()->with('user')->countByAttributes(array('status' => Registration::STATUS_ACCEPTED), 'user.status=' . User::STATUS_NORMAL);
     $dailyUser = User::getDailyUser();
     $dailyRegistration = Registration::getDailyRegistration();
     $dailyData = $this->mergeDailyData($dailyUser, $dailyRegistration);
     $hourlyUser = User::getHourlyUser();
     $hourlyRegistration = Registration::getHourlyRegistration();
     $hourlyData = $this->mergeHourlyData($hourlyUser, $hourlyRegistration);
     $userRegion = User::getUserRegion();
     $userGender = User::getUserGender();
     $userAge = User::getUserAge();
     $userWca = User::getUserWca();
     $this->render('statistics', array('totalUser' => $totalUser, 'advancedUser' => $advancedUser, 'uncheckedUser' => $uncheckedUser, 'userPerDay' => $userPerDay, 'totalRegistration' => $totalRegistration, 'acceptedRegistration' => $acceptedRegistration, 'dailyData' => $dailyData, 'hourlyData' => $hourlyData, 'userRegion' => $userRegion, 'userGender' => $userGender, 'userAge' => $userAge, 'userWca' => $userWca));
 }