From d45b972d14898f3404c0de7ee9d0eaaccfda4905 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Wed, 21 Aug 2013 18:32:13 +0200 Subject: [PATCH] * moved tabs-block in template to separate brick-file *yay* generification! --- pages/achievement.php | 82 +++++++++-------- pages/item.php | 70 ++++++++++---- pages/itemset.php | 24 ++--- pages/npc.php | 63 +++++++++---- pages/pet.php | 64 +++++++------ pages/quest.php | 20 ++-- pages/spell.php | 156 +++++++++++++++++--------------- pages/title.php | 63 +++++++------ template/achievement.tpl | 16 +--- template/bricks/tabsRelated.tpl | 16 ++++ template/itemset.tpl | 12 +-- template/pet.tpl | 16 +--- template/spell.tpl | 28 +----- template/title.tpl | 15 +-- 14 files changed, 343 insertions(+), 302 deletions(-) create mode 100644 template/bricks/tabsRelated.tpl diff --git a/pages/achievement.php b/pages/achievement.php index 94aa8af2..61f156c3 100644 --- a/pages/achievement.php +++ b/pages/achievement.php @@ -21,10 +21,10 @@ if (!defined('AOWOW_REVISION')) require 'includes/class.community.php'; -$id = intVal($pageParam); +$_id = intVal($pageParam); -$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_ACHIEVEMENT, $id, -1, User::$localeId]); -$cacheKeyTooltip = implode('_', [CACHETYPE_TOOLTIP, TYPE_ACHIEVEMENT, $id, -1, User::$localeId]); +$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_ACHIEVEMENT, $_id, -1, User::$localeId]); +$cacheKeyTooltip = implode('_', [CACHETYPE_TOOLTIP, TYPE_ACHIEVEMENT, $_id, -1, User::$localeId]); // AowowPower-request if (isset($_GET['power'])) @@ -35,11 +35,11 @@ if (isset($_GET['power'])) if (!$smarty->loadCache($cacheKeyTooltip, $x)) { - $acv = new AchievementList(array(['id', $id])); + $acv = new AchievementList(array(['id', $_id])); if ($acv->error) - die('$WowheadPower.registerAchievement(\''.$id.'\', '.User::$localeId.', {})'); + die('$WowheadPower.registerAchievement(\''.$_id.'\', '.User::$localeId.', {})'); - $x = '$WowheadPower.registerAchievement('.$id.', '.User::$localeId.",{\n"; + $x = '$WowheadPower.registerAchievement('.$_id.', '.User::$localeId.",{\n"; $x .= "\tname_".User::$localeString.": '".Util::jsEscape($acv->getField('name', true))."',\n"; $x .= "\ticon: '".urlencode($acv->getField('iconString'))."',\n"; $x .= "\ttooltip_".User::$localeString.": '".$acv->renderTooltip()."'\n"; @@ -53,60 +53,63 @@ if (isset($_GET['power'])) // regular page if (!$smarty->loadCache($cacheKeyPage, $pageData)) { - $acv = new AchievementList(array(['id', $id])); + $acv = new AchievementList(array(['id', $_id])); if ($acv->error) $smarty->notFound(Lang::$game['achievement']); - $pageData['path'] = [0, 9]; - $pageData['title'] = [Util::ucfirst(Lang::$game['achievement'])]; - // create page title and path $curCat = $acv->getField('category'); $tmpPath = []; do { - $tmpPath[] = $curCat; + array_unshift($tmpPath, $curCat); $curCat = DB::Aowow()->SelectCell('SELECT parentCategory FROM ?_achievementcategory WHERE id = ?d', $curCat); } while ($curCat > 0); - if (!empty($tmpPath)) - $pageData['path'] = array_merge($pageData['path'], array_reverse($tmpPath)); - - array_unshift($pageData['title'], $acv->getField('name', true)); + array_unshift($tmpPath, 0, 9); $acv->addGlobalsToJscript($smarty, GLOBALINFO_REWARDS); - $pageData['page'] = $acv->getDetailedData()[$id]; // infobox content + $infobox = []; switch ($acv->getField('faction')) { case 1: - $pageData['infoBox'][] = Lang::$main['side'].': '.Lang::$game['si'][SIDE_ALLIANCE].''; + $infobox[] = Lang::$main['side'].': '.Lang::$game['si'][SIDE_ALLIANCE].''; break; case 2: - $pageData['infoBox'][] = Lang::$main['side'].': '.Lang::$game['si'][SIDE_HORDE].''; + $infobox[] = Lang::$main['side'].': '.Lang::$game['si'][SIDE_HORDE].''; break; default: // case 3 - $pageData['infoBox'][] = Lang::$main['side'].': '.Lang::$game['si'][SIDE_BOTH]; + $infobox[] = Lang::$main['side'].': '.Lang::$game['si'][SIDE_BOTH]; } // todo (low): crosslink with charactersDB to check if realmFirsts are still available - $pageData['infoBox'] = array_merge($pageData['infoBox'], Lang::getInfoBoxForFlags($acv->getField('cuFlags'))); + $pageData = array( + 'title' => $acv->getField('name', true), + 'path' => $tmpPath, + 'infobox' => array_merge($infobox, Lang::getInfoBoxForFlags($acv->getField('cuFlags'))), + 'relTabs' => [], + 'page' => $acv->getDetailedData()[$_id] + ); // listview: "see also" $conditions = array( ['name_loc'.User::$localeId, $acv->getField('name', true)], - ['id', $id, '!'] + ['id', $_id, '!'] ); $saList = new AchievementList($conditions); - $pageData['page']['saData'] = $saList->getListviewData(); - $pageData['page']['saParams'] = array( - 'id' => 'see-also', - 'name' => '$LANG.tab_seealso', - 'visibleCols' => "$['category']", - 'tabs' => '$tabsRelated' + $pageData['relTabs'][] = array( + 'file' => 'achievement', + 'data' => $saList->getListviewData(), + 'params' => array( + 'id' => 'see-also', + 'name' => '$LANG.tab_seealso', + 'visibleCols' => "$['category']", + 'tabs' => '$tabsRelated' + ) ); $saList->addGlobalsToJscript($smarty); @@ -114,17 +117,20 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) // listview: "criteria of" $refs = DB::Aowow()->SelectCol('SELECT refAchievement FROM ?_achievementcriteria WHERE Type = ?d AND value1 = ?d', ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT, - $id + $_id ); if (!empty($refs)) { $coList = new AchievementList(array(['id', $refs])); - $pageData['page']['coData'] = $coList->getListviewData(); - $pageData['page']['coParams'] = array( - 'id' => 'criteria-of', - 'name' => '$LANG.tab_criteriaof', - 'visibleCols' => "$['category']", - 'tabs' => '$tabsRelated' + $pageData['relTabs'][] = array( + 'file' => 'achievement', + 'data' => $coList->getListviewData(), + 'params' => array( + 'id' => 'criteria-of', + 'name' => '$LANG.tab_criteriaof', + 'visibleCols' => "$['category']", + 'tabs' => '$tabsRelated' + ) ); $coList->addGlobalsToJscript($smarty); @@ -349,7 +355,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) { $pageData['page']['series'] = array( array( - 'id' => $id, + 'id' => $_id, 'name' => $acv->getField('name', true), 'parent' => $acv->getField('series') >> 16, ) @@ -390,13 +396,13 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) // menuId 9: Achievement g_initPath() // tabId 0: Database g_initHeader() $smarty->updatePageVars(array( - 'title' => implode(" - ", $pageData['title']), + 'title' => $pageData['title'].' - '.Util::ucfirst(Lang::$game['achievement']), 'path' => json_encode($pageData['path'], JSON_NUMERIC_CHECK), 'tab' => 0, 'type' => TYPE_ACHIEVEMENT, - 'typeId' => $id + 'typeId' => $_id )); -$smarty->assign('community', CommunityContent::getAll(TYPE_ACHIEVEMENT, $id)); // comments, screenshots, videos +$smarty->assign('community', CommunityContent::getAll(TYPE_ACHIEVEMENT, $_id)); // comments, screenshots, videos $smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$achievement)); $smarty->assign('lvData', $pageData); diff --git a/pages/item.php b/pages/item.php index cf1f27c7..4aa450fc 100644 --- a/pages/item.php +++ b/pages/item.php @@ -9,9 +9,9 @@ if (isset($_GET['xml'])) require 'includes/class.community.php'; -$id = intVal($pageParam); +$_id = intVal($pageParam); -$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_ITEM, $id, -1, User::$localeId]); +$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_ITEM, $_id, -1, User::$localeId]); // AowowPower-request if (isset($_GET['power'])) @@ -21,7 +21,7 @@ if (isset($_GET['power'])) Util::powerUseLocale(@$_GET['domain']); $enh = []; - $itemString = $id; + $itemString = $_id; if (isset($_GET['rand'])) { @@ -49,7 +49,7 @@ if (isset($_GET['power'])) // output json for tooltips if (!$smarty->loadCache($cacheKeyTooltip, $x)) { - $item = new ItemList(array(['i.entry', $id])); + $item = new ItemList(array(['i.entry', $_id])); if ($item->error) die('$WowheadPower.registerItem(\''.$itemString.'\', '.User::$localeId.', {})'); @@ -58,7 +58,7 @@ if (isset($_GET['power'])) $x .= "\tname_".User::$localeString.": '".Util::jsEscape($item->getField('name', true))."',\n"; $x .= "\tquality: ".$item->getField('Quality').",\n"; $x .= "\ticon: '".urlencode($item->getField('icon'))."',\n"; - $x .= "\ttooltip_".User::$localeString.": '".Util::jsEscape($item->tooltip[$id])."'\n"; + $x .= "\ttooltip_".User::$localeString.": '".Util::jsEscape($item->tooltip[$_id])."'\n"; $x .= "});"; $smarty->saveCache($cacheKeyTooltip, $x); @@ -69,7 +69,7 @@ if (isset($_GET['power'])) // regular page if (!$smarty->loadCache($cacheKeyPage, $item)) { - $item = new ItemList(array(['i.entry', $id])); + $item = new ItemList(array(['i.entry', $_id])); if ($item->error) $smarty->notFound(Lang::$game['item']); @@ -78,12 +78,42 @@ if (!$smarty->loadCache($cacheKeyPage, $item)) // not yet implemented -> chicken out $smarty->error(); - +/* + + + +
{#Quick_Facts#}
+
+
    + {* Уровень вещи *} + {if $item.level}
  • {#level#}: {$item.level}
  • {/if} + {* Стоимость вещи *} + {if $item.buygold or $item.buysilver or $item.buycopper} +
  • + {#Buy_for#}: + {if $item.buygold}{$item.buygold}{/if} + {if $item.buysilver}{$item.buysilver}{/if} + {if $item.buycopper}{$item.buycopper}{/if} +
  • + {/if} + {if $item.sellgold or $item.sellsilver or $item.sellcopper} +
  • + {#Sells_for#}: + {if $item.sellgold}{$item.sellgold}{/if} + {if $item.sellsilver}{$item.sellsilver}{/if} + {if $item.sellcopper}{$item.sellcopper}{/if} +
  • + {/if} + {if isset($item.disenchantskill)}
  • {#Disenchantable#} ({$item.disenchantskill})
  • {/if} + {if isset($item.key)}
  • {#Can_be_placed_in_the_keyring#}
  • {/if} +
+
+*/ unset($item); // Информация о вещи... - $item = iteminfo($id, 1); + $item = iteminfo($_id, 1); $path = [0, 0, $item['classs'], $item['subclass'], $item['type']]; // Поиск мобов с которых эта вещь лутится @@ -725,24 +755,24 @@ if (!$smarty->loadCache($cacheKeyPage, $item)) $item['currencyfor'] = []; foreach($rows_cf as $row) { - $id=$row['entry']; - $item['currencyfor'][$id] = []; - $item['currencyfor'][$id] = iteminfo2($row); - $item['currencyfor'][$id]['maxcount'] = $row['drop-maxcount']; - $item['currencyfor'][$id]['cost'] = []; + $_id=$row['entry']; + $item['currencyfor'][$_id] = []; + $item['currencyfor'][$_id] = iteminfo2($row); + $item['currencyfor'][$_id]['maxcount'] = $row['drop-maxcount']; + $item['currencyfor'][$_id]['cost'] = []; if($row['BuyPrice']>0) - $npc['sells'][$id]['cost']['money'] = $row['BuyPrice']; + $npc['sells'][$_id]['cost']['money'] = $row['BuyPrice']; if($row['reqhonorpoints']>0) - $item['currencyfor'][$id]['cost']['honor'] =/* ($row['A']==1?1:-1)* */$row['reqhonorpoints']; //FIXME_BUG + $item['currencyfor'][$_id]['cost']['honor'] =/* ($row['A']==1?1:-1)* */$row['reqhonorpoints']; //FIXME_BUG if($row['reqarenapoints']>0) - $item['currencyfor'][$id]['cost']['arena'] = $row['reqarenapoints']; - $item['currencyfor'][$id]['cost']['items'] = []; + $item['currencyfor'][$_id]['cost']['arena'] = $row['reqarenapoints']; + $item['currencyfor'][$_id]['cost']['items'] = []; for($j=1; $j<=5; $j++) if(($row['reqitem'.$j]>0) and ($row['reqitemcount'.$j]>0)) { allitemsinfo($row['reqitem'.$j], 0); - $item['currencyfor'][$id]['cost']['items'][] = array( + $item['currencyfor'][$_id]['cost']['items'][] = array( 'item' => $row['reqitem'.$j], 'count' => $row['reqitemcount'.$j] ); @@ -818,9 +848,9 @@ $smarty->updatePageVars(array( 'path' => json_encode($pageData['path'], JSON_NUMERIC_CHECK), 'tab' => 0, 'type' => TYPE_ITEM, - 'typeid' => $id + 'typeid' => $_id )); -$smarty->assign('community', CommunityContent::getAll(TYPE_ITEM, $id)); // comments, screenshots, videos +$smarty->assign('community', CommunityContent::getAll(TYPE_ITEM, $_id)); // comments, screenshots, videos $smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$item, ['colon' => Lang::$colon])); $smarty->assign('lvData', $pageData); diff --git a/pages/itemset.php b/pages/itemset.php index 0849cd10..39a93efa 100644 --- a/pages/itemset.php +++ b/pages/itemset.php @@ -6,14 +6,14 @@ if (!defined('AOWOW_REVISION')) require 'includes/class.community.php'; -$id = intVal($pageParam); +$_id = intVal($pageParam); $path = [0, 2]; -$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_ITEMSET, $id, -1, User::$localeId]); +$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_ITEMSET, $_id, -1, User::$localeId]); if (!$smarty->loadCache($cacheKeyPage, $pageData)) { - $iSet = new ItemsetList(array(['id', $id])); + $iSet = new ItemsetList(array(['id', $_id])); if ($iSet->error) $smarty->notFound(Lang::$game['itemset']); @@ -165,6 +165,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) 'title' => $name, // for header 'path' => $path, 'infobox' => $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null, + 'relTabs' => [], 'pieces' => $pieces, 'spells' => $spells, 'view3D' => json_encode($eqList, JSON_NUMERIC_CHECK), @@ -175,7 +176,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) ), 'page' => array( 'name' => $name, // for page content - 'id' => $id, + 'id' => $_id, 'bonusExt' => $skill, 'description' => $ta ? sprintf(Lang::$itemset['_desc'], $name, Lang::$itemset['notes'][$ta], $cnt) : sprintf(Lang::$itemset['_descTagless'], $name, $cnt), 'unavailable' => $unav @@ -189,25 +190,25 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) if ($ta && count($path) == 3) { - $rel[] = ['id', $id, '!']; + $rel[] = ['id', $_id, '!']; $rel[] = ['classMask', 1 << (end($path) - 1), '&']; $rel[] = ['contentGroup', (int)$ta]; } else if ($ev) { - $rel[] = ['id', $id, '!']; + $rel[] = ['id', $_id, '!']; $rel[] = ['holidayId', 0, '!']; } else if ($sk) { - $rel[] = ['id', $id, '!']; + $rel[] = ['id', $_id, '!']; $rel[] = ['contentGroup', 0]; $rel[] = ['skillId', 0, '!']; $rel[] = ['type', $ty]; } else if (!$ta && $ty) { - $rel[] = ['id', $id, '!']; + $rel[] = ['id', $_id, '!']; $rel[] = ['contentGroup', 0]; $rel[] = ['type', $ty]; $rel[] = ['skillId', 0]; @@ -218,7 +219,8 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $relSets = new ItemsetList($rel); if (!$relSets->error) { - $pageData['related'] = array( + $pageData['relTabs'][] = array( + 'file' => 'itemset', 'data' => $relSets->getListviewData(), 'params' => array( 'id' => 'see-also', @@ -246,13 +248,13 @@ $smarty->updatePageVars(array( 'path' => json_encode($pageData['path'], JSON_NUMERIC_CHECK), 'tab' => 0, 'type' => TYPE_ITEMSET, - 'typeId' => $id, + 'typeId' => $_id, 'reqJS' => array( 'template/js/Summary.js', 'template/js/swfobject.js' ) )); -$smarty->assign('community', CommunityContent::getAll(TYPE_ITEMSET, $id)); // comments, screenshots, videos +$smarty->assign('community', CommunityContent::getAll(TYPE_ITEMSET, $_id)); // comments, screenshots, videos $smarty->assign('lang', array_merge(Lang::$main, Lang::$itemset)); $smarty->assign('lvData', $pageData); diff --git a/pages/npc.php b/pages/npc.php index 8745c1bd..f8b0b8ff 100644 --- a/pages/npc.php +++ b/pages/npc.php @@ -6,10 +6,10 @@ if (!defined('AOWOW_REVISION')) require 'includes/class.community.php'; -$id = intVal($pageParam); +$_id = intVal($pageParam); -$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_NPC, $id, -1, User::$localeId]); -$cacheKeyTooltip = implode('_', [CACHETYPE_TOOLTIP, TYPE_NPC, $id, -1, User::$localeId]); +$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_NPC, $_id, -1, User::$localeId]); +$cacheKeyTooltip = implode('_', [CACHETYPE_TOOLTIP, TYPE_NPC, $_id, -1, User::$localeId]); // AowowPower-request if (isset($_GET['power'])) @@ -20,13 +20,13 @@ if (isset($_GET['power'])) if (!$smarty->loadCache($cacheKeyTooltip, $x)) { - $npc = new CreatureList(array(['ct.id', $id])); + $npc = new CreatureList(array(['ct.id', $_id])); if ($npc->error) - die('$WowheadPower.registerNpc(\''.$id.'\', '.User::$localeId.', {})'); + die('$WowheadPower.registerNpc(\''.$_id.'\', '.User::$localeId.', {})'); $s = $npc->getSpawns(true); - $x = '$WowheadPower.registerNpc('.$id.', '.User::$localeId.", {\n"; + $x = '$WowheadPower.registerNpc('.$_id.', '.User::$localeId.", {\n"; $x .= "\tname_".User::$localeString.": '".Util::jsEscape($npc->getField('name', true))."',\n"; $x .= "\ttooltip_".User::$localeString.': \''.Util::jsEscape($npc->renderTooltip())."',\n"; // $x .= "\tmap: ".($s ? '{zone: '.$s[0].', coords: {0:'.json_encode($s[1], JSON_NUMERIC_CHECK).'}' : '{}')."\n"; @@ -41,7 +41,7 @@ if (isset($_GET['power'])) // regular page if (!$smarty->loadCache($cacheKeyPage, $pageData)) { - $npc = new CreatureList(array(['ct.id', $id])); + $npc = new CreatureList(array(['ct.id', $_id])); if ($npc->error) $smarty->notFound(Lang::$game['npc']); @@ -50,7 +50,38 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) // not yet implemented -> chicken out $smarty->error(); - +/* + + + +
{#Quick_Facts#}
+
    +
  • {#Level#}: {if $npc.minlevel<>$npc.maxlevel}{$npc.minlevel} - {/if}{$npc.maxlevel}
  • +
  • {#Classification#}: {$npc.rank}
  • +
  • {#React#}: A H
  • +
  • {#Faction#}: {$npc.faction}
  • +
  • {#Health#}: {if $npc.minhealth<>$npc.maxhealth}{$npc.minhealth} - {/if}{$npc.maxhealth}
  • +{if ($npc.minmana or $npc.maxmana)} +
  • {#Mana#}: {if $npc.minmana<>$npc.maxmana}{$npc.minmana} - {/if}{$npc.maxmana}
  • +{/if} +{if ($npc.moneysilver>0) or ($npc.moneygold>0) or ($npc.moneycopper>0)} +
  • {#Wealth#}:{if ($npc.moneygold>0)} + {$npc.moneygold}{/if} +{if ($npc.moneysilver>0)} + {$npc.moneysilver}{/if} +{if ($npc.moneycopper>0)} + {$npc.moneycopper}{/if} +
  • +{/if} +{if $npc.mindmg > 0 and $npc.maxdmg > 0} +
  • {#Damage#}: {$npc.mindmg} - {$npc.maxdmg}
  • +{/if} +{if $npc.armor > 0} +
  • {#Armor#}: {$npc.armor}
  • +{/if} +
+
+*/ unset($npc); @@ -88,7 +119,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $npc_cols[1], ($_SESSION['locale']>0)? 1: DBSIMPLE_SKIP, ($_SESSION['locale']>0)? 1: DBSIMPLE_SKIP, - $id + $_id ); if($row) @@ -294,7 +325,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $item_cols[2], ($_SESSION['locale'])? $_SESSION['locale']: DBSIMPLE_SKIP, ($_SESSION['locale'])? 1: DBSIMPLE_SKIP, - $id + $_id ); if($rows_s) { @@ -350,7 +381,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) c.id=? ', $quest_cols[2], - $id + $_id ); if($rows_qs) { @@ -362,7 +393,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) unset ($rows_qs); // Начиниают event-only квесты... - $rows_qse = event_find(array('quest_creature_id' => $id)); + $rows_qse = event_find(array('quest_creature_id' => $_id)); if($rows_qse) { if (!isset($npc['starts'])) @@ -382,7 +413,7 @@ $rows_qe = $DB->select(' c.id=? ', $quest_cols[2], - $id + $_id ); if($rows_qe) { @@ -404,7 +435,7 @@ $rows_qe = $DB->select(' OR RequiredNpcOrGo4=? ', $quest_cols[2], - $id, $id, $id, $id + $_id, $_id, $_id, $_id ); if($rows_qo) { @@ -476,9 +507,9 @@ $smarty->updatePageVars(array( 'path' => json_encode($pageData['path'], JSON_NUMERIC_CHECK), 'tab' => 0, 'type' => TYPE_NPC, - 'typeId' => $id + 'typeId' => $_id )); -$smarty->assign('community', CommunityContent::getAll(TYPE_NPC, $id)); // comments, screenshots, videos +$smarty->assign('community', CommunityContent::getAll(TYPE_NPC, $_id)); // comments, screenshots, videos $smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$npc, ['colon' => Lang::$colon])); $smarty->assign('lvData', $pageData); diff --git a/pages/pet.php b/pages/pet.php index c67e51ae..18a63f15 100644 --- a/pages/pet.php +++ b/pages/pet.php @@ -6,13 +6,13 @@ if (!defined('AOWOW_REVISION')) require 'includes/class.community.php'; -$id = intVal($pageParam); +$_id = intVal($pageParam); -$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_PET, $id, -1, User::$localeId]); +$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_PET, $_id, -1, User::$localeId]); if (!$smarty->loadCache($cacheKeyPage, $pageData)) { - $pet = new PetList(array(['id', $id])); + $pet = new PetList(array(['id', $_id])); if ($pet->error) $smarty->notFound(Lang::$game['pet']); @@ -26,23 +26,24 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $infobox[] = '[li][url=?spell=53270]'.Lang::$pet['exotic'].'[/url][/li]'; $pageData = array( - 'title' => $pet->getField('name', true), - 'path' => '[0, 8, '.$pet->getField('type').']', - 'page' => array( - 'petCalc' => Util::$tcEncoding[(int)($id / 10)] . Util::$tcEncoding[(2 * ($id % 10) + ($pet->getField('exotic') ? 1 : 0))], + 'title' => $pet->getField('name', true), + 'path' => '[0, 8, '.$pet->getField('type').']', + 'infobox' => '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]', + 'relTabs' => [], + 'page' => array( + 'petCalc' => Util::$tcEncoding[(int)($_id / 10)] . Util::$tcEncoding[(2 * ($_id % 10) + ($pet->getField('exotic') ? 1 : 0))], 'name' => $pet->getField('name', true), - 'id' => $id, + 'id' => $_id, 'icon' => $pet->getField('iconString'), 'expansion' => Util::$expansionString[$pet->getField('expansion')] ), - 'infobox' => '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]', ); // tameable & gallery $condition = array( ['ct.type', 1], // Beast ['ct.type_flags', 0x1, '&'], // tameable - ['ct.family', $id], // displayed petType + ['ct.family', $_id], // displayed petType [ 'OR', // at least neutral to at least one faction ['ft.A', 1, '<'], @@ -51,23 +52,25 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) ); $tng = new CreatureList($condition); - $pageData['tameable'] = array( + $pageData['relTabs'][] = array( + 'file' => 'creature', 'data' => $tng->getListviewData(NPCINFO_TAMEABLE), - 'params' => [ + 'params' => array( 'name' => '$LANG.tab_tameable', 'tabs' => '$tabsRelated', 'hiddenCols' => "$['type']", 'visibleCols' => "$['skin']", 'note' => sprintf(Util::$filterResultString, '?npcs=1&filter=fa=38'), 'id' => 'tameable' - ] + ) ); - $pageData['gallery'] = array( + $pageData['relTabs'][] = array( + 'file' => 'model', 'data' => $tng->getListviewData(NPCINFO_MODEL), - 'params' => [ - 'tabs' => '$tabsRelated' - ] + 'params' => array( + 'tabs' => '$tabsRelated' + ) ); // diet @@ -80,22 +83,23 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $food = new ItemList(array(['i.subClass', [5, 8]], ['i.FoodType', $list])); $food->addGlobalsToJscript($smarty); - $pageData['diet'] = array( + $pageData['relTabs'][] = array( + 'file' => 'item', 'data' => $food->getListviewData(), - 'params' => [ + 'params' => array( 'name' => '$LANG.diet', 'tabs' => '$tabsRelated', 'hiddenCols' => "$['source', 'slot', 'side']", 'sort' => "$['level']", 'id' => 'diet' - ] + ) ); // spells $mask = 0x0; foreach (Util::$skillLineMask[-1] as $idx => $pair) { - if ($pair[0] == $id) + if ($pair[0] == $_id) { $mask = 1 << $idx; break; @@ -122,14 +126,15 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $spells = new SpellList($conditions); $spells->addGlobalsToJscript($smarty, GLOBALINFO_SELF); - $pageData['abilities'] = array( + $pageData['relTabs'][] = array( + 'file' => 'spell', 'data' => $spells->getListviewData(), - 'params' => [ + 'params' => array( 'name' => '$LANG.tab_abilities', 'tabs' => '$tabsRelated', 'visibleCols' => "$['schools', 'level']", 'id' => 'abilities' - ] + ) ); // talents @@ -152,16 +157,17 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $talents = new SpellList($conditions); $talents->addGlobalsToJscript($smarty, GLOBALINFO_SELF); - $pageData['talents'] = array( + $pageData['relTabs'][] = array( + 'file' => 'spell', 'data' => $talents->getListviewData(), - 'params' => [ + 'params' => array( 'tabs' => '$tabsRelated', 'visibleCols' => "$['tier', 'level']", 'name' => '$LANG.tab_talents', 'id' => 'talents', 'sort' => "$['tier', 'name']", '_petTalents' => 1 - ] + ) ); $smarty->saveCache($cacheKeyPage, $pageData); @@ -175,12 +181,12 @@ $smarty->updatePageVars(array( 'path' => $pageData['path'], 'tab' => 0, 'type' => TYPE_PET, - 'typeId' => $id, + 'typeId' => $_id, 'reqJS' => array( 'template/js/swfobject.js' ) )); -$smarty->assign('community', CommunityContent::getAll(TYPE_PET, $id)); // comments, screenshots, videos +$smarty->assign('community', CommunityContent::getAll(TYPE_PET, $_id)); // comments, screenshots, videos $smarty->assign('lang', array_merge(Lang::$main, Lang::$game)); $smarty->assign('lvData', $pageData); diff --git a/pages/quest.php b/pages/quest.php index 511e5990..fc8e5cb6 100644 --- a/pages/quest.php +++ b/pages/quest.php @@ -6,10 +6,10 @@ if (!defined('AOWOW_REVISION')) require 'includes/class.community.php'; -$id = intVal($pageParam); +$_id = intVal($pageParam); -$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_QUEST, $id, -1, User::$localeId]); -$cacheKeyTooltip = implode('_', [CACHETYPE_TOOLTIP, TYPE_QUEST, $id, -1, User::$localeId]); +$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_QUEST, $_id, -1, User::$localeId]); +$cacheKeyTooltip = implode('_', [CACHETYPE_TOOLTIP, TYPE_QUEST, $_id, -1, User::$localeId]); // AowowPower-request if (isset($_GET['power'])) @@ -20,11 +20,11 @@ if (isset($_GET['power'])) if (!$smarty->loadCache($cacheKeyTooltip, $x)) { - $quest = new QuestList(array(['qt.id', $id])); + $quest = new QuestList(array(['qt.id', $_id])); if ($quest->error) - die('$WowheadPower.registerQuest(\''.$id.'\', '.User::$localeId.', {})'); + die('$WowheadPower.registerQuest(\''.$_id.'\', '.User::$localeId.', {})'); - $x = '$WowheadPower.registerQuest('.$id.', '.User::$localeId.", {\n"; + $x = '$WowheadPower.registerQuest('.$_id.', '.User::$localeId.", {\n"; $x .= "\tname_".User::$localeString.": '".Util::jsEscape($quest->getField('Title', true))."',\n"; $x .= "\ttooltip_".User::$localeString.': \''.$quest->renderTooltip()."'\n"; // daily: 1 ... not used in wowheadPower => omitted here $x .= "});"; @@ -38,7 +38,7 @@ if (isset($_GET['power'])) // regular page if (!$smarty->loadCache($cacheKeyPage, $pageData)) { - $quest = new QuestList(array(['qt.id', $id])); + $quest = new QuestList(array(['qt.id', $_id])); if ($quest->error) $smarty->notFound(Lang::$game['quest']); @@ -52,7 +52,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) unset($quest); // Основная инфа - $quest = GetDBQuestInfo($id, 0xFFFFFF); + $quest = GetDBQuestInfo($_id, 0xFFFFFF); $path = [0, 3]; // TODO /* ЦЕПОЧКА КВЕСТОВ */ @@ -607,10 +607,10 @@ $smarty->updatePageVars(array( 'path' => json_encode($pageData['path'], JSON_NUMERIC_CHECK), 'tab' => 0, 'type' => TYPE_QUEST, - 'typeId' => $id + 'typeId' => $_id )); -$smarty->assign('community', CommunityContent::getAll(TYPE_QUEST, $id)); // comments, screenshots, videos +$smarty->assign('community', CommunityContent::getAll(TYPE_QUEST, $_id)); // comments, screenshots, videos $smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$quest, ['colon' => Lang::$colon])); $smarty->assign('lvData', $pageData); diff --git a/pages/spell.php b/pages/spell.php index b4c4c47f..4e3f0f0f 100644 --- a/pages/spell.php +++ b/pages/spell.php @@ -6,10 +6,10 @@ if (!defined('AOWOW_REVISION')) require 'includes/class.community.php'; -$id = intVal($pageParam); +$_id = intVal($pageParam); -$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_SPELL, $id, -1, User::$localeId]); -$cacheKeyTooltip = implode('_', [CACHETYPE_TOOLTIP, TYPE_SPELL, $id, -1, User::$localeId]); +$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_SPELL, $_id, -1, User::$localeId]); +$cacheKeyTooltip = implode('_', [CACHETYPE_TOOLTIP, TYPE_SPELL, $_id, -1, User::$localeId]); // AowowPower-request if (isset($_GET['power'])) @@ -20,11 +20,11 @@ if (isset($_GET['power'])) if (!$smarty->loadCache($cacheKeyTooltip, $x)) { - $spell = new SpellList(array(['s.id', $id])); + $spell = new SpellList(array(['s.id', $_id])); if ($spell->error) - die('$WowheadPower.registerSpell('.$id.', '.User::$localeId.', {});'); + die('$WowheadPower.registerSpell('.$_id.', '.User::$localeId.', {});'); - $x = '$WowheadPower.registerSpell('.$id.', '.User::$localeId.", {\n"; + $x = '$WowheadPower.registerSpell('.$_id.', '.User::$localeId.", {\n"; $pt = []; if ($n = $spell->getField('name', true)) $pt[] = "\tname_".User::$localeString.": '".Util::jsEscape($n)."'"; @@ -51,17 +51,17 @@ if (isset($_GET['power'])) // regular page if (!$smarty->loadCache($cacheKeyPage, $pageData)) { - $spell = new SpellList(array(['s.id', $id])); + $spell = new SpellList(array(['s.id', $_id])); if ($spell->error) $smarty->notFound(Lang::$game['spell']); - $cat = $spell->getField('typeCat'); - $l = [null, 'A', 'B', 'C']; + $_cat = $spell->getField('typeCat'); + $path = [0, 1, $_cat]; - $pageData['path'] = [0, 1, $cat]; + $l = [null, 'A', 'B', 'C']; // reconstruct path / title - switch($cat) + switch($_cat) { case -2: case 7: @@ -73,65 +73,51 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) { if ($cl & (1 << ($i - 1))) { - $pageData['path'][] = $i; + $path[] = $i; break; } $i++; } - if ($cat == -13) + if ($_cat == -13) { - $pageData['path'][] = ($spell->getField('cuFlags') & (SPELL_CU_GLYPH_MAJOR | SPELL_CU_GLYPH_MINOR)) >> 6; + $path[] = ($spell->getField('cuFlags') & (SPELL_CU_GLYPH_MAJOR | SPELL_CU_GLYPH_MINOR)) >> 6; break; } case 9: case -3: case 11: - $pageData['path'][] = $spell->getField('skillLines')[0]; + $path[] = $spell->getField('skillLines')[0]; - if ($cat == 11) + if ($_cat == 11) if ($_ = $spell->getField('reqSpellId')) - $pageData['path'][] = $_; + $path[] = $_; break; case -11: foreach (SpellList::$skillLines as $line => $skills) if (in_array($spell->getField('skillLines')[0], $skills)) - $pageData['path'][] = $line; + $path[] = $line; break; case -7: // only spells unique in skillLineAbility will always point to the right skillLine :/ $_ = $spell->getField('cuFlags'); if ($_ & SPELL_CU_PET_TALENT_TYPE0) - $pageData['path'][] = 411; // Ferocity + $path[] = 411; // Ferocity else if ($_ & SPELL_CU_PET_TALENT_TYPE1) - $pageData['path'][] = 409; // Tenacity + $path[] = 409; // Tenacity else if ($_ & SPELL_CU_PET_TALENT_TYPE2) - $pageData['path'][] = 410; // Cunning + $path[] = 410; // Cunning } - $pageData['page'] = $spell->getDetailPageData(); - - // description - @list( - $pageData['page']['info'], - $pageData['page']['spells'] - ) = $spell->renderTooltip(MAX_LEVEL, true); - - // buff - @list( - $pageData['page']['buff'], - $pageData['page']['buffspells'] - ) = $spell->renderBuff(MAX_LEVEL, true); - // infobox $infobox = []; - if (!in_array($cat, [-5, -6])) // not mount or vanity pet + if (!in_array($_cat, [-5, -6])) // not mount or vanity pet { if ($_ = $spell->getField('talentLevel')) // level - $infobox[] = '[li]'.(in_array($cat, [-2, 7, -13]) ? sprintf(Lang::$game['reqLevel'], $_) : Lang::$game['level'].Lang::$colon.$_).'[/li]'; + $infobox[] = '[li]'.(in_array($_cat, [-2, 7, -13]) ? sprintf(Lang::$game['reqLevel'], $_) : Lang::$game['level'].Lang::$colon.$_).'[/li]'; else if ($_ = $spell->getField('spellLevel')) - $infobox[] = '[li]'.(in_array($cat, [-2, 7, -13]) ? sprintf(Lang::$game['reqLevel'], $_) : Lang::$game['level'].Lang::$colon.$_).'[/li]'; + $infobox[] = '[li]'.(in_array($_cat, [-2, 7, -13]) ? sprintf(Lang::$game['reqLevel'], $_) : Lang::$game['level'].Lang::$colon.$_).'[/li]'; } if ($mask = $spell->getField('reqRaceMask')) // race @@ -162,7 +148,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $infobox[] = '[li]'.Lang::$game['requires2'].' '.Util::localizedString($bar, 'name').'[/li]'; } - if (in_array($cat, [9, 11])) // primary & secondary trades + if (in_array($_cat, [9, 11])) // primary & secondary trades { // skill $bar = SkillList::getName($spell->getField('skillLines')[0]); @@ -195,8 +181,26 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) if ($cost = DB::Aowow()->selectCell('SELECT spellcost FROM npc_trainer WHERE spell = ?d', $spell->id)) $infobox[] = '[li]'.Lang::$spell['trainingCost'].Lang::$colon.'[money='.$cost.'][/li]'; - // title - $pageData['title'] = [$spell->getField('name', true), Util::ucFirst(Lang::$game['spell'])]; + $pageData = array( + 'title' => $spell->getField('name', true), + 'path' => json_encode($path, JSON_NUMERIC_CHECK), + 'infobox' => $infobox, + 'relTabs' => [], + 'view3D' => 0, + 'page' => $spell->getDetailPageData() + ); + + // description + @list( + $pageData['page']['info'], + $pageData['page']['spells'] + ) = $spell->renderTooltip(MAX_LEVEL, true); + + // buff + @list( + $pageData['page']['buff'], + $pageData['page']['buffspells'] + ) = $spell->renderBuff(MAX_LEVEL, true); // js-globals $spell->addGlobalsToJScript($smarty, GLOBALINFO_RELATED); @@ -241,8 +245,6 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) // Iterate through all effects: $pageData['page']['effect'] = []; - $pageData['view3D'] = 0; - for ($i = 1; $i < 4; $i++) { if ($spell->getField('effect'.$i.'Id') <= 0) @@ -363,7 +365,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) break; case 95: // Skinning // todo (low): sort this out - 0:skinning (corpse, beast), 1:hearb (GO), 2: mineral (GO), 3: engineer (corpse, mechanic) - $foo['name'] .= ' ('.sprintf(Util::$dfnString, 'NYI]', $effMV).')'; + $foo['name'] .= ' ('.sprintf(Util::$dfnString, '[NYI]', $effMV).')'; break; case 108: // Dispel Mechanic $foo['name'] .= ' ('.sprintf(Util::$dfnString, @Lang::$game['me'][$effMV], $effMV).')'; @@ -429,7 +431,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $st = DB::Aowow()->selectRow('SELECT *, displayIdA as model1, displayIdH as model2 FROM ?_shapeshiftForms WHERE id = ?d', $effMV); if ($st['creatureType'] > 0) - $infobox[] = '[li]'.Lang::$game['type'].Lang::$colon.Lang::$game['ct'][$st['creatureType']].'[/li]'; + $pageData['infobox'][] = '[li]'.Lang::$game['type'].Lang::$colon.Lang::$game['ct'][$st['creatureType']].'[/li]'; if (!$pageData['view3D'] && $st) $pageData['view3D'] = $st['model2'] ? $st['model'.rand(1,2)]: $st['model1']; @@ -572,9 +574,10 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) if (in_array($effAura, [11, 12, 36, 77]) || in_array($effId, [])) unset($foo['value']); } - unset($foo); // clear reference - $pageData['infobox'] = $infobox ? '[ul]'.implode('', $infobox).'[/ul]' : null; + $pageData['infobox'] = '[ul]'.implode('', $pageData['infobox']).'[/ul]'; + + unset($foo); // clear reference /******* * extra tabs @@ -611,19 +614,22 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $modSpells = new SpellList($conditions); if (!$modSpells->error) { - $pageData['modifies'] = array( + + if (!$modSpells->hasSetFields(['skillLines'])) + $msH = "$['skill']"; + + $pageData['relTabs'][] = array( 'data' => $modSpells->getListviewData(), 'params' => [ 'tabs' => '$tabsRelated', 'id' => 'modifies', 'name' => '$LANG.tab_modifies', - 'visibleCols' => "$['level']" + 'visibleCols' => "$['level']", + 'hiddenCols' => isset($msH) ? $msH : null ] ); - $modSpells->addGlobalsToJScript($smarty); - if(!$modSpells->hasSetFields(['skillLines'])) - $pageData['modifies']['params']['hiddenCols'] = "$['skill']"; + $modSpells->addGlobalddoJScript($smarty); } } @@ -660,19 +666,21 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $modsSpell = new SpellList($conditions); if (!$modsSpell->error) { - $pageData['modifiedBy'] = array( + if (!$modsSpell->hasSetFields(['skillLines'])) + $mbH = "$['skill']"; + + $pageData['relTabs'][] = array( 'data' => $modsSpell->getListviewData(), 'params' => [ 'tabs' => '$tabsRelated', 'id' => 'modified-by', 'name' => '$LANG.tab_modifiedby', - 'visibleCols' => "$['level']" + 'visibleCols' => "$['level']", + 'hiddenCols' => isset($mbH) ? $mbH : null ] ); $modsSpell->addGlobalsToJScript($smarty); - if(!$modsSpell->hasSetFields(['skillLines'])) - $pageData['modifiedBy']['params']['hiddenCols'] = "$['skill']"; } } @@ -689,19 +697,22 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $saSpells = new SpellList($conditions); if (!$saSpells->error) { - $pageData['seeAlso'] = array( + + if (!$saSpells->hasSetFields(['skillLines'])) + $saH = "$['skill']"; + + $pageData['relTabs'][] = array( 'data' => $saSpells->getListviewData(), 'params' => [ 'tabs' => '$tabsRelated', 'id' => 'see-also', 'name' => '$LANG.tab_seealso', - 'visibleCols' => "$['level']" + 'visibleCols' => "$['level']", + 'hiddenCols' => isset($saH) ? $saH : null ] ); $saSpells->addGlobalsToJScript($smarty); - if(!$saSpells->hasSetFields(['skillLines'])) - $pageData['seeAlso']['params']['hiddenCols'] = "$['skill']"; } // used by - itemset @@ -714,7 +725,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $ubSets = new ItemsetList($conditions); if (!$ubSets->error) { - $pageData['usedByItemset'] = array( + $pageData['relTabs'][] = array( 'data' => $ubSets->getListviewData(), 'params' => [ 'tabs' => '$tabsRelated', @@ -729,7 +740,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) // used by - item $conditions = array( - 'OR', + 'OR', // 6: learn spell ['AND', ['spelltrigger_1', 6, '!'], ['spellid_1', $spell->id]], ['AND', ['spelltrigger_2', 6, '!'], ['spellid_2', $spell->id]], ['AND', ['spelltrigger_3', 6, '!'], ['spellid_3', $spell->id]], @@ -740,7 +751,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $ubItems = new ItemList($conditions); if (!$ubItems->error) { - $pageData['usedByItem'] = array( + $pageData['relTabs'][] = array( 'data' => $ubItems->getListviewData(), 'params' => [ 'tabs' => '$tabsRelated', @@ -759,7 +770,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $coAchievemnts = new AchievementList(array(['id', $crs])); if (!$coAchievemnts->error) { - $pageData['criteriaOf'] = array( + $pageData['relTabs'][] = array( 'data' => $coAchievemnts->getListviewData(), 'params' => [ 'tabs' => '$tabsRelated', @@ -836,7 +847,8 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) } } - $pageData['contains'] = array( + $pageData['relTabs'][] = array( + 'file' => 'item', 'data' => $lv, 'params' => [ 'tabs' => '$tabsRelated', @@ -849,8 +861,8 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) } // teaches - // spell_learn_spell - // skill_discovery_template + // -> spell_learn_spell + // -> skill_discovery_template /* source trainer first check source if not trainer : break @@ -884,6 +896,8 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) stunt through the tables... >.< */ + $spellArr['taughtbyquest'] = []; + $spellArr['usedbynpc'] = []; /* used by item @@ -935,16 +949,16 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) // menuId 1: Spell g_initPath() // tabId 0: Database g_initHeader() $smarty->updatePageVars(array( - 'title' => implode(" - ", $pageData['title']), - 'path' => json_encode($pageData['path'], JSON_NUMERIC_CHECK), + 'title' => $pageData['title'].' - '.Util::ucFirst(Lang::$game['spell']), + 'path' => $pageData['path'], 'tab' => 0, 'type' => TYPE_SPELL, - 'typeId' => $id, + 'typeId' => $_id, 'reqJS' => array( 'template/js/swfobject.js' ) )); -$smarty->assign('community', CommunityContent::getAll(TYPE_SPELL, $id)); // comments, screenshots, videos +$smarty->assign('community', CommunityContent::getAll(TYPE_SPELL, $_id)); // comments, screenshots, videos $smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$spell, ['colon' => Lang::$colon])); $smarty->assign('lvData', $pageData); diff --git a/pages/title.php b/pages/title.php index 6b2e0779..e6e70606 100644 --- a/pages/title.php +++ b/pages/title.php @@ -6,13 +6,13 @@ if (!defined('AOWOW_REVISION')) require 'includes/class.community.php'; -$id = intVal($pageParam); +$_id = intVal($pageParam); -$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_TITLE, $id, -1, User::$localeId]); +$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_TITLE, $_id, -1, User::$localeId]); if (!$smarty->loadCache($cacheKeyPage, $pageData)) { - $title = new TitleList(array(['id', $id])); + $title = new TitleList(array(['id', $_id])); if ($title->error) $smarty->notFound(Lang::$game['title']); @@ -31,17 +31,19 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $infobox[] = Lang::$game['eventShort'].Lang::$colon.'[url=?event='.$e.']'.WorldEventList::getName($e).'[/url]'; $pageData = array( - 'page' => array( - 'name' => $title->getHtmlizedName(), - 'id' => $id, - 'expansion' => Util::$expansionString[$title->getField('expansion')] - ), + 'title' => Util::ucFirst(trim(str_replace('%s', '', str_replace(',', '', $title->getField('male', true))))), + 'path' => '[0, 10, '.$title->getField('category').']', 'infobox' => '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]', + 'relTabs' => [], + 'page' => array( + 'name' => $title->getHtmlizedName(), + 'expansion' => Util::$expansionString[$title->getField('expansion')] + ) ); - if (!empty($title->sources[$id])) + if (!empty($title->sources[$_id])) { - foreach ($title->sources[$id] as $type => $entries) + foreach ($title->sources[$_id] as $type => $entries) { switch ($type) { @@ -49,26 +51,32 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $quests = new QuestList(array(['id', $entries])); $quests->addGlobalsToJscript($smarty, GLOBALINFO_REWARDS); - $pageData['page']['questReward'] = $quests->getListviewData(); - $pageData['page']['questParams'] = array( - 'id' => 'reward-from-quest', - 'name' => '$LANG.tab_rewardfrom', - 'hiddenCols' => "$['experience', 'money']", - 'visibleCols' => "$['category']", - 'tabs' => '$tabsRelated' + $pageData['relTabs'][] = array( + 'file' => 'quest', + 'data' => $quests->getListviewData(), + 'params' => array( + 'id' => 'reward-from-quest', + 'name' => '$LANG.tab_rewardfrom', + 'hiddenCols' => "$['experience', 'money']", + 'visibleCols' => "$['category']", + 'tabs' => '$tabsRelated' + ) ); break; case 12: $acvs = new AchievementList(array(['id', $entries])); $acvs->addGlobalsToJscript($smarty); - $pageData['page']['acvReward'] = $acvs->getListviewData(); - $pageData['page']['acvParams'] = array( - 'id' => 'reward-from-achievement', - 'name' => '$LANG.tab_rewardfrom', - 'visibleCols' => "$['category']", - 'sort' => "$['reqlevel', 'name']", - 'tabs' => '$tabsRelated' + $pageData['relTabs'][] = array( + 'file' => 'achievement', + 'data' => $acvs->getListviewData(), + 'params' => array( + 'id' => 'reward-from-achievement', + 'name' => '$LANG.tab_rewardfrom', + 'visibleCols' => "$['category']", + 'sort' => "$['reqlevel', 'name']", + 'tabs' => '$tabsRelated' + ) ); break; // case 13: @@ -77,9 +85,6 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) } } - $pageData['title'] = Util::ucFirst(trim(str_replace('%s', '', str_replace(',', '', $title->getField('male', true))))); - $pageData['path'] = '[0, 10, '.$title->getField('category').']'; - $smarty->saveCache($cacheKeyPage, $pageData); } @@ -91,9 +96,9 @@ $smarty->updatePageVars(array( 'path' => $pageData['path'], 'tab' => 0, 'type' => TYPE_TITLE, - 'typeId' => $id + 'typeId' => $_id )); -$smarty->assign('community', CommunityContent::getAll(TYPE_TITLE, $id)); // comments, screenshots, videos +$smarty->assign('community', CommunityContent::getAll(TYPE_TITLE, $_id)); // comments, screenshots, videos $smarty->assign('lang', array_merge(Lang::$main)); $smarty->assign('lvData', $pageData); diff --git a/template/achievement.tpl b/template/achievement.tpl index 54713dc3..fdf59c29 100644 --- a/template/achievement.tpl +++ b/template/achievement.tpl @@ -23,7 +23,7 @@