Files
aowow/pages/pets.php
Sarjuuk 73cdce784e BaseTypes:
- rewrote BaseType::iterate() to be a generator and yield references (requires php 5.5)
- reduced usage of bandaid BaseType::reset()
- removed Util::getIdFieldName() which was even more of a bandaid
- discovered DBSimple::selectPage() and consequently removed $matchQuery as they are now obsoloete

Util:
- added trainerTemplate lists for future use with trainers and trained spells

misc. forgotten and/or broken stuff here and there
2013-08-20 20:45:24 +02:00

56 lines
1.4 KiB
PHP

<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
$cat = Util::extractURLParams($pageParam)[0];
$path = [0, 8];
$validCats = [0, 1, 2];
$title = [Util::ucFirst(Lang::$game['pets'])];
$cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_PET, -1, isset($cat) ? $cat : -1, User::$localeId]);
if (!in_array($cat, $validCats))
$smarty->error();
$path[] = $cat; // should be only one parameter anyway
if (isset($cat))
array_unshift($title, Lang::$pet['cat'][$cat]);
if (!$smarty->loadCache($cacheKey, $pageData))
{
$pets = new PetList(isset($cat) ? array(['type', (int)$cat]) : []);
$pageData = array(
'file' => 'pet',
'data' => $pets->getListviewData(),
'params' => array(
'visibleCols' => "$['abilities']"
)
);
if (($mask = $pets->hasDiffFields(['type'])) == 0x0)
$pageData['params']['hiddenCols'] = "$['type']";
$pets->addGlobalsToJscript($smarty, GLOBALINFO_RELATED);
$smarty->saveCache($cacheKey, $pageData);
}
// menuId 8: Pets g_initPath()
// tabid 0: Database g_initHeader()
$smarty->updatePageVars(array(
'title' => implode(" - ", $title),
'path' => "[".implode(", ", $path)."]",
'tab' => 0
));
$smarty->assign('lang', Lang::$main);
$smarty->assign('lvData', $pageData);
// load the page
$smarty->display('generic-no-filter.tpl');
?>