コード例 #1
0
ファイル: session.php プロジェクト: mrjake79/my5280
 /**
  * listMatches:  Retrieve an array of matches for the session.
  *
  * @param string (Optional) Boolean indicating if only finished matches (those with a home or away score) should
  *                          be provided.  Default FALSE.
  * @return array
  */
 public function listMatches($DoneOnly = false)
 {
     if (empty($this->matches)) {
         require_once __DIR__ . '/match.php';
         // Include the appropriate match class file
         $format = $this->getLeagueFormat();
         $matches = array();
         // Load the teams (for lookup)
         $this->listTeams();
         global $leaguemanager;
         $filter = array('league_id' => $this->getLeagueId(), 'season' => $this->getName(), 'limit' => false);
         if ($DoneOnly) {
             $filter['home_points'] = 'not_null';
             $filter['away_points'] = 'not_null';
         }
         foreach ($leaguemanager->getMatches($filter) as $match) {
             // Add the match and index it
             $index = $match->id;
             if ($index == null) {
                 $index = -count($this->matches);
             }
             $matches[$index] = my5280_Match::factory($match, $format);
         }
         // Store the matches and index arrays
         if (!$DoneOnly) {
             $this->matches = $matches;
         } else {
             return $matches;
         }
     }
     return $this->matches;
 }