-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstatistics.php
70 lines (54 loc) · 2.11 KB
/
statistics.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
<?php
require_once 'vendor/autoload.php';
use FileListPoker\Content\StatisticsContent;
use FileListPoker\Main\Site;
use FileListPoker\Renderers\StatisticsRenderer;
use FileListPoker\Renderers\FullPageRenderer;
use Symfony\Component\HttpFoundation\Response;
$site = new Site();
$statisticsPage = new StatisticsContent();
$generalContent = $statisticsPage->getGeneralStatistics();
$tournamentsContent = $statisticsPage->getTournamentsGraph();
$registrationsContent = $statisticsPage->getRegistrationsGraph();
$pageContent = file_get_contents('templates/statistics/statistics.tpl');
$pageContent = str_replace(
array(
'{statistics_tab_general}',
'{statistics_tab_tournaments}',
'{statistics_tab_registrations}'
),
array(
$site->getWord('statistics_tab_general'),
$site->getWord('statistics_tab_tournaments'),
$site->getWord('statistics_tab_registrations')
),
$pageContent
);
$generalTpl = file_get_contents('templates/statistics/general.tpl');
$tournamentsTpl = file_get_contents('templates/statistics/tournament.graph.tpl');
$registrationsTpl = file_get_contents('templates/statistics/registrations.graph.tpl');
$renderer = new StatisticsRenderer($site);
$general = $renderer->renderGeneral($generalTpl, $generalContent);
$tournaments = $renderer->renderTournamentGraph($tournamentsTpl, $tournamentsContent);
$registrations = $renderer->renderRegistrationsGraph($registrationsTpl, $registrationsContent);
$pageContent = str_replace(
array('{generalStatistics}', '{tournamentsGraph}', '{registrationsGraph}'),
array($general, $tournaments, $registrations),
$pageContent
);
$mainRenderer = new FullPageRenderer($site);
$htmlout = $mainRenderer->renderPage('statistics.php');
$bottomScript =
'<script>
$(function() {
$("#tabs").tabs();
});
</script>';
$htmlout = str_replace(
array('{content_type_id}', '{page_content}', '{bottom_page_scripts}'),
array('content', $pageContent, $bottomScript),
$htmlout
);
$site->response->setContent($htmlout);
$site->response->setStatusCode(Response::HTTP_OK);
$site->response->send();