forked from DMeloni/shaarlo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
options_stat.php
130 lines (117 loc) · 4.67 KB
/
options_stat.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<?php
require_once('Controller.class.php');
class OptionsStat extends Controller
{
public function run()
{
$mysqli = shaarliMyConnect();
$options = array('extend', 'mode_river', 'display_empty_description',
'use_elevator', 'use_useless_options','use_dotsies',
'use_top_buttons',
'use_refresh_button',
'display_rss_button',
'display_bloc_conversation',
'use_scroll_infini',
'display_only_new_articles',
'use_tipeee',
'display_img',
'display_only_unread',
'display_little_img',
'display_poussins',
);
$optionsStat = array();
foreach ($options as $option) {
$stats = getStatsFromOption($mysqli, $option);
$nbActifs = $stats['true'];
$nbDesactifs = $stats['false'];
$ratio = $nbActifs / ($nbActifs+$nbDesactifs) * 100;
if (($nbActifs+$nbDesactifs) > 5) {
$optionsStat[] = array('nom' => $option, 'actifs' => $nbActifs, 'desactifs' => $nbDesactifs, 'ratio' => $ratio) ;
}
}
$params = array();
$this->render(
array(
'optionsStat' => $optionsStat
)
);
}
public function render($params=array())
{
?>
<!doctype html>
<html class="no-js" lang="en">
<?php
$this->renderHead();
?>
<body>
<?php
$this->renderMenu();
?>
<div class="row">
<div class="column large-12 text-center">
<h1>Statistiques des options</h1>
<div class="panel">
<div class="row top-orange ">
<div class="column large-6">
Option
</div>
<!--<div class="column large-3">
Nb d'activations
</div>
<div class="column large-3">
Nb de désactivations
</div>
-->
<div class="column large-6">
% d'utilisation de l'option
</div>
</div>
<hr/>
<?php
foreach ($params['optionsStat'] as $optionStat) {
?>
<div class="row">
<div class="column large-6">
<?php echo $optionStat['nom'];?>
</div>
<!--
<div class="column large-3">
<?php echo $optionStat['actifs'];?>
</div>
<div class="column large-3">
<?php echo $optionStat['desactifs'];?>
</div>
-->
<div class="column large-6">
<?php
if($optionStat['ratio'] > 30) {
?><span class="color-success"><?php echo ceil($optionStat['ratio']);?> %</span><?php
} else {
?><span class="red"><?php echo ceil($optionStat['ratio']);?> %</span><?php
}
?>
</div>
</div>
<hr/>
<?php
}
?>
</div>
</div>
</div>
<?php
$this->renderScript();
?>
</body>
</html>
<?php
}
public static function renderScript($params = array())
{
?>
<?php
}
}
$controller = new OptionsStat();
$controller->run();