本文整理汇总了PHP中Statistics::getData方法的典型用法代码示例。如果您正苦于以下问题:PHP Statistics::getData方法的具体用法?PHP Statistics::getData怎么用?PHP Statistics::getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Statistics
的用法示例。
在下文中一共展示了Statistics::getData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionUpdate
public function actionUpdate()
{
$competitions = Competition::model()->findAllByAttributes(array('type' => Competition::TYPE_WCA), array('condition' => 'date < unix_timestamp() AND date > unix_timestamp() - 86400 * 20', 'order' => 'date ASC'));
$wcaDb = intval(file_get_contents(dirname(__DIR__) . '/config/wcaDb'));
$sql = "UPDATE `user` `u`\r\n\t\t\t\tINNER JOIN `registration` `r` ON `u`.`id`=`r`.`user_id`\r\n\t\t\t\tLEFT JOIN `competition` `c` ON `r`.`competition_id`=`c`.`id`\r\n\t\t\t\tLEFT JOIN `wca_{$wcaDb}`.`Results` `rs`\r\n\t\t\t\t\tON `c`.`wca_competition_id`=`rs`.`competitionId`\r\n\t\t\t\t\tAND `rs`.`personName`=CASE WHEN `u`.`name_zh`='' THEN `u`.`name` ELSE CONCAT(`u`.`name`, ' (', `u`.`name_zh`, ')') END\r\n\t\t\t\tSET `u`.`wcaid`=`rs`.`personId`\r\n\t\t\t\tWHERE `u`.`wcaid`='' and `r`.`competition_id`=%id%";
$db = Yii::app()->db;
$num = [];
foreach ($competitions as $competition) {
$num[$competition->id] = $db->createCommand(str_replace('%id%', $competition->id, $sql))->execute();
}
echo 'updated wcaid: ', array_sum($num), PHP_EOL;
Yii::import('application.statistics.*');
Yii::app()->cache->flush();
$data = Statistics::getData(true);
echo 'set results_statistics_data: ', $data ? 1 : 0, PHP_EOL;
}
示例2: actionStatistics
public function actionStatistics()
{
$name = $this->sGet('name');
$names = array_map('ucfirst', explode('-', $name));
$class = implode('', $names);
$this->description = Yii::t('statistics', 'Based on the official WCA competition results, we generated several WCA statistics about Chinese competitions and competitors, which were regularly up-to-date.');
if ($class !== '') {
if (method_exists($this, $method = 'stat' . $class)) {
$this->{$method}();
Yii::app()->end();
} else {
throw new CHttpException(404);
}
}
$data = Statistics::getData();
extract($data);
$this->pageTitle = array('Fun Statistics');
$this->title = 'Fun Statistics';
$this->setWeiboShareDefaultText('关于中国WCA官方比赛及选手成绩的一系列趣味统计', false);
$this->render('statistics', array('statistics' => $statistics, 'time' => $time));
}