当前位置: 首页>>代码示例>>PHP>>正文


PHP Results::getRankingTypes方法代码示例

本文整理汇总了PHP中Results::getRankingTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP Results::getRankingTypes方法的具体用法?PHP Results::getRankingTypes怎么用?PHP Results::getRankingTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Results的用法示例。


在下文中一共展示了Results::getRankingTypes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: build

 public static function build($statistic)
 {
     $command = Yii::app()->wcaDb->createCommand()->select(array('r.*', 'rs.personName', 'rs.competitionId', 'c.cellName', 'c.cityName', 'c.year', 'c.month', 'c.day'))->leftJoin('Persons p', 'r.personId=p.id AND p.subid=1')->where('r.countryRank=1 AND rs.personCountryId="China"');
     $rows = array();
     foreach (Results::getRankingTypes() as $type) {
         $cmd = clone $command;
         $cmd->from(sprintf('Ranks%s r', ucfirst($type)))->leftJoin('Results rs', sprintf('r.best=rs.%s AND r.personId=rs.personId AND r.eventId=rs.eventId', $type == 'single' ? 'best' : $type))->leftJoin('Competitions c', 'rs.competitionId=c.id');
         foreach ($cmd->queryAll() as $row) {
             $row['type'] = $type;
             if (isset($rows[$type][$row['eventId']])) {
                 $temp = $rows[$type][$row['eventId']];
                 if ($temp['year'] > $row['year'] || $temp['month'] > $row['month'] || $temp['day'] > $row['day']) {
                     continue;
                 }
             }
             $row = self::getCompetition($row);
             $rows[$type][$row['eventId']] = $row;
         }
     }
     $rows = array_merge(array_values($rows['single']), array_values($rows['average']));
     usort($rows, function ($rowA, $rowB) {
         $temp = $rowA['year'] - $rowB['year'];
         if ($temp == 0) {
             $temp = $rowA['month'] - $rowB['month'];
         }
         if ($temp == 0) {
             $temp = $rowA['day'] - $rowB['day'];
         }
         if ($temp == 0) {
             $temp = strcmp($rowA['personName'], $rowB['personName']);
         }
         return $temp;
     });
     $rows = array_slice($rows, 0, self::$limit);
     //person days event type result record competition
     $columns = array(array('header' => 'Yii::t("statistics", "Person")', 'value' => 'Persons::getLinkByNameNId($data["personName"], $data["personId"])', 'type' => 'raw'), array('header' => 'Yii::t("statistics", "Days")', 'value' => 'CHtml::tag("b", array(), floor((time() - strtotime(sprintf("%s-%s-%s", $data["year"], $data["month"], $data["day"]))) / 86400))', 'type' => 'raw'), array('header' => 'Yii::t("common", "Event")', 'value' => 'Yii::t("event", Events::getFullEventName($data["eventId"]))'), array('header' => 'Yii::t("common", "Type")', 'value' => 'Yii::t("common", ucfirst($data["type"]))'), array('header' => 'Yii::t("common", "Result")', 'value' => 'Results::formatTime($data["best"], $data["eventId"])'), array('header' => 'Yii::t("common", "Records")', 'value' => '$data["worldRank"] == 1 ? "WR" : ($data["continentRank"] == 1 ? "AsR" : "NR")'), array('header' => 'Yii::t("common", "Competition")', 'value' => 'CHtml::link(ActiveRecord::getModelAttributeValue($data, "name"), $data["url"])', 'type' => 'raw'));
     return self::makeStatisticsData($statistic, $columns, $rows);
 }
开发者ID:sunshy360,项目名称:cubingchina,代码行数:38,代码来源:OldestStandingRecords.php

示例2: array

</label>
        <?php 
echo CHtml::dropDownList('region', $region, Region::getWCARegions(), array('class' => 'form-control'));
?>
      </div>
      <div class="form-group">
        <label for="Competition_year"><?php 
echo Yii::t('common', 'Gender');
?>
</label>
        <?php 
echo CHtml::dropDownList('gender', $gender, Persons::getGenders(), array('class' => 'form-control'));
?>
      </div>
      <?php 
foreach (Results::getRankingTypes() as $_type) {
    ?>
      <?php 
    echo CHtml::tag('button', array('type' => 'submit', 'name' => 'type', 'value' => $_type, 'class' => 'btn btn-' . ($type == $_type ? 'warning' : 'theme')), Yii::t('common', ucfirst($_type)));
    ?>
      <?php 
}
?>
    </div>
  <?php 
$this->endWidget();
?>
  <?php 
$this->widget('RankGridView', array('dataProvider' => new NonSortArrayDataProvider($statistic['rows'], array('pagination' => array('pageSize' => Statistics::$limit, 'pageVar' => 'page'), 'sliceData' => false, 'totalItemCount' => $statistic['count'])), 'template' => '{items}{pager}', 'enableSorting' => false, 'front' => true, 'rankKey' => $statistic['rankKey'], 'rank' => $statistic['rank'], 'count' => ($page - 1) * 100, 'columns' => array_map(function ($column) {
    $column['header'] = Yii::app()->evaluateExpression($column['header']);
    return $column;
开发者ID:sunshy360,项目名称:cubingchina,代码行数:31,代码来源:sumOfRanks.php

示例3: statTop100

 private function statTop100()
 {
     $region = $this->sGet('region', 'China');
     $type = $this->sGet('type', 'single');
     $event = $this->sGet('event', '333');
     $gender = $this->sGet('gender', 'all');
     if (!in_array($type, Results::getRankingTypes())) {
         $type = 'single';
     }
     if (!array_key_exists($gender, Persons::getGenders())) {
         $gender = 'all';
     }
     if (!array_key_exists($event, Events::getNormalEvents())) {
         $event = '333';
     }
     if (!Region::isValidRegion($region)) {
         $region = 'China';
     }
     $statistic = array('class' => 'Top100', 'type' => $type, 'event' => $event, 'gender' => $gender, 'region' => $region);
     $this->title = Yii::t('statistics', 'Chinese Top 100 Results');
     $this->pageTitle = array('Fun Statistics', $this->title);
     $this->breadcrumbs = array('Results' => array('/results/index'), 'Statistics' => array('/results/statistics'), $this->title);
     $data = Statistics::buildRankings($statistic);
     extract($data);
     $this->render('stat/top100', array('statistic' => $statistic, 'time' => $time, 'region' => $region, 'gender' => $gender, 'event' => $event, 'type' => $type));
 }
开发者ID:sunshy360,项目名称:cubingchina,代码行数:26,代码来源:ResultsController.php


注:本文中的Results::getRankingTypes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。