forked from pouetnet/pouet2.0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcdc.php
125 lines (104 loc) · 2.7 KB
/
cdc.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
<?
require_once("bootstrap.inc.php");
class PouetBoxCDCModerator extends PouetBox {
function PouetBoxCDCModerator() {
parent::__construct();
$this->uniqueID = "pouetbox_cdcmoderator";
$this->title = "moderators' coup de coeur history";
}
function LoadFromDB()
{
$s = new BM_Query("cdc");
$s->AddField("cdc.quand");
$s->attach(array("cdc"=>"which"),array("prods as prod"=>"id"));
$s->AddOrder("cdc.quand desc");
$this->cdcs = $s->perform();
$a = array();
foreach($this->cdcs as $v) $a[] = &$v->prod;
PouetCollectPlatforms($a);
}
function RenderBody()
{
echo "\n\n";
echo "<table class='boxtable'>\n";
$lastYear = 0;
$lastCategory = "";
foreach ($this->cdcs as $row)
{
$p = $row->prod;
echo "<tr>\n";
echo "<td>\n";
echo $p->RenderTypeIcons();
echo $p->RenderPlatformIcons();
echo "<span class='prod'>".$p->RenderLink()."</span>\n";
echo "</td>\n";
echo "<td>\n";
echo $p->RenderGroupsShortProdlist();
echo "</td>\n";
echo "<td>\n";
echo $row->quand;
echo "</td>\n";
echo "</tr>\n";
}
echo "</table>\n";
}
};
class PouetBoxCDCUser extends PouetBox {
function PouetBoxCDCUser() {
parent::__construct();
$this->uniqueID = "pouetbox_cdcuser";
$this->title = "users' coup de coeur toplist";
}
function LoadFromDB()
{
$s = new BM_Query("users_cdcs");
$s->attach(array("users_cdcs"=>"cdc"),array("prods as prod"=>"id"));
$s->AddGroup("users_cdcs.cdc");
$s->AddField("count(*) as c");
$s->AddOrder("c desc");
$this->cdcs = $s->perform();
$a = array();
foreach($this->cdcs as $v) $a[] = &$v->prod;
PouetCollectPlatforms($a);
}
function RenderBody()
{
echo "\n\n";
echo "<table class='boxtable'>\n";
$lastYear = 0;
$lastCategory = "";
foreach ($this->cdcs as $row)
{
if (!$row->prod) continue;
$p = $row->prod;
echo "<tr>\n";
echo "<td>\n";
echo $p->RenderTypeIcons();
echo $p->RenderPlatformIcons();
echo "<span class='prod'>".$p->RenderLink()."</span>\n";
echo "</td>\n";
echo "<td>\n";
echo $p->RenderGroupsShortProdlist();
echo "</td>\n";
echo "<td>\n";
echo $row->c;
echo "</td>\n";
echo "</tr>\n";
}
echo "</table>\n";
}
};
$TITLE = "coup de coeur";
require_once("include_pouet/header.php");
require("include_pouet/menu.inc.php");
echo "<div id='content'>\n";
$box = new PouetBoxCDCModerator();
$box->Load();
$box->Render();
$box = new PouetBoxCDCUser();
$box->Load();
$box->Render();
echo "</div>\n";
require("include_pouet/menu.inc.php");
require_once("include_pouet/footer.php");
?>