mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
* further optimize search - use achievement 4496 as shortcut for everything based around total achievement points - get talent distribution separately - get total profiler-items found separately - opt to not sort found results * fixed Profiles with zero Achievement Points * added cache key genrator i forgot :< * fixed typos
122 lines
3.9 KiB
PHP
122 lines
3.9 KiB
PHP
<?php
|
|
|
|
if (!defined('AOWOW_REVISION'))
|
|
die('illegal access');
|
|
|
|
|
|
// menuId 5: Profiler g_initPath()
|
|
// tabId 1: Tools g_initHeader()
|
|
class GuildsPage extends GenericPage
|
|
{
|
|
use TrProfiler;
|
|
|
|
protected $type = TYPE_GUILD;
|
|
|
|
protected $tabId = 1;
|
|
protected $path = [1, 5, 2];
|
|
protected $tpl = 'guilds';
|
|
protected $js = ['filters.js', 'profile_all.js', 'profile.js'];
|
|
|
|
public function __construct($pageCall, $pageParam)
|
|
{
|
|
if (!CFG_PROFILER_ENABLE)
|
|
$this->error();
|
|
|
|
$this->getSubjectFromUrl($pageParam);
|
|
|
|
$this->filterObj = new GuildListFilter();
|
|
|
|
foreach (Profiler::getRealms() as $idx => $r)
|
|
{
|
|
if ($this->region && $r['region'] != $this->region)
|
|
continue;
|
|
|
|
if ($this->realm && $r['name'] != $this->realm)
|
|
continue;
|
|
|
|
$this->sumSubjects += DB::Characters($idx)->selectCell('SELECT COUNT(*) FROM guild');
|
|
}
|
|
|
|
parent::__construct($pageCall, $pageParam);
|
|
|
|
$this->name = Lang::profiler('guilds');
|
|
$this->subCat = $pageParam ? '='.$pageParam : '';
|
|
}
|
|
|
|
protected function generateTitle()
|
|
{
|
|
if ($this->realm)
|
|
array_unshift($this->title, $this->realm,/* CFG_BATTLEGROUP,*/ Lang::profiler('regions', $this->region), Lang::profiler('guilds'));
|
|
else if ($this->region)
|
|
array_unshift($this->title, Lang::profiler('regions', $this->region), Lang::profiler('guilds'));
|
|
else
|
|
array_unshift($this->title, Lang::profiler('guilds'));
|
|
}
|
|
|
|
protected function generateContent()
|
|
{
|
|
$this->addJS('?data=realms&locale='.User::$localeId.'&t='.$_SESSION['dataKey']);
|
|
|
|
$conditions = array(
|
|
['c.deleteInfos_Account', null],
|
|
['c.level', MAX_LEVEL, '<='], // prevents JS errors
|
|
[['c.extra_flags', Profiler::CHAR_GMFLAGS, '&'], 0]
|
|
);
|
|
if ($_ = $this->filterObj->getConditions())
|
|
$conditions[] = $_;
|
|
|
|
// recreate form selection
|
|
$this->filter = $this->filterObj->getForm();
|
|
$this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : null;
|
|
$this->filter['initData'] = ['type' => 'guilds'];
|
|
|
|
$tabData = array(
|
|
'id' => 'guilds',
|
|
'hideCount' => 1,
|
|
'sort' => [-3],
|
|
'visibleCols' => ['members', 'achievementpoints', 'gearscore'],
|
|
'hiddenCols' => ['guild'],
|
|
);
|
|
|
|
$miscParams = [];
|
|
if ($this->realm)
|
|
$miscParams['sv'] = $this->realm;
|
|
if ($this->region)
|
|
$miscParams['rg'] = $this->region;
|
|
|
|
$guilds = new RemoteGuildList($conditions, $miscParams);
|
|
if (!$guilds->error)
|
|
{
|
|
$guilds->initializeLocalEntries();
|
|
|
|
$dFields = $guilds->hasDiffFields(['faction', 'type']);
|
|
if (!($dFields & 0x1))
|
|
$tabData['hiddenCols'][] = 'faction';
|
|
|
|
if (($dFields & 0x2))
|
|
$tabData['visibleCols'][] = 'size';
|
|
|
|
$tabData['data'] = array_values($guilds->getListviewData());
|
|
|
|
// create note if search limit was exceeded
|
|
if ($this->filter['query'] && $guilds->getMatches() > CFG_SQL_LIMIT_DEFAULT)
|
|
{
|
|
$tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_guildsfound2', $this->sumSubjects, $guilds->getMatches());
|
|
$tabData['_truncated'] = 1;
|
|
}
|
|
else if ($guilds->getMatches() > CFG_SQL_LIMIT_DEFAULT)
|
|
$tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_guildsfound', $this->sumSubjects, 0);
|
|
|
|
if ($this->filterObj->error)
|
|
$tabData['_errors'] = 1;
|
|
}
|
|
|
|
$this->lvTabs[] = ['profile', $tabData, 'membersCol'];
|
|
|
|
Lang::sort('game', 'cl');
|
|
Lang::sort('game', 'ra');
|
|
}
|
|
}
|
|
|
|
?>
|