1<div class="well myaccount_widget widget">
2 <div class="header">
3 <?= t('widget.admin.title') ?>
4 </div>
5 <div class="body">
6 <ul class="linkbuttons">
7 <li>
8 <a href="admin/index.php"><i class="fa fa-sliders"></i> <?= t('widget.admin.panel') ?></a>
9 </li>
10 <?php
11 // Everything that used to be a separate admin_*.php link now lives
12 // inside the panel. Only the counter is worth surfacing out here.
13 $new = 0;
14 $cache = new Cache('engine/cache/asideFeedbackCount');
15 if ($cache->hasExpired()) {
16 $cat = 4; // Category ID for feedback section
17 $threads = db()->fetchAll("SELECT `id`, `player_id` FROM `znote_forum_threads` WHERE `forum_id` = ? AND `closed` = 0;", [$cat]);
18 if ($threads !== false) {
19 $staffs = db()->fetchAll("SELECT `id` FROM `players` WHERE `group_id` > 1;");
20
21 foreach($threads as $thread) {
22 $response = false;
23 $posts = db()->fetchAll("SELECT `id`, `player_id` FROM `znote_forum_posts` WHERE `thread_id` = ?;", [$thread['id']]);
24 if ($posts !== false) {
25 foreach($posts as $post) {
26 foreach ($staffs as $staff) {
27 if ($post['player_id'] == $staff['id']) $response = true;
28 }
29 }
30 }
31
32 if (!$response) $new++;
33 }
34 }
35 $cache->setContent($new);
36 $cache->save();
37 } else {
38 $new = $cache->load();
39 }
40 ?>
41 <li>
42 <a href='forum.php?cat=4'><?= t('widget.admin.feedback', ['count' => $new]) ?></a>
43 </li>
44 </ul>
45 </div>
46</div>
47