Требование: PHP => 5.3, часть 2
[cswow.git] / include / info_table_generator.php
blob717a9d953baa2b39f1298312d315952b7384b0d3
1 <?php
2 include_once("conf.php");
3 include_once("functions.php");
5 function init_pagePerMark($mark, $pattern, $page)
7 global $config;
8 if ($mark == $pattern && $page > 0)
9 return ($page-1)*$config['fade_limit'];
10 return 0;
13 function render_Page($currentOffset, $totalRecords, $colSpan, $baselink, $add)
15 global $config;
16 $link = '<a href="'.$baselink.'&page=%d&mark='.$add.'#'.$add.'">%d </a>';
17 $currentPage = floor($currentOffset/$config['fade_limit']) + 1;
18 generateLPage($totalRecords, $currentPage, $link, $config['fade_limit'], $colSpan);
21 function render_AjaxPage($currentOffset, $totalRecords, $colSpan, $baselink, $add)
23 global $config;
24 $link = '<a href="'.$baselink.'&page=%d&mark='.$add.'" onClick="return uploadFromHref(this, \''.$add.'\');">%d </a>';
25 $currentPage = floor($currentOffset/$config['fade_limit']) + 1;
26 generateLPage($totalRecords, $currentPage, $link, $config['fade_limit'], $colSpan);
29 function renderFactionGroupList($parent, $list, $header, $page_seek, $totalRecords, $baseLink, $headMARK)
31 global $lang;
32 if (!$list)
33 return;
34 echo '<div class=reportContainer id='.$headMARK.'>';
35 addTab($header.' ('.$totalRecords.')', $headMARK);
36 echo "<table class=report width=500>";
37 echo "<tbody>";
38 echo "<tr class=head><td><a name=\"$headMARK\">$header</a></td></tr>";
39 echo '<tr>';
40 echo '<td class=teamreputation>';
41 echo '<a href="?faction='.$parent['id'].'">'.$parent['name'].'</a></td>';
42 echo '</tr>';
43 foreach($list as $f)
45 echo '<tr>';
46 echo '<td class=reputation><a href="?faction='.$f['id'].'">&nbsp;'.$f['name'].'</a></td>';
47 echo '</tr>';
49 render_Page($page_seek, $totalRecords, 1, $baseLink, $headMARK);
50 echo "</tbody></table></div>";
53 //=======================================================================================
54 // Рендер лута по таблицам loot_
55 // creature_loot_template
56 // gameobject_loot_template
57 // item_loot_template
58 //=======================================================================================
59 function renderSubList($lootList)
61 global $Quality, $lang;
62 if (!$lootList)
63 return;
64 $curloot = -1;
65 foreach ($lootList as $loot)
67 $gtext = "";
68 if ($loot['groupid']!=$curloot)
70 echo "<tr><th colspan = 3>$lang[kill_kredit_group]&nbsp;$loot[groupid]</th></tr>";
71 $curloot = $loot['groupid'];
73 echo "<tr>";
74 if ($loot['mincountOrRef'] > 0)
76 if ($item = GetItem($loot['item'],"`entry`, `Quality`, `name`, `displayid`"))
78 $colorname = $item['Quality'];
79 echo "<td width=1%>";show_item($item['entry'], $item['displayid'], 'reagent');echo "</td>";
80 echo "<td class=left><a class=$Quality[$colorname] href=\"?item=$item[entry]\">$item[name]</a></td>";
82 else
83 echo "<td>-</td><td>$lang[item_not_found]&nbsp;$loot[item]</td>";
85 else // Используется список вещей (падает только одна вещь из списка)
87 echo "<td align=center>".$loot['maxcount']."x</td>";
88 echo "<td class=forsub>$gtext<table class=sublist><tbody>";
89 renderSubList($loot['item']);
90 echo "</tbody></table></td>";
92 if ($loot['ChanceOrQuestChance'] < 0) echo "<td align=center>Q".(-$loot['ChanceOrQuestChance'])."%</td>";
93 else if ($loot['ChanceOrQuestChance'] > 0) echo "<td align=center>".$loot['ChanceOrQuestChance']."%</td>";
94 echo "</tr>";
98 function renderLootTableList($lootList, $header, $page_seek, $totalRecords, $baseLink, $headMARK)
100 global $lang;
101 if (!$lootList)
102 return;
103 echo '<div class=reportContainer id='.$headMARK.'>';
104 addTab($header.' ('.$totalRecords.')', $headMARK);
105 echo "<table class=report width=500>";
106 echo "<tbody>";
107 echo "<tr class=head><td colspan=3><a name=\"$headMARK\">$header</a></td></tr>";
108 echo "<tr><th width=1%></th><th>$lang[item_name]</th><th>$lang[drop]%</th></tr>";
109 renderSubList($lootList);
110 render_Page($page_seek, $totalRecords, 3, $baseLink, $headMARK);
111 echo "</tbody></table></div>";
114 //=======================================================================================
115 // Выводим зоны для рыбалки имеющие данный лут
116 //=======================================================================================
117 function renderItemFishingList($lootList, $refLoot, $header, $page_seek, $totalRecords, $baseLink, $headMARK)
119 global $lang,$config;
120 if (!$lootList)
121 return;
122 echo '<div class=reportContainer id='.$headMARK.'>';
123 addTab($header.' ('.$totalRecords.')', $headMARK);
124 echo "<table class=report width=500>";
125 echo "<tbody>";
126 echo "<tr><td colspan=2 class=head><a name=\"$headMARK\">$header</a></td></tr>";
127 echo "<tr><th>$lang[zone_name]</th><th>$lang[drop]%</th></tr>";
128 foreach ($lootList as $area_loot)
130 echo "<tr>";
131 echo '<td class=left>'.getFullAreaName($area_loot['loot_entry']).'</td>';
132 if ($area_loot['ChanceOrQuestChance'] < 0) echo "<td>Q".(-$area_loot['ChanceOrQuestChance'])."%</td>";
133 else echo "<td>".$area_loot['ChanceOrQuestChance']."%</td>";
134 echo "</tr>";
136 render_Page($page_seek, $totalRecords, 2, $baseLink, $headMARK);
137 echo "</tbody></table></div>";