Advertisement
Guest User

Untitled

a guest
Oct 17th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. /**
  2. * @inheritdoc
  3. */
  4. protected function calcData()
  5. {
  6. $results = \Yii::app()->getDb()->createCommand($this->makeSqlQuery())->query();
  7.  
  8. $statistic = [];
  9. foreach ($results as $result) {
  10. $stat = new \stdClass();
  11. $stat->category = $this->makeGroupName($result['Start'], $result['End']);
  12. $stat->column = $result['Count'];
  13.  
  14. $statistic[] = $stat;
  15. }
  16. $this->setChartData($statistic);
  17.  
  18. return (int)(max(\user\models\User::model()->count(['condition' => 'NOT "Deleted"']), 20000)/1000);
  19. }
  20.  
  21. /**
  22. *
  23. * @param array $stat
  24. */
  25. private function setChartData(array $stat)
  26. {
  27. \Yii::app()->getClientScript()->registerScript('chart-ages', '
  28. var usersByAges = ' . json_encode($stat), \CClientScript::POS_HEAD);
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement