Moved most code related to jsGlobals to template. (Except for Globals, that belong to the object already created, it makes zero sense to look them up again from the template.)

I'm not overly happy with passing the templateObject to each typeObject, but it works .. for now.
Effectively this should reduce db-lookups as each type should be looked up only twice at max (once for relevant data on the page and maybe again to get related jsGlobals for the template)
also removed BaseType::addRewardsToJscript() get it with BaseType::addGlobalsToJscript() and the appropriate addMask

* added ListviewHelper::getSetFields() wich is more appropriate in some cases (like reagents for spells should be shown even if they are all the same)
* load bricks as needed, removed the if-blocks (maybe add the filename to every TypeClass..?)
This commit is contained in:
Sarjuuk
2013-07-11 21:29:05 +02:00
parent a8804f6440
commit 49800da2c8
43 changed files with 445 additions and 445 deletions

View File

@@ -5,8 +5,10 @@ if (!defined('AOWOW_REVISION'))
class CharClassList extends BaseType
{
protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_classes WHERE [cond] ORDER BY Id ASC';
protected $matchQuery = 'SELECT COUNT(1) FROM ?_classes WHERE [cond]';
public static $type = TYPE_CLASS;
protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_classes WHERE [cond] ORDER BY Id ASC';
protected $matchQuery = 'SELECT COUNT(1) FROM ?_classes WHERE [cond]';
public function getListviewData()
{
@@ -24,7 +26,7 @@ class CharClassList extends BaseType
'power' => $this->curTpl['powerType'],
);
if ($this->curTpl['expansion'] == 2) // todo: grr, move to db
if ($this->curTpl['expansion'] == 2) // todo (low): grr, move to db
$data[$this->id]['hero'] = 1;
if ($this->curTpl['expansion'])
@@ -34,13 +36,10 @@ class CharClassList extends BaseType
return $data;
}
public function addGlobalsToJscript(&$refs)
public function addGlobalsToJscript(&$template, $addMask = 0)
{
if (!isset($refs['gClasses']))
$refs['gClasses'] = [];
while ($this->iterate())
$refs['gClasses'][$this->id] = ['name' => $this->getField('name', true)];
$template->extendGlobalData(self::$type, [$this->id => ['name' => $this->getField('name', true)]]);
}
public function addRewardsToJScript(&$ref) { }