1<?php require_once 'engine/init.php'; theme_open();
2
3// Staff list, grouped by position. Cached; the view only renders $srtGrp.
4$cache = new Cache('engine/cache/support');
5if ($cache->hasExpired()) {
6 // Fetch all staffs in-game.
7 if (znote_server_adapter()->normalizedEngine() === 'TFS_03') {
8 $staffs = support_list03();
9 } else $staffs = support_list();
10 // Fetch group ids and names from config.php
11 $groups = $config['ingame_positions'];
12 // Loops through groups, separating each group element into an ID variable and name variable
13 foreach ($groups as $group_id => $group_name) {
14 // Loops through list of staffs
15 if (!empty($staffs))
16 foreach ($staffs as $staff) {
17 if ($staff['group_id'] == $group_id) $srtGrp[$group_name][] = $staff;
18 }
19 }
20 if (!empty($srtGrp)) {
21 $cache->setContent($srtGrp);
22 $cache->save();
23 }
24} else {
25 $srtGrp = $cache->load();
26}
27
28view('support');
29
30theme_close();
31