[eTCG] mybingo

Here's a mod you can use to track the numbers you get on your bingo card.

First step : Install

This goes into your func.php, custom function page, or any pages that you will use the function on.
// Track your bingo card numbers
// $tcg = the name of the TCG as defined in the database; $mybingo = the name you used for your Additional Field; 
function mybingo($tcg, $mybingo) {
$database = new Database; 
$tcginfo = $database->get_assoc("SELECT * FROM `tcgs` WHERE `name`='$tcg'");

$bingo = get_additional($tcg,$mybingo);
$hit = explode(' | ',$bingo);
for($i=0; $i<5; $i++) { $hit[$i] = explode(', ',$hit[$i]); }

echo '<table class="mybingo"><tbody><tr><th>B</th><th>I</th><th>N</th><th>G</th><th>O</th></tr>';
for($j=1; $j<=5; $j++) {
echo '<tr>';
for($k=1; $k<=5; $k++) { echo '<td>' . str_replace("[","<b>",str_replace("]","</b>",$hit[$k-1][$j-1])) . '</td>'; }
echo '</tr>';
}
echo '</tbody></table>';
}

Second step : Style it

Add this to your css file.
.mybingo th, .mybingo td { border: 1px solid #000; padding: 5px 10px; text-align: center; }
.mybingo th { background: #000; color: #fff; }
.mybingo b { color: #f00; font-weight: bold; }

Third step : Your numbers

Create an Additional Field where you'll list your card numbers, like this: B numbers | I numbers | N numbers | G numbers | O numbers. Be sure to include the "Free space" when listing your N numbers.
Example:
14, 03, 07, 15, 05 | 18, 16, 19, 24, 29 | 32, 41, [❤], 31, 37 | 50, 47, 55, 48, 53 | 71, 64, 65, 72, 66

Fourth step : Use it

Place this wherever you want your card to show.
mybingo($tcg, $mybingo);
  • Replace $tcg with the TCG you're using it on.
  • Replace $mybingo with the name you used for your Additional Field.
  • When one of your numbers is called, surround it with [ ] to mark it.

Examples

"For this card, the numbers 07, 29, 50 and 66 have been called".
mybingo('Bookshelf','MyCard');
14, 03, [07], 15, 05 | 18, 16, 19, 24, [29] | 32, 41, [❤], 31, 37 | [50], 47, 55, 48, 53 | 71, 64, 65, 72, [66]
BINGO
1418325071
0316414764
07195565
1524314872
0529375366

That's all. If you need help or find some mistake, please let me know :D