|
@@ -6,9 +6,11 @@ include_once 'Database.php';
|
|
|
|
|
|
|
|
class WebFunctions
|
|
class WebFunctions
|
|
|
{
|
|
{
|
|
|
- function createMatchTable($matches)
|
|
|
|
|
|
|
+ function createMatchTable($matches, $betLevel, $bankValue)
|
|
|
{
|
|
{
|
|
|
- echo '<table>';
|
|
|
|
|
|
|
+ echo '<table id="soccerMatchTable" class="display">';
|
|
|
|
|
+ echo '<thead>';
|
|
|
|
|
+ echo '<tr>';
|
|
|
echo '<th>GameDate</th>';
|
|
echo '<th>GameDate</th>';
|
|
|
echo '<th>League</th>';
|
|
echo '<th>League</th>';
|
|
|
echo '<th>Home Team</th>';
|
|
echo '<th>Home Team</th>';
|
|
@@ -22,30 +24,49 @@ class WebFunctions
|
|
|
echo '<th>Bet Amount</th>';
|
|
echo '<th>Bet Amount</th>';
|
|
|
|
|
|
|
|
echo '<th>Submit</th>';
|
|
echo '<th>Submit</th>';
|
|
|
|
|
+ echo '</tr>';
|
|
|
|
|
+ echo '</thead>';
|
|
|
|
|
|
|
|
|
|
+ echo '<tbody>';
|
|
|
foreach ($matches as $match) {
|
|
foreach ($matches as $match) {
|
|
|
- $this->createMatchRow($match);
|
|
|
|
|
|
|
+ $this->createMatchRow($match, $betLevel, $bankValue);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ echo '</tbody>';
|
|
|
echo '</table>';
|
|
echo '</table>';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function createMatchRow(SoccerMatch $match)
|
|
|
|
|
- {
|
|
|
|
|
- echo '<tr>';
|
|
|
|
|
-
|
|
|
|
|
- echo '<td>' . $match->getGameDate() . '</td>';
|
|
|
|
|
- echo '<td>' . $match->getHomeTeam()->getTeamLeague() . '</td>';
|
|
|
|
|
-
|
|
|
|
|
- echo '<td>' . $match->getHomeTeam()->getTeamName() . '</td>';
|
|
|
|
|
- echo '<td>' . $match->getAwayTeam()->getTeamName() . '</td>';
|
|
|
|
|
- echo '<td>' . $match->getOdds1() . '</td>';
|
|
|
|
|
- echo '<td>' . $match->getOddsX() . '</td>';
|
|
|
|
|
- echo '<td>' . $match->getOdds2() . '</td>';
|
|
|
|
|
-
|
|
|
|
|
- echo '<td>' . $this->getAnalysisValue($match);
|
|
|
|
|
-
|
|
|
|
|
- echo '</tr>';
|
|
|
|
|
|
|
+ function createMatchRow(
|
|
|
|
|
+ SoccerMatch $match,
|
|
|
|
|
+ float $betLevel,
|
|
|
|
|
+ float $bankValue
|
|
|
|
|
+ ) {
|
|
|
|
|
+ $analysisValue = $this->getAnalysisValue($match);
|
|
|
|
|
+
|
|
|
|
|
+ if ($analysisValue != 'No bet') {
|
|
|
|
|
+ echo '<tr>';
|
|
|
|
|
+
|
|
|
|
|
+ echo '<td>' . $match->getGameDate() . '</td>';
|
|
|
|
|
+ echo '<td>' . $match->getHomeTeam()->getTeamLeague() . '</td>';
|
|
|
|
|
+
|
|
|
|
|
+ echo '<td>' . $match->getHomeTeam()->getTeamName() . '</div></td>';
|
|
|
|
|
+ echo '<td>' . $match->getAwayTeam()->getTeamName() . '</td>';
|
|
|
|
|
+ echo '<td><div contenteditable>' .
|
|
|
|
|
+ $match->getOdds1() .
|
|
|
|
|
+ '</div></td>';
|
|
|
|
|
+ echo '<td><div contenteditable>' .
|
|
|
|
|
+ $match->getOddsX() .
|
|
|
|
|
+ '</div></td>';
|
|
|
|
|
+ echo '<td><div contenteditable>' .
|
|
|
|
|
+ $match->getOdds2() .
|
|
|
|
|
+ '</div></td>';
|
|
|
|
|
+
|
|
|
|
|
+ echo '<td>' . $analysisValue;
|
|
|
|
|
+ echo '<td>' . ($bankValue * $betLevel) / 100 . '</td>';
|
|
|
|
|
+ echo '<td><button id="submitRowButton">Submit</button></td>';
|
|
|
|
|
+
|
|
|
|
|
+ echo '</tr>';
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private function getAnalysisValue(SoccerMatch $match)
|
|
private function getAnalysisValue(SoccerMatch $match)
|
|
@@ -121,4 +142,43 @@ class WebFunctions
|
|
|
|
|
|
|
|
return $result;
|
|
return $result;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public function createOutstandingBetsTable()
|
|
|
|
|
+ {
|
|
|
|
|
+ $database = new Database();
|
|
|
|
|
+ $bets = $database->getOutstandingBets();
|
|
|
|
|
+ if ($bets == null) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ echo '<table id="outstandingBetsTable">';
|
|
|
|
|
+ echo '<thead>';
|
|
|
|
|
+ echo '<tr>';
|
|
|
|
|
+ echo '<th>Game date</th>';
|
|
|
|
|
+ echo '<th>League</th>';
|
|
|
|
|
+ echo '<th>Teams</th>';
|
|
|
|
|
+ echo '<th>Bet On</th>';
|
|
|
|
|
+ echo '<th>Bet Amount</th>';
|
|
|
|
|
+ echo '<th>Odds</th>';
|
|
|
|
|
+ echo '<th>Status</th>';
|
|
|
|
|
+ echo '</tr>';
|
|
|
|
|
+ echo '</thead>';
|
|
|
|
|
+ foreach ($bets as $bet) {
|
|
|
|
|
+ $this->createOutstandingBetsRow($bet);
|
|
|
|
|
+ }
|
|
|
|
|
+ echo '<tbody>';
|
|
|
|
|
+ echo '</table>';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private function createOutstandingBetsRow(Bet $bet)
|
|
|
|
|
+ {
|
|
|
|
|
+ echo '<tr>';
|
|
|
|
|
+ echo '<td>' . $bet->getGameDate() . '</td>';
|
|
|
|
|
+ echo '<td>' . $bet->getLeagueName() . '</td>';
|
|
|
|
|
+ echo '<td>' . $bet->getTeams() . '</td>';
|
|
|
|
|
+ echo '<td>' . $bet->getBetOn() . '</td>';
|
|
|
|
|
+ echo '<td>' . $bet->getBetAmount() . '</td>';
|
|
|
|
|
+ echo '<td>' . $bet->getOdds() . '</td>';
|
|
|
|
|
+ echo '<td>' . $bet->getStatus() . '</td>';
|
|
|
|
|
+ echo '</tr>';
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|