Files
aowow/pages/factions.php
Sarjuuk 819a46ae15 detail page for events (with not much in it)
detail and listview for NPCs (without spawns, spells and some filters)
forcing the template to be more generic

- noticed, that the loot display is off. It happens with different modes
  on a creature, that has the same loot but different chances or quantities
  ... analyzing
2014-02-08 12:22:08 +01:00

80 lines
2.2 KiB
PHP

<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
$cats = Util::extractURLParams($pageParam);
$path = [0, 7];
$title = [Util::ucFirst(Lang::$game['factions'])];
$cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_FACTION, -1, implode('.', $cats), User::$localeId]);
$validCats = array(
1118 => [469, 891, 67, 892, 169],
980 => [936],
1097 => [1037, 1052, 1117],
0 => true
);
if (!Util::isValidPage($validCats, $cats))
$smarty->error();
if (!$smarty->loadCache($cacheKey, $pageData))
{
$conditions = [];
if (!User::isInGroup(U_GROUP_STAFF))
$conditions[] = ['reputationIndex', -1, '!']; // unlisted factions
if (isset($cats[0]) && empty($cats[1]))
{
if (!$cats[0])
$conditions[] = ['f1.parentFactionId', [1118, 980, 1097, 469, 891, 67, 892, 169, 1037, 1052, 1117, 936], '!'];
else
{
$subs = DB::Aowow()->selectCol('SELECT id FROM ?_factions WHERE parentFactionId = ?d', $cats[0]);
$conditions[] = ['OR', ['f1.parentFactionId', $subs], ['f1.id', $subs]];
}
$path[] = $cats[0];
// array_unshift($title, Lang::$factions['cat'][$cats[0]]);
}
else if (!empty($cats[1]))
{
$conditions[] = ['f1.parentFactionId', $cats[1]];
$path[] = $cats[0];
$path[] = $cats[1];
// array_unshift($title, Lang::$factions['cat'][$cats[1]]);
}
$factions = new FactionList($conditions);
// menuId 7: Faction g_initPath()
// tabId 0: Database g_initHeader()
$pageData = array(
'page' => array(
'title' => implode(' - ', $title),
'path' => json_encode($path, JSON_NUMERIC_CHECK),
'tab' => 0
),
'lv' => array(
array(
'file' => 'faction',
'data' => $factions->getListviewData(),
'params' => []
)
)
);
$smarty->saveCache($cacheKey, $pageData);
}
$smarty->updatePageVars($pageData['page']);
$smarty->assign('lang', Lang::$main);
$smarty->assign('lvData', $pageData['lv']);
// load the page
$smarty->display('list-page-generic.tpl');
?>