Files
aowow/includes/types/faction.class.php
Sarjuuk 0c4c7ea9ae * Factions: set titles for ListPage
* GameObjects: initial implementation (some filter missing; positions not
yet availabe; some custom data to be set; required table will be added
later)
* MiscTools: fixed random page; 'implemented' missing Screenshots; fixed
access to template file
* Search: implemented check for CUSTOM_EXCLUDE_FOR_LISTVIEW if user is not
 in U_GROUP_STAFF; searches should now be cachable
* NPCs: three more tabs on detailPage

* some work against Quests
* fighting the template-system :<
2014-02-19 16:39:15 +01:00

84 lines
2.2 KiB
PHP

<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
class FactionList extends BaseType
{
public static $type = TYPE_FACTION;
public static $brickFile = 'faction';
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 cat2']
);
public function __construct($conditions = [])
{
parent::__construct($conditions);
if ($this->error)
return;
// post processing
foreach ($this->iterate() as &$_curTpl)
{
// prepare factionTemplates
$_curTpl['templateIds'] = $_curTpl['templateIds'] ? explode(' ', $_curTpl['templateIds']) : [];
// prepare quartermaster
$_curTpl['qmNpcIds'] = $_curTpl['qmNpcIds'] ? explode(' ', $_curTpl['qmNpcIds']) : [];
}
}
public static function getName($id)
{
$n = DB::Aowow()->SelectRow('
SELECT
name_loc0,
name_loc2,
name_loc3,
name_loc6,
name_loc8
FROM
?_factions
WHERE
id = ?d',
$id
);
return Util::localizedString($n, 'name');
}
public function getListviewData()
{
$data = [];
foreach ($this->iterate() as $__)
{
$data[$this->id] = array(
'category' => $this->curTpl['cat'],
'category2' => $this->curTpl['cat2'],
'expansion' => $this->curTpl['expansion'],
'id' => $this->id,
'side' => $this->curTpl['side'],
'name' => $this->getField('name', true)
);
}
return $data;
}
public function addGlobalsToJScript(&$template, $addMask = 0)
{
foreach ($this->iterate() as $__)
$template->extendGlobalData(self::$type, [$this->id => ['name' => $this->getField('name', true)]]);
}
public function renderTooltip() { }
}
?>