?> <script> jQuery(function() { jQuery( "#draftDate" ).datepicker({ minDate: "+1D", maxDate: "+6M" }); }); jQuery(function() { jQuery( "#registrationDate" ).datepicker({ minDate: "+1D", maxDate: "+6M" }); }); </script> <?php if (selectCount("fch_leagues", " WHERE display_name = \"" . $_GET['q'] . "\" and season = \"{$season}\"") > 0) { echo "<h3>Sorry, the name " . $_GET['q'] . " is taken, please try again.</h3>"; return; } ?> <h2>Available!</h2> <form method="post" name="createLeague" class="form-validate form-horizontal"> <fieldset> <legend>Fill Us In On the Details</legend> <input name = "leagueDisplayName" value = "<?php echo $_GET['q']; ?> " type = "hidden"> <input name = "action" value = "doCreateLeague" type = "hidden">
require_once "fch-lib.php"; $userID = getUserID(); $os = ""; debug("regarding-league"); //debug(selectCount("fch_user_preferences"," WHERE userID = $userID ")); if (selectCount("fch_user_preferences", " WHERE userID = {$userID} ") == 0) { //debug("Creating preference row , "); $key = rand(0, 2147483647); $sql = "INSERT INTO `fanta66_joomla`.`fch_user_preferences` (`id` ,`userID` ,`displayLeague`, `secretKey`) VALUES (NULL , {$userID}, NULL, {$key});"; //debug($sql); executeGenericInsertSQL($sql); } //if (getSingleton("fch_user_preferences","displayLeague", " WHERE userID = $userID") == NULL) //generateUserPreferences($userID); $leagueCount = intval(selectCount("fch_league_membership", " where userID = {$userID} ")); $season = getSeason(); $dbLeague = getSingleton("fch_user_preferences", "displayLeague", " WHERE userID = {$userID}"); if (strlen($dbLeague) == 0) { debug("Setting default league."); generateUserPreferences($userID); } /* if ($leagueCount == 1) { debug("In only one league"); if (intval(selectCount("fch_league_membership", " WHERE userID = $userID and season = \"$season\"")) == 1) { debug("In only one league. Setting default membership."); $thisLeague = getSingleton("fch_league_membership","leagueID"," WHERE season = \"$season\" and userID = $userID"); debug("Setting default league for user $userID to $thisLeague");
$openDraftButton .= '<input type = "hidden" name = "leagueID" value = "' . $leagueID . '">'; $openDraftButton .= '<button class="btn btn-primary validate" type="button" id = "open_draft_button" onclick="javascript:submitForm(\'open_draft_form\',\'open_draft_button\');">Open Draft >></button> </form>'; echo $openDraftButton; } ?> </td></tr></table> <?php } $positionLimits = getAllPositionLimits($leagueID); $limit_f = $positionLimits["f_a"] + $positionLimits["f_b"]; $limit_d = $positionLimits["d_a"] + $positionLimits["d_b"]; $limit_g = $positionLimits["g_a"] + $positionLimits["g_b"]; $roster_f = selectCount("fch_draft", " Where leagueID = {$leagueID} and userID = {$userID} and position = \"F\" "); $roster_d = selectCount("fch_draft", " Where leagueID = {$leagueID} and userID = {$userID} and position = \"D\" "); $roster_g = selectCount("fch_draft", " Where leagueID = {$leagueID} and userID = {$userID} and position = \"G\" "); $allowF = 0; $allowD = 0; $allowG = 0; if ($limit_f > $roster_f) { $allowF = 1; } if ($limit_d > $roster_d) { $allowD = 1; } if ($limit_g > $roster_g) { $allowG = 1; } debug("USER: " . $userID); ?>
$season = getSeason(); $userID = getUserID(); $leagueID = leagueHandler($_POST, $userID); $playerQuery = $_GET['q']; $limit_f_a = getPositionLimit("F", "a", $leagueID); $limit_f_b = getPositionLimit("F", "b", $leagueID); $limit_d_a = getPositionLimit("D", "a", $leagueID); $limit_d_b = getPositionLimit("D", "b", $leagueID); $limit_g_a = getPositionLimit("G", "a", $leagueID); $limit_g_b = getPositionLimit("G", "b", $leagueID); $roster_f_a = selectCount("fch_rosters", " Where userID = {$userID} and leagueID = {$leagueID} and releaseDate is null and position = \"F\" and statusCode = \"act\" and season = \"{$season}\""); $roster_f_b = selectCount("fch_rosters", " Where userID = {$userID} and leagueID = {$leagueID} and releaseDate is null and position = \"F\" and statusCode = \"ben\" and season = \"{$season}\""); $roster_d_a = selectCount("fch_rosters", " Where userID = {$userID} and leagueID = {$leagueID} and releaseDate is null and position = \"D\" and statusCode = \"act\" and season = \"{$season}\""); $roster_d_b = selectCount("fch_rosters", " Where userID = {$userID} and leagueID = {$leagueID} and releaseDate is null and position = \"D\" and statusCode = \"ben\" and season = \"{$season}\""); $roster_g_a = selectCount("fch_rosters", " Where userID = {$userID} and leagueID = {$leagueID} and releaseDate is null and position = \"G\" and statusCode = \"act\" and season = \"{$season}\""); $roster_g_b = selectCount("fch_rosters", " Where userID = {$userID} and leagueID = {$leagueID} and releaseDate is null and position = \"G\" and statusCode = \"ben\" and season = \"{$season}\""); //echo "Looking for $playerQuery"; $sql = <<<SQL SELECT CONCAT( firstName, " ", lastName, ", ", schoolDisplayName ) as playerDisplayName, playerID as playerID, position, IF( schoolID IN ( SELECT schoolid FROM v_blacklist ), true, false ) as blacklist, if (playerID in (select playerID from fch_rosters where leagueID = {$leagueID} and releaseDate is NULL and season = "{$season}" ),true,false) as taken FROM `fch_players` where CONCAT( firstName, " ", lastName ) like "%{$playerQuery}%" SQL; debug($sql); $con = initializeDB();
} $num = ceil($count / 6); for ($i = 1; $i <= $num; $i++) { echo "<li>" . ($num + 1 - $i) . "</li>"; } echo "%%"; } $type = $_POST['type']; switch ($type) { case '0': selectCount("b_hot_goods", ""); BookList("b_hot_goods", "", "0"); break; case '1': $name = $_POST['name']; selectCount("b_rel_pro_maj", "WHERE id_category_major='{$name}'"); BookList("b_rel_pro_maj", "WHERE id_category_major='{$name}'", "0"); break; case '2': $idMajor = $_POST['idMajor']; $number = $_POST['number']; $FirstNumber = ($number - 1) * 6; if ($idMajor == 0) { BookList("b_hot_goods", "", $FirstNumber); } else { BookList("b_rel_pro_maj", "WHERE id_category_major='{$idMajor}'", $FirstNumber); } break; default: break; }
$passButton .= '<input name = "transactionID" value = "' . $transactionID . '" type = "hidden">'; $passButton .= '<input type = "hidden" name = "action" value = "doAcquire" >'; $passButton .= '<input type = "hidden" name = "playerID" value = "PassedPick">'; $passButton .= '<button class="btn btn-primary validate" type="button" id = "button_submit_PassedPick_a" onclick="javascript:submitForm(\'submit_PassedPick_a\',\'button_submit_PassedPick_a\');">Skip Your Turn (Pass) >></button> </form>'; //$passButton = "<form method = \"post\" name = \"submit_PassedPick_a\" name = \"tryAgain\"><input name = \"transactionID\" value = \"$transactionID\" type = \"hidden\"><input value = \"doAcquire\" type = \"hidden\" name = \"action\"><button class=\"btn btn-primary validate\" type=\"button\" id = \"button_submit_PassedPick_a\" onclick=\"javascript:submitForm('submit_PassedPick_a','button_submit_PassedPick_a');\">Pass >></button></form>"; $whoseTurn = onTheClock($leagueID); $usingWithdrawn = 0; $allowPick = 1; debug("User : "******"userID"]) == intval($userID))) { if (intval(selectCount("fch_draft", " WHERE userID = {$userID} and leagueID = {$leagueID} and playerID = \"WithdrawnPick\"")) > 0) { $alert = "<h3>You are not on the clock. This pick will replace your prior withdrawn pick.</h3>"; $usingWithdrawn = 1; $allowPick = 1; } else { if (intval(selectCount("fch_draft", " WHERE userID = {$userID} and leagueID = {$leagueID} and playerID = \"PassedPick\"")) > 0) { $alert = "<h3>You are not on the clock. This pick will replace your prior withdrawn pick.</h3>"; $usingWithdrawn = 1; $allowPick = 1; } else { $alert = "<h3>You are not on the clock.</h3>"; $allowPick = 0; } } } if ($allowPick) { $out .= $passButton; } if ($result->num_rows > 0) { // output data of each row $out = "<h3>Results</h3>{$tryAgain}<p/>";
$document = JFactory::getDocument(); #$document->addScript('fch-lib.js'); require_once "fch-lib.js"; require_once "fch-lib.php"; $limit_f_a = getPositionLimit("F", "a", $leagueID); $limit_f_b = getPositionLimit("D", "b", $leagueID); $limit_d_a = getPositionLimit("G", "a", $leagueID); $limit_d_b = getPositionLimit("F", "b", $leagueID); $limit_g_a = getPositionLimit("D", "a", $leagueID); $limit_g_b = getPositionLimit("G", "b", $leagueID); $roster_f_a = selectCount("v_current_rosters", " Where userID = \"{$userID}\" and releaseDate is not null and playerPosition = \"F\" and rosterStatus = \"act\""); $roster_f_b = selectCount("v_current_rosters", " Where userID = \"{$userID}\" and releaseDate is not null and playerPosition = \"F\" and rosterStatus = \"ben\""); $roster_d_a = selectCount("v_current_rosters", " Where userID = \"{$userID}\" and releaseDate is not null and playerPosition = \"D\" and rosterStatus = \"act\""); $roster_d_b = selectCount("v_current_rosters", " Where userID = \"{$userID}\" and releaseDate is not null and playerPosition = \"D\" and rosterStatus = \"ben\""); $roster_g_a = selectCount("v_current_rosters", " Where userID = \"{$userID}\" and releaseDate is not null and playerPosition = \"G\" and rosterStatus = \"act\""); $roster_g_b = selectCount("v_current_rosters", " Where userID = \"{$userID}\" and releaseDate is not null and playerPosition = \"G\" and rosterStatus = \"ben\""); $userID = getUserID(); $leagueID = getSingleton("fch_user_preferences", "displayLeague", " WHERE userID = {$userID}"); ?> <div class="contact-form"> <form method="get" name="nameCheckForm" class="form-validate form-horizontal"> <fieldset> <legend>Player Query</legend> <div class="control-group"> <div class="control-label"><label id="jform_contact_name-lbl" for="jform_contact_name" class="hasTooltip required" title="<strong>Name</strong><br />Your name."> Name</label></div> <div class="controls"><input type="text" name="nameCheck" id="nameCheck" value="Example: Gaudreau" class="required" size="30" onclick = "javascript:clearField(this);" required aria-required="true" /></div> </div>
function generateUserPreferences($userID) { debug("<B>GenerateUserPreferences</b>"); $season = getSeason(); $prefCount = intval(selectCount("fch_user_preferences", " WHERE userID = {$userID} and season = \"{$season}\"")); // 1. Is there a preference row at all? if ($prefCount == 0) { debug("Creating preference row , "); $key = rand(0, 2147483647); $sql = "INSERT INTO `fanta66_joomla`.`fch_user_preferences` (`id` ,`userID` ,`displayLeague`, `secretKey`) VALUES (NULL , {$userID}, NULL, {$key});"; debug($sql); executeGenericInsertSQL($sql); } // 2. Is there a league in the preference row? $displayLeague = getSingleton("fch_user_preferences", "displayLeague", " WHERE userID = {$userID}"); debug("Display League is ({$displayLeague})"); if ($displayLeague == "") { debug("No display league set."); // If not, see if he has a league at all. $l = getSingleton("fch_league_membership", "leagueID", " WHERE userID = {$userID} and status = \"active\" and season = \"{$season}\" ORDER BY id desc LIMIT 0,1"); // If so, set it. if ($l != "") { debug("Setting display League {$l}"); executeGenericSQL("UPDATE fch_user_preferences SET displayLeague = {$l} WHERE userID = {$userID} "); } else { debug("Display League was already set."); } } $leagueCount = intval(selectCount("fch_league_membership", " WHERE userID = {$userID} and status = \"active\" and season = \"{$season}\"")); $l = getSingleton("fch_league_membership", "leagueID", " WHERE userID = {$userID} and season = \"{$season}\" and status = \"active\" LIMIT 0,1"); executeGenericSQL("UPDATE fch_user_preferences SET displayLeague = {$l} WHERE userID = {$userID} "); /* if ($leagueCount < 2) { debug("generateUserPreferencesDeprecated, leaguecount < 2"); $sql = " UPDATE fch_user_preferences SET displayLeague = ( SELECT leagueID FROM fch_league_membership WHERE leagueID = 35 AND userID = $userID and season = \"$season\") WHERE userID = $userID "; executeGenericSql($sql); } */ }
select r.playerDisplayName, sum(r.totalPoints) as totalPoints, schoolID as schoolID from fch_consolidated_results r where r.playerID like "%{$query}%" and r.season = "{$season}" group by playerDisplayName SQL; debug($sql); $con = initializeDB(); $result = $con->query($sql); if ($result->num_rows > 0) { // output data of each row $out .= "<h3>Summary</h3><table class = \"detailedStatisticsSummary\" width = 100%>"; $out .= "<thead><tr><th scope=\"col\">Player</th><th scope=\"col\">Points To Date</th><th>Games Played</th><th>Points Per Game</th></tr></thead>"; while ($row = $result->fetch_assoc()) { $gamesPlayed = selectCount("fch_schedule", " WHERE (home = \"" . $row["schoolID"] . "\" or visitor=\"" . $row["schoolID"] . "\") and dateStamp < date_add(current_timestamp,interval + 3 hour)"); if ($gamesPlayed == 0 || $row['totalPoints'] == 0) { $ppg = 0; } else { $ppg = round($row['totalPoints'] / $gamesPlayed, 3); } $out .= "<tr><td class=\"rowHead\">" . $row['playerDisplayName'] . "</td><td>" . $row['totalPoints'] . "</td><td>{$gamesPlayed}</td><td>{$ppg}</td></tr>"; } $out .= "</table>"; } $sql = <<<SQL \tSELECT playerDisplayName, statLine, atVS, totalPoints, opponentDisplayName, dateLine, schoolID \tfrom fch_consolidated_results \twhere playerID like "%{$query}%" \tand season = "{$season}"