Проба показа активных событий.)
[cswow.git] / module / online / online.php
blob6715967149754779fbc6ccb8925fbe57128c3051
1 <?php
2 include_once("conf.php");
3 include_once("include/player_data.php");
4 include_once("include/functions.php");
5 include_once("include/map_data.php");
6 include_once("include/report_generator.php");
8 function onlineMapRenderCallback($data, $x, $y)
10 $imgX = 16;
11 $imgY = 16;
12 $x = round($x-$imgX/2, 0);
13 $y = round($y-$imgY/2, 0);
15 $gender = $data['gender'];
16 $class = $data['class'];
17 $race = $data['race'];
18 $level = $data['level'];
19 $faction = getPlayerFaction($race);
20 $map_name = getMapName($data['map']);
21 $area_name = getAreaNameFromPoint($data['map'], $data['position_x'], $data['position_y'], $data['position_z']);
23 $img = $faction==0 ? "gps_icon1.png" : "gps_icon.png";
25 $text ="<table class=online_map>";
26 $text.="<tr><td class=".($faction==0?"aname":"hname").">".$data['name']."</td></<tr>";
27 if ($area_name)
28 $text.="<tr><td align=center>$area_name<br>";
29 $text.="<tr><td align=center>";
30 $text.="<img width=20 src=".getRaceImage($race,$gender)."> <img width=20 src=".getClassImage($class)."><br>";
31 $text.=getRace($race)."<br>";
32 $text.=getClass($class)."<br>";
33 $text.="Level - $level<br>";
34 $text.="</td></tr>";
35 $text.="</table>";
36 return '<img src="images/map_points/'.$img.'" class=point style="left: '.$x.'; top: '.$y.';" '.addTooltip($text).'>'."\n";
39 $online = @$_REQUEST['online'];
40 $width = isset($_REQUEST['width']) ? $_REQUEST['width'] : 700;
42 if ($online == "gps")
44 $rows = $cDB->selectPage($number, "SELECT * FROM `characters` WHERE `online` <> '0' AND NOT `extra_flags`&".PLAYER_EXTRA_GM_INVISIBLE);
45 renderGPSMap("$number $lang[online_players]", $width, $rows, 'onlineMapRenderCallback');
47 else
49 $baseLink = '?online';
50 $show_fields= array('PL_REPORT_LEVEL', 'PL_REPORT_FACTION', 'PL_REPORT_NAME', 'PL_REPORT_RACE', 'PL_REPORT_CLASS', 'PL_REPORT_POS');
52 $list =& new PlayerReportGenerator();
53 $list->disableMark();
54 $list->Init($show_fields, $baseLink, 'onlineLIST', $config['online_limit'], 'name');
55 $list->online();
56 $number = $list->getTotalDataCount();
58 $ap_dateSql = $cDB->selectCell("-- CACHE: 1h
59 SELECT `NextArenaPointDistributionTime` FROM `saved_variables`");
60 $daily_quest_dateSql = $cDB->selectCell("-- CACHE: 1h
61 SELECT `NextDailyQuestResetTime` FROM `saved_variables`");
62 $weekly_quest_dateSql = $cDB->selectCell("-- CACHE: 1h
63 SELECT `NextWeeklyQuestResetTime` FROM `saved_variables`");
64 $monthly_quest_dateSql = $cDB->selectCell("-- CACHE: 1h
65 SELECT `NextMonthlyQuestResetTime` FROM `saved_variables`");
67 $ap_date = date("H:i:s d.m.Y", $ap_dateSql);
68 $daily_quest_date = date("H:i:s d.m.Y", $daily_quest_dateSql);
69 $weekly_quest_date = date("H:i:s d.m.Y", $weekly_quest_dateSql);
70 $monthly_quest_date = date("H:i:s d.m.Y", $monthly_quest_dateSql);
72 echo "<table class=report width=100%>";
73 echo "<tr><td colspan=2 class=head>".$lang['stat_timers']."</td></tr>";
74 echo "<tr><td>".$lang['ap_date']."</td><td>".$ap_date."</td></tr>";
75 echo "<tr><td>".$lang['daily_quest_date']."</td><td>".$daily_quest_date."</td></tr>";
76 echo "<tr><td>".$lang['weekly_quest_date']."</td><td>".$weekly_quest_date."</td></tr>";
77 echo "<tr><td>".$lang['monthly_quest_date']."</td><td>".$monthly_quest_date."</td></tr>";
78 if ($s = getGameEventActive())
79 foreach ($s as $s1)
81 echo "<tr><td>".$lang['active_event']."</td><td>".getGameEventName($s1['event'])."</td></tr>";
83 echo "</table>";
85 if ($number <= 0)
86 echo $lang['online_no_players'];
87 else
88 $list->createReport($number.' '.$lang['online_players']);