Files
aowow/pages/title.php
Sarjuuk 58316679bf ordered bricks somewhat
simple listview-pages now use one shared template (instead of having the same file multiple times)

some bug fixing here and there
 - achievement: faction is no longer out of range (need to reparse the faction :/)
 - item: quality is prepended to the name again and wont be left out in case of heirlooms (is 0)
 - general: forgot to change some error()-calls in index
 - and some more wich i forgot..
2013-03-23 13:40:15 +01:00

106 lines
3.9 KiB
PHP

<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
require 'includes/class.community.php';
$id = intVal($pageParam);
$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_TITLE, $id, -1, User::$localeId]);
if (!$smarty->loadCache($cacheKeyPage, $pageData))
{
$title = new TitleList(array(['id', $id]));
if ($title->error)
$smarty->notFound(Lang::$game['title']);
$title->addGlobalsToJscript($pageData);
$title->reset();
$infobox = [];
$colon = User::$localeId == LOCALE_FR ? ' : ' : ': '; // Je suis un prick! <_<
if ($title->getField('side') == 1)
$infobox[] = Lang::$main['side'].$colon.'[span class=alliance-icon]'.Lang::$game['alliance'].'[/span]';
else if ($title->getField('side') == 2)
$infobox[] = Lang::$main['side'].$colon.'[span class=horde-icon]'.Lang::$game['horde'].'[/span]';
else
$infobox[] = Lang::$main['side'].$colon.Lang::$main['both'];
if ($g = $title->getField('gender'))
$infobox[] = Lang::$main['gender'].$colon.'[span class='.($g == 2 ? 'female' : 'male').'-icon]'.Lang::$main['sex'][$g].'[/span]';
if ($e = $title->getField('eventId'))
$infobox[] = Lang::$game['eventShort'].$colon.'[url=?event='.$e.']'.WorldEvent::getName($e).'[/url]';
$pageData = array(
'page' => array(
'name' => $title->getHtmlizedName(),
'id' => $id,
'expansion' => Util::$expansionString[$title->getField('expansion')]
),
'infobox' => '[li][ul]'.implode('[/ul][ul]', $infobox).'[/ul][/li]',
);
if (!empty($title->sources[$id]))
{
foreach ($title->sources[$id] as $type => $entries)
{
switch ($type)
{
case 4:
$quests = new QuestList(array(['id', $entries]));
$quests->addRewardsToJscript($pageData);
$pageData['page']['questReward'] = $quests->getListviewData();
$pageData['page']['questParams'] = array(
'id' => 'reward-from-quest',
'name' => '$LANG.tab_rewardfrom',
'hiddenCols' => "$['side']",
'visibleCols' => "$['category']"
);
break;
case 12:
$acvs = new AchievementList(array(['id', $entries]));
$acvs->addGlobalsToJscript($pageData);
$acvs->addRewardsToJscript($pageData);
$pageData['page']['acvReward'] = $acvs->getListviewData();
$pageData['page']['acvParams'] = array(
'id' => 'reward-from-achievement',
'name' => '$LANG.tab_rewardfrom',
'visibleCols' => "$['category']",
'sort' => "$['reqlevel', 'name']"
);
break;
// case 13:
// not displayed
}
}
}
$pageData['title'] = ucFirst(trim(str_replace('%s', '', str_replace(',', '', $title->names[$title->id][0]))));
$pageData['path'] = '[0, 10, '.$title->getField('category').']';
$smarty->saveCache($cacheKeyPage, $pageData);
}
$smarty->updatePageVars(array(
'title' => $pageData['title']." - ".ucfirst(Lang::$game['title']),
'path' => $pageData['path'],
'tab' => 0, // for g_initHeader($tab)
'type' => TYPE_TITLE, // 11:Titles
'typeId' => $id
));
$smarty->assign('community', CommunityContent::getAll(TYPE_TITLE, $id)); // comments, screenshots, videos
$smarty->assign('lang', array_merge(Lang::$main));
$smarty->assign('lvData', $pageData);
$smarty->assign('mysql', DB::Aowow()->getStatistics());
$smarty->display('title.tpl');
?>