Требование: PHP => 5.3, часть 2
[cswowd.git] / module / guilds / guilds.php
blobf2f60cc4f96d468790fe6c158c161a16e1ec8b5a
1 <?php
2 include_once("include/functions.php");
3 include_once("include/report_generator.php");
5 function getGuildEmblem($guild)
7 $back = $guild['BackgroundColor'];
8 $emblem = $guild['EmblemStyle'];
9 $ecolor = $guild['EmblemColor'];
10 $border = $guild['BorderStyle'];
11 $bcolor = $guild['BorderColor'];
12 return "images/player_info/guild_ico.php?back=$back&emblem=$emblem&ecolor=$ecolor&border=$border&bcolor=$bcolor";
15 $guildid = intval(@$_REQUEST['guild']);
16 if ($guildid)
18 $FindRefrence = "?guild=$guildid";
20 $guild = getGuild($guildid);
21 if ($guild)
23 // Create guild info table
24 if ($ajaxmode==0)
26 $allow_show_all_info = 0;
27 echo '<table class=report width=500>';
28 echo '<tbody>';
29 echo '<tr><td colspan=2 class=head>'.$guild['name'].'</td></tr>';
30 echo '<tr>';
31 echo '<td rowspan=4 class=emblem><img src='.getGuildEmblem($guild).'></td>';
32 echo '<td>'.$guild['info'].'&nbsp;</td>';
33 echo '</tr>';
34 if ($allow_show_all_info)
35 echo '<tr><td>'.$guild['motd'].'&nbsp;</td></tr>';
36 echo '<tr><td>'.$lang['guild_create_at'].'&nbsp;'.date('d-m-y', $guild['createdate']).'&nbsp;</td></tr>';
37 echo '<tr><td>'.$lang['guild_money'].'&nbsp;'.money($guild['BankMoney']).'&nbsp;</td></tr>';
38 echo '</tbody>';
39 echo '</table>';
41 // Create guild members list report
42 $show_fields= array('PL_REPORT_LEVEL', 'PL_REPORT_RACE', 'PL_REPORT_CLASS', 'PL_REPORT_NAME', 'PL_REPORT_GRANK', 'PL_REPORT_NOTE');
43 $members =& new PlayerReportGenerator('guild');
44 $members->disableMark();
45 $members->Init($show_fields, $FindRefrence, 'guildMembers', $config['fade_limit'], 'name');
46 $members->guildMembers($guildid);
47 $members->createReport($lang['guild_members']);
50 else
52 $page = intval(@$_REQUEST['page']);
53 $sort = @$_REQUEST['sort'];
55 $FindRefrence = "?guild";
56 $sortstr = "";
58 $rows = $cDB->selectPage($number, "SELECT *
59 FROM `guild`
60 LIMIT ?d, ?d", getPageOffset($page), $config['fade_limit']);
61 if ($rows)
63 echo "<table class=report width=500>";
64 echo "<tbody>";
65 echo "<tr><td colspan=5 class=head>$lang[guild_list] $number</td></tr>\n";
66 // Делаем ссылку для сортировки
67 $SortRefrence = $FindRefrence;
68 if ($page>1) $SortRefrence.="&page=$page";
70 echo "<tr>";
71 echo "<th></th>";
72 echo "<th width=100%>$lang[guild_name]</th>";
73 echo "<th>$lang[guild_create]</th>";
74 echo "<th>$lang[guild_leader]</th>";
75 echo "<th></th>";
76 echo "</tr>\n";
77 foreach ($rows as $guild)
79 $leader = getCharacter($guild['leaderguid'], '`name`, `race`');
80 if (!$leader)
81 continue;
82 echo "<tr>";
83 echo "<td><img src=".getGuildEmblem($guild)." width=48></td>";
84 echo "<td class=guild>&laquo;<a href=\"?guild=$guild[guildid]\">".$guild['name']."</a>&raquo;</td>";
85 echo "<td align=center><font size=-3>".date("d-m-y", $guild['createdate'])."</font></td>";
86 echo "<td class=player><a href=\"?player=$guild[leaderguid]\">".$leader['name']."</a></td>";
87 echo "<td class=pfaction><img width=48 src=\"".getFactionImage($leader['race'])."\"></td>";
88 echo "</tr>\n";
90 $pageRefrence = $FindRefrence;
91 if ($sort) $pageRefrence.="&sort=$sort";
92 generatePage($number, $page, "<a href=\"$pageRefrence&page=%d\">%d </a>", 5);
93 echo "</tbody></table>";
95 else
96 echo $lang['guild_noexist'];