Created
October 3, 2013 12:31
-
-
Save thewheat/6809082 to your computer and use it in GitHub Desktop.
Support for custom number of fixtures. Caveat: disables checking of proper number of fixtures for all leagues. Should work with https://github.com/thewheat/PHPLeague-for-WP/commit/0c47e97739d24a9b5e7b065b4ae85bf72ce6a24a Add to your existing files Lines ending with "// added for custom number of fixtures"
Lines between "// new code - 1" and "// …
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // new code - 1 | |
| if (isset($_POST['fixtures_add']) && check_admin_referer('phpleague')) | |
| { | |
| $nb_fixtures = $db->nb_fixtures_league($id_league); | |
| $db->add_fixtures_league($nb_fixtures+1, $id_league); | |
| } | |
| if (isset($_POST['fixtures_delete']) && check_admin_referer('phpleague')) | |
| { | |
| $nb_fixtures = $db->nb_fixtures_league($id_league); | |
| $db->remove_fixtures_league($id_league, $nb_fixtures); | |
| } | |
| // new code - 0 | |
| // Odd number of teams is probably not desired... | |
| ... | |
| // Security check | |
| if ($nb_fixtures != $fixtures_number && false) // added false for custom number of fixtures // new code | |
| { | |
| ... | |
| $output .= '<div class="tablenav top"><div class="alignleft actions">'.$fct->input('fixtures', __('Save', 'phpleague'), array('type' => 'submit', 'class' => 'button')).'</div></div>'; | |
| // new code - 1 | |
| $output .= '<div class="tablenav top">'; | |
| $output .= '<div class="alignleft actions">'.$fct->input('fixtures_add', __('Add Fixtures', 'phpleague'), array('type' => 'submit', 'class' => 'button')).'</div>'; | |
| $output .= '<div class="alignleft actions">'.$fct->input('fixtures_delete', __('Delete last fixture', 'phpleague'), array('type' => 'submit', 'class' => 'button', 'onclick'=> 'return confirm("' . __('Delete last fixture?', 'phpleague') . '")')).'</div>'; | |
| $output .= '</div>'; | |
| // new code - 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Check what kind of fixtures we are dealing with (odd/even) | |
| if (($nb_teams % 2) != 0) | |
| { | |
| $nb_fixtures = $nb_teams * $nb_legs; | |
| $nb_matches = ($nb_teams - 1) / 2; | |
| } | |
| else | |
| { | |
| $nb_fixtures = ($nb_teams * $nb_legs) - $nb_legs; | |
| $nb_matches = ($nb_teams / 2); | |
| } | |
| // new code - 1 | |
| $nb_fixtures = $db->nb_fixtures_league($id_league); // added for custom number of fixtures | |
| // new code - 0 | |
| // Data processing... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Check what kind of number we have (odd/even) | |
| if (($nb_teams % 2) != 0) | |
| $nb_fixtures = $nb_teams * $nb_legs; | |
| else | |
| $nb_fixtures = ($nb_teams * $nb_legs) - $nb_legs; | |
| // new code - 1 | |
| $nb_fixtures = $db->nb_fixtures_league($id_league); // added for custom number of fixtures | |
| // new code - 0 | |
| // If the player mod is enabled, we show the toggle button |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment