Template/Update (Part 27)
* convert dbtype 'currency'
This commit is contained in:
parent
f76869ecbe
commit
79c937e0a3
12 changed files with 214 additions and 140 deletions
76
endpoints/currencies/currencies.php
Normal file
76
endpoints/currencies/currencies.php
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
|
||||
namespace Aowow;
|
||||
|
||||
if (!defined('AOWOW_REVISION'))
|
||||
die('illegal access');
|
||||
|
||||
|
||||
class CurrenciesBaseResponse extends TemplateResponse implements ICache
|
||||
{
|
||||
use TrListPage, TrCache;
|
||||
|
||||
protected int $type = Type::CURRENCY;
|
||||
protected int $cacheType = CACHE_TYPE_PAGE;
|
||||
|
||||
protected string $template = 'list-page-generic';
|
||||
protected string $pageName = 'currencies';
|
||||
protected ?int $activeTab = parent::TAB_DATABASE;
|
||||
protected array $breadcrumb = [0, 15];
|
||||
|
||||
protected array $validCats = [1, 2, 3, 22];
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
{
|
||||
$this->getCategoryFromUrl($pageParam);
|
||||
|
||||
parent::__construct($pageParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
{
|
||||
$this->h1 = Util::ucFirst(Lang::game('currencies'));
|
||||
|
||||
|
||||
/**************/
|
||||
/* Page Title */
|
||||
/**************/
|
||||
|
||||
array_unshift($this->title, $this->h1);
|
||||
if ($this->category)
|
||||
array_unshift($this->title, Lang::currency('cat', $this->category[0]));
|
||||
|
||||
|
||||
/*************/
|
||||
/* Menu Path */
|
||||
/*************/
|
||||
|
||||
if ($this->category)
|
||||
$this->breadcrumb[] = $this->category[0];
|
||||
|
||||
|
||||
/****************/
|
||||
/* Main Content */
|
||||
/****************/
|
||||
|
||||
$this->redButtons[BUTTON_WOWHEAD] = true;
|
||||
|
||||
$conditions = [];
|
||||
|
||||
if (!User::isInGroup(U_GROUP_EMPLOYEE))
|
||||
$conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
|
||||
|
||||
if ($this->category)
|
||||
$conditions[] = ['category', $this->category[0]];
|
||||
|
||||
$money = new CurrencyList($conditions);
|
||||
|
||||
$this->lvTabs = new Tabs(['parent' => "\$\$WH.ge('tabs-generic')"]);
|
||||
|
||||
$this->lvTabs->addListviewTab(new Listview(['data' => $money->getListviewData()], CurrencyList::$brickFile));
|
||||
|
||||
parent::generate();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -6,55 +6,61 @@ if (!defined('AOWOW_REVISION'))
|
|||
die('illegal access');
|
||||
|
||||
|
||||
// menuId 15: Currency g_initPath()
|
||||
// tabId 0: Database g_initHeader()
|
||||
class CurrencyPage extends GenericPage
|
||||
class CurrencyBaseResponse extends TemplateResponse implements ICache
|
||||
{
|
||||
use TrDetailPage;
|
||||
use TrDetailPage, TrCache;
|
||||
|
||||
protected $type = Type::CURRENCY;
|
||||
protected $typeId = 0;
|
||||
protected $tpl = 'detail-page-generic';
|
||||
protected $path = [0, 15];
|
||||
protected $tabId = 0;
|
||||
protected $mode = CACHE_TYPE_PAGE;
|
||||
protected int $cacheType = CACHE_TYPE_PAGE;
|
||||
|
||||
protected $_get = ['domain' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\Locale::tryFromDomain']];
|
||||
protected string $template = 'detail-page-generic';
|
||||
protected string $pageName = 'currency';
|
||||
protected ?int $activeTab = parent::TAB_DATABASE;
|
||||
protected array $breadcrumb = [0, 15];
|
||||
|
||||
private $powerTpl = '$WowheadPower.registerCurrency(%d, %d, %s);';
|
||||
public int $type = Type::CURRENCY;
|
||||
public int $typeId = 0;
|
||||
|
||||
public function __construct($pageCall, $id)
|
||||
private CurrencyList $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->contribute = Type::getClassAttrib($this->type, 'contribute') ?? CONTRIBUTE_NONE;
|
||||
}
|
||||
|
||||
$this->typeId = intVal($id);
|
||||
|
||||
protected function generate() : void
|
||||
{
|
||||
$this->subject = new CurrencyList(array(['id', $this->typeId]));
|
||||
if ($this->subject->error)
|
||||
$this->notFound(Lang::game('currency'), Lang::currency('notFound'));
|
||||
$this->generateNotFound(Lang::game('currency'), Lang::currency('notFound'));
|
||||
|
||||
$this->name = $this->subject->getField('name', true);
|
||||
}
|
||||
$this->h1 = $this->subject->getField('name', true);
|
||||
|
||||
protected function generatePath()
|
||||
{
|
||||
$this->path[] = $this->subject->getField('category');
|
||||
}
|
||||
$this->gPageInfo += array(
|
||||
'type' => $this->type,
|
||||
'typeId' => $this->typeId,
|
||||
'name' => $this->h1
|
||||
);
|
||||
|
||||
protected function generateTitle()
|
||||
{
|
||||
array_unshift($this->title, $this->subject->getField('name', true), Util::ucFirst(Lang::game('currency')));
|
||||
}
|
||||
$_relItemId = $this->subject->getField('itemId');
|
||||
|
||||
protected function generateContent()
|
||||
{
|
||||
$this->addScript([SC_JS_FILE, '?data=zones']);
|
||||
|
||||
$_itemId = $this->subject->getField('itemId');
|
||||
/**************/
|
||||
/* Page Title */
|
||||
/**************/
|
||||
|
||||
array_unshift($this->title, $this->h1, Util::ucFirst(Lang::game('currency')));
|
||||
|
||||
|
||||
/*************/
|
||||
/* Menu Path */
|
||||
/*************/
|
||||
|
||||
$this->breadcrumb[] = $this->subject->getField('category');
|
||||
|
||||
|
||||
/***********/
|
||||
/* Infobox */
|
||||
|
|
@ -64,7 +70,7 @@ class CurrencyPage extends GenericPage
|
|||
|
||||
// cap
|
||||
if ($_ = $this->subject->getField('cap'))
|
||||
$infobox[] = Lang::currency('cap').Lang::main('colon').Lang::nf($_);
|
||||
$infobox[] = Lang::currency('cap').Lang::nf($_);
|
||||
|
||||
// icon
|
||||
if ($_ = $this->subject->getField('iconId'))
|
||||
|
|
@ -73,6 +79,10 @@ class CurrencyPage extends GenericPage
|
|||
$this->extendGlobalIds(Type::ICON, $_);
|
||||
}
|
||||
|
||||
if ($infobox)
|
||||
$this->infobox = new InfoboxMarkup($infobox, ['allow' => Markup::CLASS_STAFF, 'dbpage' => true], 'infobox-contents0');
|
||||
|
||||
|
||||
/****************/
|
||||
/* Main Content */
|
||||
/****************/
|
||||
|
|
@ -81,8 +91,6 @@ class CurrencyPage extends GenericPage
|
|||
if ($hi[0] == $hi[1])
|
||||
unset($hi[1]);
|
||||
|
||||
$this->infobox = $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null;
|
||||
$this->name = $this->subject->getField('name', true);
|
||||
$this->headIcons = $hi;
|
||||
$this->redButtons = array(
|
||||
BUTTON_WOWHEAD => true,
|
||||
|
|
@ -90,30 +98,38 @@ class CurrencyPage extends GenericPage
|
|||
);
|
||||
|
||||
if ($_ = $this->subject->getField('description', true))
|
||||
$this->extraText = $_;
|
||||
$this->extraText = new Markup($_, ['dbpage' => true, 'allow' => Markup::CLASS_ADMIN], 'text-generic');
|
||||
|
||||
|
||||
/**************/
|
||||
/* Extra Tabs */
|
||||
/**************/
|
||||
|
||||
if ($this->typeId != 103 && $this->typeId != 104) // honor && arena points are not handled as items
|
||||
$this->lvTabs = new Tabs(['parent' => "\$\$WH.ge('tabs-generic')"], 'tabsRelated', true);
|
||||
|
||||
if ($this->typeId != CURRENCY_HONOR_POINTS && $this->typeId != CURRENCY_ARENA_POINTS)
|
||||
{
|
||||
// tabs: this currency is contained in..
|
||||
$lootTabs = new Loot();
|
||||
|
||||
if ($lootTabs->getByItem($_itemId))
|
||||
if ($lootTabs->getByItem($_relItemId))
|
||||
{
|
||||
$this->extendGlobalData($lootTabs->jsGlobals);
|
||||
|
||||
foreach ($lootTabs->iterate() as [$file, $tabData])
|
||||
$this->lvTabs[] = [$file, $tabData];
|
||||
foreach ($lootTabs->iterate() as [$template, $tabData])
|
||||
{
|
||||
if ($template == 'npc' || $template == 'object')
|
||||
$this->addDataLoader('zones');
|
||||
|
||||
$this->lvTabs->addListviewTab(new Listview($tabData, $template));
|
||||
}
|
||||
}
|
||||
|
||||
// tab: sold by
|
||||
$itemObj = new ItemList(array(['id', $_itemId]));
|
||||
if (!empty($itemObj->getExtendedCost()[$_itemId]))
|
||||
$itemObj = new ItemList(array(['id', $_relItemId]));
|
||||
if (!empty($itemObj->getExtendedCost()[$_relItemId]))
|
||||
{
|
||||
$vendors = $itemObj->getExtendedCost()[$_itemId];
|
||||
$vendors = $itemObj->getExtendedCost()[$_relItemId];
|
||||
$this->extendGlobalData($itemObj->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
|
||||
|
||||
$soldBy = new CreatureList(array(['id', array_keys($vendors)]));
|
||||
|
|
@ -145,8 +161,8 @@ class CurrencyPage extends GenericPage
|
|||
$row['stack'] = $itemObj->getField('buyCount');
|
||||
$row['cost'] = array(
|
||||
$itemObj->getField('buyPrice'),
|
||||
$items ? $items : null,
|
||||
$tokens ? $tokens : null
|
||||
$items ?: null,
|
||||
$tokens ?: null
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -154,27 +170,28 @@ class CurrencyPage extends GenericPage
|
|||
if (!array_column($sbData, 'condition'))
|
||||
array_pop($extraCols);
|
||||
|
||||
$this->lvTabs[] = [CreatureList::$brickFile, array(
|
||||
'data' => array_values($sbData),
|
||||
$this->addDataLoader('zones');
|
||||
$this->lvTabs->addListviewTab(new Listview(array(
|
||||
'data' => $sbData,
|
||||
'name' => '$LANG.tab_soldby',
|
||||
'id' => 'sold-by-npc',
|
||||
'extraCols' => $extraCols,
|
||||
'hiddenCols' => ['level', 'type']
|
||||
)];
|
||||
), CreatureList::$brickFile));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// tab: created by (spell) [for items its handled in Loot::getByContainer()]
|
||||
if ($this->typeId == 104)
|
||||
if ($this->typeId == CURRENCY_HONOR_POINTS)
|
||||
{
|
||||
$createdBy = new SpellList(array(['effect1Id', 45], ['effect2Id', 45], ['effect3Id', 45], 'OR'));
|
||||
$createdBy = new SpellList(array(['effect1Id', SPELL_EFFECT_ADD_HONOR], ['effect2Id', SPELL_EFFECT_ADD_HONOR], ['effect3Id', SPELL_EFFECT_ADD_HONOR], 'OR'));
|
||||
if (!$createdBy->error)
|
||||
{
|
||||
$this->extendGlobalData($createdBy->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
|
||||
|
||||
$tabData = array(
|
||||
'data' => array_values($createdBy->getListviewData()),
|
||||
'data' => $createdBy->getListviewData(),
|
||||
'name' => '$LANG.tab_createdby',
|
||||
'id' => 'created-by',
|
||||
);
|
||||
|
|
@ -182,27 +199,27 @@ class CurrencyPage extends GenericPage
|
|||
if ($createdBy->hasSetFields('reagent1', 'reagent2', 'reagent3', 'reagent4', 'reagent5', 'reagent6', 'reagent7', 'reagent8'))
|
||||
$tabData['visibleCols'] = ['reagents'];
|
||||
|
||||
$this->lvTabs[] = [SpellList::$brickFile, $tabData];
|
||||
$this->lvTabs->addListviewTab(new Listview($tabData, SpellList::$brickFile));
|
||||
}
|
||||
}
|
||||
|
||||
// tab: currency for
|
||||
$n = $w = null;
|
||||
if ($this->typeId == 103)
|
||||
if ($this->typeId == CURRENCY_ARENA_POINTS)
|
||||
{
|
||||
$n = '?items&filter=cr=145;crs=1;crv=0';
|
||||
$w = '`reqArenaPoints` > 0';
|
||||
}
|
||||
else if ($this->typeId == 104)
|
||||
else if ($this->typeId == CURRENCY_HONOR_POINTS)
|
||||
{
|
||||
$n = '?items&filter=cr=144;crs=1;crv=0';
|
||||
$w = '`reqHonorPoints` > 0';
|
||||
}
|
||||
else
|
||||
$w = '`reqItemId1` = '.$_itemId.' OR `reqItemId2` = '.$_itemId.' OR `reqItemId3` = '.$_itemId.' OR `reqItemId4` = '.$_itemId.' OR `reqItemId5` = '.$_itemId;
|
||||
$w = '`reqItemId1` = '.$_relItemId.' OR `reqItemId2` = '.$_relItemId.' OR `reqItemId3` = '.$_relItemId.' OR `reqItemId4` = '.$_relItemId.' OR `reqItemId5` = '.$_relItemId;
|
||||
|
||||
if (!$n && ItemListFilter::isCurrencyFor($_itemId))
|
||||
$n = '?items&filter=cr=158;crs='.$_itemId.';crv=0';
|
||||
if (!$n && !is_null(ItemListFilter::getCriteriaIndex(158, $_relItemId)))
|
||||
$n = '?items&filter=cr=158;crs='.$_relItemId.';crv=0';
|
||||
|
||||
$xCosts = DB::Aowow()->selectCol('SELECT `id` FROM ?_itemextendedcost WHERE '.$w);
|
||||
$boughtBy = $xCosts ? DB::World()->selectCol('SELECT `item` FROM npc_vendor WHERE `extendedCost` IN (?a) UNION SELECT `item` FROM game_event_npc_vendor WHERE `extendedCost` IN (?a)', $xCosts, $xCosts) : [];
|
||||
|
|
@ -212,7 +229,7 @@ class CurrencyPage extends GenericPage
|
|||
if (!$boughtBy->error)
|
||||
{
|
||||
$tabData = array(
|
||||
'data' => array_values($boughtBy->getListviewData(ITEMINFO_VENDOR, [Type::CURRENCY => $this->typeId])),
|
||||
'data' => $boughtBy->getListviewData(ITEMINFO_VENDOR, [Type::CURRENCY => $this->typeId]),
|
||||
'name' => '$LANG.tab_currencyfor',
|
||||
'id' => 'currency-for',
|
||||
'extraCols' => ["\$Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack')", '$Listview.extraCols.cost']
|
||||
|
|
@ -221,24 +238,13 @@ class CurrencyPage extends GenericPage
|
|||
if ($n)
|
||||
$tabData['note'] = sprintf(Util::$filterResultString, $n);
|
||||
|
||||
$this->lvTabs[] = [ItemList::$brickFile, $tabData];
|
||||
$this->lvTabs->addListviewTab(new Listview($tabData, ItemList::$brickFile));
|
||||
|
||||
$this->extendGlobalData($boughtBy->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function generateTooltip()
|
||||
{
|
||||
$power = new \StdClass();
|
||||
if (!$this->subject->error)
|
||||
{
|
||||
$power->{'name_'.Lang::getLocale()->json()} = $this->subject->getField('name', true);
|
||||
$power->icon = rawurlencode($this->subject->getField('iconString', true, 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();
|
||||
}
|
||||
}
|
||||
|
||||
50
endpoints/currency/currency_power.php
Normal file
50
endpoints/currency/currency_power.php
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
namespace Aowow;
|
||||
|
||||
if (!defined('AOWOW_REVISION'))
|
||||
die('illegal access');
|
||||
|
||||
|
||||
class CurrencyPowerResponse extends TextResponse implements ICache
|
||||
{
|
||||
use TrTooltip, TrCache;
|
||||
|
||||
private const /* string */ POWER_TEMPLATE = '$WowheadPower.registerCurrency(%d, %d, %s);';
|
||||
|
||||
protected int $type = Type::CURRENCY;
|
||||
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
|
||||
{
|
||||
$currency = new CurrencyList(array(['id', $this->typeId]));
|
||||
if ($currency->error)
|
||||
$this->cacheType = CACHE_TYPE_NONE;
|
||||
else
|
||||
$opts = array(
|
||||
'name' => $currency->getField('name', true),
|
||||
'tooltip' => $currency->renderTooltip(),
|
||||
'icon' => $currency->getField('iconString')
|
||||
);
|
||||
|
||||
$this->result = new Tooltip(self::POWER_TEMPLATE, $this->typeId, $opts ?? []);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -77,7 +77,7 @@ class CurrencyList extends DBTypeList
|
|||
$x .= '<div style="max-width: 300px" class="q">'.$_.'</div>';
|
||||
|
||||
if ($_ = $this->getField('cap'))
|
||||
$x .= '<br /><span class="q">'.Lang::currency('cap').Lang::main('colon').'</span>'.Lang::nf($_).'<br />';
|
||||
$x .= '<br /><span class="q">'.Lang::currency('cap').'</span>'.Lang::nf($_).'<br />';
|
||||
|
||||
$x .= '</td></tr></table>';
|
||||
|
||||
|
|
|
|||
|
|
@ -47,8 +47,9 @@ class Loot
|
|||
{
|
||||
reset($this->results);
|
||||
|
||||
foreach ($this->results as $k => $__)
|
||||
yield $k => $this->results[$k];
|
||||
foreach ($this->results as $k => [, $tabData])
|
||||
if ($tabData['data']) // only yield tabs with content
|
||||
yield $k => $this->results[$k];
|
||||
}
|
||||
|
||||
public function getResult() : array
|
||||
|
|
|
|||
|
|
@ -1390,7 +1390,7 @@ $lang = array(
|
|||
),
|
||||
'currency' => array(
|
||||
'notFound' => "Diese Währung existiert nicht.",
|
||||
'cap' => "Obergrenze",
|
||||
'cap' => "Obergrenze: ",
|
||||
'cat' => array(
|
||||
1 => "Verschiedenes", 2 => "Spieler gegen Spieler", 4 => "Classic", 21 => "Wrath of the Lich King", 22 => "Dungeon und Schlachtzug", 23 => "Burning Crusade", 41 => "Test", 3 => "Unbenutzt"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1390,7 +1390,7 @@ $lang = array(
|
|||
),
|
||||
'currency' => array(
|
||||
'notFound' => "This currency doesn't exist.",
|
||||
'cap' => "Total cap",
|
||||
'cap' => "Total cap: ",
|
||||
'cat' => array(
|
||||
1 => "Miscellaneous", 2 => "Player vs. Player", 4 => "Classic", 21 => "Wrath of the Lich King", 22 => "Dungeon and Raid", 23 => "Burning Crusade", 41 => "Test", 3 => "Unused"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1390,7 +1390,7 @@ $lang = array(
|
|||
),
|
||||
'currency' => array(
|
||||
'notFound' => "Esta moneda no existe.",
|
||||
'cap' => "Límite total",
|
||||
'cap' => "Límite total: ",
|
||||
'cat' => array(
|
||||
1 => "Miscelánea", 2 => "Jugador contra Jugador", 4 => "Clásico", 21 => "Wrath of the Lich King", 22 => "Mazmorra y banda", 23 => "Burning Crusade", 41 => "Prueba", 3 => "No las uso"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1390,7 +1390,7 @@ $lang = array(
|
|||
),
|
||||
'currency' => array(
|
||||
'notFound' => "Cette monnaie n'existe pas.",
|
||||
'cap' => "Maximum total",
|
||||
'cap' => "Maximum total : ",
|
||||
'cat' => array(
|
||||
1 => "Divers", 2 => "JcJ", 4 => "Classique", 21 => "Wrath of the Lich King", 22 => "Raid", 23 => "Burning Crusade", 41 => "Test", 3 => "Inutilisées"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1390,7 +1390,7 @@ $lang = array(
|
|||
),
|
||||
'currency' => array(
|
||||
'notFound' => "Такая валюта не существует.",
|
||||
'cap' => "Максимум всего",
|
||||
'cap' => "Максимум всего: ",
|
||||
'cat' => array(
|
||||
1 => "Разное", 2 => "PvP", 4 => "World of Warcraft", 21 => "Wrath of the Lich King", 22 => "Подземелья и рейды", 23 => "Burning Crusade", 41 => "Test", 3 => "Неактивно"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1389,7 +1389,7 @@ $lang = array(
|
|||
),
|
||||
'currency' => array(
|
||||
'notFound' => "这个货币不存在。",
|
||||
'cap' => "总共上限",
|
||||
'cap' => "总共上限:",
|
||||
'cat' => array(
|
||||
1 => '其它', 2 => 'PvP', 3 => '未使用', 4 => '经典旧世', 21 => '巫妖王之怒',22 => '地下城与团队', 23 => '燃烧的远征', 41 => '测试'
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,59 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Aowow;
|
||||
|
||||
if (!defined('AOWOW_REVISION'))
|
||||
die('illegal access');
|
||||
|
||||
|
||||
// menuId 15: Currency g_initPath()
|
||||
// tabId 0: Database g_initHeader()
|
||||
class CurrenciesPage extends GenericPage
|
||||
{
|
||||
use TrListPage;
|
||||
|
||||
protected $type = Type::CURRENCY;
|
||||
protected $tpl = 'list-page-generic';
|
||||
protected $path = [0, 15];
|
||||
protected $tabId = 0;
|
||||
protected $mode = CACHE_TYPE_PAGE;
|
||||
protected $validCats = [1, 2, 3, 22];
|
||||
|
||||
public function __construct($pageCall, $pageParam)
|
||||
{
|
||||
$this->getCategoryFromUrl($pageParam);
|
||||
|
||||
parent::__construct($pageCall, $pageParam);
|
||||
|
||||
$this->name = Util::ucFirst(Lang::game('currencies'));
|
||||
}
|
||||
|
||||
protected function generateContent()
|
||||
{
|
||||
$conditions = [];
|
||||
|
||||
if (!User::isInGroup(U_GROUP_EMPLOYEE))
|
||||
$conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
|
||||
|
||||
if ($this->category)
|
||||
$conditions[] = ['category', (int)$this->category[0]];
|
||||
|
||||
$money = new CurrencyList($conditions);
|
||||
$this->lvTabs[] = [CurrencyList::$brickFile, ['data' => array_values($money->getListviewData())]];
|
||||
}
|
||||
|
||||
protected function generateTitle()
|
||||
{
|
||||
array_unshift($this->title, $this->name);
|
||||
if ($this->category)
|
||||
array_unshift($this->title, Lang::currency('cat', $this->category[0]));
|
||||
}
|
||||
|
||||
protected function generatePath()
|
||||
{
|
||||
if ($this->category)
|
||||
$this->path[] = $this->category[0];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue