public static function main($argv) { global $lng; title($lng->getTrn('name', 'Gallery')); list($sel_lid, $HTML_LeagueSelector) = HTMLOUT::simpleLeagueSelector(); if (isset($_POST['type'])) { echo "<center><a href='handler.php?type=gallery'>" . $lng->getTrn('common/back') . "</a></center>\n"; switch ($_POST['type']) { case 'team': $t = new Team((int) $_POST['tid']); echo "<b>" . $lng->getTrn('playersof', 'Gallery') . " {$t->name}</b><br><hr><br>\n"; foreach ($t->getPlayers() as $p) { $img = new ImageSubSys(IMGTYPE_PLAYER, $p->player_id); $pic = $img->getPath(); echo "<div style='float:left; padding:10px;'>{$p->name} (#{$p->nr})<br><a href='" . urlcompile(T_URL_PROFILE, T_OBJ_PLAYER, $p->player_id, false, false) . "'><img HEIGHT=150 src='{$pic}' alt='pic'></a></div>"; } break; case 'stad': echo "<b>" . $lng->getTrn('stads', 'Gallery') . "</b><br><hr><br>\n"; $teams = get_rows('teams', array('team_id', 'name'), array("f_lid = {$sel_lid}")); objsort($teams, array('+name')); foreach ($teams as $t) { $img = new ImageSubSys(IMGTYPE_TEAMSTADIUM, $t->team_id); $pic = $img->getPath(); echo "<div style='float:left; padding:10px;'>{$t->name}<br><a href='{$pic}'><img HEIGHT=150 src='{$pic}' alt='pic'></a></div>"; } break; case 'coach': echo "<b>" . $lng->getTrn('coaches', 'Gallery') . "</b><br><hr><br>\n"; $q = "SELECT coach_id, name FROM coaches,memberships WHERE cid = coach_id AND lid = {$sel_lid} GROUP BY cid, lid ORDER BY name ASC"; $result = mysql_query($q); while ($c = mysql_fetch_object($result)) { $img = new ImageSubSys(IMGTYPE_COACH, $c->coach_id); $pic = $img->getPath(); echo "<div style='float:left; padding:10px;'>{$c->name}<br><a href='{$pic}'><img HEIGHT=150 src='{$pic}' alt='pic'></a></div>"; } break; } return; } echo $HTML_LeagueSelector; echo "<br><br>\n"; echo $lng->getTrn('note', 'Gallery'); ?> <ul> <li> <?php $teams = get_rows('teams', array('team_id', 'name'), array("f_lid = {$sel_lid}")); objsort($teams, array('+name')); echo $lng->getTrn('players', 'Gallery') . "\n <form method='POST' style='display:inline; margin:0px;'><select name='tid' onChange='this.form.submit();'>\n <option value='0'>— " . $lng->getTrn('none', 'Gallery') . " —</option>" . implode("\n", array_map(create_function('$o', 'return "<option value=\'$o->team_id\'>$o->name</option>";'), $teams)) . "</select><input type='hidden' name='type' value='team'></form>\n "; ?> </li> <li><?php echo inlineform(array('type' => 'stad'), 'stadForm', $lng->getTrn('stads', 'Gallery')); ?> </li> <li><?php echo inlineform(array('type' => 'coach'), 'coachesForm', $lng->getTrn('coaches', 'Gallery')); ?> </li> </ul> <?php }
public static function printList($node, $node_id, $ALLOW_EDIT) { global $lng; $entries = self::getFT($node, $node_id); echo "<table style='table-layout:fixed; width:" . (count($entries) == 1 ? 50 : 100) . "%;'><tr>"; # The percentage difference is a HTML layout fix. $i = 1; foreach ($entries as $e) { if ($i > 2) { echo "\n</tr>\n<tr>\n"; $i = 1; } ?> <td style='width:50%;' valign='top'> <div class="boxWide" style="width: 80%; margin: 20px auto 20px auto;"> <div class="boxTitle<?php echo T_HTMLBOX_INFO; ?> "> <?php echo "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $e->tid, false, false) . "'>{$e->name}</a>"; echo " (<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_COACH, $e->f_cid, false, false) . "'>{$e->f_cname}</a>)"; echo ": " . $e->title; ?> </div> <div class="boxBody"> <table class="common"> <tr> <td align="left" valign="top"> <?php echo $e->about; ?> </td> <td align="right" style='width:25%;'> <img border='0px' height='75' width='75' alt='team picture' src="<?php $img = new ImageSubSys(IMGTYPE_TEAMLOGO, $e->tid); echo $img->getPath(); ?> "> </td> </tr> <tr> <td colspan="2"><hr></td> </tr> <tr> <td align="left"> <?php echo $lng->getTrn('posted', __CLASS__) . ' ' . textdate($e->date, true); ?> </td> <td colspan="2" align="right"> <?php if ($ALLOW_EDIT) { ?> <a href="handler.php?type=famousteams&action=edit&ft_id=<?php echo $e->ft_id; ?> "><?php echo $lng->getTrn('edit', __CLASS__); ?> </a> <a href="handler.php?type=famousteams&action=delete&ft_id=<?php echo $e->ft_id; ?> "><?php echo $lng->getTrn('del', __CLASS__); ?> </a> <?php } ?> </td> </tr> </table> </div> </div> </td> <?php $i++; } echo "</tr></table>"; }
public static function main($argv) { global $pdf; global $DEA; global $skillarray; global $rules; global $lng; global $inducements; $FILLED = false; if (!empty($argv)) { $team1 = new Team($argv[0]); $team2 = new Team($argv[1]); $match = new Match($argv[2]); if (!is_null($team1) && !is_null($team2)) { $FILLED = true; } } else { $team1 = null; $team2 = null; $match = null; } define("MARGINX", 20); define("MARGINY", 20); define("DEFLINECOLOR", '#000000'); define("HEADLINEBGCOLOR", '#c3c3c3'); // Custom settings for inducements. define('MAX_STARS', 2); define('MERC_EXTRA_COST', 30000); define('MERC_EXTRA_SKILL_COST', 50000); // Color codes. define('COLOR_ROSTER_NORMAL', COLOR_HTML_NORMAL); define('COLOR_ROSTER_READY', COLOR_HTML_READY); define('COLOR_ROSTER_MNG', COLOR_HTML_MNG); define('COLOR_ROSTER_DEAD', COLOR_HTML_DEAD); define('COLOR_ROSTER_SOLD', COLOR_HTML_SOLD); define('COLOR_ROSTER_STARMERC', COLOR_HTML_STARMERC); define('COLOR_ROSTER_JOURNEY', COLOR_HTML_JOURNEY); define('COLOR_ROSTER_JOURNEY_USED', COLOR_HTML_JOURNEY_USED); define('COLOR_ROSTER_NEWSKILL', COLOR_HTML_NEWSKILL); //----- define('COLOR_ROSTER_CHR_EQP1', COLOR_HTML_CHR_EQP1); // Characteristic equal plus one. define('COLOR_ROSTER_CHR_GTP1', COLOR_HTML_CHR_GTP1); // Characteristic greater than plus one. define('COLOR_ROSTER_CHR_EQM1', COLOR_HTML_CHR_EQM1); // Characteristic equal minus one. define('COLOR_ROSTER_CHR_LTM1', COLOR_HTML_CHR_LTM1); // Characteristic less than minus one. define('T_PDF_ROSTER_SET_EMPTY_ON_ZERO', true); # Prints cp, td etc. as '' (empty string) when field = 0. $ind_cost = 0; $pdf = new BB_PDF('L', 'pt', 'A4'); // Creating a new PDF doc. landscape, scale=pixels, size A4 $pdf->SetAutoPageBreak(false, 20); // No auto page break to mess up layout $pdf->SetAuthor('Daniel Straalman, Daniel Henriksson, Nicholas Rathmann'); $pdf->SetCreator('OBBLM'); $pdf->SetTitle($lng->getTrn('name', 'PDFMatchReport')); $pdf->SetSubject($lng->getTrn('name', 'PDFMatchReport')); $pdf->AddFont('Tahoma', '', 'tahoma.php'); // Adding regular font Tahoma which is in font dir $pdf->AddFont('Tahoma', 'B', 'tahomabd.php'); // Adding Tahoma Bold // Initial settings $pdf->SetFont('Tahoma', 'B', 8); $pdf->AddPage(); $pdf->SetLineWidth(1.5); $currentx = MARGINX - 10; $currenty = MARGINY + 6; //Real PDF fill starts here $pdf->SetFillColorBB($pdf->hex2cmyk(HEADLINEBGCOLOR)); # $pdf->RoundedRect($currentx, $currenty, 542, 20, 6, 'DF'); // Filled rectangle around Team headline $pdf->SetDrawColorBB($pdf->hex2cmyk(DEFLINECOLOR)); // Text in headline $pdf->SetXY($currentx + 130, $currenty); $pdf->SetFont('Tahoma', 'B', 18); $pdf->Cell(360, 20, 'OBBLM Match Report', 0, 0, 'R', false, ''); // make a call to get the league Name instead of hardcoded //Printing game info rounded box $currenty += 5; $pdf->SetFillColorBB($pdf->hex2cmyk('#c6c6c6')); $pdf->SetDrawColorBB($pdf->hex2cmyk('#000000')); $pdf->SetFontSize(1); $pdf->SetLineWidth(0.6); #$pdf->RoundedRect($currentx, $currenty, 542, 80, 5, 'D'); //Score boxes $pdf->SetLineWidth(0.4); $scoreboxOffset = 20; # $pdf->RoundedRect($currentx + 15, $currenty + $scoreboxOffset, 50, 50, 5, 'D'); # $pdf->RoundedRect($currentx + 475, $currenty + $scoreboxOffset, 50, 50, 5, 'D'); if ($FILLED) { $img1 = new ImageSubSys(IMGTYPE_TEAMLOGO, $team1->team_id); $img2 = new ImageSubSys(IMGTYPE_TEAMLOGO, $team2->team_id); $pdf->Image($img1->getPath(), $currentx + 10, $currenty + $scoreboxOffset, 60, 60, '', '', false, 0); $pdf->Image($img2->getPath(), $currentx + 720, $currenty + $scoreboxOffset, 60, 60, '', '', false, 0); } $currentx += 190; $currenty += 15; $pdf->SetXY($currentx, $currenty); $pdf->SetFont('Tahoma', 'B', 12); $noname = '__________________'; $norace = '__________________'; $pdf->Cell(390, 50, (!$FILLED ? $noname : $team1->name) . ' - ' . (!$FILLED ? $noname : $team2->name), 0, 0, 'C', false, ''); $currenty += 15; $pdf->SetXY($currentx, $currenty); $pdf->SetFont('Tahoma', '', 10); $pdf->Cell(390, 50, (!$FILLED ? $norace : $team1->f_rname) . ' - ' . (!$FILLED ? $norace : $team2->f_rname), 0, 0, 'C', false, ''); // Gate + score text $pdf->SetFont('Tahoma', '', 10); $space = ' '; $currenty += 26; $pdf->SetXY($currentx, $currenty); $pdf->Cell(210, 50, "Score: -", 0, 0, 'R', false, ''); $currenty += 10; $pdf->SetXY($currentx, $currenty); $pdf->Cell(210, 50, "Gate:{$space}k", 0, 0, 'R', false, ''); //Printing headers for player rows. Do all this twice $smallFieldSize = 25; $mediumFieldSize = 90; $nameFieldSize = 100; $skillFieldSize = 350; //Print two team boxes $currenty += 5; $i = 0; while ($i < 2) { $i++; $currenty += 15; $currentx = MARGINX + 6; $pdf->SetXY($currentx, $currenty); $pdf->SetFillColorBB($pdf->hex2cmyk('#c6c6c6')); $pdf->SetDrawColorBB($pdf->hex2cmyk('#000000')); $pdf->SetFontSize(1); $pdf->SetLineWidth(0.6); #$pdf->RoundedRect($currentx, $currenty, 542, 315, 5, 'D'); $currenty += $scoreboxOffset; $currentx += 15; $pdf->SetXY($currentx, $currenty); $currentx += 25; $pdf->SetXY($currentx, $currenty); $h = 5; $pdf->SetFillColorBB($pdf->hex2cmyk(HEADLINEBGCOLOR)); $pdf->SetDrawColorBB($pdf->hex2cmyk(DEFLINECOLOR)); $pdf->SetFont('Tahoma', 'B', 6); $pdf->setLineWidth(1.5); // Printing headline for team table $pdf->Cell(50, $h, 'Winnings', 1, 0, 'L', true, ''); $pdf->Cell(60, $h, 'Fan Factor', 1, 0, 'C', true, ''); $pdf->Cell(70, $h, 'Total team CAS', 1, 0, 'C', true, ''); $pdf->Cell(35, $h, 'FAME', 1, 0, 'C', true, ''); if (1 && $FILLED) { $pdf->SetFont('Tahoma', 'B', 7); $pdf->Cell(150, $h, ' ' . ${"team{$i}"}->name, 0, 0, 'L', false, ''); } $currenty += 5; $pdf->SetXY($currentx, $currenty); $h = 15; // Row/cell height for team table row $pdf->SetFillColorBB($pdf->hex2cmyk('#FFFFFF')); $pdf->SetDrawColorBB($pdf->hex2cmyk('#000000')); $pdf->SetFontSize(1); $pdf->SetLineWidth(0.6); //Team table row $pdf->Cell(50, $h, '', 1, 0, 'L', true, ''); //Fan factor box $pdf->SetFont('Tahoma', '', 6); $boxx = $currentx + 50; $boxy = $currenty; $pdf->SetXY($boxx += 4, $boxy += 5); $pdf->Rect($boxx, $boxy, 5, 5, 'DF'); $pdf->SetXY($boxx += 5, $boxy -= 1); $pdf->Cell(20, 8, '+1', 0, 0, 'L', false); $pdf->SetXY($boxx += 16, $boxy += 1); $pdf->Rect($boxx, $boxy, 5, 5, 'DF'); $pdf->SetXY($boxx += 5, $boxy -= 1); $pdf->Cell(20, 8, '0', 0, 0, 'L', false); $pdf->SetXY($boxx += 12, $boxy += 1); $pdf->Rect($boxx, $boxy, 5, 5, 'DF'); $pdf->SetXY($boxx += 5, $boxy -= 1); $pdf->Cell(20, 8, '-1', 0, 0, 'L', false); //Total team cas, FAME $pdf->SetXY($currentx + 110, $currenty); $pdf->Cell(70, $h, '', 1, 0, 'C', true, ''); $pdf->Cell(35, $h, '', 1, 0, 'C', true, ''); if (1 && $FILLED) { $t = ${"team{$i}"}; $pdf->SetFont('Tahoma', '', 7); $statsstr = sprintf('TV: %uk - ReRolls: %u - Apocthecary: %u - Fan Factor: %u - Assistant Coaches: %u - Cheerleaders: %u - Played: %u - Win pct.: %1.0f - ELO: %1.0f - CAS inflicted: %u', $t->tv / 1000, $t->rerolls, $t->apothecary, $t->rg_ff, $t->ass_coaches, $t->cheerleaders, $t->mv_played, $t->rg_win_pct, $t->rg_elo, $t->mv_cas); $pdf->Cell(250, $h, ' ' . $statsstr, 0, 0, 'L', false, ''); } $currenty += $h + 5; $pdf->SetXY($currentx - 20, $currenty); //Headers for player table $h = 10; $pdf->SetFillColorBB($pdf->hex2cmyk(HEADLINEBGCOLOR)); $pdf->SetDrawColorBB($pdf->hex2cmyk(DEFLINECOLOR)); $pdf->SetFont('Tahoma', 'B', 8); $pdf->setLineWidth(1.5); // Printing headline for player table $pdf->Cell($smallFieldSize, $h, 'Nr', 1, 0, 'C', true, ''); $pdf->Cell($mediumFieldSize, $h, 'Position', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, 'MA', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, 'ST', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, 'AG', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, 'AV', 1, 0, 'C', true, ''); $pdf->Cell($skillFieldSize, $h, 'Skills', 1, 0, 'L', true, ''); $pdf->Cell($smallFieldSize, $h, 'SPP', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, 'MVP', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, 'Cp', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, 'Td', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, 'Int', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, 'BH', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, 'SI', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, 'Ki', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, 'Inj', 1, 0, 'C', true, ''); $currenty += 13; $pdf->SetXY($currentx - 20, $currenty); $pdf->SetFont('Tahoma', '', 6); $h = 10; // Row/cell height for player table $pdf->SetFillColorBB($pdf->hex2cmyk('#FFFFFF')); $pdf->SetDrawColorBB($pdf->hex2cmyk('#000000')); $pdf->SetFontSize(8); $pdf->SetLineWidth(0.6); // Printing player rows $tmp_players = array(); if ($FILLED) { $players = ${"team{$i}"}->getPlayers(); foreach ($players as $p) { if (!Match::player_validation($p, $match)) { continue; } array_push($tmp_players, $p); } } $players = $tmp_players; $j = 0; while ($j < 16) { $j++; $nr = ''; //reset all strings to clear $pos = ''; $ma = ''; $st = ''; $ag = ''; $av = ''; $skills_injuries = ''; $skillfn = ''; $spp = ''; $bgc = COLOR_ROSTER_NORMAL; if (count($players) >= $j) { $p = $players[$j - 1]; $name = $p->name; $pos = $p->position; //Get position $bgc = COLOR_ROSTER_NORMAL; if ($p->is_journeyman) { $name = "{$p->name} [J]"; $bgc = COLOR_ROSTER_JOURNEY; } if ($p->is_journeyman_used) { $name = "{$p->name} [J]"; $bgc = COLOR_ROSTER_JOURNEY_USED; } if ($p->is_mng) { $name = "{$p->name} [MNG]"; $bgc = COLOR_ROSTER_MNG; } if ($p->mayHaveNewSkill()) { $name = "{$p->name}"; $bgc = COLOR_ROSTER_NEWSKILL; } $nr = $p->nr; $ma = $p->ma; $st = $p->st; $ag = $p->ag; $av = $p->av; // Get skills and injuries $skillstr = $p->getSkillsStr(false); $injstr = $p->getInjsStr(false); if ($skillstr == '') { // No skills if ($injstr != '') { $skills_injuries = $injstr; } else { $skills_injuries = ''; } // No skills nor injuries } else { if ($injstr != '') { $skills_injuries = $skillstr . ', ' . $injstr; } else { $skills_injuries = $skillstr; } // Only skills, no injuries } $spp = $p->mv_spp; //Current Star Player Points } $pdf->SetFillColorBB($pdf->hex2cmyk($bgc)); $pdf->Cell($smallFieldSize, $h, $nr, 1, 0, 'C', true, ''); $pdf->Cell($mediumFieldSize, $h, $pos, 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, $ma, 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, $st, 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, $ag, 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, $av, 1, 0, 'C', true, ''); $pdf->Cell($skillFieldSize, $h, $skills_injuries, 1, 0, 'L', true, ''); $pdf->Cell($smallFieldSize, $h, $spp, 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, '', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, '', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, '', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, '', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, '', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, '', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, '', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, '', 1, 0, 'C', true, ''); $currenty += $h; $pdf->SetXY($currentx - 20, $currenty); } // Color legends $pdf->SetFont('Tahoma', '', 7); $currentx = 335; $currenty += 5; $dd = 2; $pdf->SetFillColorBB($pdf->hex2cmyk(COLOR_ROSTER_MNG)); $pdf->SetXY($currentx, $currenty); $pdf->Rect($currentx, $currenty, 5, 5, 'DF'); $pdf->SetXY($currentx += 5, $currenty -= 1); $pdf->Cell(20, 8, 'MNG', 0, 0, 'L', false); $pdf->SetFillColorBB($pdf->hex2cmyk(COLOR_ROSTER_JOURNEY)); $pdf->Rect($currentx += 22 + $dd, $currenty += 1, 5, 5, 'DF'); $pdf->SetXY($currentx += 5, $currenty -= 1); $pdf->Cell(45, 8, 'Journeyman', 0, 0, 'L', false); $pdf->SetFillColorBB($pdf->hex2cmyk(COLOR_ROSTER_JOURNEY_USED)); $pdf->Rect($currentx += 47 + $dd, $currenty += 1, 5, 5, 'DF'); $pdf->SetXY($currentx += 5, $currenty -= 1); $pdf->Cell(45, 8, 'Used journeyman', 0, 0, 'L', false); $pdf->SetFillColorBB($pdf->hex2cmyk(COLOR_ROSTER_NEWSKILL)); $pdf->Rect($currentx += 64 + $dd, $currenty += 1, 5, 5, 'DF'); $pdf->SetXY($currentx += 5, $currenty -= 1); $pdf->Cell(70, 8, 'New skill available', 0, 0, 'L', false); } // Output the PDF document $pdf->Output("Match Report.pdf", 'I'); }
public static function dispList() { global $lng; /* NOTE: We do NOT show teams not having played any matches for nodes = {T_NODE_TOURNAMENT, T_NODE_DIVISION}. */ list($sel_node, $sel_node_id, $sel_state, $sel_race) = HTMLOUT::nodeSelector(array('race' => true, 'state' => true)); $ALL_TIME = $sel_node === false && $sel_node_id === false; $fields = '_RRP AS "team_id", owned_by_coach_id, f_race_id, teams.name AS "tname", f_cname, f_rname, tv, teams.rdy AS "rdy", teams.retired AS "retired"'; $where = array(); if ($sel_state == T_STATE_ACTIVE) { $where[] = 'teams.rdy IS TRUE AND teams.retired IS FALSE'; } if ($sel_race != T_RACE_ALL) { $where[] = "teams.f_race_id = {$sel_race}"; } if ($sel_node == T_NODE_LEAGUE || $ALL_TIME) { if (!$ALL_TIME) { $where[] = "f_lid = {$sel_node_id}"; } $where = count($where) > 0 ? 'WHERE ' . implode(' AND ', $where) : ''; $queryCnt = "SELECT COUNT(*) FROM teams {$where}"; $queryGet = 'SELECT ' . preg_replace('/\\_RRP/', 'team_id', $fields) . ' FROM teams ' . $where . ' ORDER BY tname ASC'; } else { $q = "SELECT {$fields} FROM matches, teams, tours, divisions WHERE matches._RRP = teams.team_id AND matches.f_tour_id = tours.tour_id AND tours.f_did = divisions.did "; switch ($sel_node) { case false: break; case T_NODE_TOURNAMENT: $q .= "AND tours.tour_id = {$sel_node_id}"; break; case T_NODE_DIVISION: $q .= "AND divisions.did = {$sel_node_id}"; break; case T_NODE_LEAGUE: $q .= "AND divisions.f_lid = {$sel_node_id}"; break; } $q .= (count($where) > 0 ? ' AND ' : ' ') . implode(' AND ', $where) . ' '; $_subt1 = '(' . preg_replace('/\\_RRP/', 'team1_id', $q) . ')'; $_subt2 = '(' . preg_replace('/\\_RRP/', 'team2_id', $q) . ')'; $queryCnt = "SELECT COUNT(*) FROM (({$_subt1}) UNION DISTINCT ({$_subt2})) AS tmp"; $queryGet = '(' . $_subt1 . ') UNION DISTINCT (' . $_subt2 . ') ORDER BY tname ASC'; } $result = mysql_query($queryCnt); list($cnt) = mysql_fetch_row($result); $pages = $cnt == 0 ? 1 : ceil($cnt / T_HTML_TEAMS_PER_PAGE); global $page; $page = isset($_GET['page']) && $_GET['page'] <= $pages ? $_GET['page'] : 1; # Page 1 is default, of course. $_url = "?section=teamlist&"; echo '<br><center><table>'; echo '<tr><td>'; echo $lng->getTrn('common/page') . ': ' . implode(', ', array_map(create_function('$nr', 'global $page; return ($nr == $page) ? $nr : "<a href=\'' . $_url . 'page=$nr\'>$nr</a>";'), range(1, $pages))); echo '</td></td>'; echo "<tr><td>" . $lng->getTrn('common/teams') . ": {$cnt}</td></td>"; echo '</table></center><br>'; $queryGet .= ' LIMIT ' . ($page - 1) * T_HTML_TEAMS_PER_PAGE . ', ' . $page * T_HTML_TEAMS_PER_PAGE; $teams = array(); $result = mysql_query($queryGet); while ($t = mysql_fetch_object($result)) { $img = new ImageSubSys(IMGTYPE_TEAMLOGO, $t->team_id); $t->logo = "<img border='0px' height='20' width='20' alt='Team race picture' src='" . $img->getPath($t->f_race_id) . "'>"; $retired = $t->retired; $t->retired = $t->retired ? '<b>' . $lng->getTrn('common/yes') . '</b>' : $lng->getTrn('common/no'); $t->rdy = $t->rdy && !$retired ? '<font color="green">' . $lng->getTrn('common/yes') . '</font>' : '<font color="red">' . $lng->getTrn('common/no') . '</font>'; $t->f_rname = $lng->getTrn('race/' . strtolower(str_replace(' ', '', $t->f_rname))); $teams[] = $t; } $fields = array('logo' => array('desc' => 'Logo', 'nosort' => true, 'href' => array('link' => urlcompile(T_URL_PROFILE, T_OBJ_TEAM, false, false, false), 'field' => 'obj_id', 'value' => 'team_id'), 'nosort' => true), 'tname' => array('desc' => $lng->getTrn('common/name'), 'nosort' => true, 'href' => array('link' => urlcompile(T_URL_PROFILE, T_OBJ_TEAM, false, false, false), 'field' => 'obj_id', 'value' => 'team_id')), 'f_cname' => array('desc' => $lng->getTrn('common/coach'), 'nosort' => true, 'href' => array('link' => urlcompile(T_URL_PROFILE, T_OBJ_COACH, false, false, false), 'field' => 'obj_id', 'value' => 'owned_by_coach_id')), 'rdy' => array('desc' => $lng->getTrn('common/ready'), 'nosort' => true), 'retired' => array('desc' => $lng->getTrn('common/retired'), 'nosort' => true), 'f_rname' => array('desc' => $lng->getTrn('common/race'), 'nosort' => true, 'href' => array('link' => urlcompile(T_URL_PROFILE, T_OBJ_RACE, false, false, false), 'field' => 'obj_id', 'value' => 'f_race_id')), 'tv' => array('desc' => 'TV', 'nosort' => true, 'kilo' => true, 'suffix' => 'k')); HTMLOUT::sort_table($lng->getTrn('common/teams'), "index.php{$_url}", $teams, $fields, array(), array(), array('doNr' => false, 'noHelp' => true, 'noSRdisp' => true)); }
private static function printList($team, $ALLOW_EDIT) { global $lng; if ($team) { $entries = self::entries($team->team_id); title("<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $team->team_id, false, false) . "'>" . $team->name . '</a> ' . $lng->getTrn('name', __CLASS__)); } else { $entries = self::entries(null); title($lng->getTrn('name', __CLASS__)); } echo "<table style='table-layout:fixed; width:" . (count($entries) == 1 ? 50 : 100) . "%;'><tr>"; # The percentage difference is a HTML layout fix. $i = 1; foreach ($entries as $e) { $boxname = "container" . $e->pid; $ENTRY_EXISTS = isset($e->cemetery_id) && (int) $e->cemetery_id > 0; if ($i > 2) { echo "\n</tr>\n<tr>\n"; $i = 1; } ?> <td style='width:50%;' valign='top'> <div class="boxWide" style="width: 80%; margin: 20px auto 20px auto;"> <div class="boxTitle<?php echo T_HTMLBOX_INFO; ?> "> <?php echo "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_PLAYER, $e->pid, false, false) . "'>{$e->name}</a>"; if (!$team) { # Not a single teams cemetery, but all of the cemetery. echo " (<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $e->f_tid, false, false) . "'>" . $e->f_tname . '</a>)'; } if (!empty($e->title)) { echo ": {$e->title}"; } ?> </div> <div class="boxBody"> <table class="common"> <tr> <td align="left" valign="top"> <?php echo $lng->getTrn('died', __CLASS__) . " " . textdate($e->date_died, true) . ' ' . $lng->getTrn('after', __CLASS__) . ' <b>' . $e->lifetime . ' ' . $lng->getTrn('days', __CLASS__) . "</b><br><br>"; echo $e->about; ?> </td> <td align="right" style='width:25%;'> <img border='0px' height='75' width='75' alt='player picture' src="<?php $img = new ImageSubSys(T_OBJ_PLAYER, $e->pid); echo $img->getPath(); ?> "> </td> </tr> <tr> <td colspan="2"><hr></td> </tr> <tr> <td align="left"> <?php if ($ENTRY_EXISTS) { echo $lng->getTrn('posted', __CLASS__) . ' ' . textdate($e->date, true); } ?> </td> <td align="right"> <?php if ($ALLOW_EDIT) { ?> <a href='javascript:void(0);' onClick="slideToggle('<?php echo $boxname; ?> ');"><?php echo $lng->getTrn('edit', __CLASS__); ?> </a> <?php if (isset($e->cemetery_id) && (int) $e->cemetery_id > 0) { echo inlineform(array('action' => 'delete', 'pid' => $e->pid), "cemform{$e->cemetery_id}", $lng->getTrn('del', __CLASS__)); } } ?> </td> </tr> <tr> <td colspan="2"> <div id="<?php echo $boxname; ?> " style="display:none; clear:both;"> <br> <form method="POST"> <?php echo "<b>" . $lng->getTrn('g_title', __CLASS__) . '</b> — ' . $lng->getTrn('title', __CLASS__); ?> <br> <textarea name="title" cols="48" rows="1"><?php if ($ENTRY_EXISTS) { echo $e->title; } ?> </textarea><br><br> <?php echo "<b>" . $lng->getTrn('g_about', __CLASS__) . '</b> — ' . $lng->getTrn('about', __CLASS__); ?> <br> <textarea name="about" cols="48" rows="12"><?php if ($ENTRY_EXISTS) { echo $e->about; } ?> </textarea> <input type="hidden" name="action" value="edit"> <input type="hidden" name="pid" value="<?php echo $e->pid; ?> "> <br><br> <input type="submit" value="<?php echo $lng->getTrn('common/submit'); ?> "> </form> </div> </td> </tr> </table> </div> </div> </td> <?php $i++; } echo "</tr></table>"; }
public static function main($argv) { global $pdf; global $DEA; global $skillarray; global $rules; global $inducements; define("MARGINX", 20); define("MARGINY", 20); define("DEFLINECOLOR", '#000000'); define("HEADLINEBGCOLOR", '#c3c3c3'); // Custom settings for inducements. define('MAX_STARS', 2); define('MERC_EXTRA_COST', 30000); define('MERC_EXTRA_SKILL_COST', 50000); // Color codes. define('COLOR_ROSTER_NORMAL', COLOR_HTML_NORMAL); define('COLOR_ROSTER_READY', COLOR_HTML_READY); define('COLOR_ROSTER_MNG', COLOR_HTML_MNG); define('COLOR_ROSTER_DEAD', COLOR_HTML_DEAD); define('COLOR_ROSTER_SOLD', COLOR_HTML_SOLD); define('COLOR_ROSTER_STARMERC', COLOR_HTML_STARMERC); define('COLOR_ROSTER_JOURNEY', COLOR_HTML_JOURNEY); define('COLOR_ROSTER_JOURNEY_USED', COLOR_HTML_JOURNEY_USED); define('COLOR_ROSTER_NEWSKILL', COLOR_HTML_NEWSKILL); //----- define('COLOR_ROSTER_CHR_EQP1', COLOR_HTML_CHR_EQP1); // Characteristic equal plus one. define('COLOR_ROSTER_CHR_GTP1', COLOR_HTML_CHR_GTP1); // Characteristic greater than plus one. define('COLOR_ROSTER_CHR_EQM1', COLOR_HTML_CHR_EQM1); // Characteristic equal minus one. define('COLOR_ROSTER_CHR_LTM1', COLOR_HTML_CHR_LTM1); // Characteristic less than minus one. define('T_PDF_ROSTER_SET_EMPTY_ON_ZERO', true); # Prints cp, td etc. as '' (empty string) when field = 0. $ind_cost = 0; // // Most of team and player data is copy/pasted from teams.php // $team_id = $_GET['team_id']; // Is team id valid? if (!get_alt_col('teams', 'team_id', $team_id, 'team_id')) { fatal("Invalid team ID."); } $team = new Team($team_id); $coach = isset($_SESSION['logged_in']) ? new Coach($_SESSION['coach_id']) : null; setupGlobalVars(T_SETUP_GLOBAL_VARS__LOAD_LEAGUE_SETTINGS, array('lid' => $team->f_lid)); // Load correct $rules for league. $players = $team->getPlayers(); $tmp_players = array(); foreach ($players as $p) { if ($p->is_dead || $p->is_sold) { continue; } array_push($tmp_players, $p); } $players = $tmp_players; // Team specific data $rerollcost = $DEA[$team->f_rname]['other']['rr_cost']; $pdf = new BB_PDF('L', 'pt', 'A4'); // Creating a new PDF doc. Landscape, scale=pixels, size A4 $pdf->SetAutoPageBreak(false, 20); // No auto page break to mess up layout $pdf->SetAuthor('Daniel Straalman'); $pdf->SetCreator('OBBLM'); $pdf->SetTitle('PDF Roster for ' . utf8_decode($team->name)); $pdf->SetSubject('PDF Roster for ' . utf8_decode($team->name)); $pdf->AddFont('Tahoma', '', 'tahoma.php'); // Adding regular font Tahoma which is in font dir $pdf->AddFont('Tahoma', 'B', 'tahomabd.php'); // Adding Tahoma Bold // Initial settings $pdf->SetFont('Tahoma', 'B', 14); $pdf->AddPage(); $pdf->SetLineWidth(1.5); $currentx = MARGINX; $currenty = MARGINY; $pdf->SetFillColorBB($pdf->hex2cmyk(HEADLINEBGCOLOR)); $pdf->RoundedRect($currentx, $currenty, 802, 20, 6, 'DF'); // Filled rectangle around Team headline $pdf->SetDrawColorBB($pdf->hex2cmyk(DEFLINECOLOR)); // Text in headline $pdf->SetXY($currentx + 30, $currenty); $pdf->Cell(310, 20, utf8_decode($team->name), 0, 0, 'L', false, ''); $pdf->SetFont('Tahoma', '', 12); $pdf->Cell(60, 20, "Race:", 0, 0, 'R', false, ''); $pdf->Cell(70, 20, $team->f_rname, 0, 0, 'L', false, ''); $pdf->Cell(300, 20, "Head Coach: " . utf8_decode($team->f_cname), 0, 0, 'R', false, ''); $currenty += 25; $currentx += 6; $pdf->SetXY($currentx, $currenty); $pdf->SetFillColorBB($pdf->hex2cmyk(HEADLINEBGCOLOR)); $pdf->SetDrawColorBB($pdf->hex2cmyk(DEFLINECOLOR)); $pdf->SetFont('Tahoma', 'B', 8); $pdf->SetLineWidth(1.5); $h = 14; // Printing headline for player table $pdf->Cell(23, $h, 'Nr', 1, 0, 'C', true, ''); $pdf->Cell(97, $h, 'Name', 1, 0, 'L', true, ''); $pdf->Cell(75, $h, 'Position', 1, 0, 'L', true, ''); $pdf->Cell(18, $h, 'MA', 1, 0, 'C', true, ''); $pdf->Cell(18, $h, 'ST', 1, 0, 'C', true, ''); $pdf->Cell(18, $h, 'AG', 1, 0, 'C', true, ''); $pdf->Cell(18, $h, 'AV', 1, 0, 'C', true, ''); $pdf->Cell(329, $h, 'Skills and Injuries', 1, 0, 'L', true, ''); $pdf->Cell(23, $h, 'MNG', 1, 0, 'C', true, ''); $pdf->Cell(21, $h, 'CP', 1, 0, 'C', true, ''); $pdf->Cell(21, $h, 'TD', 1, 0, 'C', true, ''); $pdf->Cell(21, $h, 'Int', 1, 0, 'C', true, ''); $pdf->Cell(21, $h, 'Cas', 1, 0, 'C', true, ''); $pdf->Cell(23, $h, 'MVP', 1, 0, 'C', true, ''); $pdf->Cell(25, $h, 'SPP', 1, 0, 'C', true, ''); $pdf->Cell(41, $h, 'Value', 1, 0, 'C', true, ''); $currenty += 17; $pdf->SetXY($currentx, $currenty); $pdf->SetFont('Tahoma', '', 8); $h = 15; // Row/cell height for player table // // Printing player rows // $sum_spp = 0; $sum_pvalue = 0; $sum_p_missing_value = 0; $sum_avail_players = 0; $sum_players = 0; $sum_cp = 0; $sum_td = 0; $sum_int = 0; $sum_cas = 0; $sum_mvp = 0; $i = 0; // Looping through the players and printing the rows foreach ($players as $p) { $i++; $mng = ''; // Journeymen if ($p->is_journeyman) { $p->position = 'Journeyman'; $bgc = COLOR_ROSTER_JOURNEY; if ($p->is_journeyman_used) { $bgc = COLOR_ROSTER_JOURNEY_USED; } } else { $bgc = COLOR_ROSTER_NORMAL; } // Concatenate skills, upgrades and injuries $skillstr = $p->getSkillsStr(false); $injstr = $p->getInjsStr(false); if ($skillstr == '') { // No skills if ($injstr != '') { $skills_injuries = $injstr; } else { $skills_injuries = ''; } // No skills nor injuries } else { if ($injstr != '') { $skills_injuries = $skillstr . ', ' . $injstr; } else { $skills_injuries = $skillstr; } // Only skills, no injuries } // Colorcoding new skills available if ($p->mayHaveNewSkill()) { $bgc = COLOR_ROSTER_NEWSKILL; } if (!$p->is_mng) { $sum_avail_players++; $inj = ""; } else { $bgc = COLOR_ROSTER_MNG; $sum_p_missing_value += $p->value; $inj = "MNG"; // For MNG column // Removing MNG from skills and injuries $skills_injuries = str_replace(', MNG', '', $skills_injuries); $skills_injuries = str_replace('MNG', '', $skills_injuries); $skills_injuries = str_replace(' ', ' ', $skills_injuries); // Maybe not needed after changes to rest of code? } // Characteristic's colors, copied and modified from teams.php foreach (array('ma', 'ag', 'av', 'st') as $chr) { $sub = $p->{$chr} - $p->{"def_{$chr}"}; if ($sub == 0) { $p->{"{$chr}_color"} = $bgc; } elseif ($sub >= 1) { $p->{"{$chr}_color"} = COLOR_ROSTER_CHR_GTP1; } elseif ($sub <= -1) { $p->{"{$chr}_color"} = COLOR_ROSTER_CHR_LTM1; } } $pp = array('nr' => $p->nr, 'name' => utf8_decode($p->name), 'pos' => $p->position, 'ma' => $p->ma, 'st' => $p->st, 'ag' => $p->ag, 'av' => $p->av, 'skills' => $skills_injuries, 'inj' => $inj, 'cp' => $p->mv_cp, 'td' => $p->mv_td, 'int' => $p->mv_intcpt, 'cas' => $p->mv_cas, 'mvp' => $p->mv_mvp, 'spp' => $p->mv_spp, 'value' => $pdf->Mf($p->value)); $sum_spp += $p->mv_spp; $sum_pvalue += $p->value; $sum_players++; $sum_cp += $p->mv_cp; $sum_td += $p->mv_td; $sum_int += $p->mv_intcpt; $sum_cas += $p->mv_cas; $sum_mvp += $p->mv_mvp; if (T_PDF_ROSTER_SET_EMPTY_ON_ZERO) { foreach (array('cp', 'td', 'int', 'cas', 'mvp', 'spp') as $f) { if ($pp[$f] == 0) { $pp[$f] = ''; } } } // Printing player row $currenty += $pdf->print_prow($pp, $currentx, $currenty, $h, $bgc, DEFLINECOLOR, 0.5, 8, $p->ma_color, $p->st_color, $p->ag_color, $p->av_color); } // Filling up with empty rows to max number of players $pp = array('nr' => '', 'name' => '', 'pos' => '', 'ma' => '', 'st' => '', 'ag' => '', 'av' => '', 'skills' => '', 'inj' => '', 'cp' => '', 'td' => '', 'int' => '', 'cas' => '', 'mvp' => '', 'spp' => '', 'value' => ''); $bgc = COLOR_ROSTER_NORMAL; while ($i < $rules['max_team_players']) { $i++; $currenty += $pdf->print_prow($pp, $currentx, $currenty, $h, '#FFFFFF', '#000000', 0.5, 8, $bgc, $bgc, $bgc, $bgc); } // Sums $sum_pvalue -= $sum_p_missing_value; $pdf->SetXY($currentx = MARGINX + 6 + 23, $currenty += 4); $pdf->print_box($currentx, $currenty, 172, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'R', 'Total number of players next game:'); $pdf->print_box($currentx += 172, $currenty, 30, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'R', $sum_avail_players . '/' . $sum_players); $pdf->SetX($currentx = MARGINX + 6 + 559); $pdf->print_box($currentx, $currenty, 60, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'R', 'Totals (excl TV for MNG players):'); $pdf->print_box($currentx += 60, $currenty, 21, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'C', $sum_cp); $pdf->print_box($currentx += 21, $currenty, 21, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'C', $sum_td); $pdf->print_box($currentx += 21, $currenty, 21, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'C', $sum_int); $pdf->print_box($currentx += 21, $currenty, 21, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'C', $sum_cas); $pdf->print_box($currentx += 21, $currenty, 23, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'C', $sum_mvp); $pdf->print_box($currentx += 23, $currenty, 25, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'C', $sum_spp); $pdf->print_box($currentx += 25, $currenty, 41, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'R', $pdf->Mf($sum_pvalue)); // Stars and Mercs part of roster $currentx = MARGINX + 6 + 23; $currenty += $h + 2; // Draw rounded rectangle around stars and mercs // This rectangle has flexible height depending on how high player table is $pdf->SetLineWidth(0.6); $pdf->RoundedRect(MARGINX + 6, $currenty, 792, 560 - $currenty - 130, 5, 'D'); $pdf->SetXY($currentx, $currenty += 2); $h = 14; $pdf->SetFont('Tahoma', 'B', 8); $pdf->Cell(97 + 75, $h, 'Induced Stars and Mercenaries', 0, 0, 'L', true, ''); $pdf->Cell(18, $h, 'MA', 0, 0, 'C', true, ''); $pdf->Cell(18, $h, 'ST', 0, 0, 'C', true, ''); $pdf->Cell(18, $h, 'AG', 0, 0, 'C', true, ''); $pdf->Cell(18, $h, 'AV', 0, 0, 'C', true, ''); $pdf->Cell(329, $h, 'Skills', 0, 0, 'L', true, ''); //$pdf->Cell(23, $h, 'MNG', 1, 0, 'C', true, ''); // No MNG stars/mercs. They heal. ;-) $pdf->Cell(21, $h, 'CP', 0, 0, 'C', true, ''); $pdf->Cell(21, $h, 'TD', 0, 0, 'C', true, ''); $pdf->Cell(21, $h, 'Int', 0, 0, 'C', true, ''); $pdf->Cell(21, $h, 'Cas', 0, 0, 'C', true, ''); $pdf->Cell(23, $h, 'MVP', 0, 0, 'C', true, ''); $pdf->Cell(25, $h, 'SPP', 0, 0, 'C', true, ''); $pdf->Cell(41, $h, 'Value', 0, 0, 'R', true, ''); $currenty += 14; $pdf->SetXY($currentx, $currenty); $h = 13; // Printing chosen stars and mercs $pdf->SetFont('Tahoma', '', 8); $merc = array(0 => 'No Merc'); $i = 0; if ($_POST) { foreach ($DEA[$team->f_rname]["players"] as $p => $m) { $i++; array_push($merc, $m); $pos[$i] = $p; } $postvars = array(); # initialize. foreach ($_POST as $postkey => $postvalue) { if ($postkey == "Submit") { continue; } if ($postvalue == "0") { continue; } if ($postvalue == "0k") { continue; } if ($postvalue == "-No Extra Skill-") { continue; } $postvars[str_replace('_', ' ', $postkey)] = $postvalue; } $star_array_tmp[0] = 0; $merc_array_tmp[0] = 0; while (list($key, $val) = each($postvars)) { if (strpos($key, 'Star') !== false) { // if POST key is StarX array_push($star_array_tmp, $val); continue; } elseif (strpos($key, 'Merc') !== false) { $merc_nr = preg_replace("/[^0-9]/", "", $key); $merc_array_tmp[$merc_nr] = $pos[$val]; if (isset($postvars["Extra{$merc_nr}"])) { $extra_array_tmp[$merc_nr] = $postvars["Extra{$merc_nr}"]; } else { $extra_array_tmp[$merc_nr] = ''; } continue; } elseif ($key == 'Bloodweiser Babes') { $ind_babes = (int) $val; continue; } elseif ($key == 'Bribes') { $ind_bribes = (int) $val; continue; } elseif ($key == 'Card') { $ind_card = (int) str_replace('k', '000', $val); continue; } elseif ($key == 'Extra Training') { $ind_rr = (int) $val; continue; } elseif ($key == 'Halfling Master Chef') { $ind_chef = (int) $val; continue; } elseif ($key == 'Igor') { $ind_igor = (int) $val; continue; } elseif ($key == 'Wandering Apothecaries') { $ind_apo = (int) $val; continue; } elseif ($key == 'Wizard') { $ind_wiz = (int) $val; continue; } } // Printing stars first if (isset($star_array_tmp[1])) { unset($star_array_tmp[0]); foreach ($star_array_tmp as $sid) { $s = new Star($sid); $s->setSkills(true); $ss = array('name' => utf8_decode($s->name), 'ma' => $s->ma, 'st' => $s->st, 'ag' => $s->ag, 'av' => $s->av, 'skills' => $s->skills, 'cp' => $s->mv_cp, 'td' => $s->mv_td, 'int' => $s->mv_intcpt, 'cas' => $s->mv_cas, 'mvp' => $s->mv_mvp, 'spp' => $s->mv_spp, 'value' => $pdf->Mf($s->cost)); $currenty += $pdf->print_srow($ss, $currentx, $currenty, $h, $bgc, DEFLINECOLOR, 0.5, 8); $ind_cost += $s->cost; } } // Then Mercs if (is_array($merc_array_tmp)) { unset($merc[0]); $r = $team->f_rname; $i = 0; unset($merc_array_tmp[0]); foreach ($merc_array_tmp as $mpos) { $i++; $m['name'] = 'Mercenary ' . $mpos; $m['ma'] = $DEA[$r]['players'][$mpos]['ma']; $m['st'] = $DEA[$r]['players'][$mpos]['st']; $m['ag'] = $DEA[$r]['players'][$mpos]['ag']; $m['av'] = $DEA[$r]['players'][$mpos]['av']; $m['skillarr'] = $DEA[$r]['players']["{$mpos}"]['def']; if (!in_array(99, $m['skillarr'])) { array_unshift($m['skillarr'], 99); } // Adding Loner unless already in array $m['skills'] = implode(', ', skillsTrans($m['skillarr'])); $m['cost'] = $DEA[$r]['players'][$mpos]['cost'] + MERC_EXTRA_COST; if (isset($postvars["Extra{$i}"])) { $m['cost'] += MERC_EXTRA_SKILL_COST; $m['extra'] = $postvars["Extra{$i}"]; if ($m['skills'] == '') { $m['skills'] = $m['extra']; } else { $m['skills'] = $m['skills'] . ', ' . $m['extra']; } } $ss = array('name' => utf8_decode($m['name']), 'ma' => $m['ma'], 'st' => $m['st'], 'ag' => $m['ag'], 'av' => $m['av'], 'skills' => $m['skills'], 'cp' => ' ', 'td' => ' ', 'int' => ' ', 'cas' => ' ', 'mvp' => ' ', 'spp' => ' ', 'value' => $pdf->Mf($m['cost'])); $currenty += $pdf->print_srow($ss, $currentx, $currenty, $h, $bgc, DEFLINECOLOR, 0.5, 8); $ind_cost += $m['cost']; } } } $h = 13; // Printing lower part of roster $currentx = MARGINX; $currenty = 435; //print_box($x, $y, $w, $h, $bgcolor='#FFFFFF', $bordercolor='#000000', $linewidth=1, $borderstyle, $fontsize, $font, $bold=false, $align, $text) $h = 13; // Height of cells $pdf->print_box($currentx, $currenty, 170, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', true, 'R', 'Inducements '); $pdf->print_box($currentx += 170, $currenty, 120, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'L', '(for next match)'); $pdf->print_box($currentx = 630, $currenty, 40, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', true, 'R', 'Team Goods'); // 156 to margin // Checking if Wandering Apothecary should be replaced with Igor $r = $team->f_rname; if ($r == 'Nurgle' || $r == 'Khemri' || $r == 'Necromantic' || $r == 'Undead') { $apo_igor = 'Igor (0-1):'; unset($inducements['Wandering Apothecaries']); if (isset($ind_igor)) { $ind_apo_igor_cost = $ind_igor * $inducements['Igor']['cost']; $ind_cost += $ind_igor * $ind_apo_igor_cost; $ind_apo_igor = $ind_igor; } else { $ind_apo_igor = '__'; $ind_apo_igor_cost = $inducements['Igor']['cost']; } } else { $apo_igor = 'Wandering Apothecaries (0-2):'; unset($inducements['Igor']); if (isset($ind_apo)) { $ind_apo_igor_cost = $inducements['Wandering Apothecaries']['cost']; $ind_cost += $ind_apo * $ind_apo_igor_cost; $ind_apo_igor = $ind_apo; } else { $ind_apo_igor = '__'; $ind_apo_igor_cost = $inducements['Wandering Apothecaries']['cost']; } } // Checking LRB6 cheaper Chef for Halfling $chef_cost = $inducements['Halfling Master Chef'][$r == 'Halfling' ? 'reduced_cost' : 'cost']; // Checking LRB6 cheaper bribes for Goblin $bribe_cost = $inducements['Bribes'][$r == 'Goblin' ? 'reduced_cost' : 'cost']; if (isset($ind_babes)) { $ind_cost += $ind_babes * $inducements['Bloodweiser Babes']['cost']; } else { $ind_babes = '__'; } if (isset($ind_bribes)) { $ind_cost += $ind_bribes * $inducements['Bribes']['cost']; } else { $ind_bribes = '__'; } if (isset($ind_card)) { $ind_cost += $ind_card; } else { $ind_card = '__'; } if (isset($ind_rr)) { $ind_cost += $ind_rr * $inducements['Extra Training']['cost']; } else { $ind_rr = '__'; } if (isset($ind_chef)) { $ind_cost += $ind_chef * $chef_cost; } else { $ind_chef = '__'; } if (isset($ind_wiz)) { $ind_cost += $ind_wiz * $inducements['Wizard']['cost']; } else { $ind_wiz = '__'; } // print_inducements($x, $y, $h, $bgcol, $linecol, $fontsize, $ind_name, $ind_amount, $ind_value) $pdf->print_inducements(MARGINX, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 8, 'Bloodweiser Babes (0-2):', $ind_babes, $pdf->Mf($inducements['Bloodweiser Babes']['cost'])); $pdf->print_inducements(MARGINX, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 8, 'Bribes (0-3):', $ind_bribes, $pdf->Mf($bribe_cost)); $pdf->print_inducements(MARGINX, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 8, 'Extra Training (0-4):', $ind_rr, $pdf->Mf($inducements['Extra Training']['cost'])); $pdf->print_inducements(MARGINX, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 8, 'Halfling Master Chef (0-1):', $ind_chef, $pdf->Mf($chef_cost)); $pdf->print_inducements(MARGINX, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 8, $apo_igor, $ind_apo_igor, $pdf->Mf($ind_apo_igor_cost)); $pdf->print_inducements(MARGINX, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 8, 'Wizard (0-1):', $ind_wiz, $pdf->Mf($inducements['Wizard']['cost'])); $pdf->print_inducements(MARGINX, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 8, 'Card budget:', ' ', $pdf->Mf($ind_card)); $pdf->print_inducements(MARGINX, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 8, 'Gate:', null, ''); $pdf->print_inducements(MARGINX, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 8, 'FAME:', null, ''); $currenty = 435; $currentx = 630; // print_team_goods($x, $y, $h, $bgcol, $linecol, $perm_name, $perm_nr, $perm_value, $perm_total_value, $bold=false) $pdf->print_team_goods($currentx, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 'Rerolls:', $team->rerolls, $pdf->Mf($rerollcost), $pdf->Mf($team->rerolls * $rerollcost), false); $pdf->print_team_goods($currentx, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 'Fan Factor:', $team->rg_ff, $pdf->Mf($rules['cost_fan_factor']), $pdf->Mf($team->rg_ff * $rules['cost_fan_factor']), false); $pdf->print_team_goods($currentx, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 'Assistant Coaches:', $team->ass_coaches, $pdf->Mf($rules['cost_ass_coaches']), $pdf->Mf($team->ass_coaches * $rules['cost_ass_coaches']), false); $pdf->print_team_goods($currentx, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 'Cheerleaders:', $team->cheerleaders, $pdf->Mf($rules['cost_cheerleaders']), $pdf->Mf($team->cheerleaders * $rules['cost_cheerleaders']), false); if ($r == 'Undead' || $r == 'Necromantic') { // Swap Apothecary for Necromancer $pdf->print_team_goods($currentx, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 'Necromancer:', 1, 0, 0, false); } elseif ($r == 'Nurgle' || $r == 'Khemri') { // Remove Apothecary $currenty += $h; } else { // Normal case $pdf->print_team_goods($currentx, $currenty += $h, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 'Apothecary:', $team->apothecary, $pdf->Mf($rules['cost_apothecary']), $pdf->Mf($team->apothecary * $rules['cost_apothecary']), false); } $pdf->print_box($currentx += 70, $currenty += $h, 40, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'R', 'Treasury:'); $pdf->print_box($currentx += 40, $currenty, 65, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', false, 'R', $pdf->Mf($team->treasury)); // Team Value, Inducements Value, Match Value $h = 13; $pdf->print_box($currentx -= 40, $currenty += $h, 40, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', true, 'R', 'Team Value (incl MNGs value):'); $pdf->print_box($currentx += 40, $currenty, 65, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', true, 'R', $pdf->Mf($team->value + $sum_p_missing_value)); $pdf->print_box($currentx -= 40, $currenty += $h, 40, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', true, 'R', 'Induced Value:'); $pdf->print_box($currentx += 40, $currenty, 65, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', true, 'R', $pdf->Mf($ind_cost)); $pdf->print_box($currentx -= 40, $currenty += $h, 40, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', true, 'R', 'Match Value (TV for match):'); $pdf->print_box($currentx += 40, $currenty, 65, $h, COLOR_ROSTER_NORMAL, DEFLINECOLOR, 0, 0, 8, 'Tahoma', true, 'R', $pdf->Mf($team->value + $ind_cost)); // Drawing a rectangle around inducements $pdf->SetLineWidth(0.6); $pdf->RoundedRect(MARGINX + 6, 435, 792, 130, 5, 'D'); global $settings; if ($settings['enable_pdf_logos']) { // Team logo // Comment out if you dont have GD 2.x installed, or if you dont want the logo in roster. // Not tested with anything except PNG images that comes with OBBLM. $img = new ImageSubSys(IMGTYPE_TEAMLOGO, $team->team_id); $pdf->Image($img->getPath(), 346, 436, 128, 128, '', '', false, 0); // OBBLM text lower left corner as a pic $pdf->Image('modules/pdf/OBBLM_pdf_logo.png', MARGINX + 12, 534, 60, 28, '', '', false, 0); } // Color legends $pdf->SetFont('Tahoma', '', 8); $currentx = MARGINX + 16; $currenty = 572; $pdf->SetFillColorBB($pdf->hex2cmyk(COLOR_ROSTER_MNG)); $pdf->SetXY($currentx, $currenty); $pdf->Rect($currentx, $currenty, 5, 5, 'DF'); $pdf->SetXY($currentx += 5, $currenty -= 1); $pdf->Cell(20, 8, 'MNG', 0, 0, 'L', false); $pdf->SetFillColorBB($pdf->hex2cmyk(COLOR_ROSTER_JOURNEY)); $pdf->Rect($currentx += 22 + 5, $currenty += 1, 5, 5, 'DF'); $pdf->SetXY($currentx += 5, $currenty -= 1); $pdf->Cell(45, 8, 'Journeyman', 0, 0, 'L', false); $pdf->SetFillColorBB($pdf->hex2cmyk(COLOR_ROSTER_JOURNEY_USED)); $pdf->Rect($currentx += 47 + 5, $currenty += 1, 5, 5, 'DF'); $pdf->SetXY($currentx += 5, $currenty -= 1); $pdf->Cell(45, 8, 'Used journeyman', 0, 0, 'L', false); $pdf->SetFillColorBB($pdf->hex2cmyk(COLOR_ROSTER_NEWSKILL)); $pdf->Rect($currentx += 67 + 5, $currenty += 1, 5, 5, 'DF'); $pdf->SetXY($currentx += 5, $currenty -= 1); $pdf->Cell(70, 8, 'New skill available', 0, 0, 'L', false); $pdf->SetFillColorBB($pdf->hex2cmyk(COLOR_ROSTER_CHR_GTP1)); $pdf->Rect($currentx += 70 + 5, $currenty += 1, 5, 5, 'DF'); $pdf->SetXY($currentx += 5, $currenty -= 1); $pdf->Cell(50, 8, 'Stat upgrade', 0, 0, 'L', false); $pdf->SetFillColorBB($pdf->hex2cmyk(COLOR_ROSTER_CHR_LTM1)); $pdf->Rect($currentx += 50 + 5, $currenty += 1, 5, 5, 'DF'); $pdf->SetXY($currentx += 5, $currenty -= 1); $pdf->Cell(50, 8, 'Stat downgrade', 0, 0, 'L', false); $pdf->SetFont('Tahoma', '', 7); $pdf->SetFillColorBB($pdf->hex2cmyk(COLOR_ROSTER_NORMAL)); $pdf->SetXY($currentx + 160, $currenty + 1); $donate = "Please consider donating to the OBBLM project if you enjoy this software and wish to support\n further development and maintenance. For more information visit nicholasmr.dk"; $pdf->Multicell(300, 8, $donate, 0, 0, 'L', false); // Output the PDF document $pdf->Output(utf8_decode($team->name) . date(' Y-m-d') . '.pdf', 'I'); }
function _infocus($teams) { //Create a new array of teams to display $ids = array(); foreach ($teams as $team) { if (!$team['retired']) { $ids[] = $team['team_id']; } } if (empty($teams)) { return; } global $lng, $_INFOCUSCNT; //Select random team $teamKey = array_rand($ids); $teamId = $ids[$teamKey]; $team = new Team($teamId); $teamLink = "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $teamId, false, false) . "'>{$team->name}</a>"; //Create $logo_html $img = new ImageSubSys(IMGTYPE_TEAMLOGO, $team->team_id); $logo_html = "<img border='0px' height='60' alt='Team picture' src='" . $img->getPath($team->f_race_id) . "'>"; //Create $starPlayers array used to display the three most experienced players on the team $starPlayers = array(); foreach ($team->getPlayers() as $p) { if ($p->is_dead || $p->is_sold) { continue; } $starPlayers[] = array('name' => preg_replace('/\\s/', ' ', $p->name), 'spp' => $p->mv_spp); } //Sort the array usort($starPlayers, create_function('$objA,$objB', 'return ($objA["spp"] < $objB["spp"]) ? +1 : -1;')); $starPlayers = array_slice($starPlayers, 0, 3); # Show only 3 Star players ?> <style type="text/css"> /* InFocus Mod */ #inFocusBox<?php echo $_INFOCUSCNT; ?> .leftContentTd{ font-weight: bold; padding-right: 1em; } #inFocusBox<?php echo $_INFOCUSCNT; ?> .teamLogo { float: left; margin: 0 36px 0 20px; } #inFocusBox<?php echo $_INFOCUSCNT; ?> .teamName { font-weight: bold; } #inFocusContent<?php echo $_INFOCUSCNT; ?> { position:relative; left: 160px; height: 80px; } #inFocusContent<?php echo $_INFOCUSCNT; ?> P { font-weight: bold; margin-top: 5px; margin-bottom: 5px; } #inFocusContent<?php echo $_INFOCUSCNT; ?> DIV { position:absolute; top:0; left:0; z-index:8; } #inFocusContent<?php echo $_INFOCUSCNT; ?> DIV.invisible { display: none; } #inFocusContent<?php echo $_INFOCUSCNT; ?> DIV.inFocus { z-index:10; display: inline; } #inFocusContent<?php echo $_INFOCUSCNT; ?> DIV.last-inFocus { z-index:9;redeclare compare_spp } </style> <div id="inFocusBox<?php echo $_INFOCUSCNT; ?> " > <h3><?php echo $lng->getTrn('main/infocus') . ': ' . $teamLink; ?> </h3><br> <div style='clear:both;'> <div class='teamLogo'> <?php echo $logo_html; ?> </div> <div id="inFocusContent<?php echo $_INFOCUSCNT; ?> "> <div class="inFocus"> <table> <tr><td class="leftContentTd"><?php echo $lng->getTrn('common/coach'); ?> </td><td><?php echo $team->f_cname; ?> </td></tr> <tr><td class="leftContentTd"><?php echo $lng->getTrn('common/race'); ?> </td><td><?php echo $team->f_rname; ?> </td></tr> <tr><td class="leftContentTd"><?php echo 'TV'; ?> </td><td><?php echo (string) ($team->tv / 1000); ?> k</td></tr> </table> </div> <div class="invisible"> <p><?php echo $lng->getTrn('common/stars'); ?> </p> <table> <?php foreach ($starPlayers as $player) { echo "<tr><td class='leftContentTd'>" . $player['name'] . "</td><td>" . $player['spp'] . " spp</td></tr>"; } ?> </table> </div> </div> </div> </div> <script> /* * This script creates a slideshow of all <div>s in the "inFocusContent" div * * Based on an example by Jon Raasch: * * http://jonraasch.com/blog/a-simple-jquery-slideshow */ function nextContent<?php echo $_INFOCUSCNT; ?> () { var $currentDiv = $('#inFocusContent<?php echo $_INFOCUSCNT; ?> DIV.inFocus'); var $nextDiv = $currentDiv.next().length ? $currentDiv.next() : $('#inFocusContent<?php echo $_INFOCUSCNT; ?> DIV:first'); $currentDiv.addClass('last-inFocus'); //Fade current out $currentDiv.animate({opacity: 0.0}, 500, function() { $currentDiv.removeClass('inFocus last-inFocus'); $currentDiv.addClass('invisible'); }); //Fade next in $nextDiv.css({opacity: 0.0}) .addClass('inFocus') .animate({opacity: 1.0}, 500, function() { }); } $(function() { setInterval( "nextContent<?php echo $_INFOCUSCNT; ?> ()", 5000 ); }); </script> <?php $_INFOCUSCNT++; }
public static function printList($node, $node_id, $ALLOW_EDIT) { global $lng; $entries = self::getWanted($node, $node_id); echo "<table style='table-layout:fixed; width:" . (count($entries) == 1 ? 50 : 100) . "%;'><tr>"; # The percentage difference is a HTML layout fix. $i = 1; foreach ($entries as $e) { if ($i > 2) { echo "\n</tr>\n<tr>\n"; $i = 1; } ?> <td style='width:50%;' valign='top'> <div class="boxWide" style="width: 80%; margin: 20px auto 20px auto;"> <div class="boxTitle<?php echo T_HTMLBOX_INFO; ?> "><?php echo $lng->getTrn('wanted', __CLASS__) . ": <a href='" . urlcompile(T_URL_PROFILE, T_OBJ_PLAYER, $e->pid, false, false) . "'>{$e->name}</a>"; echo ' (<a href="' . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $e->f_tid, false, false) . '">' . $e->f_tname . '</a>)'; ?> </div> <div class="boxBody"> <table class="common"> <tr> <td colspan="2" align="left" valign="top"> <b><?php echo $lng->getTrn('g_title', __CLASS__); ?> :</b><br> <?php echo $e->bounty; ?> <br> </td> </tr> <tr> <td align="left" valign="top"> <br> <b><?php echo $lng->getTrn('g_about', __CLASS__); ?> :</b><br> <?php echo $e->why; if ($e->date_died) { echo "<br><br><font color='red'><b>" . $lng->getTrn('killed', __CLASS__) . "</b></font>\n"; } ?> </td> <td align="right" style="width: 25%;"> <img border='0px' height='75' width='75' alt='player picture' src="<?php $img = new ImageSubSys(T_OBJ_PLAYER, $e->pid); echo $img->getPath(); ?> "> </td> </tr> <tr> <td colspan="2"><hr></td> </tr> <tr> <td align="left"> <?php echo $lng->getTrn('posted', __CLASS__) . ' ' . textdate($e->date, true); ?> </td> <td align="right"> <?php if ($ALLOW_EDIT) { ?> <a href="handler.php?type=wanted&action=edit&wanted_id=<?php echo $e->wanted_id; ?> "><?php echo $lng->getTrn('edit', __CLASS__); ?> </a> <a href="handler.php?type=wanted&action=delete&wanted_id=<?php echo $e->wanted_id; ?> "><?php echo $lng->getTrn('del', __CLASS__); ?> </a> <?php } ?> </td> </tr> </table> </div> </div> </td> <?php $i++; } echo "</tr></table>"; }
/** * Called by Module::run, renders the actual PDF */ public static function main($argv) { global $pdf; global $DEA; global $skillarray; global $rules; global $lng; global $inducements; $FILLED = false; if (!empty($argv)) { $team1 = new Team($argv[0]); $team2 = new Team($argv[1]); $match = new Match($argv[2]); if (!is_null($team1) && !is_null($team2)) { $FILLED = true; } } else { $team1 = null; $team2 = null; $match = null; } define("MARGINX", 20); define("MARGINY", 20); define("DEFLINECOLOR", '#000000'); define("HEADLINEBGCOLOR", '#c3c3c3'); # player statuses define('COLOR_ROSTER_NORMAL', COLOR_HTML_NORMAL); define('COLOR_ROSTER_READY', COLOR_HTML_READY); define('COLOR_ROSTER_MNG', COLOR_HTML_MNG); define('COLOR_ROSTER_DEAD', COLOR_HTML_DEAD); define('COLOR_ROSTER_SOLD', COLOR_HTML_SOLD); define('COLOR_ROSTER_STARMERC', COLOR_HTML_STARMERC); define('COLOR_ROSTER_JOURNEY', COLOR_HTML_JOURNEY); define('COLOR_ROSTER_JOURNEY_USED', COLOR_HTML_JOURNEY_USED); define('COLOR_ROSTER_NEWSKILL', COLOR_HTML_NEWSKILL); define('T_PDF_ROSTER_SET_EMPTY_ON_ZERO', true); # Prints cp, td etc. as '' (empty string) when field = 0. $pdf = new BB_PDF('P', 'pt', 'A4'); // Creating a new PDF doc. Portrait, scale=pixels, size A4 $pdf->SetAutoPageBreak(false, 20); // No auto page break to mess up layout $pdf->SetAuthor('Daniel Straalman, Daniel Henriksson, Nicholas Rathmann'); $pdf->SetCreator('OBBLM'); $pdf->SetTitle($lng->getTrn('name', 'PDFMatchReport')); $pdf->SetSubject($lng->getTrn('name', 'PDFMatchReport')); $pdf->AddFont('Tahoma', '', 'tahoma.php'); // Adding regular font Tahoma which is in font dir $pdf->AddFont('Tahoma', 'B', 'tahomabd.php'); // Adding Tahoma Bold // Initial settings $pdf->SetFont('Tahoma', 'B', 14); $pdf->AddPage(); $pdf->SetLineWidth(1.5); $currentx = MARGINX + 6; $currenty = MARGINY + 6; //Real PDF fill starts here $pdf->SetFillColorBB($pdf->hex2cmyk(HEADLINEBGCOLOR)); # $pdf->RoundedRect($currentx, $currenty, 542, 20, 6, 'DF'); // Filled rectangle around Team headline $pdf->SetDrawColorBB($pdf->hex2cmyk(DEFLINECOLOR)); // Text in headline $pdf->SetXY($currentx + 30, $currenty); $pdf->SetFont('Tahoma', 'B', 22); $pdf->Cell(360, 20, 'OBBLM Match Report', 0, 0, 'R', false, ''); //Printing game info rounded box $currenty += 5; $pdf->SetFillColorBB($pdf->hex2cmyk('#c6c6c6')); $pdf->SetDrawColorBB($pdf->hex2cmyk('#000000')); $pdf->SetFontSize(1); $pdf->SetLineWidth(0.6); #$pdf->RoundedRect($currentx, $currenty, 542, 80, 5, 'D'); //Score boxes $pdf->SetLineWidth(0.4); $scoreboxOffset = 20; # $pdf->RoundedRect($currentx + 15, $currenty + $scoreboxOffset, 50, 50, 5, 'D'); # $pdf->RoundedRect($currentx + 475, $currenty + $scoreboxOffset, 50, 50, 5, 'D'); if ($FILLED) { $img1 = new ImageSubSys(IMGTYPE_TEAMLOGO, $team1->team_id); $img2 = new ImageSubSys(IMGTYPE_TEAMLOGO, $team2->team_id); $pdf->Image($img1->getPath(), $currentx - 10, $currenty + $scoreboxOffset, 60, 60, '', '', false, 0); $pdf->Image($img2->getPath(), $currentx + 495, $currenty + $scoreboxOffset, 60, 60, '', '', false, 0); } //VS text $currentx += 80; $currenty += 15; $pdf->SetXY($currentx, $currenty); $pdf->SetFont('Tahoma', '', 16); $noname = '__________________'; $pdf->Cell(390, 50, (!$FILLED ? $noname : $team1->name) . ' - ' . (!$FILLED ? $noname : $team2->name), 0, 0, 'C', false, ''); // Gate + score text $pdf->SetFont('Tahoma', '', 11); $space = ' '; $currenty += 26; $pdf->SetXY($currentx, $currenty); $pdf->Cell(210, 50, "Score: -", 0, 0, 'R', false, ''); $currenty += 18; $pdf->SetXY($currentx, $currenty); $pdf->Cell(210, 50, "Gate:{$space}k", 0, 0, 'R', false, ''); //Printing headers for player rows. Do all this twice $smallFieldSize = 25; $mediumFieldSize = 40; $nameFieldSize = 140; //Print two team boxes $currenty += 25; $i = 0; while ($i < 2) { $i++; $currenty += 5; $currentx = MARGINX + 6; $pdf->SetXY($currentx, $currenty); $pdf->SetFillColorBB($pdf->hex2cmyk('#c6c6c6')); $pdf->SetDrawColorBB($pdf->hex2cmyk('#000000')); $pdf->SetFontSize(1); $pdf->SetLineWidth(0.6); #$pdf->RoundedRect($currentx, $currenty, 542, 315, 5, 'D'); $currenty += $scoreboxOffset; $currentx += 15; $pdf->SetXY($currentx, $currenty); //Print Home / Away Images if ($i == 1) { $pdf->Image('modules/pdfmatchreport/home.png', $currentx - 10, $currenty + 90, 40, 163, '', '', false, 0); } else { $pdf->Image('modules/pdfmatchreport/away.png', $currentx - 10, $currenty + 90, 40, 161, '', '', false, 0); } $currentx += 45; $pdf->SetXY($currentx, $currenty); $h = 20; $pdf->SetFillColorBB($pdf->hex2cmyk(HEADLINEBGCOLOR)); $pdf->SetDrawColorBB($pdf->hex2cmyk(DEFLINECOLOR)); $pdf->SetFont('Tahoma', 'B', 8); $pdf->setLineWidth(1.5); // Printing headline for team table $pdf->Cell(50, $h, 'Winnings', 1, 0, 'L', true, ''); $pdf->Cell(60, $h, 'Fan Factor', 1, 0, 'C', true, ''); $pdf->Cell(70, $h, 'Total team CAS', 1, 0, 'C', true, ''); $pdf->Cell(35, $h, 'FAME', 1, 0, 'C', true, ''); if (1 && $FILLED) { $pdf->SetFont('Tahoma', 'B', 11); $pdf->Cell(150, $h, ' ' . ${"team{$i}"}->name, 0, 0, 'L', false, ''); } $currenty += 23; $pdf->SetXY($currentx, $currenty); $h = 15; // Row/cell height for team table row $pdf->SetFillColorBB($pdf->hex2cmyk('#FFFFFF')); $pdf->SetDrawColorBB($pdf->hex2cmyk('#000000')); $pdf->SetFontSize(1); $pdf->SetLineWidth(0.6); //Team table row $pdf->Cell(50, $h, '', 1, 0, 'L', true, ''); //Fan factor box $pdf->SetFont('Tahoma', '', 8); $boxx = $currentx + 50; $boxy = $currenty; $pdf->SetXY($boxx += 4, $boxy += 5); $pdf->Rect($boxx, $boxy, 5, 5, 'DF'); $pdf->SetXY($boxx += 5, $boxy -= 1); $pdf->Cell(20, 8, '+1', 0, 0, 'L', false); $pdf->SetXY($boxx += 16, $boxy += 1); $pdf->Rect($boxx, $boxy, 5, 5, 'DF'); $pdf->SetXY($boxx += 5, $boxy -= 1); $pdf->Cell(20, 8, '0', 0, 0, 'L', false); $pdf->SetXY($boxx += 12, $boxy += 1); $pdf->Rect($boxx, $boxy, 5, 5, 'DF'); $pdf->SetXY($boxx += 5, $boxy -= 1); $pdf->Cell(20, 8, '-1', 0, 0, 'L', false); //Total team cas, FAME $pdf->SetXY($currentx + 110, $currenty); $pdf->Cell(70, $h, '', 1, 0, 'C', true, ''); $pdf->Cell(35, $h, '', 1, 0, 'C', true, ''); if (1 && $FILLED) { $t = ${"team{$i}"}; $pdf->SetFont('Tahoma', '', 8); $statsstr = sprintf('TV: %uk - Played: %u - Win pct.: %1.0f - ELO: %1.0f - CAS inflicted: %u', $t->tv / 1000, $t->mv_played, $t->rg_win_pct, $t->rg_elo, $t->mv_cas); # $statsstr = sprintf('TV: %uk', $t->tv/1000); $pdf->Cell(250, $h, ' ' . $statsstr, 0, 0, 'L', false, ''); } $currenty += $h + 10; $pdf->SetXY($currentx, $currenty); //Headers for player table $h = 20; $pdf->SetFillColorBB($pdf->hex2cmyk(HEADLINEBGCOLOR)); $pdf->SetDrawColorBB($pdf->hex2cmyk(DEFLINECOLOR)); $pdf->SetFont('Tahoma', 'B', 8); $pdf->setLineWidth(1.5); // Printing headline for player table $pdf->Cell($smallFieldSize, $h, 'Nr', 1, 0, 'C', true, ''); $pdf->Cell($nameFieldSize, $h, 'Name', 1, 0, 'L', true, ''); $pdf->Cell($smallFieldSize, $h, 'MVP', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, 'Cp', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, 'Td', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, 'Int', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, 'BH', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, 'SI', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, 'Ki', 1, 0, 'C', true, ''); $pdf->Cell($mediumFieldSize, $h, 'IR D1', 1, 0, 'C', true, ''); $pdf->Cell($mediumFieldSize, $h, 'IR D2', 1, 0, 'C', true, ''); $pdf->Cell($mediumFieldSize, $h, 'Inj', 1, 0, 'C', true, ''); $currenty += 23; $pdf->SetXY($currentx, $currenty); $pdf->SetFont('Tahoma', '', 8); $h = 15; // Row/cell height for player table $pdf->SetFillColorBB($pdf->hex2cmyk('#FFFFFF')); $pdf->SetDrawColorBB($pdf->hex2cmyk('#000000')); $pdf->SetFontSize(10); $pdf->SetLineWidth(0.6); // Printing player rows $tmp_players = array(); if ($FILLED) { $players = ${"team{$i}"}->getPlayers(); foreach ($players as $p) { if (!Match::player_validation($p, $match)) { continue; } array_push($tmp_players, $p); } } $players = $tmp_players; $j = 0; while ($j < 16) { $j++; $nr = ''; $name = ''; $bgc = COLOR_ROSTER_NORMAL; if (count($players) >= $j) { $p = $players[$j - 1]; $name = $p->name; $bgc = COLOR_ROSTER_NORMAL; if ($p->is_journeyman) { $name = "{$p->name} [J]"; $bgc = COLOR_ROSTER_JOURNEY; } if ($p->is_journeyman_used) { $name = "{$p->name} [J]"; $bgc = COLOR_ROSTER_JOURNEY_USED; } if ($p->is_mng) { $name = "{$p->name} [MNG]"; $bgc = COLOR_ROSTER_MNG; } if ($p->mayHaveNewSkill()) { $name = "{$p->name}"; $bgc = COLOR_ROSTER_NEWSKILL; } $nr = $p->nr; } $pdf->SetFillColorBB($pdf->hex2cmyk($bgc)); $pdf->Cell($smallFieldSize, $h, $nr, 1, 0, 'C', true, ''); $pdf->Cell($nameFieldSize, $h, $name, 1, 0, 'L', true, ''); $pdf->Cell($smallFieldSize, $h, '', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, '', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, '', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, '', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, '', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, '', 1, 0, 'C', true, ''); $pdf->Cell($smallFieldSize, $h, '', 1, 0, 'C', true, ''); $pdf->Cell($mediumFieldSize, $h, '', 1, 0, 'C', true, ''); $pdf->Cell($mediumFieldSize, $h, '', 1, 0, 'C', true, ''); $pdf->Cell($mediumFieldSize, $h, '', 1, 0, 'C', true, ''); $currenty += $h; $pdf->SetXY($currentx, $currenty); } //$myscale = 0.55; //$pdf->Image('modules/pdfmatchreport/status.png', $currentx+280, $currenty+5, $myscale*320, $myscale*22, '', '', false, 0); // $pdf->SetFont('Tahoma', 'B', 7); // $pdf->SetXY(360, $currenty+5); // $pdf->Multicell(200, 10, $lng->getTrn('matches/report/usedjourney'), 0, 0, 'L', false); // Color legends $pdf->SetFont('Tahoma', '', 7); $currentx = 335; $currenty += 5; $dd = 2; $pdf->SetFillColorBB($pdf->hex2cmyk(COLOR_ROSTER_MNG)); $pdf->SetXY($currentx, $currenty); $pdf->Rect($currentx, $currenty, 5, 5, 'DF'); $pdf->SetXY($currentx += 5, $currenty -= 1); $pdf->Cell(20, 8, 'MNG', 0, 0, 'L', false); $pdf->SetFillColorBB($pdf->hex2cmyk(COLOR_ROSTER_JOURNEY)); $pdf->Rect($currentx += 22 + $dd, $currenty += 1, 5, 5, 'DF'); $pdf->SetXY($currentx += 5, $currenty -= 1); $pdf->Cell(45, 8, 'Journeyman', 0, 0, 'L', false); $pdf->SetFillColorBB($pdf->hex2cmyk(COLOR_ROSTER_JOURNEY_USED)); $pdf->Rect($currentx += 47 + $dd, $currenty += 1, 5, 5, 'DF'); $pdf->SetXY($currentx += 5, $currenty -= 1); $pdf->Cell(45, 8, 'Used journeyman', 0, 0, 'L', false); $pdf->SetFillColorBB($pdf->hex2cmyk(COLOR_ROSTER_NEWSKILL)); $pdf->Rect($currentx += 64 + $dd, $currenty += 1, 5, 5, 'DF'); $pdf->SetXY($currentx += 5, $currenty -= 1); $pdf->Cell(70, 8, 'New skill available', 0, 0, 'L', false); } // end $pdf->SetFont('Tahoma', '', 7); $currenty = 800; $pdf->SetXY(MARGINX - 5, $currenty); $donate = "Please consider donating to the OBBLM project if you enjoy this software and wish to support further development and maintenance. For more information visit nicholasmr.dk"; $pdf->SetFillColorBB($pdf->hex2cmyk('#FFFFFF')); $pdf->Multicell(300, 9, $donate, 0, 0, 'L', false); $currentx = MARGINX + 330; $pdf->SetXY($currentx, $currenty); # $pdf->Cell(20, 8, 'Created by Daniel Henriksson & Nicholas Rathmann, 2010-2012', 0, 0, 'L', false); // Output the PDF document $pdf->Output("Match Report.pdf", 'I'); }
public static function main($argv) { global $lng; title($lng->getTrn('name', __CLASS__)); echo $lng->getTrn('desc', __CLASS__) . "<br><br>\n"; list($sel_node, $sel_node_id) = HTMLOUT::nodeSelector(array()); echo "<br>"; $_rows = 0; foreach (self::getMemMatches($sel_node, $sel_node_id) as $d => $matches) { $_container_style = 'float:left; width:50%;'; if ($_rows == 0) { echo "<div style='{$_container_style}'>"; } ?> <div class="boxWide"> <div class="boxTitle<?php echo T_HTMLBOX_INFO; ?> "><?php echo $lng->getTrn($d, __CLASS__); ?> </div> <div class="boxBody"> <table class="common"> <?php if (empty($matches)) { ?> <tr><td align="center"><br><br><?php echo preg_replace('/\\sX\\s/', ' ' . MAX_MEM_MATCHES . ' ', $lng->getTrn('filled', __CLASS__)); ?> <br><br></td></tr><?php } else { $i = count($matches); foreach ($matches as $m) { $t1 = new Team($m->team1_id); $t2 = new Team($m->team2_id); $img1 = new ImageSubSys(IMGTYPE_TEAMLOGO, $t1->team_id); $img2 = new ImageSubSys(IMGTYPE_TEAMLOGO, $t2->team_id); ?> <tr> <td align="left" style="width:40%;"><img border='0px' height='30' width='30' alt='team picture' src='<?php echo $img1->getPath(); ?> '><?php echo $t1->name; ?> </td> <td align="center"> <?php switch ($d) { case 'td': case 'cp': case 'intcpt': case 'ki': case 'cas': $v = array(); $s = $d == 'cas' ? 'bh+ki+si' : $d; foreach (array(1, 2) as $j) { $query = "SELECT SUM({$s}) as '{$s}' FROM matches, match_data WHERE f_match_id = match_id AND match_id = {$m->match_id} AND f_team_id = team{$j}_id"; $result = mysql_query($query); $row = mysql_fetch_assoc($result); $v[$j] = $row[$s] ? $row[$s] : 0; } echo "<b>{$v['1']} - {$v['2']}</b>"; break; case 'svic': echo "<b>{$m->team1_score} - {$m->team2_score}</b>"; break; case 'inc': echo '<b>' . $m->income1 / 1000 . 'k - ' . $m->income2 / 1000 . 'k</b>'; break; case 'gate': echo '<b>' . $m->gate / 1000 . 'k</b>'; break; case 'mfans': echo "<b>{$m->fans}</b>"; break; case 'tvdiff': echo '<b>' . $m->tv1 / 1000 . 'k - ' . $m->tv2 / 1000 . 'k</b>'; break; } ?> </td> <td align="right" style="width:40%;"><?php echo $t2->name; ?> <img border='0px' height='30' width='30' alt='team picture' src='<?php echo $img2->getPath(); ?> '></td> </tr> <tr> <td align="right" colspan="3"> <small> <i><?php echo get_alt_col('tours', 'tour_id', $m->f_tour_id, 'name'); ?> , <?php echo textdate($m->date_played, true); ?> </i>, <a href="index.php?section=matches&type=report&mid=<?php echo $m->match_id; ?> "><?php echo $lng->getTrn('common/view'); ?> </a> </small> </td> </tr> <?php if (--$i > 0) { echo '<tr><td colspan="3"><hr></td></tr>'; } } } ?> </table> </div> </div> <?php if (is_int(($_rows + 1) / MMATCHES_BREAK)) { echo "</div>"; echo "<div style='{$_container_style}'>"; } $_rows++; } echo "</div>"; }
/** * Shows a team box. * * @param id the id of the team * @param selectable true/false if this the div box should be selectable or not. * If true a selected teams will get a green background, * unselected teams get red backgrounds. * If false the team will get a gray background. */ public static function showTeam($id, $selectable = true, $dragable = false) { $team = new Team($id); $teamLogo = new ImageSubSys(IMGTYPE_TEAMLOGO, $team->team_id); $selectClass = ""; if ($selectable) { $selectClass = "notselected onofftoggle"; } else if ($dragable) { $selectClass = "draggable"; } ?> <div id="pool<?echo $id; ?>" class="team <? echo $selectClass; ?>"> <img border='0px' height='30' width='30' title='<?php echo $team->name;?>' alt='<?php echo $team->name;?>' src='<?php echo $teamLogo->getPath();?>'> <span class="teamname"><?php echo $team->name;?></span> </div> <? }