Changeset 1361999
- Timestamp:
- 03/01/2016 06:38:37 PM (11 years ago)
- Location:
- leaguemanager/trunk
- Files:
-
- 2 added
- 40 edited
-
admin/admin.php (modified) (7 diffs)
-
admin/show-league.php (modified) (3 diffs)
-
admin/standings.php (modified) (3 diffs)
-
functions.php (modified) (4 diffs)
-
languages/leaguemanager-de_DE.mo (modified) ( previous)
-
languages/leaguemanager-de_DE.po (modified) (1 diff)
-
languages/leaguemanager-gymnastics-de_DE.mo (modified) ( previous)
-
languages/leaguemanager-gymnastics-de_DE.po (modified) (1 diff)
-
languages/leaguemanager-he_IL.mo (added)
-
languages/leaguemanager-he_IL.po (added)
-
leaguemanager.php (modified) (2 diffs)
-
leaguemanager.pot (modified) (1 diff)
-
lib/core.php (modified) (36 diffs)
-
lib/shortcodes.php (modified) (7 diffs)
-
readme.txt (modified) (3 diffs)
-
sports/baseball.php (modified) (4 diffs)
-
sports/basketball.php (modified) (6 diffs)
-
sports/cornhole.php (modified) (1 diff)
-
sports/gymnastics.php (modified) (8 diffs)
-
sports/handball.php (modified) (5 diffs)
-
sports/hockey.php (modified) (6 diffs)
-
sports/other-two-scores.php (modified) (5 diffs)
-
sports/pool.php (modified) (3 diffs)
-
sports/rugby.php (modified) (5 diffs)
-
sports/soccer.php (modified) (5 diffs)
-
sports/tabletennis.php (modified) (1 diff)
-
sports/tennis.php (modified) (5 diffs)
-
sports/us-football.php (modified) (5 diffs)
-
sports/volleyball.php (modified) (5 diffs)
-
style.css (modified) (1 diff)
-
templates/matches-by_matchday-accordion.php (modified) (1 diff)
-
templates/matches-by_matchday-gymnastics.php (modified) (1 diff)
-
templates/matches-by_matchday-tabs.php (modified) (1 diff)
-
templates/matches-by_matchday.php (modified) (1 diff)
-
templates/matches-gymnastics.php (modified) (2 diffs)
-
templates/matches-irish-gaelic-football.php (modified) (1 diff)
-
templates/matches-racing.php (modified) (1 diff)
-
templates/matches-tennis.php (modified) (1 diff)
-
templates/matches-volleyball.php (modified) (1 diff)
-
templates/matches.php (modified) (1 diff)
-
templates/standings-last5.php (modified) (2 diffs)
-
templates/team.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
leaguemanager/trunk/admin/admin.php
r1348420 r1361999 363 363 364 364 /** 365 * get point rule depending on selection.366 * For details on point rules see http://de.wikipedia.org/wiki/Drei-Punkte-Regel (German)367 *368 * @param int $rule369 * @return array of points370 */371 function getPointRule( $rule )372 {373 $rule = maybe_unserialize($rule);374 375 // Manual point rule376 if ( is_array($rule) ) {377 return $rule;378 } else {379 $point_rules = array();380 // One point rule381 $point_rules['one'] = array( 'forwin' => 1, 'fordraw' => 0, 'forloss' => 0 );382 // Two point rule383 $point_rules['two'] = array( 'forwin' => 2, 'fordraw' => 1, 'forloss' => 0 );384 // Three-point rule385 $point_rules['three'] = array( 'forwin' => 3, 'fordraw' => 1, 'forloss' => 0 );386 // Score. One point for each scored goal387 $point_rules['score'] = 'score';388 389 $point_rules = apply_filters( 'leaguemanager_point_rules', $point_rules );390 391 return $point_rules[$rule];392 }393 }394 395 396 /**397 365 * get available point formats 398 366 * … … 518 486 function calculatePoints( $team_id, $option ) 519 487 { 520 global $wpdb ;488 global $wpdb, $leaguemanager; 521 489 522 490 $league = $this->league; 523 491 524 $rule = $ this->getPointRule( $league->point_rule );492 $rule = $leaguemanager->getPointRule( $league->point_rule ); 525 493 $team_id = intval($team_id); 526 494 $points = array( 'plus' => 0, 'minus' => 0 ); … … 528 496 529 497 if ( 'score' == $rule ) { 530 $home = $ this->getMatches( array("home_team" => $team_id) );498 $home = $leaguemanager->getMatches( array("home_team" => $team_id, "limit" => false) ); 531 499 foreach ( $home AS $match ) { 532 500 $points['plus'] += $match->home_points; … … 534 502 } 535 503 536 $away = $ this->getMatches( array("away_team" => $team_id) );504 $away = $leaguemanager->getMatches( array("away_team" => $team_id, "limit" => false) ); 537 505 foreach ( $away AS $match ) { 538 506 $points['plus'] += $match->away_points; … … 541 509 } else { 542 510 extract( (array)$rule ); 543 $home = $ this->getMatches( array("home_team" => $team_id) );511 $home = $leaguemanager->getMatches( array("home_team" => $team_id, "limit" => false) ); 544 512 foreach ( $home AS $match ) { 545 513 $team_points += $match->home_points; 546 514 } 547 515 548 $away = $ this->getMatches( array("away_team" => $team_id) );516 $away = $leaguemanager->getMatches( array("away_team" => $team_id, "limit" => false) ); 549 517 foreach ( $away AS $match ) { 550 518 $team_points += $match->away_points; … … 1309 1277 $loser = $this->getMatchResult($points['home'], $points['away'], $home_team[$match_id], $away_team[$match_id], 'loser' ); 1310 1278 1311 $m = $leaguemanager->getMatch( $match_id );1279 $m = $leaguemanager->getMatch( $match_id, false ); 1312 1280 $cv = isset($custom[$match_id]) ? $custom[$match_id] : array(); 1313 1281 $c = array_merge( (array)$m->custom, (array)$cv ); … … 1974 1942 return $rs; 1975 1943 } 1944 1945 1946 function showDatabaseColumns() 1947 { 1948 global $wpdb; 1949 1950 $tables = array($wpdb->leaguemanager, $wpdb->leaguemanager_teams, $wpdb->leaguemanager_matches, $wpdb->leaguemanager_stats); 1951 1952 foreach( $tables AS $table ) { 1953 $results = $wpdb->get_results("SHOW COLUMNS FROM {$table}"); 1954 $columns = array(); 1955 foreach ( $results AS $result ) { 1956 $columns[] = "<li>".$result->Field." ".$result->Type.", NULL: ".$result->Null.", Default: ".$result->Default.", Extra: ".$result->Extra."</li>"; 1957 } 1958 echo "<p>Table ".$table."<ul>"; 1959 echo implode("", $columns); 1960 echo "</ul></p>"; 1961 } 1962 } 1976 1963 } 1977 1964 ?> -
leaguemanager/trunk/admin/show-league.php
r1344775 r1361999 154 154 155 155 if ( $league_mode != 'championship' ) { 156 $teams = $leaguemanager->getTeams( array("league_id" => $league->id, "season" => $season['name'] ), 'OBJECT' );156 $teams = $leaguemanager->getTeams( array("league_id" => $league->id, "season" => $season['name'], "cache" => false), 'OBJECT' ); 157 157 $matches = $leaguemanager->getMatches( $match_args ); 158 158 $leaguemanager->setNumMatches($leaguemanager->getMatches(array_merge($match_args, array('limit' => false, 'count' => true)))); … … 162 162 $tab = 2; 163 163 164 if ( isset($_GET['standingstable']) ) { 165 $get = $_GET['standingstable']; 166 $match_day = false; 167 $mode = 'all'; 168 if ( preg_match('/match_day-\d/', $get, $hits) ) { 169 $res = explode("-", $hits[0]); 170 $match_day = $res[1]; 171 } elseif ( in_array($get, array('home', 'away')) ) { 172 $mode = htmlspecialchars($get); 173 } 174 $teams = $leaguemanager->getStandings( $teams, $match_day, $mode ); 175 } 164 176 /*$tmp = $leaguemanager->getTeams( array('league_id' => $league->id) ); 165 177 foreach ( $tmp AS $t ) … … 222 234 <div id="standings-table" class="league-block-container"> 223 235 <h2 class="header"><?php _e( 'Table', 'leaguemanager' ) ?></h2> 236 <div class="alignright"> 237 <form action="admin.php" method="get"> 238 <input type="hidden" name="page" value="leaguemanager" /> 239 <input type="hidden" name="subpage" value="show-league" /> 240 <input type="hidden" name="league_id" value="<?php echo $league->id ?>" /> 241 242 <?php echo $leaguemanager->getStandingsSelection( $league ); ?> 243 <input type="submit" class="button-secondary" value="<?php _e( 'Show', 'leaguemanager' ) ?>" /> 244 </form> 245 </div> 224 246 <?php include_once('standings.php'); ?> 225 247 </div> -
leaguemanager/trunk/admin/standings.php
r1348420 r1361999 27 27 <?php if ( !empty($league->groups) && $league->mode == 'championship' ) : ?><th class="num"><?php _e( 'Group', 'leaguemanager' ) ?></th><?php endif; ?> 28 28 <th class="num"><?php if ( isset($league->standings['pld']) && 1 == $league->standings['pld'] ) : ?><?php _e( 'Pld', 'leaguemanager' ) ?><?php endif; ?></th> 29 <th class="num"><?php if ( isset($league->standings['won']) && 1 == $league->standings['won'] ) : ?><?php echo _x( 'W','leaguemanager' ) ?><?php endif; ?></th>30 <th class="num"><?php if ( isset($league->standings['tie']) && 1 == $league->standings['tie'] ) : ?><?php echo _x( 'T','leaguemanager' ) ?><?php endif; ?></th>31 <th class="num"><?php if ( isset($league->standings['lost']) && 1 == $league->standings['lost'] ) : ?><?php echo _x( 'L','leaguemanager' ) ?><?php endif; ?></th>29 <th class="num"><?php if ( isset($league->standings['won']) && 1 == $league->standings['won'] ) : ?><?php _e( 'W','leaguemanager' ) ?><?php endif; ?></th> 30 <th class="num"><?php if ( isset($league->standings['tie']) && 1 == $league->standings['tie'] ) : ?><?php _e( 'T','leaguemanager' ) ?><?php endif; ?></th> 31 <th class="num"><?php if ( isset($league->standings['lost']) && 1 == $league->standings['lost'] ) : ?><?php _e( 'L','leaguemanager' ) ?><?php endif; ?></th> 32 32 <?php do_action( 'leaguemanager_standings_header_'.$sport ) ?> 33 33 <th class="num"><?php _e( 'Pts', 'leaguemanager' ) ?></th> … … 37 37 <tbody id="<?php echo ( $league->mode == 'championship' ) ? "the-list-standings-".$group : "the-list-standings" ?>" class="form-table standings-table <?php if ($league->team_ranking == 'manual') echo 'sortable' ?>"> 38 38 <?php if ( count($teams) > 0 ) : $class = ''; ?> 39 <?php foreach( $teams AS $ team ) : $class = ( 'alternate' == $class ) ? '' : 'alternate'; ?>39 <?php foreach( $teams AS $i => $team ) : $class = ( 'alternate' == $class ) ? '' : 'alternate'; ?> 40 40 <tr class="<?php echo $class ?>" id="team_<?php echo $team->id ?>"> 41 41 <th scope="row" class="check-column"><input type="hidden" name="team_id[<?php echo $team->id ?>]" value="<?php echo $team->id ?>" /><input type="checkbox" value="<?php echo $team->id ?>" name="team[<?php echo $team->id ?>]" /></th> … … 45 45 <input type="text" name="rank[<?php echo $team->id ?>]" size="2" id="rank_<?php echo $team->id ?>" class="rank-input" value="<?php echo $team->rank ?>" /> 46 46 <?php else : ?> 47 <?php echo $ team->rank ?>47 <?php echo $i+1;//$team->rank ?> 48 48 <?php endif; ?> 49 49 </td> -
leaguemanager/trunk/functions.php
r1336648 r1361999 42 42 * 43 43 * @param int $team_id 44 * @param int $ne number of matches 45 */ 46 function get_last_matches( $team_id, $n = 1 ) { 44 * @param int $n number of matches 45 * @param boolean $logos 46 * @return $matches 47 */ 48 function get_last_matches( $team_id, $n = 1, $logos = true ) { 47 49 global $leaguemanager; 48 49 $matches = $leaguemanager->getMatches( array( 'time' => 'prev', 'team_id' => intval($team_id), 'limit' => intval($n) ) ); 50 return $matches; 50 $matches = $leaguemanager->getMatches( array("time" => "prev", "team_id" => $team_id, "limit" => $n, "logos" => $logos) ); 51 if ( empty($matches) ) 52 return false; 53 54 if ( $n == 1 ) 55 return $matches[0]; 56 else 57 return $matches; 51 58 } 52 59 … … 56 63 * 57 64 * @param int $team_id 58 * @param int $ne number of matches 59 */ 60 function get_next_matches( $team_id, $n = 1 ) { 65 * @param int $n number of matches 66 * @param boolean $logos 67 * @return $matches 68 */ 69 function get_next_matches( $team_id, $n = 1, $logos = true ) { 61 70 global $leaguemanager; 62 63 $matches = $leaguemanager->getMatches( array( 'time' => 'next', 'team_id' => intval($team_id), 'limit' => intval($n) ) ); 64 return $matches; 71 $matches = $leaguemanager->getMatches( array("time" => "next", "team_id" => $team_id, "limit" => $n, "logos" => $logos) ); 72 if ( empty($matches) ) 73 return false; 74 75 if ( $n == 1 ) 76 return $matches[0]; 77 else 78 return $matches; 65 79 } 66 80 … … 114 128 } 115 129 116 /** 117 * get next game for Last 5 function 118 * 119 * @param int $id_team 120 * @param int $limit additional argument (optional) 121 * @return $next_results 122 */ 123 130 131 /* 124 132 function get_next_match($id_team, $limit = 1) { 125 133 global $wpdb; … … 133 141 return $next_results; 134 142 } 135 143 */ 136 144 137 145 /** -
leaguemanager/trunk/languages/leaguemanager-de_DE.po
r1344775 r1361999 16 16 "Plural-Forms: nplurals=2; plural=(n != 1);\n" 17 17 18 msgid "Current Table" 19 msgstr "Aktuelle Tabelle" 20 21 msgid "Hometable" 22 msgstr "Heimtabelle" 23 24 msgid "Awaytable" 25 msgstr "Auswärtstabelle" 26 18 27 msgid "Final Results" 19 28 msgstr "Finalergebnisse" -
leaguemanager/trunk/languages/leaguemanager-gymnastics-de_DE.po
r1324769 r1361999 16 16 "Plural-Forms: nplurals=2; plural=(n != 1);\n" 17 17 18 msgid "Current Table" 19 msgstr "Aktuelle Tabelle" 20 21 msgid "Hometable" 22 msgstr "Heimtabelle" 23 24 msgid "Awaytable" 25 msgstr "Auswärtstabelle" 26 18 27 #: sports/gymnastics 19 28 msgid "Floor" -
leaguemanager/trunk/leaguemanager.php
r1348420 r1361999 4 4 Plugin URI: http://wordpress.org/extend/plugins/leaguemanager/ 5 5 Description: Manage and present sports league results. 6 Version: 4.0. 86 Version: 4.0.9 7 7 Author: Kolja Schleich, LaMonte Forthun 8 8 … … 39 39 * @var string 40 40 */ 41 var $version = '4.0. 8';41 var $version = '4.0.9'; 42 42 43 43 -
leaguemanager/trunk/leaguemanager.pot
r1324769 r1361999 17 17 "Content-Transfer-Encoding: 8bit\n" 18 18 "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" 19 20 msgid "Current Table" 21 msgstr "" 22 23 msgid "Hometable" 24 msgstr "" 25 26 msgid "Awaytable" 27 msgstr "" 28 29 msgid "Final Results" 30 msgstr "" 31 32 msgid "Third Place" 33 msgstr "" 34 35 msgid "Final Matches" 36 msgstr "" 37 38 msgid "Preliminary Rounds" 39 msgstr "" 19 40 20 41 #: sports/gymnastics -
leaguemanager/trunk/lib/core.php
r1348420 r1361999 22 22 * @var array 23 23 */ 24 var $league = array();24 var $league = null; 25 25 26 26 … … 30 30 * @var int 31 31 */ 32 var $league_id ;32 var $league_id = null; 33 33 34 34 … … 66 66 67 67 /** 68 * number of matches 69 * 70 * @var int 71 */ 72 var $num_matches = null; 73 74 75 /** 68 76 * number of matches per page 69 77 * … … 81 89 82 90 91 /** 92 * match day 93 * 94 * @var int 95 */ 96 var $match_day = null; 97 98 83 99 /** 84 100 * Initializes plugin … … 283 299 global $wpdb; 284 300 301 if ( isset($this->home_only_query[$league_id]) ) 302 return $this->home_only_query[$league_id]; 303 285 304 $queries = array(); 286 305 $teams = $wpdb->get_results($wpdb->prepare("SELECT `id` FROM {$wpdb->leaguemanager_teams} WHERE `league_id` = '%d' AND `home` = 1", intval($league_id)) ); … … 291 310 $query = " AND (".implode(" OR ", $queries).")"; 292 311 293 return $query; 312 $this->home_only_query[$league_id] = $query; 313 return $this->home_only_query[$league_id]; 294 314 } 295 315 … … 484 504 global $wpdb; 485 505 506 $sql = ""; 507 486 508 $league_id = $this->getCurrentLeagueID(); 487 509 $season = isset($this->season['name']) ? $this->season['name'] : ''; … … 490 512 } elseif ( isset($_GET['match_day_'.$league_id])) { 491 513 $match_day = intval($_GET['match_day_'.$league_id]); 492 } elseif ( isset($this->match_day) && $this->match_day != -1) {493 $match_day = intval($this->match_day);494 514 } elseif (isset($_POST['match_day'])) { 495 515 $match_day = intval($_POST['match_day']); 496 516 } elseif ( $select == "last" ) { 497 $sql = "SELECT `match_day`, DATEDIFF(NOW(), `date`) AS datediff FROM {$wpdb->leaguemanager_matches} WHERE `league_id` = '%d' AND `season` = '%s' AND DATEDIFF(NOW(), `date`) > 0 ORDER BY datediff ASC"; 498 $matches = $wpdb->get_results( $wpdb->prepare($sql, $this->getLeagueID(), $season) ); 499 if ($matches[0]) $match_day = $matches[0]->match_day; 500 else $match_day = -1; 517 if ( isset($this->last_match_day) ) { 518 $match_day = $this->last_match_day; 519 } else { 520 $sql = "SELECT `match_day`, DATEDIFF(NOW(), `date`) AS datediff FROM {$wpdb->leaguemanager_matches} WHERE `league_id` = '%d' AND `season` = '%s' AND DATEDIFF(NOW(), `date`) > 0 ORDER BY datediff ASC"; 521 $matches = $wpdb->get_results( $wpdb->prepare($sql, $this->getLeagueID(), $season) ); 522 if ($matches) $match_day = $matches[0]->match_day; 523 else $match_day = -1; 524 525 $this->last_match_day = $match_day; 526 } 501 527 } elseif ( $select == "next" ) { 502 $sql = "SELECT `match_day`, DATEDIFF(NOW(), `date`) AS datediff FROM {$wpdb->leaguemanager_matches} WHERE `league_id` = '%d' AND `season` = '%s' AND DATEDIFF(NOW(), `date`) < 0 ORDER BY datediff DESC"; 503 $matches = $wpdb->get_results( $wpdb->prepare($sql, $this->getLeagueID(), $season) ); 504 505 if ($matches[0]) $match_day = $matches[0]->match_day; 506 else $match_day = -1; 528 if ( isset($this->next_match_day) ) { 529 $match_day = $this->next_match_day; 530 } else { 531 $sql = "SELECT `match_day`, DATEDIFF(NOW(), `date`) AS datediff FROM {$wpdb->leaguemanager_matches} WHERE `league_id` = '%d' AND `season` = '%s' AND DATEDIFF(NOW(), `date`) < 0 ORDER BY datediff DESC"; 532 $matches = $wpdb->get_results( $wpdb->prepare($sql, $this->getLeagueID(), $season) ); 533 if ($matches) $match_day = $matches[0]->match_day; 534 else $match_day = -1; 535 536 $this->next_match_day = $match_day; 537 } 507 538 } elseif ( $select == "current" || $select == "latest") { 508 $sql = "SELECT `id`, `match_day`, DATEDIFF(NOW(), `date`) AS datediff FROM {$wpdb->leaguemanager_matches} WHERE `league_id` = '%d' AND `season` = '%s' ORDER BY datediff ASC"; 509 $matches = $wpdb->get_results( $wpdb->prepare($sql, $this->getLeagueID(), $season) ); 510 if ($matches) { 511 $datediff = array(); 512 foreach ($matches AS $key => $match) { 513 $datediff[$key] = abs($match->datediff); 539 if ( isset($this->current_match_day) ) { 540 $match_day = $this->current_match_day; 541 } else { 542 $sql = "SELECT `id`, `match_day`, DATEDIFF(NOW(), `date`) AS datediff FROM {$wpdb->leaguemanager_matches} WHERE `league_id` = '%d' AND `season` = '%s' ORDER BY datediff ASC"; 543 $matches = $wpdb->get_results( $wpdb->prepare($sql, $this->getLeagueID(), $season) ); 544 if ($matches) { 545 $datediff = array(); 546 foreach ($matches AS $key => $match) { 547 $datediff[$key] = abs($match->datediff); 548 } 549 asort($datediff); 550 $keys = array_keys($datediff); 551 $match_day = $matches[$keys[0]]->match_day; 552 } else { 553 $match_day = -1; 514 554 } 515 asort($datediff); 516 $keys = array_keys($datediff); 517 $match_day = $matches[$keys[0]]->match_day; 518 } else { 519 $match_day = -1; 555 556 $this->current_match_day = $match_day; 520 557 } 558 } elseif ( intval($this->match_day) > 0 ) { 559 $match_day = $this->match_day; 521 560 } else { 522 561 $match_day = -1; … … 604 643 { 605 644 global $wpdb; 645 646 // use cached object 647 if ( !is_null($this->league) ) 648 return $this->league; 606 649 607 650 $league = $wpdb->get_results($wpdb->prepare("SELECT `title`, `id`, `seasons`, `settings` FROM {$wpdb->leaguemanager} WHERE `id` = '%d' OR `title` = '%s'", intval($league_id), $league_id) ); … … 674 717 global $wpdb; 675 718 676 $defaults = array( 'league_id' => false, 'season' => false, 'group' => false, 'rank' => false, 'orderby' => array("rank" => "ASC", "id" => "ASC") );719 $defaults = array( 'league_id' => false, 'season' => false, 'group' => false, 'rank' => false, 'orderby' => array("rank" => "ASC", "id" => "ASC"), "home" => false, "cache" => true ); 677 720 $args = array_merge($defaults, $args); 678 721 extract($args, EXTR_SKIP); 679 722 723 $cachekey = md5(implode(array_map(function($entry) { if(is_array($entry)) { return implode($entry); } else { return $entry; } }, $args)) . $output); 724 725 // use cached object 726 if ( isset($this->teams[$cachekey]) && $cache ) 727 return $this->teams[$cachekey]; 728 680 729 $search_terms = array(); 681 if ( $league_id) {730 if ( $league_id ) { 682 731 if ($league_id == "any") 683 732 $search_terms[] = "`league_id` != ''"; … … 685 734 $search_terms[] = $wpdb->prepare("`league_id` = '%d'", intval($league_id)); 686 735 } 687 if ( $season) {736 if ( $season ) { 688 737 if ($season == "any") 689 738 $search_terms[] = "`season` != ''"; … … 691 740 $search_terms[] = $wpdb->prepare("`season` = '%s'", htmlspecialchars($season)); 692 741 } 693 if ($group && $this->groupExists($league_id, htmlspecialchars($group))) $search_terms[] = $wpdb->prepare("`group` = '%s'", htmlspecialchars($group)); 694 if ($rank) $search_terms[] = $wpdb->prepare("`rank` = '%s'", $rank); 742 if ($group && $this->groupExists($league_id, htmlspecialchars($group))) 743 $search_terms[] = $wpdb->prepare("`group` = '%s'", htmlspecialchars($group)); 744 if ( $rank ) 745 $search_terms[] = $wpdb->prepare("`rank` = '%s'", $rank); 746 747 if ( $home ) 748 $search_terms[] = "`home` = 1"; 695 749 696 750 $search = ""; … … 715 769 $teamlist = $wpdb->get_results( $sql ); 716 770 $teams = array(); $i = 0; $class = ''; 771 $logo_sizes = array( 'tiny', 'thumb', 'large' ); 717 772 foreach ( $teamlist AS $team ) { 718 773 $class = ( 'alternate' == $class ) ? '' : 'alternate'; … … 727 782 $teams[$team->id]['stadium'] = stripslashes($team->stadium); 728 783 $teams[$team->id]['logo'] = ( !empty($team->logo) ) ? $this->getImageUrl(basename($team->logo)) : false; 784 if ( $team->logo ) { 785 foreach ( $logo_sizes AS $logo_size ) { 786 $teams[$team->id]['logos'][$logo_size] = $this->getImageUrl( basename($team->logo), false, $logo_size ); 787 $teams[$team->id]['logos'][$logo_size] = $this->getImageUrl( basename($team->logo), false, $logo_size ); 788 } 789 } 729 790 $teams[$team->id]['home'] = $team->home; 730 791 $teams[$team->id]['group'] = $team->group; … … 739 800 $teams[$team->id]['points2'] = array( 'plus' => $team->points2_plus, 'minus' => $team->points2_minus ); 740 801 $teams[$team->id]['add_points'] = $team->add_points; 802 $teams[$team->id]['diff'] = ( $team->diff > 0 ) ? '+'.intval($team->diff) : $team->diff; 741 803 foreach ( (array)$team->custom AS $key => $value ) 742 804 $teams[$team->id][$key] = stripslashes_deep($value); 743 805 } else { 744 806 $teamlist[$i]->logo = ( !empty($team->logo) ) ? $this->getImageUrl(basename($team->logo)) : false; 807 if ( $team->logo ) { 808 foreach ( $logo_sizes AS $logo_size ) { 809 $teamlist[$i]->logos[$logo_size] = $this->getImageUrl( basename($team->logo), false, $logo_size ); 810 $teamlist[$i]->logos[$logo_size] = $this->getImageUrl( basename($team->logo), false, $logo_size ); 811 } 812 } 745 813 $teamlist[$i]->roster = maybe_unserialize($team->roster); 746 814 if ( $this->hasBridge() ) { … … 754 822 $teamlist[$i]->stadium = stripslashes($team->stadium); 755 823 $teamlist[$i]->class = $class; 824 $teamlist[$i]->diff = ( $team->diff > 0 ) ? '+'.intval($team->diff) : $team->diff; 756 825 $teamlist[$i] = (object)array_merge((array)$team, (array)$team->custom); 757 826 } 758 827 759 unset($teamlist[$i]->custom, $team->custom);828 //unset($teamlist[$i]->custom, $team->custom); 760 829 $i++; 761 830 } 762 831 763 if ( 'ARRAY' == $output ) 764 return $teams; 765 766 return $teamlist; 832 if ( 'ARRAY' == $output ) { 833 $this->teams[$cachekey] = $teams; 834 } else { 835 $this->teams[$cachekey] = $teamlist; 836 } 837 838 return $this->teams[$cachekey]; 767 839 } 768 840 … … 778 850 global $wpdb; 779 851 852 // use cached object 853 if ( isset($this->team[$team_id]) ) 854 return $this->team[$team_id]; 855 780 856 $team = $wpdb->get_results( $wpdb->prepare("SELECT `title`, `website`, `coach`, `stadium`, `logo`, `home`, `group`, `roster`, `profile`, `points_plus`, `points_minus`, `points2_plus`, `points2_minus`, `add_points`, `done_matches`, `won_matches`, `draw_matches`, `lost_matches`, `diff`, `league_id`, `id`, `season`, `rank`, `status`, `custom` FROM {$wpdb->leaguemanager_teams} WHERE `id` = '%d' ORDER BY `rank` ASC, `id` ASC", intval($team_id)) ); 781 857 … … 791 867 $team->roster = maybe_unserialize($team->roster); 792 868 $team->logo = ( !empty($team->logo) ) ? $this->getImageUrl(basename($team->logo)) : false; 869 if ( $team->logo ) { 870 $logo_sizes = array( 'tiny', 'thumb', 'large' ); 871 foreach ( $logo_sizes AS $logo_size ) { 872 $team->logos[$logo_size] = $this->getImageUrl( basename($team->logo), false, $logo_size ); 873 $team->logos[$logo_size] = $this->getImageUrl( basename($team->logo), false, $logo_size ); 874 } 875 } 876 $team->diff = ( $team->diff > 0 ) ? '+'.$team->diff : $team->diff; 877 793 878 if ( $this->hasBridge() ) { 794 879 global $lmBridge; … … 798 883 799 884 $team = (object)array_merge((array)$team,(array)$team->custom); 800 unset($team->custom); 801 802 return $team; 885 //unset($team->custom); 886 887 $this->team[$team_id] = $team; 888 return $this->team[$team_id]; 803 889 } 804 890 … … 829 915 { 830 916 global $wpdb; 917 918 $key = md5($league_id . $group); 919 920 // use cached number 921 if ( isset($this->num_teams[$key]) ) 922 return $this->num_teams[$key]; 923 831 924 $league_id = intval($league_id); 832 925 if ($group == ''){ 833 $ num_teams= $wpdb->get_var( $wpdb->prepare("SELECT COUNT(ID) FROM {$wpdb->leaguemanager_teams} WHERE `league_id` = '%d'", $league_id) );926 $this->num_teams[$key] = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(ID) FROM {$wpdb->leaguemanager_teams} WHERE `league_id` = '%d'", $league_id) ); 834 927 } else { 835 $ num_teams= $wpdb->get_var( $wpdb->prepare("SELECT COUNT(ID) FROM {$wpdb->leaguemanager_teams} WHERE `league_id` = '%d' AND `group` = '%s'", $league_id, $group) );836 } 837 return $ num_teams;928 $this->num_teams[$key] = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(ID) FROM {$wpdb->leaguemanager_teams} WHERE `league_id` = '%d' AND `group` = '%s'", $league_id, $group) ); 929 } 930 return $this->num_teams[$key]; 838 931 } 839 932 … … 864 957 global $wpdb; 865 958 866 $num_matches = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(ID) FROM {$wpdb->leaguemanager_matches} WHERE `league_id` = '%d'", $league_id) ); 867 return $num_matches; 959 if ( !is_null($this->num_matches) ) 960 return $this->num_matches; 961 962 $this->num_matches = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(ID) FROM {$wpdb->leaguemanager_matches} WHERE `league_id` = '%d'", $league_id) ); 963 return $this->num_matches; 868 964 } 869 965 … … 930 1026 $teams = $teamsTmp = array(); 931 1027 foreach ( $this->getTeams( $team_args ) AS $team ) { 932 $team->diff = ( $team->diff > 0 ) ? '+'.$team->diff : $team->diff;1028 //$team->diff = ( $team->diff > 0 ) ? '+'.$team->diff : $team->diff; 933 1029 $team->points = array( 'plus' => $team->points_plus, 'minus' => $team->points_minus ); 934 1030 $team->points2 = array( 'plus' => $team->points2_plus, 'minus' => $team->points2_minus ); … … 959 1055 960 1056 /** 1057 * get standings table 1058 * 1059 * @param array $teams 1060 * @param int $match_day 1061 * @param string $mode 1062 * @param string $group 1063 */ 1064 function getStandings( $teams = false, $match_day = false, $mode = 'all', $group = false ) 1065 { 1066 global $wpdb; 1067 1068 $league = $this->getCurrentLeague( ); 1069 $season = $this->getSeason($league); 1070 if ( !$teams ) $teams = $this->getTeams( array("league_id" => $league->id, "season" => $season['name']), 'OBJECT' ); 1071 1072 $rule = $this->getPointRule( $league->point_rule ); 1073 extract( (array)$rule ); 1074 1075 foreach ( $teams AS $i => $team ) { 1076 $match_args = array( "league_id" => $league->id, "season" => $season['name'], "final" => "", "standingstable" => true, 'limit' => false ); 1077 // get matches of specific group 1078 if ( $group ) 1079 $match_args["group"] = $group; 1080 1081 // get only home matches 1082 if ( $mode == "home" ) 1083 $match_args['home_team'] = $team->id; 1084 // get only away matches 1085 if ( $mode == "away" ) 1086 $match_args['away_team'] = $team->id; 1087 // get all matches for given team 1088 if ( $mode == "all" ) 1089 $match_args['team_id'] = $team->id; 1090 1091 // get matches up to given match day 1092 if ( $match_day ) 1093 $match_args['match_day'] = $match_day; 1094 1095 // initialize team standings data 1096 $team->done_matches = 0; 1097 $team->won_matches = 0; 1098 $team->draw_matches = 0; 1099 $team->lost_matches = 0; 1100 $team->points_plus = 0; 1101 $team->points_minus = 0; 1102 $team->points2_plus = 0; 1103 $team->points2_minus = 0; 1104 1105 $points = array( 'plus' => 0, 'minus' => 0 ); 1106 $points2 = array( 'plus' => 0, 'minus' => 0 ); 1107 $team_points = 0; 1108 1109 // get matches 1110 $matches = $this->getMatches( $match_args ); 1111 foreach ( $matches AS $match ) { 1112 if ( $match->home_points != "" && $match->away_points != "" ) 1113 $team->done_matches += 1; 1114 1115 if ( $match->winner_id == $team->id ) 1116 $team->won_matches += 1; 1117 1118 if ( $match->loser_id == $team->id ) 1119 $team->lost_matches += 1; 1120 1121 if ( $match->winner_id == -1 && $match->loser_id == -1 ) 1122 $team->draw_matches += 1; 1123 1124 // Home Match 1125 if ( $match->home_team == $team->id ) { 1126 if ( 'score' == $rule ) { 1127 $points['plus'] += $match->home_points; 1128 $points['minus'] += $match->away_points; 1129 } else { 1130 $team_points += $match->home_points; 1131 } 1132 } 1133 1134 // Away Match 1135 if ( $match->away_team == $team->id ) { 1136 if ( 'score' == $rule ) { 1137 $points['plus'] += $match->away_points; 1138 $points['minus'] += $match->home_points; 1139 } else { 1140 $team_points += $match->away_points; 1141 } 1142 } 1143 } 1144 1145 if ( $rule != "score" ) { 1146 $points['plus'] = $team->won_matches * $forwin + $team->draw_matches * $fordraw + $team->lost_matches * $forloss + ($team_points * (isset($forscoring) ? $forscoring : 0)); 1147 $points['minus'] = $team->draw_matches * $fordraw + $team->lost_matches * $forwin + $team->won_matches * $forloss; 1148 } 1149 1150 //$points = apply_filters( 'team_points_'.$league->sport, $points, $team->id, $rule ); 1151 $team->points_plus = $points['plus']; 1152 $team->points_minus = $points['minus']; 1153 1154 //$points2 = apply_filters( 'team_points2_'.$league->sport, $team->id ); 1155 $team->points2_plus = $points2['plus']; 1156 $team->points2_minus = $points2['minus']; 1157 1158 $team = apply_filters( "leaguemanager_get_standings_".$league->sport, $team, $matches, $rule ); 1159 $team->diff = $team->points2_plus - $team->points2_minus; 1160 $team->points = array( 'plus' => $team->points_plus, 'minus' => $team->points_minus ); 1161 $team->points2 = array( 'plus' => $team->points2_plus, 'minus' => $team->points2_minus ); 1162 1163 $teams[$i] = $team; 1164 } 1165 1166 /* 1167 * rank teams 1168 */ 1169 if ( has_filter( 'rank_teams_'.$league->sport ) ) { 1170 $teams = apply_filters( 'rank_teams_'.$league->sport, $teams ); 1171 } else { 1172 foreach ( $teams AS $key => $row ) { 1173 $points[$key] = $row->points['plus'] + $row->add_points; 1174 $done[$key] = $row->done_matches; 1175 } 1176 1177 array_multisort($points, SORT_DESC, $done, SORT_ASC, $teams); 1178 } 1179 1180 return $teams; 1181 } 1182 1183 1184 /** 1185 * get standings selection 1186 * 1187 * @param objet $league 1188 */ 1189 function getStandingsSelection( $league ) 1190 { 1191 $selected = isset($_GET['standingstable']) ? htmlspecialchars($_GET['standingstable']) : ''; 1192 1193 $season = $this->getSeason( $league ); 1194 $options = array( 'all' => __( 'Current Table', 'leaguemanager' ), 'home' => __( 'Hometable', 'leaguemanager' ), 'away' => __( 'Awaytable', 'leaguemanager' ) ); 1195 $action = is_admin() ? menu_page_url('leaguemanager', 0)."&subpage=show-league&league_id=".$league->id : get_permalink(); 1196 $out = "<select size='1' name='standingstable'>"; 1197 foreach ( $options AS $value => $label ) { 1198 $out .= "<option value='".$value."'".selected($value, $selected, false).">".$label."</option>"; 1199 } 1200 for ( $day = 1; $day <= $season['num_match_days']; $day++ ) { 1201 $out .= "<option value='match_day-".$day."'".selected("match_day-".$day, $selected, false).">".sprintf(__("%d. Match Day", 'leaguemanager'), $day)."</option>"; 1202 } 1203 $out .= "</select>"; 1204 1205 return $out; 1206 } 1207 1208 1209 /** 1210 * get point rule depending on selection. 1211 * For details on point rules see http://de.wikipedia.org/wiki/Drei-Punkte-Regel (German) 1212 * 1213 * @param int $rule 1214 * @return array of points 1215 */ 1216 function getPointRule( $rule ) 1217 { 1218 $rule = maybe_unserialize($rule); 1219 1220 // Manual point rule 1221 if ( is_array($rule) ) { 1222 return $rule; 1223 } else { 1224 $point_rules = array(); 1225 // One point rule 1226 $point_rules['one'] = array( 'forwin' => 1, 'fordraw' => 0, 'forloss' => 0 ); 1227 // Two point rule 1228 $point_rules['two'] = array( 'forwin' => 2, 'fordraw' => 1, 'forloss' => 0 ); 1229 // Three-point rule 1230 $point_rules['three'] = array( 'forwin' => 3, 'fordraw' => 1, 'forloss' => 0 ); 1231 // Score. One point for each scored goal 1232 $point_rules['score'] = 'score'; 1233 1234 $point_rules = apply_filters( 'leaguemanager_point_rules', $point_rules ); 1235 1236 return $point_rules[$rule]; 1237 } 1238 } 1239 1240 1241 /** 961 1242 * determine if two teams are tied 962 1243 * … … 986 1267 global $wpdb; 987 1268 988 $defaults = array( 'league_id' => false, 'count' => false, 'season' => false, 'group' => false, 'final' => false, 'match_day' => false, 'time' => false, 'home_only' => false, 'winner_id' => false, 'loser_id' => false, 'team_id' => false, 'home_team' => false, 'away_team' => false, 'home_points' => false, 'away_points' => false, 'limit' => true, 'orderby' => array("date" => "ASC", "id" => "ASC") );1269 $defaults = array( 'league_id' => false, 'count' => false, 'season' => false, 'group' => false, 'final' => false, 'match_day' => false, 'time' => false, 'home_only' => false, 'winner_id' => false, 'loser_id' => false, 'team_id' => false, 'home_team' => false, 'away_team' => false, 'home_points' => false, 'away_points' => false, 'limit' => true, 'orderby' => array("date" => "ASC", "id" => "ASC"), 'standingstable' => false, 'cache' => true, 'logos' => true); 989 1270 $args = array_merge($defaults, (array)$args); 990 1271 extract($args, EXTR_SKIP); 1272 1273 $cachekey = md5(implode(array_map(function($entry) { if(is_array($entry)) { return implode($entry); } else { return $entry; } }, $args)) . $output); 1274 1275 // use cached objects 1276 if ( isset($this->matches[$cachekey]) && $cache && !$count ) 1277 return $this->matches[$cachekey]; 1278 1279 if ( isset($this->num_matches2[$cachekey]) && $cache && $count ) 1280 return intval($this->num_matches2[$cachekey]); 991 1281 992 1282 $league = $this->getCurrentLeague(); … … 1024 1314 if ($away_team) $search_terms[] = $wpdb->prepare("`away_team` = '%s'", $away_team); 1025 1315 } 1026 if ($match_day) $search_terms[] = $wpdb->prepare("`match_day` = '%d'", $match_day); 1316 1317 if ( $match_day && intval($match_day) > 0 ) { 1318 if ( $standingstable ) 1319 $search_terms[] = $wpdb->prepare("`match_day` <='%d'", $match_day); 1320 else 1321 $search_terms[] = $wpdb->prepare("`match_day` = '%d'", $match_day); 1322 } 1323 1324 // get only finished matches with score for time 'latest' 1325 if ( $time == 'latest' ) { 1326 $home_points = $away_points = false; 1327 $search_terms[] = "(`home_points` != '' OR `away_points` != '')"; 1328 } 1329 1027 1330 if ($home_points) { 1028 1331 if ($home_points == "null") … … 1052 1355 elseif ( $time == 'day' ) 1053 1356 $search_terms[] = "DATEDIFF('". htmlspecialchars(strip_tags($match_date))."', `date`) = 0"; 1054 1357 1055 1358 $search = ""; 1056 1359 if (count($search_terms) > 0) { … … 1094 1397 $sql .= " ORDER BY $order"; 1095 1398 //if ( $limit ) $sql .= " LIMIT ".intval($offset).",".intval($limit).""; 1096 return $wpdb->get_var($sql); 1399 $this->num_matches2[$cachekey] = $wpdb->get_var($sql); 1400 return $this->num_matches2[$cachekey]; 1097 1401 } else { 1098 1402 $sql = "SELECT `group`, `home_team`, `away_team`, DATE_FORMAT(`date`, '%Y-%m-%d %H:%i') AS date, DATE_FORMAT(`date`, '%e') AS day, DATE_FORMAT(`date`, '%c') AS month, DATE_FORMAT(`date`, '%Y') AS year, DATE_FORMAT(`date`, '%H') AS `hour`, DATE_FORMAT(`date`, '%i') AS `minutes`, `match_day`, `location`, `league_id`, `home_points`, `away_points`, `winner_id`, `loser_id`, `post_id`, `season`, `id`, `custom` FROM {$wpdb->leaguemanager_matches}"; … … 1105 1409 1106 1410 $i = 0; 1411 $class = ''; 1107 1412 foreach ( $matches AS $match ) { 1413 $class = ( 'alternate' == $class ) ? '' : 'alternate'; 1414 $matches[$i]->class = $class; 1415 1416 $matches[$i]->title = $this->getMatchTitle($match->id, $logos, $match); 1417 1108 1418 $matches[$i]->location = stripslashes($match->location); 1109 1419 $matches[$i]->custom = $match->custom = stripslashes_deep(maybe_unserialize($match->custom)); … … 1114 1424 $matches[$i]->hadPenalty = ( isset($match->penalty) && $match->penalty['home'] != '' && $match->penalty['away'] != '' ) ? true : false; 1115 1425 1116 $matches[$i]->time = ( '00:00' == $match->hour.":".$match->minutes ) ? '' : mysql2date(get_option('time_format'), $match->date); 1426 $matches[$i]->start_time = ( '00:00' == $match->hour.":".$match->minutes ) ? '' : mysql2date(get_option('time_format'), $match->date); 1427 $matches[$i]->match_date = ( substr($match->date, 0, 10) == '0000-00-00' ) ? 'N/A' : mysql2date(get_option('date_format'), $match->date); 1428 1429 if ( $matches[$i]->hadPenalty ) { 1430 $matches[$i]->homeScore = $match->penalty['home']+$match->overtime['home']; 1431 $matches[$i]->awayScore = $match->penalty['away']+$match->overtime['away']; 1432 $matches[$i]->score = sprintf("%s - %s", $matches[$i]->homeScore, $matches[$i]->awayScore)." ".__( '(o.P.)', 'leaguemanager' ); 1433 } elseif ( $matches[$i]->hadOvertime ) { 1434 $matches[$i]->homeScore = $match->overtime['home']; 1435 $matches[$i]->awayScore = $match->overtime['away']; 1436 $matches[$i]->score = sprintf("%s - %s", $matches[$i]->homeScore, $matches[$i]->awayScore)." ".__( '(AET)', 'leaguemanager' ); 1437 //$matches[$i]->score = sprintf("%s - %s", $matches[$i]->home_points, $matches[$i]->away_points); 1438 } elseif ( $matches[$i]->home_points != NULL && $match->away_points != NULL ) { 1439 $matches[$i]->homeScore = $match->home_points; 1440 $matches[$i]->awayScore = $match->away_points; 1441 $matches[$i]->score = sprintf("%s - %s", $matches[$i]->homeScore, $matches[$i]->awayScore); 1442 } else { 1443 $matches[$i]->homeScore = "-"; 1444 $matches[$i]->awayScore = "-"; 1445 $matches[$i]->score = sprintf("%s:%s", $matches[$i]->homeScore, $matches[$i]->awayScore); 1446 } 1447 1448 $matches[$i]->homeTeam = $this->getTeam($match->home_team); 1449 $matches[$i]->awayTeam = $this->getTeam($match->away_team); 1450 1451 $matches[$i]->report = ( $match->post_id != 0 ) ? '(<a href="'.get_permalink($match->post_id).'">'.__('Report', 'leaguemanager').'</a>)' : ''; 1117 1452 1118 1453 $i++; 1119 1454 } 1120 return $matches; 1455 1456 $this->matches[$cachekey] = $matches; 1457 return $this->matches[$cachekey]; 1121 1458 } 1122 1459 … … 1128 1465 * @return object 1129 1466 */ 1130 function getMatch( $match_id )1467 function getMatch( $match_id, $cache = true ) 1131 1468 { 1132 1469 global $wpdb; 1133 1470 1471 // use cached object 1472 if ( isset($this->match[$match_id]) && $cache ) 1473 return $this->match[$match_id]; 1474 1134 1475 $match = $wpdb->get_results("SELECT `group`, `home_team`, `away_team`, DATE_FORMAT(`date`, '%Y-%m-%d %H:%i') AS date, DATE_FORMAT(`date`, '%e') AS day, DATE_FORMAT(`date`, '%c') AS month, DATE_FORMAT(`date`, '%Y') AS year, DATE_FORMAT(`date`, '%H') AS `hour`, DATE_FORMAT(`date`, '%i') AS `minutes`, `match_day`, `location`, `league_id`, `home_points`, `away_points`, `winner_id`, `loser_id`, `post_id`, `season`, `id`, `custom` FROM {$wpdb->leaguemanager_matches} WHERE `id` = '".intval($match_id)."'"); 1135 1476 … … 1144 1485 //unset($match->custom); 1145 1486 1146 return $match; 1487 $this->match[$match_id] = $match; 1488 return $this->match[$match_id]; 1147 1489 } 1148 1490 … … 1167 1509 $title = ""; 1168 1510 } else { 1169 $home_logo_img = ($teams[$match->home_team]['logo'] != "" && $show_logo) ? "<img class=' home-logo logo' src='".$this->getThumbnailUrl($teams[$match->home_team]['logo'])."' alt='' />" : "";1170 $away_logo_img = ($teams[$match->away_team]['logo'] != "" && $show_logo) ? "<img class=' away-logo logo' src='".$this->getThumbnailUrl($teams[$match->away_team]['logo'])."' alt='' />" : "";1511 $home_logo_img = ($teams[$match->home_team]['logo'] != "" && $show_logo) ? "<img class='match-title home-logo logo' src='".$this->getThumbnailUrl($teams[$match->home_team]['logo'])."' alt='' />" : ""; 1512 $away_logo_img = ($teams[$match->away_team]['logo'] != "" && $show_logo) ? "<img class='match-title away-logo logo' src='".$this->getThumbnailUrl($teams[$match->away_team]['logo'])."' alt='' />" : ""; 1171 1513 $home_team_name = ($this->isHomeTeamMatch($match->home_team, $match->away_team, $teams)) ? "<strong>".$teams[$match->home_team]['title']."</strong>" : $teams[$match->home_team]['title']; 1172 1514 $away_team_name = ($this->isHomeTeamMatch($match->home_team, $match->away_team, $teams)) ? "<strong>".$teams[$match->away_team]['title']."</strong>" : $teams[$match->away_team]['title']; … … 1216 1558 $query_args['match_day'] = htmlspecialchars(strip_tags($_POST['match_day'])); 1217 1559 } 1218 1560 1219 1561 $page_links = paginate_links( array( 1220 1562 'base' => add_query_arg( $base, '%#%' ), … … 1255 1597 $this->current_page = 1; 1256 1598 1599 if ( $this->current_page > $this->getNumPages() ) 1600 $this->current_page = $this->getNumPages(); 1601 1257 1602 return intval($this->current_page); 1258 1603 } … … 1292 1637 function getNumPages() 1293 1638 { 1294 $this->num_max_pages = ( 0 == $this->getNumMatchesPerPage() ) ? 1 : ceil( $this->getNumMatches Query()/$this->getNumMatchesPerPage() );1639 $this->num_max_pages = ( 0 == $this->getNumMatchesPerPage() ) ? 1 : ceil( $this->getNumMatches($this->getLeagueID())/$this->getNumMatchesPerPage() ); 1295 1640 return $this->num_max_pages; 1296 1641 } … … 1456 1801 return false; 1457 1802 1803 if ( isset($this->database_column_exists[$table][$column]) ) 1804 return $this->database_column_exists[$table][$column]; 1805 1458 1806 $num = $wpdb->query( $wpdb->prepare("SHOW COLUMNS FROM {$table} LIKE %s", $column) ); 1459 1807 if ($num == 1) 1460 returntrue;1808 $this->database_column_exists[$table][$column] = true; 1461 1809 else 1462 return false; 1810 $this->database_column_exists[$table][$column] = false; 1811 1812 return $this->database_column_exists[$table][$column]; 1463 1813 } 1464 1814 -
leaguemanager/trunk/lib/shortcodes.php
r1348420 r1361999 263 263 $league->isCurrMatchDay = ''; 264 264 } 265 265 266 266 if ( $match_day == -1 || !empty($league->isCurrMatchDay) ) { 267 267 if (isset($_GET['match_day'])) … … 271 271 elseif ($league->isCurrMatchDay != "") 272 272 $match_day = $leaguemanager->getMatchDay($league->isCurrMatchDay); 273 else if ( $template != "by_matchday" )273 else 274 274 $match_day = 1; 275 275 } … … 327 327 328 328 //$leaguemanager->getMatchDay(); 329 if ( $limit === 'false' || $template == 'by_matchday') {329 if ( $limit === 'false' || in_array($template, array('by_matchday', 'by_matchday-tabs', 'by_matchday-accordion')) ) { 330 330 $match_args['limit'] = false; 331 331 } elseif ( $limit && is_numeric($limit) ) { … … 336 336 $match_args['match_date'] = $match_date; 337 337 $match_args['home_only'] = ( $home_only == 1 || $home_only == 'true' ) ? true : false; 338 339 // get matches340 $matches = $leaguemanager->getMatches( $match_args );341 338 342 339 /* … … 346 343 $league->current_page = $leaguemanager->getCurrentPage($league->id); 347 344 $league->pagination = ( $limit == 'true' ) ? $leaguemanager->getPageLinks($league->current_page, "match_paged_".$league->id) : ''; 345 $league->num_matches = $leaguemanager->getNumMatches($leaguemanager->getLeagueID()); 346 347 // get matches 348 $matches = $leaguemanager->getMatches( $match_args ); 348 349 349 350 /* … … 656 657 $next_match->match = $opponent->title . " – " . $team->title; 657 658 } 659 $next_match->match = $leaguemanager->getMatchTitle($next_match->id); 658 660 } 659 661 … … 669 671 $prev_match->match = $opponent->title . " – " . $team->title; 670 672 } 673 $prev_match->match = $leaguemanager->getMatchTitle($prev_match->id); 671 674 672 675 $prev_match->hadOvertime = ( isset($prev_match->overtime) && $prev_match->overtime['home'] != '' && $prev_match->overtime['away'] != '' ) ? true : false; -
leaguemanager/trunk/readme.txt
r1348420 r1361999 5 5 Requires at least: 2.7 6 6 Tested up to: 4.4.2 7 Stable tag: 4.0. 87 Stable tag: 4.0.9 8 8 License: LGPLv2.1 or later 9 9 … … 41 41 * Italian 42 42 * Arabian 43 * Hebrew by Bar Shai 43 44 44 45 == Installation == … … 83 84 * TO-DO - Updating the translation code to remove the deprecated code has broken some translations due to a change in how WordPress handles multiple options. The translations files need some attention, so do the sport files... 84 85 * Coming soon - Players, pagination for leagues, teams, matches, and players. New admin dashboard. New sport files. 86 87 = 4.0.9 = 88 * NEW: show standingstable for home/away matches and after each match day 89 * NEW: functions get_next_matches() and get_last_matches() (functions.php) to get next or last matches for specific team 90 * NEW: added hebrew translation by Bar Shai 91 * BUGFIX: fixed match_day option in [matches] shortcode when using multiple shortcodes on same page 92 * BUGFIX: fixed calculation of apparatus points for gymnastics 93 * BUGFIX: improved page loading times by caching MySQL query results and prevent unneccessary queries 94 * BUGFIX: fix in matches pagination 95 * BUGFIX: several small fixes 85 96 86 97 = 4.0.8 = -
leaguemanager/trunk/sports/baseball.php
r1324769 r1361999 43 43 44 44 add_action( 'leaguemanager_save_standings_'.$this->key, array(&$this, 'saveStandings') ); 45 add_action( 'leaguemanager_get_standings_'.$this->key, array(&$this, 'getStandingsFilter'), 10, 3 ); 45 46 46 47 } … … 107 108 108 109 /** 110 * get standings table data 111 * 112 * @param object $team 113 * @param array $matches 114 */ 115 function getStandingsFilter( $team, $matches, $point_rule ) 116 { 117 /* 118 * analogue to leaguemanager_save_standings_$sport filter 119 */ 120 $team->runs = $this->getRuns($team->id); 121 $team->gb = $this->getGamesBehind($team->id); 122 $team->shutouts = $this->getShutouts($team->id); 123 124 return $team; 125 } 126 127 128 /** 109 129 * get number of runs for team 110 130 * … … 118 138 $runs = array( 'for' => 0, 'against' => 0 ); 119 139 120 $home = $leaguemanager->getMatches( array("home_team" => $team_id, "limit" => false) ); 121 foreach ( $home AS $match ) { 122 $runs['for'] += $match->runs['for']; 123 $runs['against'] += $match->runs['against']; 140 $matches = $leaguemanager->getMatches( array("team_id" => $team_id, "limit" => false, "cache" => false) ); 141 foreach ( $matches AS $match ) { 142 if ( $match->home_team == $team_id ) { 143 $runs['for'] += $match->runs['for']; 144 $runs['against'] += $match->runs['against']; 145 } 146 if ( $match->away_team == $team_id ) { 147 $runs['for'] += $match->runs['against']; 148 $runs['against'] += $match->runs['for']; 149 } 124 150 } 125 151 126 $away = $leaguemanager->getMatches( array("away_team" => $team_id, "limit" => false) );127 foreach ( $away AS $match ) {128 $runs['for'] += $match->runs['against'];129 $runs['against'] += $match->runs['for'];130 }131 132 152 return $runs; 133 153 } … … 167 187 $shutouts = 0; 168 188 169 $home = $leaguemanager->getMatches( array("home_team" => $team_id) ); 170 foreach ( $home AS $match ) { 171 $shutouts += $match->shutouts['home']; 172 } 173 174 $away = $leaguemanager->getMatches( array("away_team" => $team_id) ); 175 foreach ( $away AS $match ) { 176 $shutouts += $match->shutouts['away']; 189 $matches = $leaguemanager->getMatches( array("team_id" => $team_id, "limit" => false, "cache" => false) ); 190 foreach ( $matches AS $match ) { 191 if ( $match->home_team == $team_id ) { 192 $shutouts += $match->shutouts['home']; 193 } else { 194 $shutouts += $match->shutouts['away']; 195 } 177 196 } 178 197 -
leaguemanager/trunk/sports/basketball.php
r1345280 r1361999 38 38 39 39 add_action( 'leaguemanager_update_results_'.$this->key, array(&$this, 'updateResults') ); 40 add_action( 'leaguemanager_get_standings_'.$this->key, array(&$this, 'getStandingsFilter'), 10, 3 ); 40 41 } 41 42 function LeagueManagerBasketball() … … 80 81 81 82 /** 83 * get standings table data 84 * 85 * @param object $team 86 * @param array $matches 87 */ 88 function getStandingsFilter( $team, $matches, $point_rule ) 89 { 90 /* 91 * analogue to team_points2_$sport filter 92 */ 93 $baskets = $this->calculateBasketStatistics( $team->id, $matches ); 94 $team->points2_plus = $baskets['plus']; 95 $team->points2_minus = $baskets['minus']; 96 97 return $team; 98 } 99 100 101 /** 82 102 * calculate baskets. Penalty is not counted in statistics 83 103 * … … 86 106 * @return int 87 107 */ 88 function calculateBasketStatistics( $team_id )108 function calculateBasketStatistics( $team_id, $matches = false ) 89 109 { 90 110 global $wpdb, $leaguemanager; … … 93 113 94 114 $team_id = intval($team_id); 95 //$matches = $wpdb->get_results( $wpdb->prepare("SELECT `home_points`, `away_points`, `custom` FROM {$wpdb->leaguemanager_matches} WHERE `home_team` = '%d'", $team_id) ); 96 $matches = $leaguemanager->getMatches( array("home_team" => $team_id, "limit" => false) ); 115 if ( !$matches ) $matches = $leaguemanager->getMatches( array("team_id" => $team_id, "limit" => false, "cache" => false) ); 97 116 if ( $matches ) { 98 117 foreach ( $matches AS $match ) { … … 100 119 $home_goals = $match->home_points; 101 120 $away_goals = $match->away_points; 102 103 $goals['plus'] += $home_goals; 104 $goals['minus'] += $away_goals; 105 106 } 107 } 108 109 //$matches = $wpdb->get_results( $wpdb->prepare("SELECT `home_points`, `away_points`, `custom` FROM {$wpdb->leaguemanager_matches} WHERE `away_team` = '%d'", $team_id) ); 110 $matches = $leaguemanager->getMatches( array("away_team" => $team_id, "limit" => false) ); 111 if ( $matches ) { 112 foreach ( $matches AS $match ) { 113 $custom = maybe_unserialize($match->custom); 114 $home_goals = $match->home_points; 115 $away_goals = $match->away_points; 116 117 $goals['plus'] += $away_goals; 118 $goals['minus'] += $home_goals; 119 121 122 // home match 123 if ( $match->home_team == $team_id ) { 124 $goals['plus'] += $home_goals; 125 $goals['minus'] += $away_goals; 126 } 127 128 // away match 129 if ( $match->away_team == $team_id ) { 130 $goals['plus'] += $away_goals; 131 $goals['minus'] += $home_goals; 132 } 120 133 } 121 134 } … … 272 285 global $wpdb, $leaguemanager; 273 286 274 $match = $leaguemanager->getMatch( $match_id );287 $match = $leaguemanager->getMatch( $match_id, false ); 275 288 276 289 if ( $match->home_points == "" && $match->away_points == "" ) { -
leaguemanager/trunk/sports/cornhole.php
r1266075 r1361999 58 58 global $leaguemanager; 59 59 60 $ home = $leaguemanager->getMatches( array("home_team" => $team_id, "limit" => false) );60 $matches = $leaguemanager->getMatches( array("team_id" => $team_id, "limit" => false, "cache" => false) ); 61 61 foreach ( $home AS $match ) { 62 $points['plus'] += $match->home_points; 63 $points['minus'] += $match->away_points; 64 } 65 66 $away = $leaguemanager->getMatches( array("away_team" => $team_id, "limit" => false) ); 67 foreach ( $away AS $match ) { 68 $points['plus'] += $match->away_points; 69 $points['minus'] += $match->home_points; 62 if ( $match->home_team == $team_id ) { 63 $points['plus'] += $match->home_points; 64 $points['minus'] += $match->away_points; 65 } else { 66 $points['plus'] += $match->away_points; 67 $points['minus'] += $match->home_points; 68 } 70 69 } 71 70 -
leaguemanager/trunk/sports/gymnastics.php
r1335884 r1361999 43 43 44 44 add_action( 'leaguemanager_save_standings_'.$this->key, array(&$this, 'saveStandings') ); 45 add_action( 'leaguemanager_get_standings_'.$this->key, array(&$this, 'getStandingsFilter'), 10, 3 ); 45 46 add_action( 'leaguemanager_update_results_'.$this->key, array(&$this, 'updateResults') ); 46 47 } … … 84 85 85 86 /** 87 * get standings table data 88 * 89 * @param object $team 90 * @param array $matches 91 */ 92 function getStandingsFilter( $team, $matches, $point_rule ) 93 { 94 /* 95 * analogue to team_points2_$sport filter 96 */ 97 $apparatus_points = $this->calculateApparatusPoints( $team->id, $matches ); 98 $team->points2_plus = $apparatus_points['plus']; 99 $team->points2_minus = $apparatus_points['minus']; 100 101 /* 102 * analogue to leaguemanager_save_standings_$sport filter 103 */ 104 $data = $this->getStandingsData( $team->id, maybe_unserialize($team->custom), $matches ); 105 $team->apparatus = $data['apparatus']; 106 107 return $team; 108 } 109 110 111 /** 86 112 * get standings data for given team 87 113 * … … 90 116 * @return array number of runs for and against as assoziative array 91 117 */ 92 function getStandingsData( $team_id, $data = array() )118 function getStandingsData( $team_id, $data = array(), $matches = false ) 93 119 { 94 120 global $leaguemanager; … … 97 123 $points = array( 'win' => 2, 'lost' => 0); 98 124 99 $matches = $leaguemanager->getMatches( array("team_id" => $team_id, "limit" => false) );125 if ( !$matches ) $matches = $leaguemanager->getMatches( array("team_id" => $team_id, "limit" => false, "cache" => false) ); 100 126 foreach ( $matches AS $match ) { 101 127 if ( isset($match->floor) ) { … … 135 161 $points2[$key] = $row->points2['plus']; 136 162 $done[$key] = $row->done_matches; 137 } 138 139 array_multisort( $points, SORT_DESC, $points2, SORT_DESC, $done, SORT_ASC, $teams ); 163 $diff[$key] = $row->diff; 164 } 165 166 array_multisort( $points, SORT_DESC, $diff, SORT_DESC, $done, SORT_ASC, $teams ); 140 167 return $teams; 141 168 } … … 366 393 * @return array of points 367 394 */ 368 function calculateApparatusPoints( $team_id )395 function calculateApparatusPoints( $team_id, $matches = false ) 369 396 { 370 397 global $wpdb, $leaguemanager; 371 398 372 $home = $leaguemanager->getMatches( array("home_team" => $team_id, "limit" => false) );373 $away = $leaguemanager->getMatches( array("away_team" => $team_id, "limit" => false) );374 375 399 $points = array( 'plus' => 0, 'minus' => 0); 376 if ( count($home) > 0 ) { 377 foreach ( $home AS $match ) { 400 401 if ( !$matches ) $matches = $leaguemanager->getMatches( array("team_id" => $team_id, "limit" => false, "cache" => false) ); 402 if ( $matches ) { 403 foreach ( $matches AS $match ) { 378 404 $custom = (array)maybe_unserialize($match->custom); 379 405 380 406 if (!isset($custom['apparatus_points'])) $custom['apparatus_points'] = array('plus' => '', 'minus' => ''); 381 $points['plus'] += intval($custom['apparatus_points']['plus']); 382 $points['minus'] += intval($custom['apparatus_points']['minus']); 407 if ( $match->home_team == $team_id ) { 408 $points['plus'] += intval($custom['apparatus_points']['plus']); 409 $points['minus'] += intval($custom['apparatus_points']['minus']); 410 } 411 if ( $match->away_team == $team_id ) { 412 $points['plus'] += intval($custom['apparatus_points']['minus']); 413 $points['minus'] += intval($custom['apparatus_points']['plus']); 414 } 383 415 } 384 416 } 385 386 if ( count($away) > 0 ) { 387 foreach ( $away AS $match ) { 388 $custom = (array)maybe_unserialize($match->custom); 389 390 if (!isset($custom['apparatus_points'])) $custom['apparatus_points'] = array('plus' => '', 'minus' => ''); 391 $points['plus'] += intval($custom['apparatus_points']['minus']); 392 $points['minus'] += intval($custom['apparatus_points']['plus']); 393 } 394 } 395 417 396 418 return $points; 397 419 } … … 408 430 global $wpdb, $leaguemanager; 409 431 410 $match = $leaguemanager->getMatch( $match_id );432 $match = $leaguemanager->getMatch( $match_id, false ); 411 433 412 434 if ( $match->home_points == "" && $match->away_points == "" ) { … … 420 442 foreach ( $apparatus AS $key ) { 421 443 if ( $match->{$key}['home'] != '' && $match->{$key}['guest'] != '' ) { 422 if ( $match->{$key}['home'] > $match->{$key}['guest'] ) 444 if ( $match->{$key}['home'] > $match->{$key}['guest'] ) { 423 445 $ap['plus'] += 2; 424 else446 } elseif ( $match->{$key}['home'] < $match->{$key}['guest'] ) { 425 447 $ap['minus'] += 2; 448 } else { 449 $ap['plus'] += 1; 450 $ap['minus'] += 1; 451 } 426 452 } 427 453 } -
leaguemanager/trunk/sports/handball.php
r1324769 r1361999 38 38 add_action( 'leaguemanager_standings_header_'.$this->key, array(&$this, 'displayStandingsHeader') ); 39 39 add_action( 'leaguemanager_standings_columns_'.$this->key, array(&$this, 'displayStandingsColumns'), 10, 2 ); 40 41 add_action( 'leaguemanager_get_standings_'.$this->key, array(&$this, 'getStandingsFilter'), 10, 3 ); 40 42 41 43 } … … 78 80 79 81 82 /** 83 * get standings table data 84 * 85 * @param object $team 86 * @param array $matches 87 */ 88 function getStandingsFilter( $team, $matches, $point_rule ) 89 { 90 /* 91 * analogue to team_points2_$sport filter 92 */ 93 $goals = $this->calculateGoalStatistics( $team->id, $matches ); 94 $team->points2_plus = $goals['plus']; 95 $team->points2_minus = $goals['minus']; 96 97 return $team; 98 } 99 100 80 101 /** 81 102 * extend header for Standings Table in Backend … … 207 228 * @return int 208 229 */ 209 function calculateGoalStatistics( $team_id )230 function calculateGoalStatistics( $team_id, $matches = false ) 210 231 { 211 232 global $wpdb, $leaguemanager; … … 213 234 $goals = array( 'plus' => 0, 'minus' => 0 ); 214 235 215 $matches = $leaguemanager->getMatches( array("home_team" => $team_id, "limit" => false) );236 if ( !$matches ) $matches = $leaguemanager->getMatches( array("team_id" => $team_id, "limit" => false, "cache" => false) ); 216 237 if ( $matches ) { 217 238 foreach ( $matches AS $match ) { … … 225 246 } 226 247 227 $goals['plus'] += $home_goals; 228 $goals['minus'] += $away_goals; 248 if ( $match->home_team == $team_id ) { 249 $goals['plus'] += $home_goals; 250 $goals['minus'] += $away_goals; 251 } else { 252 $goals['plus'] += $away_goals; 253 $goals['minus'] += $home_goals; 254 } 229 255 } 230 256 } 231 257 232 $matches = $leaguemanager->getMatches( array("away_team" => $team_id, "limit" => false) );233 if ( $matches ) {234 foreach ( $matches AS $match ) {235 $custom = maybe_unserialize($match->custom);236 if ( !empty($custom['overtime']['home']) && !empty($custom['overtime']['away']) ) {237 $home_goals = $custom['overtime']['home'];238 $away_goals = $custom['overtime']['away'];239 } else {240 $home_goals = $match->home_points;241 $away_goals = $match->away_points;242 }243 244 $goals['plus'] += $away_goals;245 $goals['minus'] += $home_goals;246 }247 }248 249 258 return $goals; 250 259 } -
leaguemanager/trunk/sports/hockey.php
r1345280 r1361999 45 45 46 46 add_action( 'leaguemanager_update_results_'.$key, array(&$this, 'updateResults') ); 47 add_action( 'leaguemanager_get_standings_'.$key, array(&$this, 'getStandingsFilter'), 10, 3 ); 47 48 } 48 49 } … … 121 122 122 123 /** 124 * get standings table data 125 * 126 * @param object $team 127 * @param array $matches 128 */ 129 function getStandingsFilter( $team, $matches, $point_rule ) 130 { 131 /* 132 * analogue to team_points2_$sport filter 133 */ 134 $goals = $this->calculateGoalStatistics( $team->id, $matches ); 135 $team->points2_plus = $goals['plus']; 136 $team->points2_minus = $goals['minus']; 137 138 return $team; 139 } 140 141 142 /** 123 143 * calculate goals. Penalty is not counted in statistics 124 144 * … … 127 147 * @return int 128 148 */ 129 function calculateGoalStatistics( $team_id )149 function calculateGoalStatistics( $team_id, $matches = false ) 130 150 { 131 151 global $wpdb, $leaguemanager; … … 133 153 $goals = array( 'plus' => 0, 'minus' => 0 ); 134 154 135 //$matches = $wpdb->get_results( "SELECT `home_points`, `away_points`, `custom` FROM {$wpdb->leaguemanager_matches} WHERE `home_team` = '".$team_id."'" ); 136 $matches = $leaguemanager->getMatches( array("home_team" => $team_id, "limit" => false) ); 155 if ( !$matches ) $matches = $leaguemanager->getMatches( array("team_id" => $team_id, "limit" => false, "cache" => false) ); 137 156 if ( $matches ) { 138 157 foreach ( $matches AS $match ) { … … 144 163 $home_goals = $match->home_points; 145 164 $away_goals = $match->away_points; 165 } 166 167 if ( $match->home_team == $team_id ) { 168 $goals['plus'] += $home_goals; 169 $goals['minus'] += $away_goals; 170 } else { 171 $goals['plus'] += $away_goals; 172 $goals['minus'] += $home_goals; 146 173 } 147 148 $goals['plus'] += $home_goals;149 $goals['minus'] += $away_goals;150 }151 }152 153 //$matches = $wpdb->get_results( "SELECT `home_points`, `away_points`, `custom` FROM {$wpdb->leaguemanager_matches} WHERE `away_team` = '".$team_id."'" );154 $matches = $leaguemanager->getMatches( array("away_team" => $team_id, "limit" => false) );155 if ( $matches ) {156 foreach ( $matches AS $match ) {157 $custom = maybe_unserialize($match->custom);158 if ( !empty($custom['overtime']['home']) && !empty($custom['overtime']['away']) ) {159 $home_goals = $custom['overtime']['home'];160 $away_goals = $custom['overtime']['away'];161 } else {162 $home_goals = $match->home_points;163 $away_goals = $match->away_points;164 }165 166 $goals['plus'] += $away_goals;167 $goals['minus'] += $home_goals;168 174 } 169 175 } … … 400 406 global $wpdb, $leaguemanager; 401 407 402 $match = $leaguemanager->getMatch( $match_id );408 $match = $leaguemanager->getMatch( $match_id, false ); 403 409 404 410 if ( $match->home_points == "" && $match->away_points == "" ) { -
leaguemanager/trunk/sports/other-two-scores.php
r1266075 r1361999 33 33 add_action( 'leaguemanager_standings_columns_'.$this->key, array(&$this, 'displayStandingsColumns'), 10, 2 ); 34 34 35 add_action( 'leaguemanager_get_standings_'.$this->key, array(&$this, 'getStandingsFilter'), 10, 3 ); 35 36 } 36 37 function LeagueManagerTwoScores() … … 72 73 73 74 75 /** 76 * get standings table data 77 * 78 * @param object $team 79 * @param array $matches 80 */ 81 function getStandingsFilter( $team, $matches, $point_rule ) 82 { 83 /* 84 * analogue to team_points2_$sport filter 85 */ 86 $goals = $this->calculateGoalStatistics( $team->id, $matches ); 87 $team->points2_plus = $goals['plus']; 88 $team->points2_minus = $goals['minus']; 89 90 return $team; 91 } 92 93 74 94 /** 75 95 * extend header for Standings Table in Backend … … 115 135 * @return int 116 136 */ 117 function calculateGoalStatistics( $team_id )137 function calculateGoalStatistics( $team_id, $matches = false ) 118 138 { 119 139 global $wpdb, $leaguemanager; … … 121 141 $goals = array( 'plus' => 0, 'minus' => 0 ); 122 142 123 //$matches = $wpdb->get_results( "SELECT `home_points`, `away_points`, `custom` FROM {$wpdb->leaguemanager_matches} WHERE `home_team` = '".$team_id."'" ); 124 $matches = $leaguemanager->getMatches( array("home_team" => $team_id, "limit" => false) ); 143 if ( !$matches ) $matches = $leaguemanager->getMatches( array("team_id" => $team_id, "limit" => false, "cache" => false) ); 125 144 if ( $matches ) { 126 145 foreach ( $matches AS $match ) { … … 134 153 } 135 154 136 $goals['plus'] += $home_goals; 137 $goals['minus'] += $away_goals; 138 } 139 } 140 141 //$matches = $wpdb->get_results( "SELECT `home_points`, `away_points`, `custom` FROM {$wpdb->leaguemanager_matches} WHERE `away_team` = '".$team_id."'" ); 142 $matches = $leaguemanager->getMatches( array("away_team" => $team_id, "limit" => false) ); 143 if ( $matches ) { 144 foreach ( $matches AS $match ) { 145 $custom = maybe_unserialize($match->custom); 146 if ( !empty($custom['overtime']['home']) && !empty($custom['overtime']['away']) ) { 147 $home_goals = $custom['overtime']['home']; 148 $away_goals = $custom['overtime']['away']; 155 if ( $match->home_team == $team_id ) { 156 $goals['plus'] += $home_goals; 157 $goals['minus'] += $away_goals; 149 158 } else { 150 $ home_goals = $match->home_points;151 $ away_goals = $match->away_points;159 $goals['plus'] += $away_goals; 160 $goals['minus'] += $home_goals; 152 161 } 153 154 $goals['plus'] += $away_goals;155 $goals['minus'] += $home_goals;156 162 } 157 163 } -
leaguemanager/trunk/sports/pool.php
r1348420 r1361999 43 43 44 44 add_action( 'leaguemanager_save_standings_'.$this->key, array(&$this, 'saveStandings') ); 45 add_action( 'leaguemanager_get_standings_'.$this->key, array(&$this, 'getStandingsFilter'), 10, 3 ); 45 46 } 46 47 function LeagueManagerSoccer() … … 85 86 86 87 /** 88 * get standings table data 89 * 90 * @param object $team 91 * @param array $matches 92 */ 93 function getStandingsFilter( $team, $matches, $point_rule ) 94 { 95 /* 96 * analogue to leaguemanager_save_standings_$sport filter 97 */ 98 $team->forScore = $this->getPoolScore($team->id, 'for', $matches); 99 $team->againstScore = $this->getPoolScore($team->id, 'against', $matches); 100 101 return $team; 102 } 103 104 105 /** 87 106 * save custom standings 88 107 * … … 111 130 * @return array number of runs for and against as assoziative array 112 131 */ 113 function getPoolScore( $team_id, $index )132 function getPoolScore( $team_id, $index, $matches = false ) 114 133 { 115 134 global $leaguemanager; 116 135 117 136 $score = array( 'for' => 0, 'against' => 0 ); 118 $home = $leaguemanager->getMatches( array("home_team" => $team_id, "limit" => false) );137 if ( !$matches ) $matches = $leaguemanager->getMatches( array("team_id" => $team_id, "limit" => false, "cache" => false) ); 119 138 foreach ( $home AS $match ) { 120 $score['for'] += $match->forScore; 121 $score['against'] += $match->againstScore; 122 } 123 124 $away = $leaguemanager->getMatches( array("away_team" => $team_id, "limit" => false) ); 125 foreach ( $away AS $match ) { 126 $score['for'] += $match->againstScore; 127 $score['against'] += $match->forScore; 139 if ( $team_id == $match->home_team ) { 140 $score['for'] += $match->forScore; 141 $score['against'] += $match->againstScore; 142 } else { 143 $score['for'] += $match->againstScore; 144 $score['against'] += $match->forScore; 145 } 128 146 } 129 147 -
leaguemanager/trunk/sports/rugby.php
r1324769 r1361999 48 48 add_action( 'leaguemanager_update_results_'.$this->key, array(&$this, 'updateResults') ); 49 49 add_action( 'leaguemanager_save_standings_'.$this->key, array(&$this, 'saveStandings') ); 50 add_action( 'leaguemanager_get_standings_'.$this->key, array(&$this, 'getStandingsFilter'), 10, 3 ); 50 51 } 51 52 function LeagueManagerSoccer() … … 127 128 extract($rule); 128 129 129 $matches = $leaguemanager->getMatches( array("team_id" => $team_id, "limit" => false ) );130 $matches = $leaguemanager->getMatches( array("team_id" => $team_id, "limit" => false, "cache" => false) ); 130 131 foreach ( $matches AS $match ) { 131 132 $index = ( $match->home_team == $team_id ) ? 'home' : 'away'; … … 198 199 199 200 /** 201 * get standings table data 202 * 203 * @param object $team 204 * @param array $matches 205 */ 206 function getStandingsFilter( $team, $matches, $point_rule ) 207 { 208 /* 209 * analogue to leaguemanager_save_standings_$sport filter 210 */ 211 $data = $this->getStandingsData( $team->id, maybe_unserialize($team->custom), $matches ); 212 $team->gamepoints = $data['gamepoints']; 213 214 return $team; 215 } 216 217 218 /** 200 219 * get standings data for given team 201 220 * … … 204 223 * @return array number of runs for and against as assoziative array 205 224 */ 206 function getStandingsData( $team_id, $data = array() )225 function getStandingsData( $team_id, $data = array(), $matches = false ) 207 226 { 208 227 global $leaguemanager; … … 210 229 $data['gamepoints'] = array( 'plus' => 0, 'minus' => 0 ); 211 230 212 $matches = $leaguemanager->getMatches( array("team_id" => $team_id, "limit" => false) );231 if ( !$matches ) $matches = $leaguemanager->getMatches( array("team_id" => $team_id, "limit" => false, "cache" => false) ); 213 232 foreach ( $matches AS $match ) { 214 233 // Home Match -
leaguemanager/trunk/sports/soccer.php
r1348420 r1361999 38 38 add_action( 'leaguemanager_standings_columns_'.$this->key, array(&$this, 'displayStandingsColumns'), 10, 2 ); 39 39 40 add_action( 'leaguemanager_get_standings_'.$this->key, array(&$this, 'getStandingsFilter'), 10, 3 ); 40 41 } 41 42 function LeagueManagerSoccer() … … 77 78 78 79 80 /** 81 * get standings table data 82 * 83 * @param object $team 84 * @param array $matches 85 */ 86 function getStandingsFilter( $team, $matches, $point_rule ) 87 { 88 /* 89 * analogue to team_points2_$sport filter 90 */ 91 $goals = $this->calculateGoalStatistics( $team->id, $matches ); 92 $team->points2_plus = $goals['plus']; 93 $team->points2_minus = $goals['minus']; 94 95 return $team; 96 } 97 98 79 99 /** 80 100 * extend header for Standings Table … … 209 229 * @return int 210 230 */ 211 function calculateGoalStatistics( $team_id )231 function calculateGoalStatistics( $team_id, $matches = false ) 212 232 { 213 233 global $wpdb, $leaguemanager; … … 215 235 $goals = array( 'plus' => 0, 'minus' => 0 ); 216 236 217 //$matches = $wpdb->get_results( "SELECT `home_points`, `away_points`, `custom` FROM {$wpdb->leaguemanager_matches} WHERE `home_team` = '".$team_id."'" ); 218 $matches = $leaguemanager->getMatches( array("home_team" => $team_id, "limit" => false) ); 237 if ( !$matches ) $matches = $leaguemanager->getMatches( array("team_id" => $team_id, "limit" => false, "cache" => false) ); 219 238 if ( $matches ) { 220 239 foreach ( $matches AS $match ) { … … 228 247 } 229 248 230 $goals['plus'] += $home_goals; 231 $goals['minus'] += $away_goals; 232 } 233 } 234 235 //$matches = $wpdb->get_results( "SELECT `home_points`, `away_points`, `custom` FROM {$wpdb->leaguemanager_matches} WHERE `away_team` = '".$team_id."'" ); 236 $matches = $leaguemanager->getMatches( array("away_team" => $team_id, "limit" => false) ); 237 if ( $matches ) { 238 foreach ( $matches AS $match ) { 239 $custom = maybe_unserialize($match->custom); 240 if ( !empty($custom['overtime']['home']) && !empty($custom['overtime']['away']) ) { 241 $home_goals = $custom['overtime']['home']; 242 $away_goals = $custom['overtime']['away']; 249 if ( $match->home_team == $team_id ) { 250 $goals['plus'] += $home_goals; 251 $goals['minus'] += $away_goals; 243 252 } else { 244 $ home_goals = $match->home_points;245 $ away_goals = $match->away_points;253 $goals['plus'] += $away_goals; 254 $goals['minus'] += $home_goals; 246 255 } 247 248 $goals['plus'] += $away_goals;249 $goals['minus'] += $home_goals;250 256 } 251 257 } -
leaguemanager/trunk/sports/tabletennis.php
r1266075 r1361999 89 89 90 90 $points = array( 'plus' => 0, 'minus' => 0 ); 91 $home = $leaguemanager->getMatches( array("home_team" => $team_id, "limit" => false) ); 92 foreach ( $home AS $match ) { 93 $points['plus'] += $match->home_points; 94 $points['minus'] += $match->away_points; 95 } 96 97 $away = $leaguemanager->getMatches( array("away_team" => $team_id, "limit" => false) ); 98 foreach ( $away AS $match ) { 99 $points['plus'] += $match->away_points; 100 $points['minus'] += $match->home_points; 91 $matches = $leaguemanager->getMatches( array("team_id" => $team_id, "limit" => false, "cache" => false) ); 92 foreach ( $matches AS $match ) { 93 if ( $team_id == $match->home_team ) { 94 $points['plus'] += $match->home_points; 95 $points['minus'] += $match->away_points; 96 } else { 97 $points['plus'] += $match->away_points; 98 $points['minus'] += $match->home_points; 99 } 101 100 } 102 101 -
leaguemanager/trunk/sports/tennis.php
r1345280 r1361999 56 56 add_filter( 'leaguemanager_lost_matches_'.$this->key, array(&$this, 'getNumLostMatches'), 10, 2 ); 57 57 add_action( 'leaguemanager_save_standings_'.$this->key, array(&$this, 'saveStandings') ); 58 add_action( 'leaguemanager_get_standings_'.$this->key, array(&$this, 'getStandingsFilter'), 10, 3 ); 58 59 59 60 add_action( 'league_settings_'.$this->key, array(&$this, 'leagueSettings') ); … … 286 287 287 288 /** 289 * get standings table data 290 * 291 * @param object $team 292 * @param array $matches 293 */ 294 function getStandingsFilter( $team, $matches, $point_rule ) 295 { 296 /* 297 * analogue to leaguemanager_save_standings_$sport filter 298 */ 299 $data = $this->getStandingsData( $team->id, maybe_unserialize($team->custom), $matches ); 300 $team->straight_set = $data['straight_set']; 301 $team->split_set = $data['split_set']; 302 $team->games_allowed = $data['games_allowed']; 303 304 return $team; 305 } 306 307 308 /** 288 309 * get standings data for given team 289 310 * … … 292 313 * @return array number of runs for and against as assoziative array 293 314 */ 294 function getStandingsData( $team_id, $data = array() )315 function getStandingsData( $team_id, $data = array(), $matches = false ) 295 316 { 296 317 global $leaguemanager; … … 302 323 $season = $leaguemanager->getSeason($league); 303 324 304 $matches = $leaguemanager->getMatches( array("league_id" => $league->id, "season" => $season['name'], "final" => '', "limit" => false) );325 if ( !$matches ) $matches = $leaguemanager->getMatches( array("league_id" => $league->id, "season" => $season['name'], "final" => '', "limit" => false, "cache" => false) ); 305 326 foreach ( $matches AS $match ) { 306 327 if ( $match->home_team == $team_id || $match->away_team == $team_id || ( isset($match->home_partner) && $match->home_partner == $team_id ) || ( isset($match->guest_partner) && $match->guest_partner == $team_id ) ) { … … 598 619 global $wpdb, $leaguemanager; 599 620 600 $match = $leaguemanager->getMatch( $match_id );621 $match = $leaguemanager->getMatch( $match_id, false ); 601 622 if ( $match->home_points == "" && $match->away_points == "" ) { 602 623 $score = array( 'home' => '', 'guest' => '' ); -
leaguemanager/trunk/sports/us-football.php
r1324769 r1361999 37 37 add_action( 'leaguemanager_standings_header_'.$key, array(&$this, 'displayStandingsHeader') ); 38 38 add_action( 'leaguemanager_standings_columns_'.$key, array(&$this, 'displayStandingsColumns'), 10, 2 ); 39 40 add_action( 'leaguemanager_get_standings_'.$key, array(&$this, 'getStandingsFilter'), 10, 3 ); 39 41 } 40 42 } … … 117 119 118 120 /** 121 * get standings table data 122 * 123 * @param object $team 124 * @param array $matches 125 */ 126 function getStandingsFilter( $team, $matches, $point_rule ) 127 { 128 /* 129 * analogue to team_points2_$sport filter 130 */ 131 $goals = $this->calculateGoalStatistics( $team->id, $matches ); 132 $team->points2_plus = $goals['plus']; 133 $team->points2_minus = $goals['minus']; 134 135 return $team; 136 } 137 138 139 /** 119 140 * extend header for Standings Table in Backend 120 141 * … … 179 200 * @return int 180 201 */ 181 function calculateGoalStatistics( $team_id )202 function calculateGoalStatistics( $team_id, $matches = false ) 182 203 { 183 204 global $wpdb, $leaguemanager; … … 185 206 $goals = array( 'plus' => 0, 'minus' => 0 ); 186 207 187 //$matches = $wpdb->get_results( "SELECT `home_points`, `away_points`, `custom` FROM {$wpdb->leaguemanager_matches} WHERE `home_team` = '".$team_id."'" ); 188 $matches = $leaguemanager->getMatches( array("home_team" => $team_id, "limit" => false) ); 208 if ( !$matches ) $matches = $leaguemanager->getMatches( array("team_id" => $team_id, "limit" => false, "cache" => false) ); 189 209 if ( $matches ) { 190 210 foreach ( $matches AS $match ) { … … 193 213 $away_goals = $match->away_points; 194 214 195 $goals['plus'] += $home_goals; 196 $goals['minus'] += $away_goals; 215 if ( $match->home_team == $team_id ) { 216 $goals['plus'] += $home_goals; 217 $goals['minus'] += $away_goals; 218 } else { 219 $goals['plus'] += $away_goals; 220 $goals['minus'] += $home_goals; 221 } 197 222 } 198 223 } 199 224 200 //$matches = $wpdb->get_results( "SELECT `home_points`, `away_points`, `custom` FROM {$wpdb->leaguemanager_matches} WHERE `away_team` = '".$team_id."'" );201 $matches = $leaguemanager->getMatches( array("away_team" => $team_id, "limit" => false) );202 if ( $matches ) {203 foreach ( $matches AS $match ) {204 $custom = maybe_unserialize($match->custom);205 $home_goals = $match->home_points;206 $away_goals = $match->away_points;207 208 $goals['plus'] += $away_goals;209 $goals['minus'] += $home_goals;210 }211 }212 213 225 return $goals; 214 226 } -
leaguemanager/trunk/sports/volleyball.php
r1345280 r1361999 54 54 55 55 add_action( 'leaguemanager_save_standings_'.$this->key, array(&$this, 'saveStandings') ); 56 56 add_action( 'leaguemanager_get_standings_'.$this->key, array(&$this, 'getStandingsFilter'), 10, 3 ); 57 57 add_action( 'leaguemanager_update_results_'.$this->key, array(&$this, 'updateResults') ); 58 58 } … … 215 215 216 216 /** 217 * get standings table data 218 * 219 * @param object $team 220 * @param array $matches 221 */ 222 function getStandingsFilter( $team, $matches, $point_rule ) 223 { 224 /* 225 * analogue to leaguemanager_save_standings_$sport filter 226 */ 227 $data = $this->getStandingsData( $team->id, maybe_unserialize($team->custom), $matches ); 228 $team->sets = $data['sets']; 229 $team->ballpoints = $data['ballpoints']; 230 231 return $team; 232 } 233 234 235 /** 217 236 * get standings data for given team 218 237 * … … 221 240 * @return array number of runs for and against as assoziative array 222 241 */ 223 function getStandingsData( $team_id, $data = array() )242 function getStandingsData( $team_id, $data = array(), $matches = false ) 224 243 { 225 244 global $leaguemanager; … … 228 247 $data['ballpoints'] = array( 'plus' => 0, 'minus' => 0 ); 229 248 230 $matches = $leaguemanager->getMatches( array("team_id" => $team_id, "limit" => false) );249 if ( !$matches ) $matches = $leaguemanager->getMatches( array("team_id" => $team_id, "limit" => false, "cache" => false) ); 231 250 foreach ( $matches AS $match ) { 232 251 // Home Match … … 449 468 global $wpdb, $leaguemanager; 450 469 451 $match = $leaguemanager->getMatch( $match_id );470 $match = $leaguemanager->getMatch( $match_id, false ); 452 471 if ( $match->home_points == "" && $match->away_points == "" ) { 453 472 $score = array( 'home' => '', 'guest' => '' ); -
leaguemanager/trunk/style.css
r1348420 r1361999 260 260 width: 130px; 261 261 } 262 table.leaguemanager .logo { 262 table.leaguemanager .logo, 263 table .leaguemanager .match-title.logo { 263 264 width: 20px; 264 265 } 266 .match-title.logo { 267 max-width: 50px; 268 } 265 269 table.leaguemanager .logo img { 266 270 display: block; -
leaguemanager/trunk/templates/matches-by_matchday-accordion.php
r1344775 r1361999 41 41 <?php $class = ( $class == 'alternate' ) ? '' : 'alternate'; ?> 42 42 <tr class='<?php echo $class ?>'> 43 <td class='match'><?php echo $match-> date." ".$match->start_time." ".$match->location ?><br /><a href="<?php echo $match->pageURL ?>"><?php echo $match->title ?></a> <?php echo $match->report ?></td>43 <td class='match'><?php echo $match->match_date." ".$match->start_time." ".$match->location ?><br /><a href="<?php echo $match->pageURL ?>"><?php echo $match->title ?></a> <?php echo $match->report ?></td> 44 44 <td class='score' valign='bottom'><?php echo $match->score ?></td> 45 45 </tr> -
leaguemanager/trunk/templates/matches-by_matchday-gymnastics.php
r1344775 r1361999 42 42 <?php $class = ( $class == 'alternate' ) ? '' : 'alternate'; ?> 43 43 <tr class='<?php echo $class ?>'> 44 <td class='match'><?php echo $match-> date." ".$match->start_time." ".$match->location ?><br /><a href="<?php echo $match->pageURL ?>"><?php echo $match->title ?></a> <?php echo $match->report ?></td>44 <td class='match'><?php echo $match->match_date." ".$match->start_time." ".$match->location ?><br /><a href="<?php echo $match->pageURL ?>"><?php echo $match->title ?></a> <?php echo $match->report ?></td> 45 45 <td class='score' valign='bottom'><?php echo $match->score ?></td> 46 46 <td class='ap' valign='bottom'> -
leaguemanager/trunk/templates/matches-by_matchday-tabs.php
r1344775 r1361999 47 47 <?php $class = ( $class == 'alternate' ) ? '' : 'alternate'; ?> 48 48 <tr class='<?php echo $class ?>'> 49 <td class='match'><?php echo $match-> date." ".$match->start_time." ".$match->location ?><br /><a href="<?php echo $match->pageURL ?>"><?php echo $match->title ?></a> <?php echo $match->report ?></td>49 <td class='match'><?php echo $match->match_date." ".$match->start_time." ".$match->location ?><br /><a href="<?php echo $match->pageURL ?>"><?php echo $match->title ?></a> <?php echo $match->report ?></td> 50 50 <td class='score' valign='bottom'><?php echo $match->score ?></td> 51 51 </tr> -
leaguemanager/trunk/templates/matches-by_matchday.php
r1344775 r1361999 41 41 <?php $class = ( $class == 'alternate' ) ? '' : 'alternate'; ?> 42 42 <tr class='<?php echo $class ?>'> 43 <td class='match'><?php echo $match-> date." ".$match->start_time." ".$match->location ?><br /><a href="<?php echo $match->pageURL ?>"><?php echo $match->title ?></a> <?php echo $match->report ?></td>43 <td class='match'><?php echo $match->match_date." ".$match->start_time." ".$match->location ?><br /><a href="<?php echo $match->pageURL ?>"><?php echo $match->title ?></a> <?php echo $match->report ?></td> 44 44 <td class='score' valign='bottom'><?php echo $match->score ?></td> 45 45 </tr> -
leaguemanager/trunk/templates/matches-gymnastics.php
r1336648 r1361999 30 30 31 31 <tr class='<?php echo $match->class ?>'> 32 <td class='match'><?php echo $match-> date." ".$match->start_time." ".$match->location ?><br /><a href="<?php echo $match->pageURL ?>"><?php echo $match->title ?></a> <?php echo $match->report ?></td>32 <td class='match'><?php echo $match->match_date." ".$match->start_time." ".$match->location ?><br /><a href="<?php echo $match->pageURL ?>"><?php echo $match->title ?></a> <?php echo $match->report ?></td> 33 33 <td class='score' valign='bottom'><?php echo $match->score ?></td> 34 34 <td class='ap' valign='bottom'> … … 40 40 </table> 41 41 42 <p class='page-numbers'><?php echo $league->pagination ?></p> 43 42 44 <?php endif; ?> 43 45 -
leaguemanager/trunk/templates/matches-irish-gaelic-football.php
r1336648 r1361999 34 34 ?> 35 35 <tr class='<?php echo $match->class ?>'> 36 <td class='match'><?php echo $match-> date." ".$match->start_time." ".$match->location ?><br /><a href="<?php echo $match->pageURL ?>"><?php echo $match->title ?></a> <?php echo $match->report ?></td>36 <td class='match'><?php echo $match->match_date." ".$match->start_time." ".$match->location ?><br /><a href="<?php echo $match->pageURL ?>"><?php echo $match->title ?></a> <?php echo $match->report ?></td> 37 37 <td class='score' valign='bottom'><?php echo $match->score ?></td> 38 38 </tr> -
leaguemanager/trunk/templates/matches-racing.php
r1336648 r1361999 79 79 <?php $class = ( 'alternate' == $class ) ? '' : 'alternate'; ?> 80 80 <tr class='<?php echo $class ?>'> 81 <td><?php echo $match-> date ?></td>81 <td><?php echo $match->match_date ?></td> 82 82 <?php if (!$roster) : ?> 83 83 <td><?php echo $racer['name'] ?></td> -
leaguemanager/trunk/templates/matches-tennis.php
r1336648 r1361999 31 31 32 32 <tr class='<?php echo $match->class ?>'> 33 <td class='match'><?php echo $match-> date." ".$match->start_time." ".$match->location ?><br /><a href="<?php echo $match->pageURL ?>"><?php echo $match->title ?></a> <?php echo $match->report ?></td>33 <td class='match'><?php echo $match->match_date." ".$match->start_time." ".$match->location ?><br /><a href="<?php echo $match->pageURL ?>"><?php echo $match->title ?></a> <?php echo $match->report ?></td> 34 34 <td class='score' valign='bottom'> 35 35 <?php -
leaguemanager/trunk/templates/matches-volleyball.php
r1336648 r1361999 35 35 ?> 36 36 <tr class='<?php echo $match->class ?>'> 37 <td class='match'><?php echo $match-> date." ".$match->start_time." ".$match->location ?><br /><a href="<?php echo $match->pageURL ?>"><?php echo $match->title ?></a> <?php echo $match->report ?></td>37 <td class='match'><?php echo $match->match_date." ".$match->start_time." ".$match->location ?><br /><a href="<?php echo $match->pageURL ?>"><?php echo $match->title ?></a> <?php echo $match->report ?></td> 38 38 <td class='score' valign='bottom'> 39 39 <?php echo $match->score . " (".implode(", ", $sets).")" ?> -
leaguemanager/trunk/templates/matches.php
r1336648 r1361999 28 28 29 29 <tr class='<?php echo $match->class ?>'> 30 <td class='match'><?php echo $match-> date." ".$match->start_time." ".$match->location ?><br /><a href="<?php echo $match->pageURL ?>"><?php echo $leaguemanager->getMatchTitle($match->id) ?></a> <?php echo $match->report ?></td>30 <td class='match'><?php echo $match->match_date." ".$match->start_time." ".$match->location ?><br /><a href="<?php echo $match->pageURL ?>"><?php echo $leaguemanager->getMatchTitle($match->id) ?></a> <?php echo $match->report ?></td> 31 31 <td class='score' valign='bottom'><?php echo $match->score ?></td> 32 32 </tr> -
leaguemanager/trunk/templates/standings-last5.php
r1348420 r1361999 79 79 80 80 // Get Next Match 81 $next_results = get_next_match($team->id, 1); 81 //$next_results = get_next_match($team->id, 1); 82 $next_results = $leaguemanager->getMatches( array("time" => "next", "team_id" => $team->id, "limit" => 1) ); 82 83 $last5 = '<td style="text-align: right;" class="last5Icon last5">'; 83 84 if ( $next_results ) { … … 98 99 // Get the latest results 99 100 //$results = get_last_matches($team->id, 5); 100 $results = get_latest_results($team->id, 5); 101 //$results = get_latest_results($team->id, 5); 102 $results = $leaguemanager->getMatches( array("time" => "latest", "team_id" => $team->id, "limit" => 5) ); 101 103 foreach ($results as $result) 102 104 { -
leaguemanager/trunk/templates/team.php
r1348420 r1361999 47 47 <p class="match"><?php echo $team->next_match->match ?></p> 48 48 <p class='match_day'><?php printf(__("<strong>%d.</strong> Match Day", 'leaguemanager'), $team->next_match->match_day); ?></p> 49 <p class='match_date'><?php echo mysql2date("j. F Y", $team->next_match-> date) ?> <span class='time'><?php echo $team->next_match->time ?></span> <span class='location'><?php echo $team->next_match->location ?></span></p>49 <p class='match_date'><?php echo mysql2date("j. F Y", $team->next_match->match_date) ?> <span class='time'><?php echo $team->next_match->start_time ?></span> <span class='location'><?php echo $team->next_match->location ?></span></p> 50 50 <p class="score"> </p> 51 51 </div> … … 61 61 <p class="match"><?php echo $team->prev_match->match ?></p> 62 62 <p class='match_day'><?php printf(__("<strong>%d.</strong> Match Day", 'leaguemanager'), $team->prev_match->match_day); ?></p> 63 <p class='match_date'><?php echo mysql2date("j. F Y", $team->prev_match-> date) ?> <span class='time'><?php echo $team->prev_match->time ?></span> <span class='location'><?php echo $team->prev_match->location ?></span></p>63 <p class='match_date'><?php echo mysql2date("j. F Y", $team->prev_match->match_date) ?> <span class='time'><?php echo $team->prev_match->start_time ?></span> <span class='location'><?php echo $team->prev_match->location ?></span></p> 64 64 <p class="score"><?php echo $team->prev_match->score ?></p> 65 65 </div>
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)