コード例 #1
0
<input type="submit" value="Apply filter" />

</form><div class="pad"></div></div>

<script type="text/javascript">//<![CDATA[
fi_init('achievements');
//]]></script>

<div id="lv-achievements" class="listview"></div>
<?php 
$achievements = WoW_Achievements::GetAchievements();
$js_icons_data = '';
$js_items_data = '';
$js_titles_data = '';
$js_listview_data = '';
$achievements_count = WoW_Achievements::GetCount();
if (is_array($achievements)) {
    $current = 1;
    $achievements_count_current = count($achievements);
    foreach ($achievements as $achievement) {
        $js_icons_data .= sprintf('_[%d]={name_%s:\'%s\',icon:\'%s\'};', $achievement['id'], WoW_Locale::GetLocale(LOCALE_SPLIT), str_replace("'", "\\'", $achievement['name']), str_replace("'", "\\'", $achievement['icon']));
        if (isset($achievement['itemReward']) && is_array($achievement['itemReward'])) {
            $js_items_data .= sprintf('_[%d]={name_%s:\'%\',quality:%d,icon:\'%s\'};', $achievement['itemReward']['id'], WoW_Locale::GetLocale(LOCALE_SPLIT), $achievement['itemReward']['quality'], $achievement['itemReward']['icon']);
        }
        if (is_array($achievement['titleReward'])) {
            $js_titles_data .= sprintf('_[%d]={name_%s:\'%\'};', $achievement['titleReward']['id'], WoW_Locale::GetLocale(LOCALE_SPLIT), $achievement['titleReward']['name']);
        }
        $js_listview_data .= sprintf('{"category":%d,"description":"%s","id":%d,"name":"%s","parentcat":%d,"points":%d,"side":%d,"type":%d}', $achievement['categoryId'], str_replace('"', '\\"', $achievement['desc']), $achievement['id'], str_replace('"', '\\"', $achievement['name']), $achievement['parentCategory'], $achievement['points'], $achievement['side'], $achievement['type']);
        if ($current < $achievements_count_current) {
            $js_listview_data .= ',';
        }