Bladeren bron

- SKS Statistiken eingebaut

- SKS PageAdmin eingebaut und funktionstüchtig gemacht.
- StatsGenerator erstellt für Grafische Kurve der Besucher und Downloads Pro Tag
tags/v0.2^0
Marcel Völkel 7 jaren geleden
bovenliggende
commit
0989854726

+ 2
- 0
Application/Config/Router.php Bestand weergeven

@@ -4,4 +4,6 @@ $router->map('GET|POST', '/',  ROOTDIR . DS . APP .'/Data/Dashboard.php', 'home'
4 4
 
5 5
 $router->map('GET', '/statistics/[a:nameOfStats]', ROOTDIR.DS.APP.'/Data/Statistics.php', 'statisticsPage');
6 6
 
7
+$router->map('GET|POST', '/pageadmin/[a:nameOfPage]',ROOTDIR.DS.APP.'/Data/PageAdmin.php','PageAdministration');
8
+
7 9
 $router->map('GET', '/logout', ROOTDIR.DS.APP.'/Data/Logout.php', 'logout');

+ 17
- 0
Application/Data/PageAdmin.php Bestand weergeven

@@ -0,0 +1,17 @@
1
+<?php
2
+
3
+use SCF\Core\Breadcrumb;
4
+use SCF\Core\DI;
5
+
6
+$breadcrumb = new Breadcrumb();
7
+$params = $router->match()['params'];
8
+
9
+$breadcrumb->setPageHeader(
10
+        [
11
+            'Administration',
12
+            strtoupper($params['nameOfPage'])
13
+        ]
14
+);
15
+
16
+$tpl->assign('pageHeader', $breadcrumb->getPageHeader());
17
+require ROOTDIR.DS.APP.'/Data/PageAdmin/'.$params['nameOfPage'].'.php';

+ 25
- 0
Application/Data/PageAdmin/sternenkindsaga.php Bestand weergeven

@@ -0,0 +1,25 @@
1
+<?php
2
+
3
+use SCF\Core\DI;
4
+use SCF\Core\Database;
5
+
6
+$acl = DI::getInstance()->get('acl');
7
+
8
+if($acl->acl('see_SKS') == 1) {
9
+    $db_slave = new Database($config['dbext'], $config['dbhost'], $config['dbuser'], $config['dbpass'], 'sks_gametracking');
10
+    $sksSettings = [];
11
+
12
+    $db_slave->query("SELECT * FROM sks_core_settings");
13
+    $set = $db_slave->fetchArray();
14
+
15
+    foreach ($set as $key => $value) {
16
+        $sksSettings[$value['setting']] = $value['value'];
17
+    }
18
+
19
+    //var_dump($sksSettings);
20
+    $tpl->assign('sksSettings', $sksSettings);
21
+    $tpl->assign('vardump', $sksSettings);
22
+    $tpl->display('Data/PageAdmin/sternenkindsaga.tpl');
23
+} else {
24
+    $tpl->display('errorpages/AclError.tpl');
25
+}

+ 6
- 0
Application/Data/Statistics/sternenkindsaga.php Bestand weergeven

@@ -39,6 +39,12 @@ if($acl->acl('see_SKS') == 1) {
39 39
 
40 40
     $stats = new StatsGenerator($db_slave);
41 41
 
42
+    $stats->setDateLabels($_GET['day'], $_GET['month'], $_GET['year'], $_GET['range']);
43
+    $stats->setUserDateRows('user', $_GET['day'], $_GET['month'], $_GET['year'], $_GET['range']);
44
+
45
+    $stats->setDownloadDateRows('dls', $_GET['day'], $_GET['month'], $_GET['year'], $_GET['range']);
46
+
47
+
42 48
     $genTraffic = round((($Download['all']*555008)/1024)/1024,2);
43 49
 
44 50
 

+ 83
- 16
Application/scf/Core/StatsGenerator.php Bestand weergeven

@@ -14,7 +14,12 @@ class StatsGenerator {
14 14
     /**
15 15
      * @var array
16 16
      */
17
-    private $statValues = [];
17
+    private $userStatValues = [];
18
+
19
+    /**
20
+     * @var array
21
+     */
22
+    private $downloadStatValue = [];
18 23
 
19 24
     /**
20 25
      * @var array
@@ -24,7 +29,12 @@ class StatsGenerator {
24 29
     /**
25 30
      * @var array
26 31
      */
27
-    private $dateRows = [];
32
+    private $userDateRows = [];
33
+
34
+    /**
35
+     * @var array
36
+     */
37
+    private $downloadDateRows = [];
28 38
 
29 39
     /**
30 40
      * StatsGenerator constructor.
@@ -34,16 +44,15 @@ class StatsGenerator {
34 44
     {
35 45
         $this->_db = $db;
36 46
 
37
-        $this->readDatabaseToArray();
38
-        $this->setDateLabels(25,12,2014,10);
39
-        $this->setDateRows(25,12,2014,10);
47
+        $this->userReadDatabaseToArray();
48
+        $this->downloadReadDatabaseToArray();
40 49
 
41 50
     }
42 51
 
43 52
     /**
44 53
      * @return array
45 54
      */
46
-    private function readDatabaseToArray()
55
+    private function userReadDatabaseToArray()
47 56
     {
48 57
         $this->_db->query("SELECT COUNT(guid) AS visit_count, DAY(FROM_UNIXTIME(`timestamp`)) as visit_day, MONTH(FROM_UNIXTIME(`timestamp`)) as visit_month, YEAR(FROM_UNIXTIME(`timestamp`)) AS visit_year FROM sks_unique_user GROUP BY visit_year DESC, visit_month DESC, visit_day DESC");
49 58
         $visitorsPerDay = $this->_db->fetchArray();
@@ -52,11 +61,30 @@ class StatsGenerator {
52 61
             $day = ($value['visit_day'] < 10 ? '0'.$value['visit_day'] : $value['visit_day']);
53 62
             $month = ($value['visit_month'] < 10 ? '0'.$value['visit_month'] : $value['visit_month']);
54 63
             $year = $value['visit_year'];
55
-            $this->statValues[$day.'.'.$month.'.'.$year] = (int) $value['visit_count'];
64
+            $this->userStatValues[$day.'.'.$month.'.'.$year] = (int) $value['visit_count'];
65
+        }
66
+
67
+
68
+       return $this->userStatValues;
69
+    }
70
+
71
+    /**
72
+     * @return array
73
+     */
74
+    private function downloadReadDatabaseToArray()
75
+    {
76
+        $this->_db->query("SELECT COUNT(guid) AS visit_count, DAY(FROM_UNIXTIME(`timestamp`)) as visit_day, MONTH(FROM_UNIXTIME(`timestamp`)) as visit_month, YEAR(FROM_UNIXTIME(`timestamp`)) AS visit_year FROM sks_unique_dls GROUP BY visit_year DESC, visit_month DESC, visit_day DESC");
77
+        $visitorsPerDay = $this->_db->fetchArray();
78
+
79
+        foreach ($visitorsPerDay as $key => $value) {
80
+            $day = ($value['visit_day'] < 10 ? '0'.$value['visit_day'] : $value['visit_day']);
81
+            $month = ($value['visit_month'] < 10 ? '0'.$value['visit_month'] : $value['visit_month']);
82
+            $year = $value['visit_year'];
83
+            $this->downloadStatValue[$day.'.'.$month.'.'.$year] = (int) $value['visit_count'];
56 84
         }
57 85
 
58 86
 
59
-       return $this->statValues;
87
+        return $this->downloadStatValue;
60 88
     }
61 89
 
62 90
     /**
@@ -77,7 +105,7 @@ class StatsGenerator {
77 105
             $range = ($range > 30 ? 30 : $range);
78 106
             $genStart = $genStart->modify("-" . $range . " days");
79 107
             $genEnd = clone $genStart;
80
-            $genEnd = $genEnd->modify("+" . ($range * 2) . " days");
108
+            $genEnd = $genEnd->modify("+" .($range+1)." days");
81 109
         } else {
82 110
             $genEnd = clone $genStart;
83 111
             $genEnd->add(new \DateInterval("P1M"));
@@ -86,7 +114,7 @@ class StatsGenerator {
86 114
         $dateRange = new \DatePeriod($genStart,$interval,$genEnd);
87 115
 
88 116
         foreach ($dateRange as $date) {
89
-            $genDates[] = $date->format("d.m.Y");
117
+            $genDates[] = $date->format("d.m.");
90 118
         }
91 119
 
92 120
         return $genDates;
@@ -100,9 +128,13 @@ class StatsGenerator {
100 128
      * @param string $range
101 129
      * @return array
102 130
      */
103
-    private function generateRows($day = "", $month="", $year="", $range="")
131
+    private function generateRows($type="", $day = "", $month="", $year="", $range="")
104 132
     {
105
-        $rowArray = $this->statValues;
133
+        if($type == "user") {
134
+            $rowArray = $this->userStatValues;
135
+        } elseif ($type="dls") {
136
+            $rowArray = $this->downloadStatValue;
137
+        }
106 138
         $genRows = [];
107 139
         $dateValue = $day.'.'.$month.'.'.$year;
108 140
 
@@ -145,6 +177,11 @@ class StatsGenerator {
145 177
      */
146 178
     public function setDateLabels($day = "", $month="", $year="", $range="")
147 179
     {
180
+
181
+        $day = (!empty($day) ? $day : date("d", time()));
182
+        $month = (!empty($month) ? $month : date("m", time()));
183
+        $year = (!empty($year) ? $year : date("Y", time()));
184
+        $range =(!empty($range) ? $range : 5);
148 185
         $this->dateLabels = $this->generateLabels($day,$month,$year,$range);
149 186
     }
150 187
 
@@ -157,21 +194,51 @@ class StatsGenerator {
157 194
     }
158 195
 
159 196
     /**
197
+     * @param string $type
160 198
      * @param string $day
161 199
      * @param string $month
162 200
      * @param string $year
163 201
      * @param string $range
164 202
      */
165
-    public function setDateRows($day = "", $month="", $year="", $range="")
203
+    public function setUserDateRows($type="", $day = "", $month="", $year="", $range="")
204
+    {
205
+
206
+        $day = (!empty($day) ? $day : date("d", time()));
207
+        $month = (!empty($month) ? $month : date("m", time()));
208
+        $year = (!empty($year) ? $year : date("Y", time()));
209
+        $range =(!empty($range) ? $range : 5);
210
+        $this->userDateRows = $this->generateRows($type, $day,$month,$year,$range);
211
+    }
212
+
213
+    /**
214
+     * @param string $type
215
+     * @param string $day
216
+     * @param string $month
217
+     * @param string $year
218
+     * @param string $range
219
+     */
220
+    public function setDownloadDateRows($type="", $day = "", $month="", $year="", $range="")
221
+    {
222
+
223
+        $day = (!empty($day) ? $day : date("d", time()));
224
+        $month = (!empty($month) ? $month : date("m", time()));
225
+        $year = (!empty($year) ? $year : date("Y", time()));
226
+        $range =(!empty($range) ? $range : 5);
227
+        $this->downloadDateRows = $this->generateRows($type, $day,$month,$year,$range);
228
+    }
229
+    /**
230
+     * @return array
231
+     */
232
+    public function getUserDateRows()
166 233
     {
167
-        $this->dateRows = $this->generateRows($day,$month,$year,$range);
234
+        return $this->userDateRows;
168 235
     }
169 236
 
170 237
     /**
171 238
      * @return array
172 239
      */
173
-    public function getDateRows()
240
+    public function getDownloadDateRows()
174 241
     {
175
-        return json_encode($this->dateRows);
242
+        return $this->downloadDateRows;
176 243
     }
177 244
 }

+ 1
- 0
Application/scf/Core/Templates.php Bestand weergeven

@@ -57,6 +57,7 @@ class Templates extends Smarty
57 57
         $this->assign('auth', $this->_auth);
58 58
         $this->assign('lang', $this->_lang);
59 59
         $this->assign('settings', $this->_settings);
60
+        $this->assign('router', $this->_router);
60 61
 
61 62
 
62 63
         if($this->_auth->isLogin()) {

+ 102
- 0
Application/templates/SmartAdmin/Data/PageAdmin/sternenkindsaga.tpl Bestand weergeven

@@ -0,0 +1,102 @@
1
+{extends "Data/pageAdmin.tpl"}
2
+{block name="body"}
3
+    <section id="widget-grid" class="">
4
+
5
+        <!-- row -->
6
+        <div class="row">
7
+
8
+
9
+                <article class="col-sm-12">
10
+                    <!-- new widget -->
11
+                    <div class="jarviswidget jarviswidget-color-blueLight" id="wid-id-0" data-widget-togglebutton="false" data-widget-editbutton="false" data-widget-fullscreenbutton="false" data-widget-colorbutton="false" data-widget-deletebutton="false">
12
+                        <!-- widget options:
13
+                        usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false">
14
+
15
+                        data-widget-colorbutton="false"
16
+                        data-widget-editbutton="false"
17
+                        data-widget-togglebutton="false"
18
+                        data-widget-deletebutton="false"
19
+                        data-widget-fullscreenbutton="false"
20
+                        data-widget-custombutton="false"
21
+                        data-widget-collapsed="true"
22
+                        data-widget-sortable="false"
23
+
24
+                        -->
25
+                        <header>
26
+                            <span class="widget-icon"> <i class="fa fa-chain txt-color-darken"></i> </span>
27
+                            <h2>Einstellungen für Sternenkindsaga Landingpage</h2>
28
+                        </header>
29
+
30
+                        <div>
31
+
32
+                            <div class="widget-body no-padding">
33
+                                <div class="alert alert-info fadeIn">
34
+                                    <i class="fa-fw fa fa-info"></i>
35
+                                    <strong>Info</strong> Hier können die Informationen der Landingpage bearbeitet werden. Dateinamen  und Pfad zu den Dateien für das Spiel und den EU Zeichensatz können hier festgelegt werden.
36
+                                    Ebenso kann der Beschreibungstext sowie die Headline bearbeitet werden.
37
+                                </div>
38
+                                <div class="result"></div>
39
+                                <form action="" id="settingsForm" class="smart-form" method="post">
40
+                                    <fieldset>
41
+                                        <legend>Eingaben</legend>
42
+
43
+                                        <section class="col col-6">
44
+                                            <label class="label">Sternenkind Saga Download Pfad:</label>
45
+                                            <label class="input"> <i class="icon-append fa fa-question-circle"></i>
46
+                                                <input type="text" name="sks_download_path" value="{$sksSettings.sks_download_path}">
47
+                                                <b class="tooltip tooltip-top-right">
48
+                                                    <i class="fa fa-warning txt-color-teal"></i>
49
+                                                    Vollst&auml;ndiger Pfad zum Verzeichnis, wo die Downloaddateien f&uuml;r das Spiel und den EU-Zeichensatz liegen!</b>
50
+                                            </label>
51
+                                        </section>
52
+
53
+                                        <section class="col col-6">
54
+                                            <label class="label">Sternenkind Saga Download Datei:</label>
55
+                                            <label class="input"> <i class="icon-append fa fa-question-circle"></i>
56
+                                                <input type="text" name="sks_download_file" value="{$sksSettings.sks_download_file}">
57
+                                                <b class="tooltip tooltip-top-right">
58
+                                                    <i class="fa fa-warning txt-color-teal"></i>
59
+                                                    Dateiname des Spieles!</b>
60
+                                            </label>
61
+                                        </section>
62
+
63
+                                        <section class="col col-6">
64
+                                            <label class="label">Sternenkind Saga Download Datei:</label>
65
+                                            <label class="input"> <i class="icon-append fa fa-question-circle"></i>
66
+                                                <input type="text" name="sks_eufont_file" value="{$sksSettings.sks_eufont_file}">
67
+                                                <b class="tooltip tooltip-top-right">
68
+                                                    <i class="fa fa-warning txt-color-teal"></i>
69
+                                                    Dateiname des Europ&auml;ischen Zeichensatzes!</b>
70
+                                            </label>
71
+                                        </section>
72
+
73
+                                        <section class="col col-6">
74
+                                            <label class="label">Landingpage Teaser Headeline Text:</label>
75
+                                            <label class="input"> <i class="icon-append fa fa-question-circle"></i>
76
+                                                <input type="text" name="lp_teaser_text_headline" value="{$sksSettings.lp_teaser_text_headline}">
77
+                                                <b class="tooltip tooltip-top-right">
78
+                                                    <i class="fa fa-warning txt-color-teal"></i>
79
+                                                    Titel/Headline der Landingpage. </b>
80
+                                            </label>
81
+                                        </section>
82
+                                        <section class="col col-6">
83
+                                            <label class="label">Landingpage Teaser Text:</label>
84
+                                            <label class="textarea textarea-resizable"><i class="icon-append fa fa-question-circle" style="padding-right: 15px;"></i>
85
+                                                <textarea rows="10" class="custom-scroll">{$sksSettings.lp_teaser_text}</textarea>
86
+                                                <b class="tooltip tooltip-top-right" style="margin-right: 15px;">
87
+                                                    <i class="fa fa-warning txt-color-teal"></i>
88
+                                                    Kurzbeschreibung f&uuml;r die Landingpage/Eyecatcher!</b>
89
+                                            </label>
90
+                                        </section>
91
+                                    </fieldset>
92
+                                    <footer>
93
+                                        <button type="submit" class="btn btn-primary">&Auml;nderung speichern</button>
94
+                                    </footer>
95
+                                </form>
96
+                            </div>
97
+                        </div>
98
+                    </div>
99
+                </article>
100
+        </div>
101
+    </section>
102
+{/block}

+ 4
- 0
Application/templates/SmartAdmin/Data/pageAdmin.tpl Bestand weergeven

@@ -0,0 +1,4 @@
1
+{include file="header.tpl"}
2
+{block name="body"}{/block}
3
+{$vardump|var_dump}
4
+{include file="footer.tpl"}

+ 103
- 68
Application/templates/SmartAdmin/Data/specific/sternenkindsaga.tpl Bestand weergeven

@@ -26,8 +26,8 @@
26 26
 
27 27
         <!-- row -->
28 28
         <div class="row">
29
-            <div class="container">
30
-                <article class="col-sm-12">
29
+
30
+                <article class="col-sm-6">
31 31
                     <!-- new widget -->
32 32
                     <div class="jarviswidget jarviswidget-color-blueLight" id="wid-id-0" data-widget-togglebutton="false" data-widget-editbutton="false" data-widget-fullscreenbutton="false" data-widget-colorbutton="false" data-widget-deletebutton="false">
33 33
                         <!-- widget options:
@@ -44,20 +44,78 @@
44 44
 
45 45
                         -->
46 46
                         <header>
47
-                            <span class="widget-icon"> <i class="fa fa-info-circle txt-color-darken"></i> </span>
48
-                            <h2>Statistik</h2>
47
+                            <span class="widget-icon"> <i class="fa fa-line-chart txt-color-darken"></i> </span>
48
+                            <h2>Besucher pro Tag Statistik</h2>
49 49
                         </header>
50 50
 
51 51
                         <div class="no-padding">
52 52
 
53 53
                             <div class="widget-body">
54
-                                <canvas id="lineChart" style="height:250px"></canvas>
54
+                                <canvas id="userLineChart" height="100"></canvas>
55 55
 
56 56
                             </div>
57 57
                         </div>
58 58
                     </div>
59 59
                 </article>
60
-            </div>
60
+
61
+            <article class="col-sm-6">
62
+                <!-- new widget -->
63
+                <div class="jarviswidget jarviswidget-color-blueLight" id="wid-id-1" data-widget-togglebutton="false" data-widget-editbutton="false" data-widget-fullscreenbutton="false" data-widget-colorbutton="false" data-widget-deletebutton="false">
64
+                    <!-- widget options:
65
+                    usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false">
66
+
67
+                    data-widget-colorbutton="false"
68
+                    data-widget-editbutton="false"
69
+                    data-widget-togglebutton="false"
70
+                    data-widget-deletebutton="false"
71
+                    data-widget-fullscreenbutton="false"
72
+                    data-widget-custombutton="false"
73
+                    data-widget-collapsed="true"
74
+                    data-widget-sortable="false"
75
+
76
+                    -->
77
+                    <header>
78
+                        <span class="widget-icon"> <i class="fa fa-info-circle txt-color-darken"></i> </span>
79
+                        <h2>Statistik</h2>
80
+                    </header>
81
+
82
+                    <div class="no-padding">
83
+
84
+                        <div class="widget-body" style="padding-top: 20px;">
85
+                            <table class="table table-bordered">
86
+                                <thead>
87
+                                    <tr>
88
+                                        <th>Bezeichnung:</th>
89
+                                        <th>Gesamt:</th>
90
+                                        <th>Letzte 7 Tage</th>
91
+                                        <th>Letzten 30 Tage</th>
92
+                                    </tr>
93
+                                </thead>
94
+                                <tbody>
95
+                                    <tr>
96
+                                        <td>Downloads:</td>
97
+                                        <td>{$allDownloads}</td>
98
+                                        <td><span class="label label-danger">Coming Soon</span></td>
99
+                                        <td><span class="label label-danger">Coming Soon</span></td>
100
+                                    </tr>
101
+                                    <tr>
102
+                                        <td>Besucher:</td>
103
+                                        <td>{$allVisitors}</td>
104
+                                        <td><span class="label label-danger">Coming Soon</span></td>
105
+                                        <td><span class="label label-danger">Coming Soon</span></td>
106
+                                    </tr>
107
+                                    <tr>
108
+                                        <td>Traffic:</td>
109
+                                        <td>{$traffic} GB</td>
110
+                                        <td><span class="label label-danger">Coming Soon</span></td>
111
+                                        <td><span class="label label-danger">Coming Soon</span></td>
112
+                                    </tr>
113
+                                </tbody>
114
+                            </table>
115
+                        </div>
116
+                    </div>
117
+                </div>
118
+            </article>
61 119
         </div>
62 120
     </section>
63 121
 {/block}
@@ -65,68 +123,45 @@
65 123
     <script src="lib/SmartAdmin/js/plugin/chartjs/chart.min.js"></script>
66 124
 {/block}
67 125
 {block name="additionalJSCode"}
126
+        var userCtx = document.getElementById("userLineChart").getContext("2d");
68 127
 
69
-var areaChartData = {
70
-    type: "line",
71
-labels: {$stats->getDateLabels()},
72
-datasets: [
73
-{
74
-label: "Users Per Day",
75
-fillColor: "rgba(60,141,188,0.9)",
76
-strokeColor: "rgba(60,141,188,0.8)",
77
-pointColor: "#3b8bba",
78
-pointStrokeColor: "rgba(60,141,188,1)",
79
-pointHighlightFill: "#fff",
80
-pointHighlightStroke: "rgba(60,141,188,1)",
81
-data: {$stats->getDateRows()}
82
-}
83
-]
84
-};
85
-
86
-
87
-var areaChartOptions = {
88
-//Boolean - If we should show the scale at all
89
-showScale: true,
90
-//Boolean - Whether grid lines are shown across the chart
91
-scaleShowGridLines: false,
92
-//String - Colour of the grid lines
93
-scaleGridLineColor: "rgba(0,0,0,.05)",
94
-//Number - Width of the grid lines
95
-scaleGridLineWidth: 1,
96
-//Boolean - Whether to show horizontal lines (except X axis)
97
-scaleShowHorizontalLines: true,
98
-//Boolean - Whether to show vertical lines (except Y axis)
99
-scaleShowVerticalLines: true,
100
-//Boolean - Whether the line is curved between points
101
-bezierCurve: true,
102
-//Number - Tension of the bezier curve between points
103
-bezierCurveTension: 0.3,
104
-//Boolean - Whether to show a dot for each point
105
-pointDot: true,
106
-//Number - Radius of each point dot in pixels
107
-pointDotRadius: 2.5,
108
-//Number - Pixel width of point dot stroke
109
-pointDotStrokeWidth: 1,
110
-//Number - amount extra to add to the radius to cater for hit detection outside the drawn point
111
-pointHitDetectionRadius: 2,
112
-//Boolean - Whether to show a stroke for datasets
113
-datasetStroke: true,
114
-//Number - Pixel width of dataset stroke
115
-datasetStrokeWidth: 2,
116
-//Boolean - Whether to fill the dataset with a color
117
-datasetFill: true,
118
-//String - A legend template
119
-{literal}
120
-legendTemplate: "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].lineColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>",
121
-//Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container
122
-maintainAspectRatio: true,
123
-//Boolean - whether to make the chart responsive to window resizing
124
-responsive: true
125
-};
126
-var lineChartCanvas = $("#lineChart").get(0).getContext("2d");
127
-var lineChart = new Chart(lineChartCanvas);
128
-var lineChartOptions = areaChartOptions;
129
-lineChartOptions.datasetFill = false;
130
-lineChart.Line(areaChartData, lineChartOptions);{/literal}
128
+        var userLineConfig = {
129
+            type: 'line',
130
+            data: {
131
+                labels: {$stats->getDateLabels()},
132
+                datasets:[
133
+                    {
134
+                        label: 'Besucher pro Tag',
135
+                        data: {$stats->getUserDateRows()|json_encode},
136
+                        backgroundColor: 'rgba(107,176,255,0.5)',
137
+                        borderColor: 'rgba(107,176,255,1)'
138
+                    },
139
+                    {
140
+                        label: 'Downloads pro Tag',
141
+                        data: {$stats->getDownloadDateRows()|json_encode},
142
+                        backgroundColor: 'rgba(191,63,63,0.5)',
143
+                        borderColor: 'rgba(191,63,63,1)'
144
+                    }
145
+                ]
146
+            },
147
+            options: {
148
+                responsive: true,
149
+                scales: {
150
+                    yAxes: [{
151
+                        ticks: {
152
+                            beginAtZero: true,
153
+                            stepSize: 10
154
+                        }
155
+                    }]
156
+                },
131 157
 
158
+                tooltips: {
159
+                    mode: 'label'
160
+                },
161
+                hover: {
162
+                    mode: 'dataset'
163
+                }
164
+            }
165
+        };
166
+        window.userLine = new Chart(userCtx, userLineConfig);
132 167
 {/block}

+ 0
- 1
Application/templates/SmartAdmin/Data/statistics.tpl Bestand weergeven

@@ -1,4 +1,3 @@
1 1
 {include file="header.tpl"}
2 2
 {block name="body"}{/block}
3
-<!--{$vardump|var_dump}-->
4 3
 {include file="footer.tpl"}

+ 2
- 1
Application/templates/SmartAdmin/meta/htmlFooter.tpl Bestand weergeven

@@ -42,7 +42,7 @@
42 42
 
43 43
 <!-- FastClick: For mobile devices -->
44 44
 <script src="lib/SmartAdmin/js/plugin/fastclick/fastclick.min.js"></script>
45
-{block name="additionalJSFiles"}{/block}
45
+
46 46
 
47 47
 <!--[if IE 8]>
48 48
 
@@ -65,6 +65,7 @@
65 65
 <!-- Full Calendar -->
66 66
 <script src="lib/SmartAdmin/js/plugin/moment/moment.min.js"></script>
67 67
 <script src="lib/SmartAdmin/js/plugin/fullcalendar/jquery.fullcalendar.min.js"></script>
68
+<script src="lib/SmartAdmin/js/main.js"></script>
68 69
 {block name="additionalJSFiles"}{/block}
69 70
 <script>
70 71
     {literal}

+ 19
- 0
web/ajax/saveSettings.php Bestand weergeven

@@ -0,0 +1,19 @@
1
+<?php
2
+require_once "../../init.php";
3
+use SCF\Core\Database;
4
+
5
+if($auth->isLogin()) {
6
+    $db_slave = new Database($config['dbext'], $config['dbhost'], $config['dbuser'], $config['dbpass'], 'sks_gametracking');
7
+
8
+    foreach($_POST as $key => $value) {
9
+        $text .= "UPDATE sks_core_settings SET `value` = '{$value}' WHERE setting = '{$key}';";
10
+    }
11
+    $db_slave->query($text);
12
+    $db_slave->execute();
13
+
14
+    return true;
15
+    //echo '<div class="alert alert-success"><i class="fa-fw fa fa-check-square"></i><strong>Änderung übernommen</strong><br />&Auml;nderungen wurden erfolgreich gespeichert.</div>';
16
+}
17
+else {
18
+    echo 'nope';
19
+}

+ 17
- 0
web/lib/SmartAdmin/js/main.js Bestand weergeven

@@ -0,0 +1,17 @@
1
+$(document).ready(function() {
2
+    $('#settingsForm').submit(function(event) {
3
+        event.preventDefault();
4
+
5
+        $.post("ajax/saveSettings.php", $("#settingsForm").serialize(), function(data) {
6
+            $(".result").html(data);
7
+        }).success(function(e) {
8
+            $.bigBox({
9
+                title: "Änderung erfolgreich",
10
+                content: "Die Einstellungen zur Landingpage wurden &uuml;bernommen.",
11
+                color: "#739E73",
12
+                icon: "fa fa-check",
13
+                timeout: 5000
14
+            });
15
+        });
16
+    });
17
+});

+ 4
- 35
web/lib/SmartAdmin/js/plugin/chartjs/chart.min.js
Diff onderdrukt omdat het te groot bestand
Bestand weergeven


Laden…
Annuleren
Opslaan