private function _CCprofile($ALLOW_EDIT) { global $lng, $coach, $leagues; // Was new password/email request made? if (isset($_POST['type']) && $ALLOW_EDIT) { if (get_magic_quotes_gpc()) { $_POST['new_passwd'] = isset($_POST['new_passwd']) ? stripslashes($_POST['new_passwd']) : ''; $_POST['new_phone'] = isset($_POST['new_phone']) ? stripslashes($_POST['new_phone']) : ''; $_POST['new_email'] = isset($_POST['new_email']) ? stripslashes($_POST['new_email']) : ''; $_POST['new_name'] = isset($_POST['new_name']) ? stripslashes($_POST['new_name']) : ''; $_POST['new_realname'] = isset($_POST['new_realname']) ? stripslashes($_POST['new_realname']) : ''; } switch ($_POST['type']) { case 'chpasswd': status(Coach::checkPasswd($this->coach_id, $_POST['old_passwd']) && $this->setPasswd($_POST['new_passwd'])); break; case 'chphone': status($this->setPhone($_POST['new_phone'])); break; case 'chmail': status($this->setMail($_POST['new_email'])); break; case 'chlogin': status($this->setName($_POST['new_name'])); break; case 'chname': status($this->setRealName($_POST['new_realname'])); break; case 'chlang': status($this->setSetting('lang', $_POST['new_lang'])); break; case 'chhomelid': status(isset($_POST['new_homelid']) && get_alt_col('leagues', 'lid', (int) $_POST['new_homelid'], 'lid') && $this->setSetting('home_lid', $_POST['new_homelid'])); break; case 'pic': status($_POST['add_del'] == 'add' ? $this->savePic(false) : $this->deletePic()); break; case 'coachtext': if (get_magic_quotes_gpc()) { $_POST['coachtext'] = stripslashes($_POST['coachtext']); } status($this->saveText($_POST['coachtext'])); break; } } // New team and change coach settings. echo "<br><br>"; ?> <table class="common"><tr class="commonhead"><td><b><?php echo $lng->getTrn('cc/coach_info'); ?> </b></td></tr></table> <br> <?php echo $lng->getTrn('cc/note_persinfo'); echo "<br><br>"; if (is_object($coach) && !$ALLOW_EDIT) { # Logged in but not viewing own coach page. ?> <table> <tr> <td>ID:</td> <td><?php echo $this->coach_id; ?> </td> </tr> <tr> <td>Name (login):</td> <td><?php echo $this->name; ?> </td> </tr> <tr> <td>Full name:</td> <td><?php echo empty($this->realname) ? '<i>' . $lng->getTrn('common/none') . '</i>' : $this->realname; ?> </td> </tr> <tr> <td>Phone:</td> <td><?php echo empty($this->phone) ? '<i>' . $lng->getTrn('common/none') . '</i>' : $this->phone; ?> </td> </tr> <tr> <td>Mail:</td> <td><?php echo empty($this->mail) ? '<i>' . $lng->getTrn('common/none') . '</i>' : $this->mail; ?> </td> </tr> </table> <br> <?php } if ($ALLOW_EDIT) { ?> <table class="common" style="border-spacing:5px; padding:20px;"> <tr><td colspan='4'>ID: <?php echo $this->coach_id; ?> </td></tr> <tr> <form method="POST"> <td><?php echo $lng->getTrn('cc/chpasswd'); ?> :</td> <td><?php echo $lng->getTrn('cc/old'); ?> :<input type='password' name='old_passwd' size="20" maxlength="50"></td> <td><?php echo $lng->getTrn('cc/new'); ?> :<input type='password' name='new_passwd' size="20" maxlength="50"></td> <td><input type="submit" name="button" value="<?php echo $lng->getTrn('cc/chpasswd'); ?> "></td> <input type='hidden' name='type' value='chpasswd'> </form> </tr> <tr> <form method="POST"> <td><?php echo $lng->getTrn('cc/chphone'); ?> :</td> <td><?php echo $lng->getTrn('cc/old'); ?> :<input type='text' name='old_phone' readonly value="<?php echo $this->phone; ?> " size="20" maxlength="129"></td> <td><?php echo $lng->getTrn('cc/new'); ?> :<input type='text' name='new_phone' size="20" maxlength="25"></td> <td><input type="submit" name="button" value="<?php echo $lng->getTrn('cc/chphone'); ?> "></td> <input type='hidden' name='type' value='chphone'> </form> </tr> <tr> <form method="POST"> <td><?php echo $lng->getTrn('cc/chmail'); ?> :</td> <td><?php echo $lng->getTrn('cc/old'); ?> :<input type='text' name='old_email' readonly value="<?php echo $this->mail; ?> " size="20" maxlength="129"></td> <td><?php echo $lng->getTrn('cc/new'); ?> :<input type='text' name='new_email' size="20" maxlength="129"></td> <td><input type="submit" name="button" value="<?php echo $lng->getTrn('cc/chmail'); ?> "></td> <input type='hidden' name='type' value='chmail'> </form> </tr> <tr> <form method="POST"> <td><?php echo $lng->getTrn('cc/chlogin'); ?> :</td> <td><?php echo $lng->getTrn('cc/old'); ?> :<input type='text' name='old_name' readonly value="<?php echo $this->name; ?> " size="20" maxlength="50"></td> <td><?php echo $lng->getTrn('cc/new'); ?> :<input type='text' name='new_name' size="20" maxlength="50"></td> <td><input type="submit" name="button" value="<?php echo $lng->getTrn('cc/chlogin'); ?> "></td> <input type='hidden' name='type' value='chlogin'> </form> </tr> <tr> <form method="POST"> <td><?php echo $lng->getTrn('cc/chname'); ?> :</td> <td><?php echo $lng->getTrn('cc/old'); ?> :<input type='text' name='old_realname' readonly value="<?php echo $this->realname; ?> " size="20" maxlength="50"></td> <td><?php echo $lng->getTrn('cc/new'); ?> :<input type='text' name='new_realname' size="20" maxlength="50"></td> <td><input type="submit" name="button" value="<?php echo $lng->getTrn('cc/chname'); ?> "></td> <input type='hidden' name='type' value='chname'> </form> </tr> <tr> <form method="POST"> <td><?php echo $lng->getTrn('cc/chlang'); ?> :</td> <td><?php echo $lng->getTrn('cc/current'); ?> : <?php echo $this->settings['lang']; ?> </td> <td> <?php echo $lng->getTrn('cc/new'); ?> : <select name='new_lang'> <?php foreach (Translations::$registeredLanguages as $lang) { echo "<option value='{$lang}'>{$lang}</option>\n"; } ?> </select> </td> <td><input type="submit" name="button" value="<?php echo $lng->getTrn('cc/chlang'); ?> "></td> <input type='hidden' name='type' value='chlang'> </form> </tr> <tr> <form method="POST"> <td><?php echo $lng->getTrn('cc/chhomelid'); ?> :</td> <td><?php echo $lng->getTrn('cc/current'); ?> : <?php echo isset($leagues[$this->settings['home_lid']]) ? $leagues[$this->settings['home_lid']]['lname'] : '<i>' . $lng->getTrn('common/none') . '</i>'; ?> </td> <td> <?php echo $lng->getTrn('cc/new'); ?> : <select name='new_homelid'> <?php foreach ($leagues as $lid => $desc) { echo "<option value='{$lid}'>{$desc['lname']}</option>\n"; } ?> </select> </td> <td><input type="submit" name="button" value="<?php echo $lng->getTrn('cc/chhomelid'); ?> " <?php echo count($leagues) == 0 ? 'DISABLED' : ''; ?> ></td> <input type='hidden' name='type' value='chhomelid'> </form> </tr> </table> <?php } ?> <table class='common'> <tr class='commonhead'> <td><b><?php echo $lng->getTrn('cc/photo'); ?> </b></td> <td><b><?php echo $lng->getTrn('common/about'); ?> </b></td> </tr> <tr> <td> <?php ImageSubSys::makeBox(IMGTYPE_COACH, $this->coach_id, $ALLOW_EDIT, false); ?> </td> <td valign='top'> <?php $txt = $this->getText(); if (empty($txt)) { $txt = $lng->getTrn('common/nobody'); } if ($ALLOW_EDIT) { ?> <form method='POST'> <textarea name='coachtext' rows='15' cols='70'><?php echo $txt; ?> </textarea> <br><br> <input type="hidden" name="type" value="coachtext"> <input type="submit" name='Save' value="<?php echo $lng->getTrn('common/save'); ?> "> </form> <?php } else { echo '<p>' . fmtprint($txt) . "</p>\n"; } ?> </td> </tr> </table> <?php }
private function _about($ALLOW_EDIT) { global $lng; $p = $this; // Copy. Used instead of $this for readability. $p->skills = $p->getSkillsStr(true); $p->injs = $p->getInjsStr(true); ?> <div class="row"> <div class="boxPlayerPageInfo"> <div class="boxTitle<?php echo T_HTMLBOX_INFO; ?> "><?php echo $lng->getTrn('profile/player/about'); ?> </div> <div class="boxBody"> <table class="pbox"> <tr> <td><b><?php echo $lng->getTrn('common/name'); ?> </b></td> <td><?php echo "{$p->name} (#{$p->nr})"; ?> </td> </tr> <tr> <td><b><?php echo $lng->getTrn('common/pos'); ?> </b></td> <td><?php echo $lng->getTrn('position/' . strtolower($lng->FilterPosition($p->position))); ?> </td> </tr> <tr> <td><b><?php echo $lng->getTrn('common/team'); ?> </b></td> <td><a href="<?php echo urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $p->owned_by_team_id, false, false); ?> "><?php echo $p->f_tname; ?> </a></td> </tr> <tr> <td><b><?php echo $lng->getTrn('common/bought'); ?> </b></td> <td><?php echo $p->date_bought; ?> </td> </tr> <tr> <td><b><?php echo $lng->getTrn('common/status'); ?> </b></td> <td> <?php if ($p->is_dead) { echo "<b><font color='red'>" . $lng->getTrn('common/dead') . "</font></b> ({$p->date_died})"; } elseif ($p->is_sold) { echo "<b>" . $lng->getTrn('common/sold') . "</b> ({$p->date_sold})"; } else { global $T_INJS; $status = ucfirst(strtolower($T_INJS[$p->status])); echo $status == 'none' ? '<b><font color="green">' . $lng->getTrn('common/ready') . '</font></b>' : "<b><font color='blue'>{$status}</font></b>"; } ?> </td> </tr> <tr> <td><b><?php echo $lng->getTrn('common/value'); ?> </b></td> <td><?php echo $p->value / 1000 . 'k'; ?> </td> </tr> <tr> <td><b>SPP/extra</b></td> <td><?php echo "{$p->mv_spp}/{$p->extra_spp}"; ?> </td> </tr> <?php if (Module::isRegistered('Wanted')) { ?> <tr> <td><b>Wanted</b></td> <td><?php echo Module::run('Wanted', array('isWanted', $p->player_id)) ? '<b><font color="red">Yes</font></b>' : 'No'; ?> </td> </tr> <?php } if (Module::isRegistered('HOF')) { ?> <tr> <td><b>In HoF</b></td> <td><?php echo Module::run('HOF', array('isInHOF', $p->player_id)) ? '<b><font color="green">Yes</font></b>' : 'No'; ?> </td> </tr> <?php } ?> <tr> <td><b><?php echo $lng->getTrn('common/played'); ?> </b></td> <td><?php echo $p->mv_played; ?> </td> </tr> <tr> <td><b>W/L/D</b></td> <td><?php echo "{$p->mv_won}/{$p->mv_lost}/{$p->mv_draw}"; ?> </td> </tr> <?php if (Module::isRegistered('SGraph')) { ?> <tr> <td><b>Vis. stats</b></td> <td><?php echo "<a href='handler.php?type=graph&gtype=" . SG_T_PLAYER . "&id={$p->player_id}''>" . $lng->getTrn('common/view') . "</a>\n"; ?> </td> </tr> <?php } ?> <tr> <td colspan="2"><hr></td> </tr> <tr> <td><b>Ma</b></td> <td><?php echo $p->ma; ?> </td> </tr> <tr> <td><b>St</b></td> <td><?php echo $p->st; ?> </td> </tr> <tr> <td><b>Ag</b></td> <td><?php echo $p->ag; ?> </td> </tr> <tr> <td><b>Av</b></td> <td><?php echo $p->av; ?> </td> </tr> <tr valign="top"> <td><b><?php echo $lng->getTrn('common/skills'); ?> </b></td> <td><?php echo empty($p->skills) ? '<i>' . $lng->getTrn('common/none') . '</i>' : $p->skills; ?> </td> </tr> <tr> <td><b><?php echo $lng->getTrn('common/injs'); ?> </b></td> <td><?php echo empty($p->injs) ? '<i>' . $lng->getTrn('common/none') . '</i>' : $p->injs; ?> </td> </tr> <tr> <td><b>Cp</b></td> <td><?php echo $p->mv_cp; ?> </td> </tr> <tr> <td><b>Td</b></td> <td><?php echo $p->mv_td; ?> </td> </tr> <tr> <td><b>Int</b></td> <td><?php echo $p->mv_intcpt; ?> </td> </tr> <tr> <td><b>BH/SI/Ki</b></td> <td><?php echo "{$p->mv_bh}/{$p->mv_si}/{$p->mv_ki}"; ?> </td> </tr> <tr> <td><b>Cas</b></td> <td><?php echo $p->mv_cas; ?> </td> </tr> <tr> <td><b>MVP</b></td> <td><?php echo $p->mv_mvp; ?> </td> </tr> </table> </div> </div> <div class="boxCommon"> <div class="boxTitle<?php echo T_HTMLBOX_INFO; ?> "><?php echo $lng->getTrn('profile/player/profile'); ?> </div> <div class="boxBody"> <i><?php echo $lng->getTrn('common/picof'); ?> </i><hr> <?php ImageSubSys::makeBox(IMGTYPE_PLAYER, $p->player_id, $ALLOW_EDIT, false); ?> <br><br> <i><?php echo $lng->getTrn('common/about'); ?> </i><hr> <?php $txt = $p->getText(); if (empty($txt)) { $txt = $lng->getTrn('common/nobody'); } if ($ALLOW_EDIT) { ?> <form method="POST" enctype="multipart/form-data"> <textarea name='playertext' rows='8' cols='45'><?php echo $txt; ?> </textarea> <br><br> <input type="hidden" name="type" value="playertext"> <input type="submit" name='Save' value='<?php echo $lng->getTrn('common/save'); ?> '> </form> <?php } else { echo '<p>' . fmtprint($txt) . '</p>'; } ?> </div> </div> </div> <?php }
private function _news($ALLOW_EDIT) { global $lng; $team = $this; // Copy. Used instead of $this for readability. title("<a name='anc'>" . $lng->getTrn('profile/team/news') . "</a>"); $news = $team->getNews(MAX_TNEWS); ?> <div class="row"> <div class="boxWide"> <div class="boxTitle<?php echo T_HTMLBOX_INFO; ?> "><?php echo $lng->getTrn('profile/team/tnews'); ?> </div> <div class="boxBody"> <?php $news_2 = array(); foreach ($news as $n) { $news_2[] = '<p>' . fmtprint($n->txt) . '<div id="newsedit' . $n->news_id . '" style="display:none; clear:both;"><form method="POST"> <textarea name="txt" cols="60" rows="4">' . $n->txt . '</textarea> <input type="hidden" name="type" value="newsedit"> <input type="hidden" name="news_id" value="' . $n->news_id . '"> <br><br> <input type="submit" value="' . $lng->getTrn('common/submit') . '"> </form></div> <div style="text-align: right;"><p style="display: inline;">' . textdate($n->date, true) . ($ALLOW_EDIT ? ' ' . inlineform(array('type' => 'newsdel', 'news_id' => $n->news_id), "newsForm{$n->news_id}", $lng->getTrn('common/delete')) . " <a href='javascript:void(0);' onClick=\"slideToggle('newsedit" . $n->news_id . "');\">" . $lng->getTrn('common/edit') . "</a>" : '') . '</p></div><br></p>'; } echo implode("<hr>\n", $news_2); if (empty($news)) { echo '<i>' . $lng->getTrn('profile/team/nonews') . '</i>'; } if ($ALLOW_EDIT) { ?> <hr> <br> <b><?php echo $lng->getTrn('profile/team/wnews'); ?> </b> <form method="POST"> <textarea name='txt' cols='60' rows='4'></textarea> <br><br> <input type="hidden" name="type" value="news"> <input type='submit' value="<?php echo $lng->getTrn('common/submit'); ?> "> </form> <?php } ?> </div> </div> </div> <?php }
function sec_main() { global $settings, $rules, $coach, $lng, $leagues; MTS('Main start'); list($sel_lid, $HTML_LeagueSelector) = HTMLOUT::simpleLeagueSelector(); $IS_GLOBAL_ADMIN = is_object($coach) && $coach->ring == Coach::T_RING_GLOBAL_ADMIN; /* * Was any main board actions made? */ if (isset($_POST['type']) && is_object($coach) && $coach->isNodeCommish(T_NODE_LEAGUE, $sel_lid)) { if (get_magic_quotes_gpc()) { if (isset($_POST['title'])) { $_POST['title'] = stripslashes($_POST['title']); } if (isset($_POST['txt'])) { $_POST['txt'] = stripslashes($_POST['txt']); } } $msg = isset($_POST['msg_id']) ? new Message((int) $_POST['msg_id']) : null; switch ($_POST['type']) { case 'msgdel': status($msg->delete()); break; case 'msgnew': status(Message::create(array('f_coach_id' => $coach->coach_id, 'f_lid' => $IS_GLOBAL_ADMIN && isset($_POST['BC']) && $_POST['BC'] ? Message::T_BROADCAST : $sel_lid, 'title' => $_POST['title'], 'msg' => $_POST['txt']))); break; case 'msgedit': status($msg->edit($_POST['title'], $_POST['txt'])); break; case 'pin': status($msg->pin(1)); break; case 'unpin': status($msg->pin(0)); break; } } /* * Now we are ready to generate the HTML code. */ ?> <div class="main_head"><?php echo $settings['league_name']; ?> </div> <div class='main_leftColumn'> <div class="main_leftColumn_head"> <?php echo "<div class='main_leftColumn_welcome'>\n"; echo $settings['welcome']; echo "</div>\n"; echo "<div class='main_leftColumn_left'>\n"; if (count($leagues) > 1) { echo $HTML_LeagueSelector; } echo "</div>\n"; echo "<div class='main_leftColumn_right'>\n"; if (is_object($coach) && $coach->isNodeCommish(T_NODE_LEAGUE, $sel_lid)) { echo "<a href='javascript:void(0);' onClick=\"slideToggle('msgnew');\">" . $lng->getTrn('main/newmsg') . "</a> \n"; } if (Module::isRegistered('RSSfeed')) { echo "<a href='handler.php?type=rss'>RSS</a>\n"; } echo "</div>\n"; ?> <div style="display:none; clear:both;" id="msgnew"> <br><br> <form method="POST"> <textarea name="title" rows="1" cols="50"><?php echo $lng->getTrn('common/notitle'); ?> </textarea><br><br> <textarea name="txt" rows="15" cols="50"><?php echo $lng->getTrn('common/nobody'); ?> </textarea><br><br> <?php if ($IS_GLOBAL_ADMIN) { echo $lng->getTrn('main/broadcast'); ?> <input type="checkbox" name="BC"><br><br><?php } ?> <input type="hidden" name="type" value="msgnew"> <input type="submit" value="<?php echo $lng->getTrn('common/submit'); ?> "> </form> </div> </div> <?php /* Generate main board. Left column is the message board, consisting of both commissioner messages and game summaries/results. To generate this table we create a general array holding the content of both. */ $j = 1; $prevPinned = 0; foreach (TextSubSys::getMainBoardMessages($settings['fp_messageboard']['length'], $sel_lid, $settings['fp_messageboard']['show_team_news'], $settings['fp_messageboard']['show_match_summaries']) as $e) { if ($prevPinned == 1 && !$e->pinned) { echo "<hr>\n"; } $prevPinned = $e->pinned; echo "<div class='boxWide'>\n"; echo "<h3 class='boxTitle{$e->cssidx}'>{$e->title}</h3>\n"; echo "<div class='boxBody'>\n"; $fmtMsg = fmtprint($e->message); # Basic supported syntax: linebreaks. echo "\r\n <div id='e{$j}' class='expandable'>{$fmtMsg}</div>\r\n <script type='text/javascript'>\r\n \$('#e{$j}').expander({\r\n slicePoint: 300,\r\n expandText: '" . $lng->getTrn('main/more') . "',\r\n collapseTimer: 0,\r\n userCollapseText: ''\r\n });\r\n </script>"; echo "<br><hr>\n"; echo "<table class='boxTable'><tr>\n"; switch ($e->type) { case T_TEXT_MATCH_SUMMARY: echo "<td align='left' width='100%'>" . $lng->getTrn('main/posted') . " " . textdate($e->date) . " " . (isset($e->date_mod) && $e->date_mod != $e->date ? "(" . $lng->getTrn('main/lastedit') . " " . textdate($e->date_mod) . ") " : '') . $lng->getTrn('main/by') . " {$e->author}</td>\n"; echo "<td align='right'><a href='index.php?section=matches&type=report&mid={$e->match_id}'>" . $lng->getTrn('common/view') . "</a></td>\n"; break; case T_TEXT_MSG: echo "<td align='left' width='100%'>" . $lng->getTrn('main/posted') . " " . textdate($e->date) . " " . $lng->getTrn('main/by') . " {$e->author}</td>\n"; if (is_object($coach) && ($IS_GLOBAL_ADMIN || $coach->coach_id == $e->author_id)) { // Only admins may delete messages, or if it's a commissioner's own message. echo "<td align='right'><a href='javascript:void(0);' onClick=\"slideToggle('msgedit{$e->msg_id}');\">" . $lng->getTrn('common/edit') . "</a></td>\n"; echo "<td align='right'>"; $fieldname = 'pin'; if ($e->pinned) { $fieldname = 'unpin'; } echo inlineform(array('type' => "{$fieldname}", 'msg_id' => $e->msg_id), "{$fieldname}{$e->msg_id}", $lng->getTrn("main/{$fieldname}")); echo "</td>"; echo "<td align='right'>"; echo inlineform(array('type' => 'msgdel', 'msg_id' => $e->msg_id), "msgdel{$e->msg_id}", $lng->getTrn('common/delete')); echo "</td>"; } break; case T_TEXT_TNEWS: echo "<td align='left' width='100%'>" . $lng->getTrn('main/posted') . " " . textdate($e->date) . "</td>\n"; break; } ?> </tr></table> <?php if ($e->type == T_TEXT_MSG) { echo "<div style='display:none;' id='msgedit{$e->msg_id}'>\n"; echo "<hr><br>\n"; echo '<form method="POST"> <textarea name="title" rows="1" cols="50">' . $e->title . '</textarea><br><br> <textarea name="txt" rows="15" cols="50">' . $e->message . '</textarea><br><br> <input type="hidden" name="type" value="msgedit"> <input type="hidden" name="msg_id" value="' . $e->msg_id . '"> <input type="submit" value="' . $lng->getTrn('common/submit') . '"> </form>'; echo "</div>"; } ?> </div> </div> <?php $j++; } ?> </div> <?php MTS('Board messages generated'); /* The right hand side column optionally (depending on settings) contains standings, latest game results, touchdown and casualties stats. We will now generate the stats, so that they are ready to be printed in correct order. */ echo "<div class='main_rightColumn'>\n"; $boxes_all = array_merge($settings['fp_standings'], $settings['fp_leaders'], $settings['fp_events'], $settings['fp_latestgames']); usort($boxes_all, create_function('$a,$b', 'return (($a["box_ID"] > $b["box_ID"]) ? 1 : (($a["box_ID"] < $b["box_ID"]) ? -1 : 0) );')); $boxes = array(); foreach ($boxes_all as $box) { # These fields distinguishes the box types. if (isset($box['fields'])) { $box['dispType'] = 'standings'; } else { if (isset($box['field'])) { $box['dispType'] = 'leaders'; } else { if (isset($box['content'])) { $box['dispType'] = 'events'; } else { $box['dispType'] = 'latestgames'; } } } switch ($box['type']) { case 'league': $_type = T_NODE_LEAGUE; break; case 'division': $_type = T_NODE_DIVISION; break; case 'tournament': $_type = T_NODE_TOURNAMENT; break; default: $_type = T_NODE_LEAGUE; } $box['type'] = $_type; $boxes[] = $box; } // Used in the below standings dispType boxes. global $core_tables, $ES_fields; $_MV_COLS = array_merge(array_keys($core_tables['mv_teams']), array_keys($ES_fields)); $_MV_RG_INTERSECT = array_intersect(array_keys($core_tables['teams']), array_keys($core_tables['mv_teams'])); // Let's print those boxes! foreach ($boxes as $box) { switch ($box['dispType']) { case 'standings': $_BAD_COLS = array(); # Halt on these columns/fields. switch ($box['type']) { case T_NODE_TOURNAMENT: if (!get_alt_col('tours', 'tour_id', $box['id'], 'tour_id')) { break 2; } $tour = new Tour($box['id']); $SR = array_map(create_function('$val', 'return $val[0]."mv_".substr($val,1);'), $tour->getRSSortRule()); break; case T_NODE_DIVISION: $_BAD_COLS = array('elo', 'swon', 'slost', 'sdraw', 'win_pct'); # Divisions do not have pre-calculated, MV, values of these fields. // Fall through! # Divisions do not have pre-calculated, MV, values of these fields. // Fall through! case T_NODE_LEAGUE: default: global $hrs; $SR = $hrs[$box['HRS']]['rule']; foreach ($SR as &$f) { $field = substr($f, 1); if (in_array($field, $_MV_RG_INTERSECT)) { if (in_array($field, $_BAD_COLS)) { # E.g. divisions have no win_pct record for teams like the mv_teams table (for tours) has. fatal("Sorry, the element '{$field}' in your specified house sortrule #{$box['HRS']} is not supported for your chosen type (ie. tournament/division/league)."); } $f = $f[0] . "rg_" . substr($f, 1); } else { $f = $f[0] . "mv_" . substr($f, 1); } } break; } list($teams, ) = Stats::getRaw(T_OBJ_TEAM, array($box['type'] => $box['id']), array(1, $box['length']), $SR, false); ?> <div class='boxWide'> <h3 class='boxTitle<?php echo T_HTMLBOX_STATS; ?> '><?php echo $box['title']; ?> </h3> <div class='boxBody'> <table class="boxTable"> <?php echo "<tr>\n"; foreach ($box['fields'] as $title => $f) { echo "<td><i>{$title}</i></td>\n"; } echo "</tr>\n"; foreach ($teams as $t) { if (!$t['retired']) { echo "<tr>\n"; foreach ($box['fields'] as $title => $f) { if (in_array($f, $_MV_COLS)) { $f = 'mv_' . $f; } echo "<td>"; if ($settings['fp_links'] && $f == 'name') { echo "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $t['team_id'], false, false) . "'>{$t['name']}</a>"; } elseif (is_numeric($t[$f]) && !ctype_digit($t[$f][0] == '-' ? substr($t[$f], 1) : $t[$f])) { echo sprintf('%1.2f', $t[$f]); } else { echo in_array($f, array('tv')) ? $t[$f] / 1000 : $t[$f]; } echo "</td>\n"; } echo "</tr>\n"; } } ?> </table> <?php if (isset($box['infocus']) && $box['infocus']) { echo "<hr>"; _infocus($teams); } ?> </div> </div> <?php MTS('Standings table generated'); break; case 'latestgames': if ($box['length'] <= 0) { break; } ?> <div class="boxWide"> <h3 class='boxTitle<?php echo T_HTMLBOX_MATCH; ?> '><?php echo $box['title']; ?> </h3> <div class='boxBody'> <table class="boxTable"> <tr> <td style="text-align: right;" width="50%"><i><?php echo $lng->getTrn('common/home'); ?> </i></td> <td> </td> <td style="text-align: left;" width="50%"><i><?php echo $lng->getTrn('common/away'); ?> </i></td> <td><i><?php echo $lng->getTrn('common/date'); ?> </i></td> <td> </td> </tr> <?php list($matches, $pages) = Match::getMatches(array(1, $box['length']), $box['type'], $box['id'], false); foreach ($matches as $m) { echo "<tr valign='top'>\n"; $t1name = $settings['fp_links'] ? "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $m->team1_id, false, false) . "'>{$m->team1_name}</a>" : $m->team1_name; $t2name = $settings['fp_links'] ? "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $m->team2_id, false, false) . "'>{$m->team2_name}</a>" : $m->team2_name; echo "<td style='text-align: right;'>{$t1name}</td>\n"; echo "<td><nobr>{$m->team1_score}—{$m->team2_score}</nobr></td>\n"; echo "<td style='text-align: left;'>{$t2name}</td>\n"; echo "<td>" . str_replace(' ', ' ', textdate($m->date_played, true)) . "</td>"; echo "<td><a href='index.php?section=matches&type=report&mid={$m->match_id}'>Show</a></td>"; echo "</tr>"; } ?> </table> </div> </div> <?php MTS('Latest matches table generated'); break; case 'leaders': $f = 'mv_' . $box['field']; list($players, ) = Stats::getRaw(T_OBJ_PLAYER, array($box['type'] => $box['id']), array(1, $box['length']), array('-' . $f), false); ?> <div class="boxWide"> <h3 class='boxTitle<?php echo T_HTMLBOX_STATS; ?> '><?php echo $box['title']; ?> </h3> <div class='boxBody'> <table class="boxTable"> <tr> <td><i><?php echo $lng->getTrn('common/name'); ?> </i></td> <?php if ($box['show_team']) { ?> <td><i><?php echo $lng->getTrn('common/team'); ?> </i></td><?php } ?> <td><i>#</i></td> <td><i><?php echo $lng->getTrn('common/value'); ?> </i></td> </tr> <?php foreach ($players as $p) { echo "<tr>\n"; echo "<td>" . ($settings['fp_links'] ? "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_PLAYER, $p['player_id'], false, false) . "'>{$p['name']}</a>" : $p['name']) . "</td>\n"; if ($box['show_team']) { echo "<td>" . ($settings['fp_links'] ? "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $p['owned_by_team_id'], false, false) . "'>{$p['f_tname']}</a>" : $p['f_tname']) . "</td>\n"; } echo "<td>" . $p[$f] . "</td>\n"; echo "<td>" . $p['value'] / 1000 . "k</td>\n"; echo "</tr>"; } ?> </table> </div> </div> <?php MTS('Leaders standings generated'); break; case 'events': $events = _events($box['content'], $box['type'], $box['id'], $box['length']); ?> <div class="boxWide"> <h3 class='boxTitle<?php echo T_HTMLBOX_STATS; ?> '><?php echo $box['title']; ?> </h3> <div class='boxBody'> <table class="boxTable"> <?php $head = array_pop($events); echo "<tr>\n"; foreach ($head as $col => $name) { echo "<td><i>{$name}</i></td>\n"; } echo "</tr>\n"; foreach ($events as $e) { echo "<tr>\n"; foreach ($head as $col => $name) { switch ($col) { case 'date': $e->{$col} = str_replace(' ', ' ', textdate($e->{$col}, true)); break; case 'name': if ($settings['fp_links']) { $e->{$col} = "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_PLAYER, $e->pid, false, false) . "'>" . $e->{$col} . "</a>"; } break; case 'tname': if ($settings['fp_links']) { $e->{$col} = "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $e->f_tid, false, false) . "'>" . $e->{$col} . "</a>"; } break; case 'rname': if ($settings['fp_links']) { $e->{$col} = "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_RACE, $e->f_rid, false, false) . "'>" . $e->{$col} . "</a>"; } break; case 'f_pos_name': if ($settings['fp_links']) { $e->{$col} = "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_RACE, $e->f_rid, false, false) . "'>" . $e->{$col} . "</a>"; } break; case 'value': $e->{$col} = $e->{$col} / 1000 . 'k'; break; } echo "<td>" . $e->{$col} . "</td>\n"; } echo "</tr>\n"; } ?> </table> </div> </div> <?php MTS('Events box generated'); break; } } ?> </div> <div class="main_foot"> <?php HTMLOUT::dnt(); ?> <br> <a TARGET="_blank" href="http://nicholasmr.dk/index.php?sec=obblm">OBBLM official website</a><br><br> This web site is completely unofficial and in no way endorsed by Games Workshop Limited. <br> Bloodquest, Blood Bowl, the Blood Bowl logo, The Blood Bowl Spike Device, Chaos, the Chaos device, the Chaos logo, Games Workshop, Games Workshop logo, Nurgle, the Nurgle device, Skaven, Tomb Kings, and all associated marks, names, races, race insignia, characters, vehicles, locations, units, illustrations and images from the Blood Bowl game, the Warhammer world are either (R), TM and/or (C) Games Workshop Ltd 2000-2006, variably registered in the UK and other countries around the world. Used without permission. No challenge to their status intended. All Rights Reserved to their respective owners. </div> <?php }