";
$ledivision = intval($_COOKIE["TeamInfoReportDivision"]);
$lecategory = intval($_COOKIE["TeamInfoReportCategory"]);
$lecompetition = intval($_COOKIE["TeamInfoReportCompetition"]);
$letier = intval($_COOKIE["TeamInfoReportTier"]);
}//
setcookie("TeamInfoReportDivision", $ledivision);
setcookie("TeamInfoReportCategory", $lecategory);
setcookie("TeamInfoReportCompetition", $lecompetition);
setcookie("TeamInfoReportTier", $letier);
if($lecompetition != -1){
$addonfilter .= " AND gameschedule.competitionID = $lecompetition";
}//end competition filter
if($letier != -1){
$addonfilter .= " AND gameschedule.groupID = $letier";
}//end tier filter
//print "Add on Filter Selection: $addonfilter
";
$mycount = 0;
$xarray = 0;
$collection = array();
$myrecord = array();
// include the teams private information to which they are part of the grouping they have access to
$sqlhome = "SELECT DISTINCT teams.teamID AS teamid
, teams.name AS name
, teams.divisionID AS divisonid
, teams.categoryID AS categoryid
, seasonTeam.gameStartTime AS gamestarttime
, seasonTeam.gameEndTime AS gameendtime
, seasonTeam.gameDay AS gameday
, seasonTeam.gameLocation AS homeicename
, seasonTeam.coach AS coach
, seasonTeam.coachHomePhone AS coachhomephone
, seasonTeam.coachCellPhone AS coachcellphone
, seasonTeam.coachEmail AS coachemail
, seasonTeam.manager AS manager
, seasonTeam.managerHomePhone AS managerhomephone
, seasonTeam.managerCellPhone AS managercellphone
, seasonTeam.managerEmail AS manageremail
, seasonTeam.jerseyColour AS jerseycolour
FROM teams
LEFT JOIN seasonTeam ON teams.teamID = seasonTeam.teamID
LEFT JOIN gameschedule ON ((teams.teamID = gameschedule.homeID or teams.teamID = gameschedule.visitorID)
AND gameschedule.seasonID = $leseason
AND gameschedule.divisionID = $ledivision
AND gameschedule.categoryID = $lecategory)
WHERE teams.PCAHATeam = 'Y'
AND seasonTeam.seasonID = $leseason
AND teams.divisionID = $ledivision
AND teams.categoryID = $lecategory
$addonfilter
AND exists (SELECT * FROM teams
WHERE teams.divisionID = $ledivision
AND teams.categoryID = $lecategory
".(($tfilter == "")?"":" AND $tfilter").")
ORDER BY teams.name;";
//print "ACCESS GROUP TEAMS: $sqlhome
";
$sqlresult = mysqli_query($sqlcn, $sqlhome);
if(($sqlresult == true)&&(mysqli_num_rows($sqlresult) != 0)){
while($sqlrow = mysqli_fetch_array($sqlresult)){
if((array_search($sqlrow["teamid"], $collection, true) === false)){
//print "Team ID HOME @ $xarray: ".$sqlrow["teamid"]."
";
$collection[] = $sqlrow["teamid"];
$mycount ++;
$myrecord[$xarray]["name"] =($sqlrow["name"] == "")?" ":$sqlrow["name"];
$myrecord[$xarray]["gameday"] =($sqlrow["gameday"] == "")?" ":$sqlrow["gameday"];
$myrecord[$xarray]["gameicetime"] = ($sqlrow["gamestarttime"] == "")?" ":(($sqlrow["gameendtime"] == "")?$sqlrow["gamestarttime"]:$sqlrow["gamestarttime"]." - ".$sqlrow["gameendtime"]);
$myrecord[$xarray]["homeicename"] =($sqlrow["homeicename"] == "")?" ":$sqlrow["homeicename"];
$myrecord[$xarray]["coach"] =($sqlrow["coach"] == "")?" ":$sqlrow["coach"];
$myrecord[$xarray]["coachphone"] = ($sqlrow["coachhomephone"] == "")?(($sqlrow["coachcellphone"] == "")?(" "):($sqlrow["coachcellphone"])):(($sqlrow["coachcellphone"] == "")?($sqlrow["coachhomephone"]):("h: ".$sqlrow["coachhomephone"]."
c: ".$sqlrow["coachcellphone"]));
$myrecord[$xarray]["manager"] =($sqlrow["manager"] == "")?" ":$sqlrow["manager"];
$myrecord[$xarray]["managerphone"] = ($sqlrow["managerhomephone"] == "")?(($sqlrow["managercellphone"] == "")?(" "):($sqlrow["managercellphone"])):(($sqlrow["managercellphone"] == "")?($sqlrow["managerhomephone"]):("h: ".$sqlrow["managerhomephone"]."
c: ".$sqlrow["managercellphone"]));
$myrecord[$xarray]["coachemail"] =($sqlrow["coachemail"] == "")?("#"):("mailto:".$sqlrow["coach"]." <".$sqlrow["coachemail"]).">";
$myrecord[$xarray]["manageremail"] =($sqlrow["manageremail"] == "")?("#"):("mailto:".$sqlrow["manager"]." <".$sqlrow["manageremail"].">");
$myrecord[$xarray]["jerseycolour"] = ($sqlrow["jerseycolour"] == "")?"":$sqlrow["jerseycolour"];
$xarray ++;
}//end if
}//end loop
mysqli_free_result($sqlresult);
}//end if
// only display the entered team information when we do NOT select competition and group. When competition and group are selected, we are looking for a finite group related to game schedules.
//INFO ENTERED (teams that are not part of the user access or is public access)
$sqlentered = "SELECT DISTINCT teams.teamID AS teamid
, teams.name AS name
, teams.divisionID AS divisonid
, teams.categoryID AS categoryid
, seasonTeam.gameStartTime AS gamestarttime
, seasonTeam.gameEndTime AS gameendtime
, seasonTeam.gameDay AS gameday
, seasonTeam.gameLocation AS homeicename
, seasonTeam.coach AS coach
, seasonTeam.manager AS manager
, seasonTeam.jerseyColour AS jerseycolour
FROM teams
LEFT JOIN seasonTeam ON teams.teamID = seasonTeam.teamID
LEFT JOIN gameschedule ON ((teams.teamID = gameschedule.homeID or teams.teamID = gameschedule.visitorID)
AND gameschedule.seasonID = $leseason
AND gameschedule.divisionID = $ledivision
AND gameschedule.categoryID = $lecategory)
WHERE teams.PCAHATeam = 'Y'
AND seasonTeam.seasonID = $leseason
AND teams.divisionID = $ledivision
AND teams.categoryID = $lecategory
$addonfilter
ORDER BY teams.name;";
//print "INFO ENTERED TEAM: $sqlentered
";
$sqlresult = mysqli_query($sqlcn, $sqlentered);
if(($sqlresult == true)&&(mysqli_num_rows($sqlresult) != 0)){
while($sqlrow = mysqli_fetch_array($sqlresult)){
if((array_search($sqlrow["teamid"], $collection, true) === false)){
//print "Team ID VISITOR @ $xarray : ".$sqlrow["teamid"]."
";
$collection[] = $sqlrow["teamid"];
$mycount ++;
$myrecord[$xarray]["name"] = ($sqlrow["name"] == "")?" ":$sqlrow["name"];
$myrecord[$xarray]["gameday"] = ($sqlrow["gameday"] == "")?" ":$sqlrow["gameday"];
$myrecord[$xarray]["gameicetime"] = ($sqlrow["gamestarttime"] == "")?" ":(($sqlrow["gameendtime"] == "")?$sqlrow["gamestarttime"]:$sqlrow["gamestarttime"]." - ".$sqlrow["gameendtime"]);
$myrecord[$xarray]["homeicename"] = ($sqlrow["homeicename"] == "")?" ":$sqlrow["homeicename"];
$myrecord[$xarray]["coach"] = " ";
$myrecord[$xarray]["coachphone"] = " ";
$myrecord[$xarray]["manager"] = " ";
$myrecord[$xarray]["managerphone"] = " ";
$myrecord[$xarray]["coachemail"] = "#";
$myrecord[$xarray]["manageremail"] = "#";
$myrecord[$xarray]["jerseycolour"] = ($sqlrow["jerseycolour"] == "")?"":$sqlrow["jerseycolour"];
$xarray ++;
}//end if
}//end loop
mysqli_free_result($sqlresult);
}//end team info entered processing
//STORE IN ARRAYS OF COLUMNS
foreach($myrecord as $key => $row){
$T1[$key] = $row["name"];
$T2[$key] = $row["gameday"];
$T3[$key] = $row["gameicetime"];
$T4[$key] = $row["homeicename"];
$T5[$key] = $row["coach"];
$T6[$key] = $row["coachphone"];
$T7[$key] = $row["manager"];
$T8[$key] = $row["managerphone"];
$T9[$key] = $row["jerseycolour"];
}//
if ( count($myrecord) != 0 ) {
array_multisort($T1, SORT_ASC, $myrecord);
}
?>