1 | <?php
|
---|
2 | include('global.php');
|
---|
3 |
|
---|
4 | $EventsLinks = array(
|
---|
5 | 1 => array('http://www.wowwiki.com/Midsummer_Fire_Festival', 'http://www.worldofwarcraft.com/info/events/midsummer/'),
|
---|
6 | 2 => array('http://www.wowwiki.com/Feast_of_Winter_Veil', 'http://www.worldofwarcraft.com/info/events/winterveil/'),
|
---|
7 | 3 => array('http://www.wowwiki.com/Darkmoon_Faire', 'http://www.worldofwarcraft.com/info/basics/factions/darkmoon/'),
|
---|
8 | 4 => array('http://www.wowwiki.com/Darkmoon_Faire', 'http://www.worldofwarcraft.com/info/basics/factions/darkmoon/'),
|
---|
9 | 5 => array('http://www.wowwiki.com/Darkmoon_Faire', 'http://www.worldofwarcraft.com/info/basics/factions/darkmoon/'),
|
---|
10 | 6 => array('http://www.wowwiki.com/New_Year', 'http://www.worldofwarcraft.com/info/events/newyears/'),
|
---|
11 | 7 => array('http://www.wowwiki.com/Lunar_Festival', 'http://www.worldofwarcraft.com/info/events/lunarnewyears/'),
|
---|
12 | 8 => array('http://www.wowwiki.com/Love_is_in_the_Air', 'http://www.worldofwarcraft.com/info/events/loveisintheair/'),
|
---|
13 | 9 => array('http://www.wowwiki.com/Noblegarden', 'http://www.worldofwarcraft.com/community/ingameevents.html#noblegarden'),
|
---|
14 | 10 => array('http://www.wowwiki.com/Children%27s_Week', 'http://www.worldofwarcraft.com/info/events/childrensweek/'),
|
---|
15 | 11 => array('http://www.wowwiki.com/Harvest_Festival', 'http://www.worldofwarcraft.com/info/events/harvestfestival/'),
|
---|
16 | 12 => array('http://www.wowwiki.com/Hallow%27s_End', 'http://www.worldofwarcraft.com/info/events/hallowsend/'),
|
---|
17 | 13 => array('http://www.wowwiki.com/Elemental_Invasions', 'http://www.worldofwarcraft.com/community/ingameevents.html#elemental'),
|
---|
18 | 14 => array('http://www.wowwiki.com/Stranglethorn_Fishing_Extravaganza', 'http://www.worldofwarcraft.com/info/events/fishing/'),
|
---|
19 | 15 => array('http://www.wowwiki.com/Stranglethorn_Fishing_Extravaganza', 'http://www.worldofwarcraft.com/info/events/fishing/'),
|
---|
20 | 16 => array('http://www.wowwiki.com/Gurubashi_Arena#Gurubashi_Arena_Booty_Run', 'http://www.worldofwarcraft.com/community/ingameevents.html#gurubashi'),
|
---|
21 | 17 => array('http://www.wowwiki.com/The_Scourge_Invasion', 'http://www.worldofwarcraft.com/info/events/scourgeinvasion/'),
|
---|
22 | 18 => array('', 'http://www.worldofwarcraft.com/community/ingameevents.html#calltoarms'),
|
---|
23 | 19 => array('', 'http://www.worldofwarcraft.com/community/ingameevents.html#calltoarms'),
|
---|
24 | 20 => array('', 'http://www.worldofwarcraft.com/community/ingameevents.html#calltoarms'),
|
---|
25 | 21 => array('', 'http://www.worldofwarcraft.com/community/ingameevents.html#calltoarms'),
|
---|
26 | 22 => array('http://www.wowwiki.com/Ahn%27Qiraj_War_Effort', 'http://www.worldofwarcraft.com/wareffort/servers.html'),
|
---|
27 | 23 => array('', ''),
|
---|
28 | 24 => array('', ''),
|
---|
29 | 25 => array('', 'http://www.worldofwarcraft.com/community/ingameevents.html#calltoarms'),
|
---|
30 | 26 => array('http://www.wowwiki.com/Brewfest', 'http://www.worldofwarcraft.com/info/events/brewfest/'),
|
---|
31 | 27 => array('', ''),
|
---|
32 | 28 => array('http://www.wowwiki.com/Noblegarden', 'http://www.worldofwarcraft.com/community/ingameevents.html#noblegarden'),
|
---|
33 | 29 => array('http://www.wowwiki.com/Edge_of_Madness', ''),
|
---|
34 | 30 => array('http://www.wowwiki.com/Edge_of_Madness', ''),
|
---|
35 | 31 => array('http://www.wowwiki.com/Edge_of_Madness', ''),
|
---|
36 | 32 => array('http://www.wowwiki.com/Edge_of_Madness', ''),
|
---|
37 | 33 => array('http://www.wowwiki.com/Arena_Tournament', ''),
|
---|
38 | 34 => array('http://www.wowwiki.com/L70ETC', ''),
|
---|
39 | );
|
---|
40 |
|
---|
41 | function Events()
|
---|
42 | {
|
---|
43 | global $Database, $EventsLinks, $Config;
|
---|
44 |
|
---|
45 | $Events = array('Running' => array(), 'Planned' => array());
|
---|
46 | $Database->select_db($Config['Mangos']['DatabaseMangos']);
|
---|
47 |
|
---|
48 | // Add already started events
|
---|
49 | $DbResult = $Database->select('game_event', '*, UNIX_TIMESTAMP(start_time) as start', 'end_time > NOW() AND start_time < NOW()');
|
---|
50 | while($Row = $DbResult->fetch_array())
|
---|
51 | {
|
---|
52 | if(!array_key_exists($Row['entry'], $EventsLinks)) $EventsLinks[$Row['entry']] = array('', '');
|
---|
53 | $Start = (floor((time() - $Row['start']) / ($Row['occurence'] * 60))) * $Row['occurence'] * 60 + $Row['start'];
|
---|
54 | $End = $Start + $Row['length'] * 60;
|
---|
55 | if((time() > $Start) and (time() < $End)) $EventState = 'Running';
|
---|
56 | else
|
---|
57 | {
|
---|
58 | $EventState = 'Planned';
|
---|
59 | $Start += $Row['occurence'] * 60;
|
---|
60 | $End += $Row['occurence'] * 60;
|
---|
61 | }
|
---|
62 | $Events[$EventState][$Row['start']] = array('StartTime' => $Start, 'EndTime' => $End, 'Title' => $Row['description'], 'WoWWiki' => $EventsLinks[$Row['entry']][0], 'Official' => $EventsLinks[$Row['entry']][1]);
|
---|
63 | }
|
---|
64 |
|
---|
65 | // Add events not started so far
|
---|
66 | $DbResult = $Database->select('game_event', '*, UNIX_TIMESTAMP(start_time) as start', 'start_time > NOW()');
|
---|
67 | while($Row = $DbResult->fetch_array())
|
---|
68 | {
|
---|
69 | if(!array_key_exists($Row['entry'], $EventsLinks)) $EventsLinks[$Row['entry']] = array('', '');
|
---|
70 | $Events['Planned'][$Row['start']] = array('StartTime' => $Row['start'], 'EndTime' => ($Row['start'] + $Row['length'] * 60), 'Title' => $Row['description'], 'WoWWiki' => $EventsLinks[$Row['entry']][0], 'Official' => $EventsLinks[$Row['entry']][1]);
|
---|
71 | }
|
---|
72 |
|
---|
73 | sort($Events['Running']);
|
---|
74 | sort($Events['Planned']);
|
---|
75 |
|
---|
76 | return($Events);
|
---|
77 | }
|
---|
78 |
|
---|
79 | function ShowEventList($Events)
|
---|
80 | {
|
---|
81 | foreach($Events as $Event)
|
---|
82 | {
|
---|
83 | echo('<tr><td align="Left">'.$Event['Title'].'</td><td align="right">'.date('j.n.Y H:i', $Event['StartTime']).'</td><td align="right">'.date('j.n.Y H:i', $Event['EndTime']).'</td>');
|
---|
84 | if($Event['WoWWiki'] != '') echo('<td><a href="'.$Event['WoWWiki'].'">wowwiki</a></td>');
|
---|
85 | else echo('<td> </td>');
|
---|
86 | if($Event['Official'] != '') echo('<td><a href="'.$Event['Official'].'">worldofwarcraft</a></td>'); else echo('<td> </td>');
|
---|
87 | echo('</tr>');
|
---|
88 | }
|
---|
89 | }
|
---|
90 |
|
---|
91 | ShowHeader();
|
---|
92 |
|
---|
93 | echo('<h3>Události ve hře:</h3><div align="center">');
|
---|
94 |
|
---|
95 | $Events = Events();
|
---|
96 | echo('<table class="TableGuilda" border="1" cellpadding="3" cellspacing="0">');
|
---|
97 | echo('<tr><th>Název</th><th>Začátek</th><th>Konec</th><th>Informace</th><th>Informace</th></tr>');
|
---|
98 | echo('<tr><td colspan="5"><strong style="color: yellow;">Aktuálně běžící akce</strong></td></tr>');
|
---|
99 | ShowEventList($Events['Running']);
|
---|
100 | echo('<tr><td colspan="5"><strong style="color: yellow;">Plánované akce</strong></td></tr>');
|
---|
101 | ShowEventList($Events['Planned']);
|
---|
102 | echo('</table></div>');
|
---|
103 |
|
---|
104 | ShowFooter();
|
---|
105 |
|
---|
106 | ?>
|
---|