myDatabase = $myDatabase; $this->now = date("Y-m-d H:i:s"); $this->sport_names = array(); $this->sport_leagues = array(); $this->publishers = array(); $this->fixtures = array(); $this->fixture_info = array(); $this->teams = array(); $this->packages = array(); $this->package_publishers = array(); $this->alias_document_class = array( "dynamic-resource-file"=>"Rosters", "event-summary"=>"Game Data", "news"=>"News", "schedules"=>"Schedules", "standings"=>"Standings", "statistics"=>"Statistics" ); $this->fixture_publishers = array(); $this->publisher_hash = array( "t123"=>"TSN", "rw342"=>"RW", "esa687"=>"ESA", "fss907"=>"FSS", "lgst654"=>"LGST", "inf942"=>"INF", "nhl241"=>"NHL", "roto675"=>"ROTOWIRE", "xts067"=>"XTS", "opta446"=>"OPTA", "pad992"=>"PA", "sdi213"=>"SDI", "odf788"=>"ODF", "tsf569"=>"TSF", "stat991"=>"STATS", "rs732"=>"RS", "cbb813"=>"CBB", "tsx432"=>"SPX", "spx432"=>"SPX" ); } function get_sport_league() { $sql = "SELECT DISTINCT fixtures.league_key, fixtures.league_name, fixtures.sport_name, leagues.sport_name as sportName, leagues.abbreviation as abb FROM fixtures LEFT JOIN leagues ON leagues.league_key = fixtures.league_key WHERE fixtures.league_key != '' ORDER BY fixtures.sport_name ASC, leagues.rank ASC"; $result = $this->myDatabase->dbGetResult("FIXTURES", $sql); while ($row = $this->myDatabase->dbMoveNext($result)) { foreach ($row as $key => $value) { $this->sport_leagues[$row->league_key][$key] = $value; } } } function get_leagues() { $sql = "SELECT DISTINCT(fixtures.league_name) AS league_name, leagues.* FROM fixtures LEFT JOIN leagues ON fixtures.league_key = leagues.league_key WHERE leagues.display = 1 AND fixtures.display = 1 GROUP BY fixtures.league_key ORDER BY leagues.sport_name, leagues.rank"; $result = $this->myDatabase->dbGetResult("FIXTURES", $sql); while ($row = $this->myDatabase->dbMoveNext($result)) { foreach ($row as $key => $value) { $this->sport_leagues[$row->league_key][$key] = $value; } //Store the sport names here $this->sport_names[$row->sport_name] = ucwords($row->sport_name); } } function get_publishers($active = 1) { $sql2 = " WHERE active = 1 "; if ($active != 1) { $sql2 = ""; } $sql = "SELECT * FROM publishers " . $sql2 . "ORDER BY publisher_name ASC"; $result = $this->myDatabase->dbGetResult("FIXTURES", $sql); while ($row = $this->myDatabase->dbMoveNext($result)) { foreach ($row as $key => $value) { $this->publishers[$row->publisher_key] = $row->abbreviation; $this->publisher_names[$row->publisher_key] = $row->publisher_name; $this->publisher_active[$row->publisher_key] = $row->active; } } } function get_fixtures($data) { $id = isset($data["id"]) ? $data["id"] : 0; $internal = isset($data["internal"]) ? $data["internal"] : 0; $leaguekey = isset($data["leaguekey"]) ? $data["leaguekey"] : ""; $addpub = isset($data["addpub"]) ? $data["addpub"] : array(); $tempsql = array(); $tempsql[] = "fixtures.active = 'yes'"; if ($id > 0) { $tempsql[] = "ID_FIXTURE = ".$id; } if ($internal != 1) { $tempsql[] = "fixtures.display = 1"; } if ($leaguekey != "") { $tempsql[] = "fixtures.league_key = '".$leaguekey."'"; } $sql2 = ""; if (count($tempsql) > 0) { $cnt = 1; foreach ($tempsql as $sqlkey => $sqlval) { $and = "AND"; if ($cnt == 1) { $and = "WHERE"; } $sql2 .= " ".$and." ".$sqlval; $cnt++; } } $sql = "SELECT fixtures.ID_FIXTURE, fixtures.fixture_key, fixtures.ID_FIXTURE, fixtures.fixture_name, fixtures.document_class, fixtures.sw5_sample, publishers.publisher_name, publishers.publisher_key, publishers.abbreviation as pubabbrev FROM fixtures JOIN publishers ON fixtures.publisher_key = publishers.publisher_key $sql2 ORDER BY fixtures.document_class, fixtures.fixture_name"; // print $sql."

"; $result = $this->myDatabase->dbGetResult("FIXTURES", $sql); while ($row = $this->myDatabase->dbMoveNext($result)) { foreach ($row as $key => $value) { $this->fixtures[$row->document_class][$row->publisher_key][$row->fixture_key][$key] = $value; if ($id > 0) { $this->fixtures_by_id[$row->ID_FIXTURE][$key] = $value; } } //All publishers that are here for filtering $this->fixture_publishers[$row->publisher_key] = $row->pubabbrev; } if (count($addpub) > 0) { $sql = "SELECT fixtures.ID_FIXTURE, fixtures.fixture_key, fixtures.ID_FIXTURE, fixtures.fixture_name, fixtures.document_class, fixtures.sw5_sample, publishers.publisher_name, publishers.publisher_key, publishers.abbreviation as pubabbrev FROM fixtures JOIN publishers ON fixtures.publisher_key = publishers.publisher_key WHERE fixtures.league_key = '".$leaguekey."' AND fixtures.active = 'yes' AND publishers.abbreviation IN ('".implode("','",$addpub)."') ORDER BY fixtures.document_class, fixtures.fixture_name"; //print $sql."

"; $result = $this->myDatabase->dbGetResult("FIXTURES", $sql); while ($row = $this->myDatabase->dbMoveNext($result)) { foreach ($row as $key => $value) { $this->fixtures[$row->document_class][$row->publisher_key][$row->fixture_key][$key] = $value; if ($id > 0) { $this->fixtures_by_id[$row->ID_FIXTURE][$key] = $value; } } //All publishers that are here for filtering $this->fixture_publishers[$row->publisher_key] = $row->pubabbrev; } } } function get_fixture_info($id) { $sql = "SELECT * FROM fixtures WHERE ID_FIXTURE = $id"; $result = $this->myDatabase->dbGetResult("FIXTURES", $sql); while ($row = $this->myDatabase->dbMoveNext($result)) { foreach ($row as $key => $value) { $this->fixture_info[$key] = $value; } } } function get_league_teams($data) { $leaguekey = $data["leaguekey"]; $sql = "SELECT t.location_name, t.nickname, t.team_key_xts FROM teams t WHERE t.league_key = '".$leaguekey."' AND t.leaguedir = '1' ORDER BY t.location_name ASC"; $result = $this->myDatabase->dbGetResult("TEAMS", $sql); while ($row = $this->myDatabase->dbMoveNext($result)) { foreach ($row as $key => $value) { $this->teams[$row->team_key_xts][$key] = $value; } } } function get_packages() { $sql = "SELECT packages.package_name, packages.package_description, packages.id, packages.publisher_id, publishers.publisher_name, publishers.abbreviation FROM packages JOIN publishers ON packages.publisher_id = publishers.id WHERE packages.include_in_public_list = 1 ORDER BY packages.sort_order"; // print $sql."

"; $result = $this->myDatabase->dbGetResult("FIXTURES", $sql); while ($row = $this->myDatabase->dbMoveNext($result)) { foreach ($row as $key => $value) { $this->packages[$row->publisher_id][$row->id][$key] = $value; $this->package_publishers[$row->publisher_id] = $row->publisher_name; } } } function get_ref_price_scoreboard($data = array()) { $publisherkey = isset($data["publisherkey"]) ? $data["publisherkey"] : ""; $leaguekey = isset($data["leaguekey"]) ? $data["leaguekey"] : ""; $tempsql = array(); if ($publisherkey != "") { $tempsql[] = "publisher_key = '$publisherkey'"; } if ($leaguekey != "") { $tempsql[] = "league_key = '$leaguekey'"; } $sql2 = ""; if (count($tempsql) > 0) { $cnt = 1; foreach ($tempsql as $sqlkey => $sqlval) { $and = "AND"; if ($cnt == 1) { $and = "WHERE"; } $sql2 .= " ".$and." ".$sqlval; $cnt++; } } $sql = "SELECT * FROM ref_price_scoreboard $sql2"; $result = $this->myDatabase->dbGetResult("USERS", $sql); while ($row = $this->myDatabase->dbMoveNext($result)) { $this->ref_price_scoreboard[$row->publisher_key][$row->league_key] = $row->credits; } } function get_ref_price_document($data = array()) { $publisherkey = isset($data["publisherkey"]) ? $data["publisherkey"] : ""; $leaguekey = isset($data["leaguekey"]) ? $data["leaguekey"] : ""; $fixturekey = isset($data["fixturekey"]) ? $data["fixturekey"] : ""; $tempsql = array(); if ($publisherkey != "") { $tempsql[] = "publisher_key = '$publisherkey'"; } if ($leaguekey != "") { $tempsql[] = "league_key = '$leaguekey'"; } if ($fixturekey != "") { $tempsql[] = "fixture_key = '$fixturekey'"; } $sql2 = ""; if (count($tempsql) > 0) { $cnt = 1; foreach ($tempsql as $sqlkey => $sqlval) { $and = "AND"; if ($cnt == 1) { $and = "WHERE"; } $sql2 .= " ".$and." ".$sqlval; $cnt++; } } $sql = "SELECT * FROM ref_price_document $sql2"; $result = $this->myDatabase->dbGetResult("USERS", $sql); while ($row = $this->myDatabase->dbMoveNext($result)) { $this->ref_price_document[$row->publisher_key][$row->league_key][$row->fixture_key] = $row->credits; } } function xslt_transform($xml_str, $xsl_str) { $xsl = new DomDocument(); $xsl->loadXML($xsl_str); $inputdom = new DomDocument(); $inputdom->loadXML($xml_str); $proc = new XsltProcessor(); $xsl = $proc->importStylesheet($xsl); $newdom = $proc->transformToDoc($inputdom); return $newdom->saveXML(); } }