mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
* modernize DB-Types - long term: should be split in class that describes the DB-Type and container class that handles multiples * make unchanging filter props static, allow lookup of criteria indizes through filter * move username/mail/password checks to util and make them usable as input filter
84 lines
2.4 KiB
PHP
84 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace Aowow;
|
|
|
|
if (!defined('AOWOW_REVISION'))
|
|
die('illegal access');
|
|
|
|
|
|
class FactionList extends DBTypeList
|
|
{
|
|
public static int $type = Type::FACTION;
|
|
public static string $brickFile = 'faction';
|
|
public static string $dataTable = '?_factions';
|
|
|
|
protected string $queryBase = 'SELECT f.*, f.`parentFactionId` AS "cat", f.`id` AS ARRAY_KEY FROM ?_factions f';
|
|
protected array $queryOpts = array(
|
|
'f' => [['f2']],
|
|
'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`']
|
|
);
|
|
|
|
public function __construct(array $conditions = [], array $miscData = [])
|
|
{
|
|
parent::__construct($conditions, $miscData);
|
|
|
|
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 function getListviewData() : array
|
|
{
|
|
$data = [];
|
|
|
|
foreach ($this->iterate() as $__)
|
|
{
|
|
$data[$this->id] = array(
|
|
'expansion' => $this->curTpl['expansion'],
|
|
'id' => $this->id,
|
|
'side' => $this->curTpl['side'],
|
|
'name' => $this->getField('name', true)
|
|
);
|
|
|
|
if ($this->curTpl['cat2'])
|
|
{
|
|
$data[$this->id]['category'] = $this->curTpl['cat'];
|
|
$data[$this->id]['category2'] = $this->curTpl['cat2'];
|
|
}
|
|
else
|
|
{
|
|
$data[$this->id]['category'] = $this->curTpl['cat2'];
|
|
$data[$this->id]['category2'] = $this->curTpl['cat'];
|
|
}
|
|
|
|
}
|
|
|
|
return $data;
|
|
}
|
|
|
|
public function getJSGlobals(int $addMask = 0) : array
|
|
{
|
|
$data = [];
|
|
|
|
foreach ($this->iterate() as $__)
|
|
$data[Type::FACTION][$this->id] = ['name' => $this->getField('name', true)];
|
|
|
|
return $data;
|
|
}
|
|
|
|
public function renderTooltip() : ?string { return null; }
|
|
|
|
}
|
|
|
|
?>
|