public static function makeList($ALLOW_EDIT) { global $lng, $coach, $settings; HTMLOUT::frame_begin(is_object($coach) ? $coach->settings['theme'] : $settings['stylesheet']); # Make page frame, banner and menu. /* A new entry was sent. Add it to system */ if (isset($_POST['tid']) && $ALLOW_EDIT) { if (get_magic_quotes_gpc()) { $_POST['title'] = stripslashes($_POST['title']); $_POST['about'] = stripslashes($_POST['about']); } switch ($_GET['action']) { case 'edit': $e = new self($_GET['ft_id']); status($e->edit($_POST['title'], $_POST['about'])); break; case 'new': status(self::create($_POST['tid'], $_POST['title'], $_POST['about'])); break; } } title($lng->getTrn('name', __CLASS__)); /* Was a request for a new entry made? */ if (isset($_GET['action']) && $ALLOW_EDIT) { // Default schema values. These are empty unless "edit" is chosen. $tid = false; $title = ''; $about = ''; switch ($_GET['action']) { case 'delete': if (isset($_GET['ft_id']) && is_numeric($_GET['ft_id'])) { $e = new self($_GET['ft_id']); status($e->delete()); unset($e); } else { fatal('Sorry. You did not specify which FT-id you wish to delete.'); } break; case 'edit': if (isset($_GET['ft_id']) && is_numeric($_GET['ft_id'])) { $e = new self($_GET['ft_id']); $tid = $e->tid; $title = $e->title; $about = $e->about; $_POST['lid'] = get_alt_col('mv_teams', 'f_tid', $tid, 'f_lid'); } else { fatal('Sorry. You did not specify which FT-id you wish to edit.'); } // Fall-through to "new" !!! // Fall-through to "new" !!! case 'new': echo "<a href='handler.php?type=famousteams'><-- " . $lng->getTrn('common/back') . "</a><br><br>"; $_DISABLED = !isset($_POST['lid']) ? 'DISABLED' : ''; $node_id = isset($_POST['lid']) ? $_POST['lid'] : null; ?> <form name="STS" method="POST" enctype="multipart/form-data"> <b><?php echo $lng->getTrn('common/league'); ?> </b><br> <?php echo HTMLOUT::nodeList(T_NODE_LEAGUE, 'lid', array(), array(), array('sel_id' => $node_id)); ?> <input type='submit' value='<?php echo $lng->getTrn('common/select'); ?> '> </form> <br> <form method="POST"> <b><?php echo $lng->getTrn('team', __CLASS__) . '</b>'; ?> <br> <?php $query = "SELECT team_id, name FROM teams WHERE f_lid = {$node_id} ORDER by name ASC"; $result = mysql_query($query); if ($result && mysql_num_rows($result) == 0) { $_DISABLED = 'DISABLED'; } ?> <select name="tid" id="teams" <?php echo $_DISABLED; ?> > <?php while ($row = mysql_fetch_assoc($result)) { echo "<option value='{$row['team_id']}' " . ($tid == $row['team_id'] ? 'SELECTED' : '') . ">{$row['name']}</option>\n"; } ?> </select> <br><br> <b><?php echo $lng->getTrn('g_title', __CLASS__) . '</b> — ' . $lng->getTrn('title', __CLASS__); ?> <br> <input type="text" name="title" size="60" maxlength="100" value="<?php echo $title; ?> " <?php echo $_DISABLED; ?> > <br><br> <b><?php echo $lng->getTrn('g_about', __CLASS__) . '</b> — ' . $lng->getTrn('about', __CLASS__); ?> <br> <textarea name="about" rows="15" cols="100" <?php echo $_DISABLED; ?> ><?php echo $about; ?> </textarea> <br><br> <input type="submit" value="<?php echo $lng->getTrn('submit', __CLASS__); ?> " name="Submit" <?php echo $_DISABLED; ?> > </form> <?php return; break; } } /* Print the hall of fame */ echo $lng->getTrn('desc', __CLASS__) . "<br><br>\n"; list($sel_node, $sel_node_id) = HTMLOUT::nodeSelector(array()); if ($ALLOW_EDIT) { echo "<br><a href='handler.php?type=famousteams&action=new'>" . $lng->getTrn('new', __CLASS__) . "</a><br>\n"; } self::printList($sel_node, $sel_node_id, $ALLOW_EDIT); HTMLOUT::frame_end(); }
public static function makeList() { global $lng, $coach, $settings; HTMLOUT::frame_begin(); # Make page frame, banner and menu. title($lng->getTrn('name', __CLASS__)); echo $lng->getTrn('desc', __CLASS__) . "<br><br>\n"; list($sel_node, $sel_node_id) = HTMLOUT::nodeSelector(array()); $ALLOW_EDIT = is_object($coach) && $coach->isNodeCommish($sel_node, $sel_node_id); /* A new entry was sent. Add it to system */ if ($ALLOW_EDIT && isset($_POST['tid']) && isset($_POST['trid'])) { if (get_magic_quotes_gpc()) { $_POST['title'] = stripslashes($_POST['title']); $_POST['txt'] = stripslashes($_POST['txt']); } switch ($_GET['action']) { case 'new': status(self::create($_POST['ptype'], $_POST['tid'], $_POST['trid'], $_POST['title'], $_POST['txt'])); break; } } /* Was a request for a new entry made? */ if (isset($_GET['action']) && $ALLOW_EDIT) { switch ($_GET['action']) { case 'delete': if (isset($_GET['prid']) && is_numeric($_GET['prid'])) { $pr = new Prize($_GET['prid']); status($pr->delete()); unset($pr); } else { fatal('Sorry. You did not specify which prize ID you wish to delete.'); } break; case 'new': echo "<a href='handler.php?type=prize'><-- " . $lng->getTrn('common/back') . "</a><br><br>"; $_DISABLED = !isset($_POST['trid']) ? 'DISABLED' : ''; ?> <form name="STS" method="POST" enctype="multipart/form-data"> <b><?php echo $lng->getTrn('common/tournament'); ?> </b><br> <?php echo HTMLOUT::nodeList(T_NODE_TOURNAMENT, 'trid'); ?> <input type='submit' value='<?php echo $lng->getTrn('common/select'); ?> '> </form> <br> <form method="POST" enctype="multipart/form-data"> <b><?php echo $lng->getTrn('team', __CLASS__); ?> </b><br> <select name="tid" <?php echo $_DISABLED; ?> > <?php $teams = isset($_POST['trid']) ? Team::getTeams(false, array(get_parent_id(T_NODE_TOURNAMENT, (int) $_POST['trid'], T_NODE_LEAGUE)), true) : array(); foreach ($teams as $tid => $name) { echo "<option value='{$tid}'>{$name}</option>\n"; } ?> </select> <br><br> <b><?php echo $lng->getTrn('kind', __CLASS__); ?> </b><br> <select name="ptype" <?php echo $_DISABLED; ?> > <?php foreach (self::getTypes() as $ptype => $desc) { echo "<option value='{$ptype}'>{$desc}</option>\n"; } ?> </select> <br><br> <?php echo '<b>' . $lng->getTrn('g_title', __CLASS__) . '</b> — ' . $lng->getTrn('title', __CLASS__); ?> <br> <input type="text" name="title" size="60" maxlength="100" value="" <?php echo $_DISABLED; ?> > <br><br> <?php echo '<b>' . $lng->getTrn('g_about', __CLASS__) . '</b> — ' . $lng->getTrn('about', __CLASS__); ?> <br> <textarea name="txt" rows="15" cols="100" <?php echo $_DISABLED; ?> ></textarea> <br><br><br> <input type='hidden' name='trid' value='<?php echo $_DISABLED ? 0 : $_POST['trid']; ?> '> <input type="submit" value="<?php echo $lng->getTrn('submit', __CLASS__); ?> " name="Submit" <?php echo $_DISABLED; ?> > </form> <br> <?php return; break; } } if ($ALLOW_EDIT) { echo "<br><a href='handler.php?type=prize&action=new'>" . $lng->getTrn('new', __CLASS__) . "</a><br>\n"; } /* Print the prizes */ self::printList($sel_node, $sel_node_id, $ALLOW_EDIT); HTMLOUT::frame_end(); }
echo "<div id='OPTS_FFA_TOUR_SETS'>{$body}</div>\n"; // Round robin seed multiplier. $body = ''; $body .= $lng->getTrn('admin/schedule/rrobin_rnds') . "<br><select name='rounds'>"; foreach (range(1, 10) as $i) { $body .= "<option value='{$i}'>{$i}</option>\n"; } $body .= "</select> " . $lng->getTrn('admin/schedule/times') . "\n"; echo "<div id='OPTS_RR_TOUR_SETS'>{$body}</div>\n"; ?> <div id='OPTS_FFA_SINGLE_SETS'> <br> <?php $body = ''; $body .= $lng->getTrn('admin/schedule/in_tour') . '<br>'; $body .= HTMLOUT::nodeList(T_NODE_TOURNAMENT, 'existTour', array(T_NODE_TOURNAMENT => array('type' => TT_FFA), 'OTHER' => array('ring' => Coach::T_RING_LOCAL_ADMIN)), array('locked' => 1, 'DISSTR' => 'LOCKED — %name'), array('empty_str' => array(T_NODE_LEAGUE => strtoupper($lng->getTrn('common/empty')) . ' — %name', T_NODE_DIVISION => strtoupper($lng->getTrn('common/empty')) . ' — %name'))); echo $body; ?> </div> </div> </div> <div class='boxCommon' style='<?php echo $commonStyle; ?> '> <h3 class='boxTitle<?php echo T_HTMLBOX_ADMIN; ?> '><?php echo $lng->getTrn('admin/schedule/add_team'); ?>
public static function userSched() { global $lng, $coach, $settings, $leagues, $divisions, $tours; if (!is_object($coach)) { status(false, "You must be logged in to schedule games"); return; } if (isset($_POST['creategame'])) { // Test input $trid = (int) $_POST['trid']; $round = (int) $_POST['round']; $own_team = (int) $_POST['own_team']; $errmsg = ''; // Logged in coach has access to the tour? if (!in_array($trid, array_keys($tours))) { $errmsg = 'You do not have access to the tournament ' . $tours[$trid]['tname']; } // Is the team is really owned by the logged in coach? if ($coach->coach_id != get_alt_col('teams', 'team_id', $own_team, 'owned_by_coach_id')) { $errmsg = 'The team ' . get_alt_col('teams', 'team_id', $own_team, 'name') . ' is not owned by you'; } // Create match if (!$errmsg) { list($exitStatus, $mid) = Match::create(array('team1_id' => $own_team, 'team2_id' => get_alt_col('teams', 'name', $_POST['opposing_team_autocomplete'], 'team_id'), 'round' => $round, 'f_tour_id' => $trid)); $backFromMatchLink = Mobile::isMobile() ? "index.php?mobile=1" : "index.php?section=matches&type=report&mid={$mid}"; status(!$exitStatus, $exitStatus ? Match::$T_CREATE_ERROR_MSGS[$exitStatus] : "<a href='{$backFromMatchLink}'>Click here</a> to open the match report"); if (!$exitStatus) { echo "<br>"; } } else { status(false, $errmsg); } } $trid = isset($_GET['trid']) && is_numeric($_GET['trid']) ? (int) $_GET['trid'] : 0; $lid = $trid ? get_parent_id(T_NODE_TOURNAMENT, $trid, T_NODE_LEAGUE) : false; $lname = $lid ? get_parent_name(T_NODE_TOURNAMENT, $trid, T_NODE_LEAGUE) : '- N/A -'; $did = $trid && get_alt_col('leagues', 'lid', $lid, 'tie_teams') == 1 ? get_parent_id(T_NODE_TOURNAMENT, $trid, T_NODE_DIVISION) : false; $dname = $did ? get_parent_name(T_NODE_TOURNAMENT, $trid, T_NODE_DIVISION) : false; $_DISABLED = !$trid ? 'DISABLED' : ''; #print_r(array($trid, $lid, $lname, $did)); title($lng->getTrn('menu/matches_menu/usersched')); $LOCK_FORMS = false; ?> <div class='boxCommon'> <h3 class='boxTitle<?php echo T_HTMLBOX_MATCH; ?> '><?php echo $lng->getTrn('menu/matches_menu/usersched'); ?> </h3> <div class='boxBody'> <form method="POST" id="usersched"> <?php echo "In tournament "; echo HTMLOUT::nodeList(T_NODE_TOURNAMENT, 'trid', array(T_NODE_TOURNAMENT => array('locked' => 0, 'type' => TT_FFA, 'allow_sched' => 1)), array(), array('sel_id' => $trid, 'extra_tags' => array('onChange="document.location.href = \'' . getFormAction('?section=matches&type=usersched') . '&trid=\' + $(this).val();"'), 'init_option' => '<option value="0">- ' . $lng->getTrn('matches/usersched/selecttour') . " -</option>\n")); echo ' as '; echo '<select name="round" id="round" ' . $_DISABLED . '>'; $T_ROUNDS = Match::getRounds(); foreach ($T_ROUNDS as $r => $d) { echo "<option value='{$r}' " . ($r == 1 ? 'SELECTED' : '') . ">" . $d . "</option>\n"; } ?> </select> <br><br> Your team <?php $teams = array(); foreach ($coach->getTeams($lid, $did, array('sortby' => 'team_id DESC')) as $t) { if (!$t->rdy || $t->is_retired) { continue; } $teams[] = $t; } ?> <select name='own_team' id='own_team' <?php echo $_DISABLED; ?> > <?php echo "<optgroup class='leagues' label='{$lname}'>\n"; if ($dname) { echo "<optgroup class='divisions' label=' {$dname}'>\n"; } foreach ($teams as $t) { echo "<option style='background-color: white; margin-left: -1em;' value='{$t->team_id}'> {$t->name}</option>\n"; } ?> </select> VS. <input type="text" id='opposing_team_autoselect' name="opposing_team_autocomplete" size="30" maxlength="50" <?php echo $_DISABLED; ?> > <script> $(document).ready(function(){ var options, b; options = { minChars:2, serviceUrl:'handler.php?type=autocomplete&obj=<?php echo T_OBJ_TEAM; ?> &trid=<?php echo $trid; ?> ', }; b = $('#opposing_team_autoselect').autocomplete(options); }); </script> <br><br><br> <input type="submit" name="creategame" value="<?php echo $lng->getTrn('menu/matches_menu/usersched'); ?> " <?php if (empty($teams) || $_DISABLED) { echo 'DISABLED'; } ?> > <?php if (Mobile::isMobile()) { echo '<a href="' . getFormAction('') . '">' . $lng->getTrn('common/back') . '</a>'; } ?> </form> </div> </div> <?php }
</div> </div> </td> </tr> <tr> <td valign='top' colspan='2'> <div class="boxCommon"> <div class="boxTitle<?php echo T_HTMLBOX_ADMIN; ?> ">Delete league</div> <div class="boxBody"> <form method="POST"> League<br> <?php echo HTMLOUT::nodeList(T_NODE_LEAGUE, 'lid', array('OTHER' => array('ring' => Coach::T_RING_LOCAL_ADMIN)), array(), array('empty_str' => array(T_NODE_LEAGUE => ''))); ?> <br><br> <?php echo $ONLY_FOR_GLOBAL_ADMIN; ?> <br><br> <input type='submit' value='Delete' <?php echo empty($leagues) || !$IS_GLOBAL_ADMIN ? ' DISABLED ' : ''; ?> onclick="if(!confirm('Warning: You should only delete leagues if empty, ie. no divisions/matches assigned to them.')){return false;}"> <input type='hidden' name='type' value='del_league'> </form> </div> </div> </td>