Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @inheritdoc
- */
- protected function calcData()
- {
- $results = \Yii::app()->getDb()->createCommand($this->makeSqlQuery())->query();
- $statistic = [];
- foreach ($results as $result) {
- $stat = new \stdClass();
- $stat->category = $this->makeGroupName($result['Start'], $result['End']);
- $stat->column = $result['Count'];
- $statistic[] = $stat;
- }
- $this->setChartData($statistic);
- return (int)(max(\user\models\User::model()->count(['condition' => 'NOT "Deleted"']), 20000)/1000);
- }
- /**
- *
- * @param array $stat
- */
- private function setChartData(array $stat)
- {
- \Yii::app()->getClientScript()->registerScript('chart-ages', '
- var usersByAges = ' . json_encode($stat), \CClientScript::POS_HEAD);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement