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