コード例 #1
0
 public function actionIndex($season = '2016s2')
 {
     $model = new MatchInfoModel();
     $model->attributes = $_REQUEST;
     $criteria = new CDbCriteria(array('condition' => 'season=?', 'order' => 'id desc', 'params' => array($season)));
     $allPlayers = SteamPlayerModel::model('SteamPlayerModel')->findAll();
     $matches = array();
     foreach (MatchInfoModel::model('MatchInfoModel')->findAll($criteria) as $match) {
         if ($model->player) {
             $found = false;
             foreach ($match->attendants as $side => $players) {
                 foreach ($players as $player) {
                     if ($player->id == $model->player) {
                         $found = true;
                         if ($model->result == 1 && $player->match->win == 0) {
                             break;
                         }
                         if ($model->result == 2 && $player->match->win > 0) {
                             break;
                         }
                         $matches[] = $match;
                         break;
                     }
                 }
                 if ($found) {
                     break;
                 }
             }
         } else {
             $matches[] = $match;
         }
     }
     $this->render('index', array('model' => $model, 'players' => $allPlayers, 'season' => $season, 'matches' => $matches));
 }
コード例 #2
0
 public function actionIndex()
 {
     $players = array();
     foreach (SteamPlayerModel::model('SteamPlayerModel')->findAll() as $player) {
         if ($player->attendance > 0) {
             $players[] = $player;
         }
     }
     usort($players, array($this, 'sortByScore'));
     $this->render('index', array('players' => $players));
 }