Template/Update (Part 17)

* convert dbtype 'itemset'
This commit is contained in:
Sarjuuk 2025-08-08 16:09:14 +02:00
parent 70e4bca10f
commit 11bb5a521b
12 changed files with 316 additions and 265 deletions

View file

@ -6,71 +6,76 @@ if (!defined('AOWOW_REVISION'))
die('illegal access');
// menuId 2: Itemset g_initPath()
// tabId 0: Database g_initHeader()
class ItemsetPage extends GenericPage
class ItemsetBaseResponse extends TemplateResponse implements ICache
{
use TrDetailPage;
use TrDetailPage, TrCache;
protected $summary = [];
protected $bonusExt = '';
protected $description = '';
protected $unavailable = false;
protected $pieces = [];
protected $spells = [];
protected int $cacheType = CACHE_TYPE_PAGE;
protected $type = Type::ITEMSET;
protected $typeId = 0;
protected $tpl = 'itemset';
protected $path = [0, 2];
protected $tabId = 0;
protected $mode = CACHE_TYPE_PAGE;
protected $scripts = [[SC_JS_FILE, 'js/swfobject.js'], [SC_JS_FILE, 'js/Summary.js']];
protected string $template = 'itemset';
protected string $pageName = 'itemset';
protected ?int $activeTab = parent::TAB_DATABASE;
protected array $breadcrumb = [0, 2];
protected $_get = ['domain' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\Locale::tryFromDomain']];
protected array $scripts = [[SC_JS_FILE, 'js/swfobject.js'], [SC_JS_FILE, 'js/Summary.js']];
private $powerTpl = '$WowheadPower.registerItemSet(%d, %d, %s);';
public int $type = Type::ITEMSET;
public int $typeId = 0;
public string $bonusExt = '';
public string $description = '';
public bool $unavailable = false;
public array $pieces = [];
public array $spells = [];
public ?Summary $summary = null;
public function __construct($pageCall, $id)
private ItemsetList $subject;
public function __construct(string $id)
{
parent::__construct($pageCall, $id);
parent::__construct($id);
// temp locale
if ($this->mode == CACHE_TYPE_TOOLTIP && $this->_get['domain'])
Lang::load($this->_get['domain']);
$this->typeId = intVal($id);
$this->typeId = intVal($id);
$this->contribute = Type::getClassAttrib($this->type, 'contribute') ?? CONTRIBUTE_NONE;
}
protected function generate() : void
{
$this->subject = new ItemsetList(array(['id', $this->typeId]));
if ($this->subject->error)
$this->notFound(Lang::game('itemset'), Lang::itemset('notFound'));
$this->generateNotFound(Lang::game('itemset'), Lang::itemset('notFound'));
$this->name = $this->subject->getField('name', true);
$this->extendGlobalData($this->subject->getJSGlobals());
}
protected function generatePath()
{
if ($_ = $this->subject->getField('classMask'))
{
$bit = log($_, 2);
if (intVal($bit) != $bit) // bit is float => multiple classes were set => skip out
return;
$this->h1 = $this->subject->getField('name', true);
$this->path[] = $bit + 1;
}
}
$this->gPageInfo += array(
'type' => $this->type,
'typeId' => $this->typeId,
'name' => $this->h1
);
protected function generateTitle()
{
array_unshift($this->title, $this->name, Util::ucFirst(Lang::game('itemset')));
}
protected function generateContent()
{
$_ta = $this->subject->getField('contentGroup');
$_ty = $this->subject->getField('type');
$_sk = $this->subject->getField('skillId');
$_evt = $this->subject->getField('eventId');
$_cnt = count($this->subject->getField('pieces'));
$_cl = ChrClass::fromMask($this->subject->getField('classMask'));
/*************/
/* Menu Path */
/*************/
if (count($_cl) == 1)
$this->breadcrumb[] = $_cl[0];
/**************/
/* Page Title */
/**************/
array_unshift($this->title, $this->h1, Util::ucWords(Lang::game('itemset')));
/***********/
/* Infobox */
@ -78,15 +83,14 @@ class ItemsetPage extends GenericPage
$infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
// unavailable (todo (low): set data)
if ($this->subject->getField('cuFlags') & CUSTOM_UNAVAILABLE)
$infobox[] = Lang::main('unavailable');
// worldevent
if ($e = $this->subject->getField('eventId'))
if ($_evt)
{
$infobox[] = Lang::game('eventShort').Lang::main('colon').'[event='.$e.']';
$this->extendGlobalIds(Type::WORLDEVENT, $e);
$infobox[] = Lang::game('eventShort', ['[event='.$_evt.']']);
$this->extendGlobalIds(Type::WORLDEVENT, $_evt);
}
// itemLevel
@ -102,32 +106,34 @@ class ItemsetPage extends GenericPage
}
// class
$jsg = [];
if ($cl = Lang::getClassString($this->subject->getField('classMask'), $jsg, Lang::FMT_MARKUP))
{
$this->extendGlobalIds(Type::CHR_CLASS, ...$jsg);
$t = count($jsg)== 1 ? Lang::game('class') : Lang::game('classes');
$t = count($jsg) == 1 ? Lang::game('class') : Lang::game('classes');
$infobox[] = Util::ucFirst($t).Lang::main('colon').$cl;
}
// required level
if ($lvl = $this->subject->getField('reqLevel'))
$infobox[] = sprintf(Lang::game('reqLevel'), $lvl);
$infobox[] = Lang::game('reqLevel', [$lvl]);
// type
if ($_ty)
$infobox[] = Lang::game('type').Lang::main('colon').Lang::itemset('types', $_ty);
$infobox[] = Lang::game('type').Lang::itemset('types', $_ty);
// tag
if ($_ta)
$infobox[] = Lang::itemset('_tag').Lang::main('colon').'[url=?itemsets&filter=ta='.$_ta.']'.Lang::itemset('notes', $_ta).'[/url]';
$infobox[] = Lang::itemset('_tag').'[url=?itemsets&filter=ta='.$_ta.']'.Lang::itemset('notes', $_ta).'[/url]';
if ($infobox)
$this->infobox = new InfoboxMarkup($infobox, ['allow' => Markup::CLASS_STAFF, 'dbpage' => true], 'infobox-contents0');
/****************/
/* Main Content */
/****************/
// pieces + Summary
$pieces = [];
$eqList = [];
$compare = [];
@ -136,8 +142,8 @@ class ItemsetPage extends GenericPage
else
$cnd = ['i.id', array_keys($this->subject->pieceToSet)];
$iList = new ItemList(array($cnd));
$data = $iList->getListviewData(ITEMINFO_SUBITEMS | ITEMINFO_JSON);
$iList = new ItemList(array($cnd));
$data = $iList->getListviewData(ITEMINFO_SUBITEMS | ITEMINFO_JSON);
foreach ($iList->iterate() as $itemId => $__)
{
if (empty($data[$itemId]))
@ -150,26 +156,35 @@ class ItemsetPage extends GenericPage
$compare[] = $itemId;
$pieces[$itemId] = array(
'name_'.Lang::getLocale()->json() => $iList->getField('name', true),
'quality' => $iList->getField('quality'),
'icon' => $iList->getField('iconString'),
'jsonequip' => $data[$itemId]
$this->pieces[$itemId] = array(
array(
'name_'.Lang::getLocale()->json() => $iList->getField('name', true),
'quality' => $iList->getField('quality'),
'icon' => $iList->getField('iconString'),
'jsonequip' => $data[$itemId]
),
new IconElement(Type::ITEM, $itemId, $iList->getField('name', true), quality: $iList->getField('quality'), size: IconElement::SIZE_SMALL, align: 'right', element: 'iconlist-icon')
);
}
$skill = '';
if ($_sk = $this->subject->getField('skillId'))
if ($compare)
$this->summary = new Summary(array(
'template' => 'itemset',
'id' => 'itemset',
'parent' => 'summary-generic',
'groups' => array_map(fn ($x) => [[$x]], $compare),
'level' => $this->subject->getField('reqLevel')
));
// required skill
if ($_sk)
{
$spellLink = sprintf('<a href="?spells=11.%s">%s</a> (%s)', $_sk, Lang::spell('cat', 11, $_sk, 0), $this->subject->getField('skillLevel'));
$skill = ' &ndash; <small><b>'.sprintf(Lang::game('requires'), $spellLink).'</b></small>';
$this->bonusExt = ' &ndash; <small><b>'.Lang::game('requires', [$spellLink]).'</b></small>';
}
$this->bonusExt = $skill;
$this->description = $_ta ? sprintf(Lang::itemset('_desc'), $this->name, Lang::itemset('notes', $_ta), $_cnt) : sprintf(Lang::itemset('_descTagless'), $this->name, $_cnt);
$this->description = $_ta ? Lang::itemset('_desc', [$this->h1, Lang::itemset('notes', $_ta), $_cnt]) : Lang::itemset('_descTagless', [$this->h1, $_cnt]);
$this->unavailable = !!($this->subject->getField('cuFlags') & CUSTOM_UNAVAILABLE);
$this->infobox = $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null;
$this->pieces = $pieces;
$this->spells = $this->subject->getBonuses();
// $this->expansion = $this->subject->getField('expansion'); NYI - todo: add col to table
$this->redButtons = array(
@ -178,14 +193,7 @@ class ItemsetPage extends GenericPage
BUTTON_VIEW3D => ['type' => Type::ITEMSET, 'typeId' => $this->typeId, 'equipList' => $eqList],
BUTTON_COMPARE => $compare ? ['eqList' => implode(':', $compare), 'qty' => $_cnt] : false
);
if ($compare)
$this->summary = array(
'id' => 'itemset',
'template' => 'itemset',
'parent' => 'summary-generic',
'groups' => array_map(function ($v) { return [[$v]]; }, $compare),
'level' => $this->subject->getField('reqLevel'),
);
/**************/
/* Extra Tabs */
@ -194,18 +202,18 @@ class ItemsetPage extends GenericPage
// related sets (priority: 1: similar tag + class; 2: has event; 3: no tag + similar type, 4: similar type + profession)
$rel = [];
if ($_ta && count($this->path) == 3)
if ($_ta && count($_cl) == 1)
{
$rel[] = ['id', $this->typeId, '!'];
$rel[] = ['classMask', 1 << (end($this->path) - 1), '&'];
$rel[] = ['classMask', 1 << ($_cl[0] - 1), '&'];
$rel[] = ['contentGroup', (int)$_ta];
}
else if ($this->subject->getField('eventId'))
else if ($_evt)
{
$rel[] = ['id', $this->typeId, '!'];
$rel[] = ['eventId', 0, '!'];
}
else if ($this->subject->getField('skillId'))
else if ($_sk)
{
$rel[] = ['id', $this->typeId, '!'];
$rel[] = ['contentGroup', 0];
@ -220,13 +228,15 @@ class ItemsetPage extends GenericPage
$rel[] = ['skillId', 0];
}
$this->lvTabs = new Tabs(['parent' => "\$\$WH.ge('tabs-generic')"], 'tabsRelated', true);
if ($rel)
{
$relSets = new ItemsetList($rel);
if (!$relSets->error)
{
$tabData = array(
'data' => array_values($relSets->getListviewData()),
'data' => $relSets->getListviewData(),
'id' => 'see-also',
'name' => '$LANG.tab_seealso'
);
@ -234,23 +244,13 @@ class ItemsetPage extends GenericPage
if (!$relSets->hasDiffFields('classMask'))
$tabData['hiddenCols'] = ['classes'];
$this->lvTabs[] = [ItemsetList::$brickFile, $tabData];
$this->lvTabs->addListviewTab(new Listview($tabData, ItemsetList::$brickFile));
$this->extendGlobalData($relSets->getJSGlobals());
}
}
}
protected function generateTooltip()
{
$power = new \StdClass();
if (!$this->subject->error)
{
$power->{'name_'.Lang::getLocale()->json()} = $this->subject->getField('name', true);
$power->{'tooltip_'.Lang::getLocale()->json()} = $this->subject->renderTooltip();
}
return sprintf($this->powerTpl, $this->typeId, Lang::getLocale()->value, Util::toJSON($power, JSON_AOWOW_POWER));
parent::generate();
}
}

View file

@ -0,0 +1,49 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
class ItemsetPowerResponse extends TextResponse implements ICache
{
use TrCache, TrTooltip;
private const /* string */ POWER_TEMPLATE = '$WowheadPower.registerItemSet(%d, %d, %s);';
protected int $type = Type::ITEMSET;
protected int $typeId = 0;
protected int $cacheType = CACHE_TYPE_TOOLTIP;
protected array $expectedGET = array(
'domain' => ['filter' => FILTER_CALLBACK, 'options' => [Locale::class, 'tryFromDomain']]
);
public function __construct(string $id)
{
parent::__construct($id);
// temp locale
if ($this->_get['domain'])
Lang::load($this->_get['domain']);
$this->typeId = intVal($id);
}
protected function generate() : void
{
$itemset = new ItemsetList(array(['id', $this->typeId]));
if ($itemset->error)
$this->cacheType = CACHE_TYPE_NONE;
else
$opts = array(
'name' => $itemset->getField('name', true),
'tooltip' => $itemset->renderTooltip(),
);
$this->result = new Tooltip(self::POWER_TEMPLATE, $this->typeId, $opts ?? []);
}
}
?>

View file

@ -0,0 +1,112 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
class ItemsetsBaseResponse extends TemplateResponse implements ICache
{
use TrListPage, TrCache;
protected int $type = Type::ITEMSET;
protected int $cacheType = CACHE_TYPE_PAGE;
protected string $template = 'itemsets';
protected string $pageName = 'itemsets';
protected ?int $activeTab = parent::TAB_DATABASE;
protected array $breadcrumb = [0, 2];
// protected array $dataLoader = ['weight-presets']; // was here since day 1, but was never accessed..?
protected array $scripts = [[SC_JS_FILE, 'js/filters.js']];
protected array $expectedGET = array(
'filter' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => Filter::PATTERN_PARAM]]
);
public function __construct(string $pageParam)
{
$this->getCategoryFromUrl($pageParam);
parent::__construct($pageParam);
$this->subCat = $pageParam !== '' ? '='.$pageParam : '';
$this->filter = new ItemsetListFilter($this->_get['filter'] ?? '', ['parentCats' => $this->category]);
$this->filterError = $this->filter->error;
}
protected function generate() : void
{
$this->h1 = Util::ucWords(Lang::game('itemsets'));
$conditions = [];
if (!User::isInGroup(U_GROUP_EMPLOYEE))
$conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
$this->filter->evalCriteria();
if ($_ = $this->filter->getConditions())
$conditions[] = $_;
$this->filterError = $this->filter->error; // maybe the evalX() caused something
/*************/
/* Menu Path */
/*************/
if ($cl = $this->filter->values['cl'])
$this->breadcrumb[] = $cl;
/**************/
/* Page Title */
/**************/
array_unshift($this->title, $this->h1);
if ($cl = $this->filter->values['cl'])
array_unshift($this->title, Lang::game('cl', $cl));
/****************/
/* Main Content */
/****************/
$this->redButtons[BUTTON_WOWHEAD] = true;
if ($fiQuery = $this->filter->buildGETParam())
$this->wowheadLink .= '&filter='.$fiQuery;
$itemsets = new ItemsetList($conditions, ['calcTotal' => true]);
$this->extendGlobalData($itemsets->getJSGlobals());
$tabData = ['data' => $itemsets->getListviewData()];
if ($this->filter->fiExtraCols)
$tabData['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
// create note if search limit was exceeded
if ($itemsets->getMatches() > Cfg::get('SQL_LIMIT_DEFAULT'))
{
$tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_itemsetsfound', $itemsets->getMatches(), Cfg::get('SQL_LIMIT_DEFAULT'));
$tabData['_truncated'] = 1;
}
$this->lvTabs = new Tabs(['parent' => "\$\$WH.ge('tabs-generic')"]);
$this->lvTabs->addListviewTab(new Listview($tabData, ItemsetList::$brickFile));
parent::generate();
$this->setOnCacheLoaded([self::class, 'onBeforeDisplay']);
}
public static function onBeforeDisplay() : void
{
// sort for dropdown-menus
Lang::sort('itemset', 'notes', SORT_NATURAL);
Lang::sort('game', 'cl');
}
}
?>

View file

@ -333,7 +333,7 @@ $lang = array(
'difficulty' => "Modus",
'dispelType' => "Bannart",
'duration' => "Dauer",
'eventShort' => "Ereignis",
'eventShort' => "Ereignis: %s",
'flags' => "Flags",
'glyphType' => "Glyphenart",
'level' => "Stufe",
@ -1449,7 +1449,7 @@ $lang = array(
'_conveyBonus' => "Das Tragen mehrerer Gegenstände aus diesem Set gewährt Eurem Charakter Boni.",
'_pieces' => "Teile",
'_unavailable' => "Dieses Ausrüstungsset ist nicht für Spieler verfügbar.",
'_tag' => "Tag",
'_tag' => "Tag: ",
'summary' => "Zusammenfassung",
'notes' => array(
null, "Dungeon-Set 1", "Dungeon-Set 2", "Tier 1 Raid-Set",

View file

@ -333,7 +333,7 @@ $lang = array(
'difficulty' => "Difficulty",
'dispelType' => "Dispel type",
'duration' => "Duration",
'eventShort' => "Event",
'eventShort' => "Event: %s",
'flags' => "Flags",
'glyphType' => "Glyph type",
'level' => "Level",
@ -1449,7 +1449,7 @@ $lang = array(
'_conveyBonus' => "Wearing more pieces of this set will convey bonuses to your character.",
'_pieces' => "pieces",
'_unavailable' => "This item set is not available to players.",
'_tag' => "Tag",
'_tag' => "Tag: ",
'summary' => "Summary",
'notes' => array(
null, "Dungeon Set 1", "Dungeon Set 2", "Tier 1 Raid Set",

View file

@ -333,7 +333,7 @@ $lang = array(
'difficulty' => "Dificultad",
'dispelType' => "Tipo de disipación",
'duration' => "Duración",
'eventShort' => "Evento",
'eventShort' => "Evento: %s",
'flags' => "Banderas",
'glyphType' => "Tipo de glifo",
'level' => "Nivel",
@ -1449,7 +1449,7 @@ $lang = array(
'_conveyBonus' => "Tener puestos mas objetos de este conjunto le aplicará una bonificación a tu personaje.",
'_pieces' => "piezas",
'_unavailable' => "Este conjunto de objetos no está disponible para jugadores.",
'_tag' => "Etiqueta",
'_tag' => "Etiqueta: ",
'summary' => "Resúmen",
'notes' => array(
null, "Set de mazmorra 1", "Set de mazmorra 2", "Set de banda tier 1",

View file

@ -333,7 +333,7 @@ $lang = array(
'difficulty' => "Difficulté",
'dispelType' => "Type de dissipation",
'duration' => "Durée",
'eventShort' => "Évènement",
'eventShort' => "Évènement : %s",
'flags' => "Marqueurs",
'glyphType' => "Type de glyphe",
'level' => "Niveau",
@ -1449,7 +1449,7 @@ $lang = array(
'_conveyBonus' => "Plus d'objets de cet ensemble sont équipés, plus votre personnage aura des bonus de caractéristiques.",
'_pieces' => "pièces",
'_unavailable' => "Cet objet n'est plus disponible aux joueurs.",
'_tag' => "Étiquette",
'_tag' => "Étiquette : ",
'summary' => "Résumé",
'notes' => array(
null, "Ensemble de donjon 1", "Ensemble de donjon 2", "Ensemble de raid palier 1",

View file

@ -333,7 +333,7 @@ $lang = array(
'difficulty' => "Сложность",
'dispelType' => "Тип рассеивания",
'duration' => "Длительность",
'eventShort' => "Игровое событие",
'eventShort' => "Игровое событие: %s",
'flags' => "Метки",
'glyphType' => "Тип символа",
'level' => "Уровень",
@ -1449,7 +1449,7 @@ $lang = array(
'_conveyBonus' => "Ношение большего числа предметов из этого комплекта предоставит бонусы для вашего персонажа.",
'_pieces' => "частей",
'_unavailable' => "Этот набор предметов не доступен игрокам.",
'_tag' => "Тэг",
'_tag' => "Тэг: ",
'summary' => "Сводка",
'notes' => array(
null, "Комплект подземелий 1", "Комплект подземелий 2", "Рейдовый комплект Tier 1",

View file

@ -332,7 +332,7 @@ $lang = array(
'difficulty' => "难度",
'dispelType' => "驱散类型",
'duration' => "持续时间",
'eventShort' => "事件",
'eventShort' => "事件%s",
'flags' => "标记",
'glyphType' => "雕文类型",
'level' => "等级",
@ -1448,7 +1448,7 @@ $lang = array(
'_conveyBonus' => "穿更多这个套装的部分将会提供给你角色奖励。",
'_pieces' => "",
'_unavailable' => "这个物品套装对玩家不可用。",
'_tag' => "标签",
'_tag' => "标签",
'summary' => "摘要",
'notes' => array(
null, "地下城套装1", "地下城套装2", "T1副本套装",

View file

@ -1,98 +0,0 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
// menuId 2: Itemset g_initPath()
// tabId 0: Database g_initHeader()
class ItemsetsPage extends GenericPage
{
use TrListPage;
protected $type = Type::ITEMSET;
protected $tpl = 'itemsets';
protected $path = [0, 2];
protected $tabId = 0;
protected $mode = CACHE_TYPE_PAGE;
protected $scripts = [[SC_JS_FILE, 'js/filters.js']];
protected $_get = ['filter' => ['filter' => FILTER_UNSAFE_RAW]];
public function __construct($pageCall, $pageParam)
{
$this->getCategoryFromUrl($pageParam);
parent::__construct($pageCall, $pageParam);
$this->filterObj = new ItemsetListFilter($this->_get['filter'] ?? '', ['parentCats' => $this->category]);
$this->name = Util::ucFirst(Lang::game('itemsets'));
}
protected function generateContent()
{
$this->addScript([SC_JS_FILE, '?data=weight-presets']);
$conditions = [];
if (!User::isInGroup(U_GROUP_EMPLOYEE))
$conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
$this->filterObj->evalCriteria();
if ($_ = $this->filterObj->getConditions())
$conditions[] = $_;
$itemsets = new ItemsetList($conditions, ['calcTotal' => true]);
$this->extendGlobalData($itemsets->getJSGlobals());
$xCols = $this->filterObj->fiExtraCols;
if ($xCols)
$this->filter['initData']['ec'] = $xCols;
$tabData = ['data' => array_values($itemsets->getListviewData())];
if ($xCols)
$tabData['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
// create note if search limit was exceeded
if ($itemsets->getMatches() > Cfg::get('SQL_LIMIT_DEFAULT'))
{
$tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_itemsetsfound', $itemsets->getMatches(), Cfg::get('SQL_LIMIT_DEFAULT'));
$tabData['_truncated'] = 1;
}
if ($this->filterObj->error)
$tabData['_errors'] = 1;
$this->lvTabs[] = [ItemsetList::$brickFile, $tabData];
}
protected function postCache()
{
// sort for dropdown-menus
Lang::sort('itemset', 'notes', SORT_NATURAL);
Lang::sort('game', 'si');
}
protected function generateTitle()
{
array_unshift($this->title, $this->name);
$form = $this->filterObj->values;
if ($form['cl'])
array_unshift($this->title, Lang::game('cl', $form['cl']));
}
protected function generatePath()
{
$form = $this->filterObj->values;
if ($form['cl'])
$this->path[] = $form['cl'];
}
}
?>

View file

@ -1,7 +1,10 @@
<?php namespace Aowow; ?>
<?php
namespace Aowow\Template;
<?php $this->brick('header'); ?>
use \Aowow\Lang;
$this->brick('header');
?>
<div class="main" id="main">
<div class="main-precontents" id="main-precontents"></div>
<div class="main-contents" id="main-contents">
@ -19,9 +22,9 @@
$this->brick('redButtons');
if ($this->expansion):
echo ' <h1 class="h1-icon"><span class="icon-'.$this->expansion.'-right">'.$this->name."</span></h1>\n";
echo ' <h1 class="h1-icon"><span class="icon-'.$this->expansion.'-right">'.$this->h1."</span></h1>\n";
else:
echo ' <h1>'.$this->name."</h1>\n";
echo ' <h1>'.$this->h1."</h1>\n";
endif;
if ($this->unavailable):
?>
@ -30,32 +33,31 @@ if ($this->unavailable):
<div class="pad"></div>
<?php
endif;
$this->brick('article');
$this->brick('markup', ['markup' => $this->article]);
echo $this->description;
?>
<script type="text/javascript">//<![CDATA[
<?php
foreach ($this->pieces as $iId => $piece):
echo " g_items.add(".$iId.", ".Util::toJSON($piece).");\n";
foreach ($this->pieces as $iId => [$piece, ]):
echo " g_items.add(".$iId.", ".$this->json($piece).");\n";
endforeach;
?>
//]]></script>
<table class="iconlist">
<?php
$idx = 0;
foreach ($this->pieces as $iId => $piece):
echo ' <tr><th align="right" id="iconlist-icon'.(++$idx).'"></th><td><span class="q'.$piece['quality'].'"><a href="?item='.$iId.'">'.$piece['name_'.Lang::getLocale()->json()]."</a></span></td></tr>\n";
$iconIdx = 0;
foreach ($this->pieces as [, $icon]):
echo $icon->renderContainer(20, $iconIdx, true);
endforeach;
?>
</table>
<script type="text/javascript">//<![CDATA[
<?php
$idx = 0;
foreach ($this->pieces as $iId => $__):
echo " \$WH.ge('iconlist-icon".(++$idx)."').appendChild(g_items.createIcon(".$iId.", 0, 0));\n";
foreach ($this->pieces as [, $icon]):
echo $icon->renderJS(20);
endforeach;
?>
//]]></script>
@ -78,7 +80,7 @@ if ($this->summary):
<div id="summary-generic"></div>
<script type="text/javascript">//<![CDATA[
new Summary(<?=Util::toJSON($this->summary); ?>);
<?=$this->summary; ?>
//]]></script>
<?php
endif;
@ -88,7 +90,7 @@ endif;
</div>
<?php
$this->brick('lvTabs', ['relTabs' => true]);
$this->brick('lvTabs');
$this->brick('contribute');
?>

View file

@ -1,10 +1,11 @@
<?php namespace Aowow; ?>
<?php
$this->brick('header');
$f = $this->filterObj->values // shorthand
?>
namespace Aowow\Template;
use \Aowow\Lang;
$this->brick('header');
$f = $this->filter->values; // shorthand
?>
<div class="main" id="main">
<div class="main-precontents" id="main-precontents"></div>
<div class="main-contents" id="main-contents">
@ -12,76 +13,61 @@ $f = $this->filterObj->values // shorthand
<?php
$this->brick('announcement');
$this->brick('pageTemplate', ['fiQuery' => $this->filterObj->query, 'fiMenuItem' => [2]]);
$this->brick('pageTemplate', ['fiQuery' => $this->filter->query, 'fiMenuItem' => [2]]);
?>
<div id="fi" style="display: <?=($this->filter->query ? 'block' : 'none'); ?>;">
<form action="?filter=itemsets<?=$this->subCat; ?>" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)">
<div class="text">
<?php
$this->brick('headIcons');
<div id="fi" style="display: <?=($this->filterObj->query ? 'block' : 'none'); ?>;">
<form action="?filter=itemsets" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)">
$this->brick('redButtons');
?>
<h1><?=$this->h1; ?></h1>
</div>
<div class="rightpanel">
<div style="float: left"><?=Lang::item('_quality').Lang::main('colon'); ?></div>
<div style="float: left"><?=Lang::item('_quality'); ?></div>
<small><a href="javascript:;" onclick="document.forms['fi'].elements['qu[]'].selectedIndex = -1; return false" onmousedown="return false"><?=Lang::main('clear'); ?></a></small>
<div class="clear"></div>
<select name="qu[]" size="7" multiple="multiple" class="rightselect" style="background-color: #181818">
<?php
foreach (Lang::item('quality') as $i => $str):
echo ' <option value="'.$i.'" class="q'.$i.'"'.(isset($f['qu']) && in_array($i, (array)$f['qu']) ? ' selected' : null).'>'.$str."</option>\n";
endforeach;
?>
<?=$this->makeOptionsList(Lang::item('quality'), $f['qu'], 28, fn($v, $k, &$e) => $e = ['class' => 'q'.$k]); ?>
</select>
</div>
<div class="rightpanel2">
<div style="float: left"><?=Lang::game('type').Lang::main('colon'); ?></div>
<div style="float: left"><?=Lang::game('type'); ?></div>
<small><a href="javascript:;" onclick="document.forms['fi'].elements['ty[]'].selectedIndex = -1; return false" onmousedown="return false"><?=Lang::main('clear'); ?></a></small>
<div class="clear"></div>
<select name="ty[]" size="7" multiple="multiple" class="rightselect">
<?php
foreach (Lang::itemset('types') as $i => $str):
if ($str):
echo ' <option value="'.$i.'"'.(isset($f['ty']) && in_array($i, (array)$f['ty']) ? ' selected' : null).'>'.$str."</option>\n";
endif;
endforeach;
?>
<?=$this->makeOptionsList(Lang::itemset('types'), $f['ty'], 28); ?>
</select>
</div>
<table>
<tr>
<td><?=Util::ucFirst(Lang::main('name')).Lang::main('colon'); ?></td>
<td colspan="3">&nbsp;<input type="text" name="na" size="30" <?=(isset($f['na']) ? 'value="'.Util::htmlEscape($f['na']).'" ' : null); ?>/></td>
<td><?=$this->ucFirst(Lang::main('name')).Lang::main('colon'); ?></td>
<td colspan="3">&nbsp;<input type="text" name="na" size="30" <?=($f['na'] ? 'value="'.$this->escHTML($f['na']).'" ' : ''); ?>/></td>
</tr><tr>
<td class="padded"><?=Lang::game('level').Lang::main('colon'); ?></td>
<td class="padded">&nbsp;<input type="text" name="minle" maxlength="3" class="smalltextbox2" <?=(isset($f['minle']) ? 'value="'.$f['minle'].'" ' : null); ?>/> - <input type="text" name="maxle" maxlength="3" class="smalltextbox2" <?=(isset($f['maxle']) ? 'value="'.$f['maxle'].'" ' : null); ?>/></td>
<td class="padded">&nbsp;<input type="text" name="minle" maxlength="3" class="smalltextbox2" <?=($f['minle'] ? 'value="'.$f['minle'].'" ' : ''); ?>/> - <input type="text" name="maxle" maxlength="3" class="smalltextbox2" <?=($f['maxle'] ? 'value="'.$f['maxle'].'" ' : ''); ?>/></td>
<td class="padded" width="100%">
<table><tr>
<td>&nbsp;&nbsp;&nbsp;<?=Lang::main('_reqLevel').Lang::main('colon'); ?></td>
<td>&nbsp;<input type="text" name="minrl" maxlength="2" class="smalltextbox" <?=(isset($f['minrl']) ? 'value="'.$f['minrl'].'" ' : null); ?>/> - <input type="text" name="maxrl" maxlength="2" class="smalltextbox" <?=(isset($f['maxrl']) ? 'value="'.$f['maxrl'].'" ' : null); ?>/></td>
<td>&nbsp;&nbsp;&nbsp;<?=Lang::main('_reqLevel'); ?></td>
<td>&nbsp;<input type="text" name="minrl" maxlength="2" class="smalltextbox" <?=($f['minrl'] ? 'value="'.$f['minrl'].'" ' : ''); ?>/> - <input type="text" name="maxrl" maxlength="2" class="smalltextbox" <?=($f['maxrl'] ? 'value="'.$f['maxrl'].'" ' : ''); ?>/></td>
</tr></table>
</td>
</tr><tr>
<td class="padded"><?=Util::ucFirst(Lang::game('class')).Lang::main('colon'); ?></td>
<td class="padded"><?=$this->ucFirst(Lang::game('class')).Lang::main('colon'); ?></td>
<td class="padded">&nbsp;<select name="cl">
<option></option>
<?php
foreach (Lang::game('cl') as $i => $str):
if ($str):
echo ' <option value="'.$i.'"'.(isset($f['cl']) && $i == $f['cl'] ? ' selected' : null).'>'.$str."</option>\n";
endif;
endforeach;
?>
<?=$this->makeOptionsList(Lang::game('cl'), $f['cl'], 36); ?>
</select></td>
<td class="padded">
<table><tr>
<td>&nbsp;&nbsp;&nbsp;<?=Lang::itemset('_tag').Lang::main('colon'); ?></td>
<td>&nbsp;&nbsp;&nbsp;<?=Lang::itemset('_tag'); ?></td>
<td>&nbsp;<select name="ta">
<option></option>
<?php
foreach (Lang::itemset('notes') as $i => $str):
if ($str):
echo ' <option value="'.$i.'"'.(isset($f['ta']) && $i == $f['ta'] ? ' selected' : null).'>'.$str."</option>\n";
endif;
endforeach;
?>
<?=$this->makeOptionsList(Lang::itemset('notes'), $f['ta'], 36); ?>
</select></td>
</tr></table>
</td>
@ -92,7 +78,7 @@ endforeach;
<div class="padded2">
<div style="float: right"><?=Lang::main('refineSearch'); ?></div>
<?=Lang::main('match').Lang::main('colon'); ?><input type="radio" name="ma" value="" id="ma-0" <?=(!isset($f['ma']) ? 'checked="checked" ' : null); ?>/><label for="ma-0"><?=Lang::main('allFilter'); ?></label><input type="radio" name="ma" value="1" id="ma-1" <?=(isset($f['ma']) ? 'checked="checked" ' : null); ?> /><label for="ma-1"><?=Lang::main('oneFilter'); ?></label>
<?=Lang::main('match'); ?><input type="radio" name="ma" value="" id="ma-0" <?=(!$f['ma'] ? 'checked="checked" ' : ''); ?>/><label for="ma-0"><?=Lang::main('allFilter'); ?></label><input type="radio" name="ma" value="1" id="ma-1" <?=($f['ma'] ? 'checked="checked" ' : ''); ?> /><label for="ma-1"><?=Lang::main('oneFilter'); ?></label>
</div>
<div class="clear"></div>
@ -106,7 +92,7 @@ endforeach;
<div class="pad"></div>
</div>
<?php $this->brick('filter'); ?>
<?=$this->renderFilter(12); ?>
<?php $this->brick('lvTabs'); ?>