removing smarty - part VI

- rewrote currencies, achievements, events, factions
- GenericPage:
   * moved more checks from Util
   * structured and commented GenericPage to be easier to comprehend
   * added GenericPage::postCache() to modify cached data before display (e.g. update time for events)
- fixed:
   * parsing events from markdown (e.g. articles)
   * huge padding of minibox headings (css)
   * Loot passing jsGlobals to template
   * ItemList::getExtendedCost passing jsGlobals to template
   * categories for factions
   * conflicting GenericPage::$subject when displaying 'notFound'
   * load of typos
This commit is contained in:
Sarjuuk
2014-06-21 18:39:54 +02:00
parent 9c7c2e29b5
commit caa7a7e39f
33 changed files with 1969 additions and 1856 deletions

View File

@@ -44,6 +44,8 @@ class AchievementList extends BaseType
$_curTpl['rewards'][TYPE_TITLE][] = -$rewId;
}
}
$_curTpl['iconString'] = $_curTpl['iconString'] ?: 'trade_engineering';
}
}

View File

@@ -9,10 +9,10 @@ class FactionList extends BaseType
public static $type = TYPE_FACTION;
public static $brickFile = 'faction';
protected $queryBase = 'SELECT f.*, f.parentFactionId AS cat2, f.id AS ARRAY_KEY FROM ?_factions f';
protected $queryBase = 'SELECT f.*, f.parentFactionId AS cat, f.id AS ARRAY_KEY FROM ?_factions f';
protected $queryOpts = array(
'f' => [['f2']],
'f2' => ['j' => ['?_factions f2 ON f.parentFactionId = f2.id', true], 's' => ', IFNULL(f2.parentFactionId, 0) AS cat'],
'f2' => ['j' => ['?_factions f2 ON f.parentFactionId = f2.id', true], 's' => ', IFNULL(f2.parentFactionId, 0) AS cat2'],
'ft' => ['j' => '?_factiontemplate ft ON ft.factionId = f.id']
);

View File

@@ -107,13 +107,13 @@ class ItemList extends BaseType
if ($_ = @$costs['reqArenaPoints'])
{
$data[-103] = $_;
$this->jsGlobals[TYPE_CURRENCY][103] = [103];
$this->jsGlobals[TYPE_CURRENCY][103] = 103;
}
if ($_ = @$costs['reqHonorPoints'])
{
$data[-104] = $_;
$this->jsGlobals[TYPE_CURRENCY][104] = [104];
$this->jsGlobals[TYPE_CURRENCY][104] = 104;
}
for ($i = 1; $i < 6; $i++)
@@ -135,7 +135,9 @@ class ItemList extends BaseType
if ($cItems)
{
$moneyItems = new CurrencyList(array(['itemId', $cItems]));
$this->jsGlobals = $moneyItems->getJSGlobals();
foreach ($moneyItems->getJSGlobals() as $type => $jsData)
foreach ($jsData as $k => $v)
$this->jsGlobals[$type][$k] = $v;
foreach ($itemz as $id => $vendors)
{
@@ -158,7 +160,7 @@ class ItemList extends BaseType
}
if (!$found)
$this->jsGlobals[TYPE_ITEM][$k] = [$k];
$this->jsGlobals[TYPE_ITEM][$k] = $k;
}
}
$vendors[$l] = $costs;
@@ -289,7 +291,7 @@ class ItemList extends BaseType
if ($e = $cost['event'])
{
$this->jsGlobals[TYPE_WORLDEVENT][$e] = [$e];
$this->jsGlobals[TYPE_WORLDEVENT][$e] = $e;
$data[$this->id]['condition'] = array(
'type' => TYPE_WORLDEVENT,
'typeId' => -$e,
@@ -366,7 +368,7 @@ class ItemList extends BaseType
public function getJSGlobals($addMask = GLOBALINFO_SELF, &$extra = [])
{
$data = $this->jsGlobals;
$data = $addMask & GLOBALINFO_RELATED ? $this->jsGlobals : [];
foreach ($this->iterate() as $id => $__)
{