Exemplo n.º 1
0
 /**
  * Display user dashboard
  */
 public function actionDashboard()
 {
     //$model = Yii::$app->user->identity;
     $journals = new ActiveDataProvider(['query' => Journal::find()->orderBy(['date' => SORT_DESC])->limit(5), 'pagination' => false]);
     $events = new ActiveDataProvider(['query' => \app\models\Event::find()->orderBy(['date' => SORT_DESC])->limit(5), 'pagination' => false]);
     $photos = \app\models\Photos::find()->orderBy(['id' => SORT_DESC])->limit(5)->all();
     $wishlists = new ActiveDataProvider(['query' => \app\models\Wishlist::find()->where(['status' => 0])->orderBy('id')->limit(5), 'pagination' => false]);
     $DataProvider = new ActiveDataProvider(['query' => User::find()->where('level !=0 AND parent_id=0')->orderBy('id')]);
     $RegisteredMembers = count(User::find()->where('level > :level', [':level' => 3])->orWhere('level > :level', [':level' => 2])->orWhere('level > :level', [':level' => 1])->all());
     $famillies = User::find()->where(['level' => '1'])->count();
     $orders = count(\app\models\Payment::find()->all());
     $payments = Payment::getPaymentsCount();
     $months = Payment::getMonths();
     $epercent = Payment::earningPercentage();
     $earning = Payment::getMonthlyEarning();
     $revenue = Payment::totalRevenue();
     $rpercent = payment::revenuePercentage();
     $mearning = Payment::getPaymentsMonth();
     return $this->render('dashboard', ['dataProvider' => $DataProvider, 'events' => $events, 'journals' => $journals, 'photos' => $photos, 'wishlists' => $wishlists, 'RegisteredMembers' => $RegisteredMembers, 'orders' => $orders, 'payments' => $payments, 'months' => $months, 'epercent' => $epercent, 'earning' => $earning, 'revenue' => $revenue, 'rpercent' => $rpercent, 'mearning' => $mearning, 'famillies' => $famillies]);
 }