-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrankings.php
75 lines (59 loc) · 2.48 KB
/
rankings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
require_once 'vendor/autoload.php';
use FileListPoker\Content\RankingsContent;
use FileListPoker\Main\Site;
use FileListPoker\Renderers\RankingsRenderer;
use FileListPoker\Renderers\FullPageRenderer;
use Symfony\Component\HttpFoundation\Response;
$site = new Site();
$rankingsPage = new RankingsContent();
$topAllTimeContent = $rankingsPage->getTopPlayersAllTime();
$topMostActiveContent = $rankingsPage->getMostActive50Players();
$topSixMonthsContent = $rankingsPage->getTop40Players6Months();
$topFinalTablesContent = $rankingsPage->getTop50FinalTables();
$pageContent = file_get_contents('templates/rankings/rankings.tpl');
$pageContent = str_replace(
array(
'{statistics_tab_top_all_time}',
'{statistics_tab_top_6_months}',
'{statistics_tab_most_active}',
'{statistics_tab_final_tables}'
),
array(
$site->getWord('statistics_tab_top_all_time'),
$site->getWord('statistics_tab_top_6_months'),
$site->getWord('statistics_tab_most_active'),
$site->getWord('statistics_tab_final_tables')
),
$pageContent
);
$allTimeTpl = file_get_contents('templates/rankings/top.all.time.tpl');
$sixMonthsTpl = file_get_contents('templates/rankings/top.six.months.tpl');
$mostActiveTpl = file_get_contents('templates/rankings/top.most.active.tpl');
$finalTablesTpl = file_get_contents('templates/rankings/top.final.tables.tpl');
$renderer = new RankingsRenderer($site);
$topAllTime = $renderer->renderTopAllTime($allTimeTpl, $topAllTimeContent);
$topSixMonths = $renderer->render6Months($sixMonthsTpl, $topSixMonthsContent);
$topMostActive = $renderer->renderMostActivePlayers($mostActiveTpl, $topMostActiveContent);
$topFinalTables = $renderer->renderFinalTables($finalTablesTpl, $topFinalTablesContent);
$pageContent = str_replace(
array('{rankings_tab_alltime}', '{rankings_tab_6months}', '{rankings_tab_mostactive}', '{rankings_tab_ftables}'),
array($topAllTime, $topSixMonths, $topMostActive, $topFinalTables),
$pageContent
);
$mainRenderer = new FullPageRenderer($site);
$htmlout = $mainRenderer->renderPage('rankings.php');
$bottomScript =
'<script>
$(function() {
$("#tabs").tabs();
});
</script>';
$htmlout = str_replace(
array('{content_type_id}', '{page_content}', '{bottom_page_scripts}'),
array('content-narrower', $pageContent, $bottomScript),
$htmlout
);
$site->response->setContent($htmlout);
$site->response->setStatusCode(Response::HTTP_OK);
$site->response->send();