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 }
$day = GETPOST('day'); /* if(!empty($year)) { if(!empty($day)) { $start = $year.'-'.$month.'-'.$day; $end = $year.'-'.$month.'-'.$day; } else{ $start = $year.'-'.$month.'-01'; $end = $year.'-'.$month.'-31'; } } */ $TEvent = _events($start, $end); __out($TEvent, 'json'); break; default: break; } switch ($put) { case 'event-move': $a = new ActionComm($db); if ($a->fetch(GETPOST('id')) > 0) { $a->fetch_userassigned(); $TData = $_REQUEST['data']; if (!empty($TData['minutes'])) { $a->datep = strtotime($TData['minutes'] . ' minute', $a->datep); $a->datef = strtotime($TData['minutes'] . ' minute', $a->datef); }