From f1b613cfa0e94afa9198cc2f5afe4de7fb4a632e Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Wed, 20 Aug 2025 02:47:46 +0200 Subject: [PATCH] Template/Update (Part 43) * split 'arena-teams' into separate endpoints --- endpoints/arena-team/arena-team.php | 146 ++++++++++++++++++++++ endpoints/arena-team/resync.php | 48 +++++++ endpoints/arena-team/status.php | 29 +++++ endpoints/arena-teams/arena-teams.php | 152 +++++++++++++++++++++++ includes/ajaxHandler/arenateam.class.php | 83 ------------- includes/dbtypes/arenateam.class.php | 3 +- localization/locale_dede.php | 2 +- localization/locale_enus.php | 2 +- localization/locale_eses.php | 2 +- localization/locale_frfr.php | 2 +- localization/locale_ruru.php | 2 +- localization/locale_zhcn.php | 2 +- pages/arenateam.php | 152 ----------------------- pages/arenateams.php | 135 -------------------- template/pages/arena-teams.tpl.php | 52 ++++---- 15 files changed, 410 insertions(+), 402 deletions(-) create mode 100644 endpoints/arena-team/arena-team.php create mode 100644 endpoints/arena-team/resync.php create mode 100644 endpoints/arena-team/status.php create mode 100644 endpoints/arena-teams/arena-teams.php delete mode 100644 includes/ajaxHandler/arenateam.class.php delete mode 100644 pages/arenateam.php delete mode 100644 pages/arenateams.php diff --git a/endpoints/arena-team/arena-team.php b/endpoints/arena-team/arena-team.php new file mode 100644 index 00000000..2d40ce97 --- /dev/null +++ b/endpoints/arena-team/arena-team.php @@ -0,0 +1,146 @@ + Profiler > Arena Team + + protected array $dataLoader = ['realms', 'weight-presets']; + protected array $scripts = array( + [SC_JS_FILE, 'js/profile_all.js'], + [SC_JS_FILE, 'js/profile.js'], + [SC_CSS_FILE, 'css/Profiler.css'] + ); + + public int $type = Type::ARENA_TEAM; + + public function __construct(string $idOrProfile) + { + parent::__construct($idOrProfile); + + if (!Cfg::get('PROFILER_ENABLE')) + $this->generateError(); + + if (!$idOrProfile) + $this->generateError(); + + $this->getSubjectFromUrl($idOrProfile); + + // we have an ID > ok + if ($this->typeId) + return; + + // param was incomplete profile > error + if (!$this->subjectName) + $this->generateError(); + + // 3 possibilities + // 1) already synced to aowow + if ($subject = DB::Aowow()->selectRow('SELECT `id`, `realmGUID`, `cuFlags` FROM ?_profiler_arena_team WHERE `realm` = ?d AND `nameUrl` = ?', $this->realmId, Profiler::urlize($this->subjectName))) + { + $this->typeId = $subject['id']; + + if ($subject['cuFlags'] & PROFILER_CU_NEEDS_RESYNC) + $this->handleIncompleteData(Type::ARENA_TEAM, $subject['realmGUID']); + + return; + } + + // 2) not yet synced but exists on realm (wont work if we get passed an urlized name, but there is nothing we can do about it) + else if ($subject = DB::Characters($this->realmId)->selectRow('SELECT at.`arenaTeamId` AS "realmGUID", at.`name`, at.`type` FROM arena_team at WHERE at.`name` = ?', Util::ucFirst($this->subjectName))) + { + $subject['realm'] = $this->realmId; + $subject['cuFlags'] = PROFILER_CU_NEEDS_RESYNC; + + // create entry from realm with basic info + DB::Aowow()->query('INSERT IGNORE INTO ?_profiler_arena_team (?#) VALUES (?a)', array_keys($subject), array_values($subject)); + + $this->handleIncompleteData(Type::ARENA_TEAM, $subject['realmGUID']); + return; + } + + // 3) does not exist at all + $this->notFound(); + } + + protected function generate() : void + { + if ($this->doResync) + { + parent::generate(); + return; + } + + $subject = new LocalArenaTeamList(array(['at.id', $this->typeId])); + if ($subject->error) + $this->notFound(); + + // arena team accessed by id + if (!$this->subjectName) + $this->forward($subject->getProfileUrl()); + + $this->h1 = Lang::profiler('arenaRoster', [$subject->getField('name')]); + + + /*************/ + /* Menu Path */ + /*************/ + + $this->followBreadcrumbPath(); + + + /**************/ + /* Page Title */ + /**************/ + + array_unshift( + $this->title, + $subject->getField('name').' ('.$this->realm.' - '.Lang::profiler('regions', $this->region).')', + Util::ucFirst(Lang::profiler('profiler')) + ); + + + /****************/ + /* Main Content */ + /****************/ + + parent::generate(); + + $this->redButtons[BUTTON_RESYNC] = [$this->typeId, 'arena-team']; + + // statistic calculations here + + + /**************/ + /* Extra Tabs */ + /**************/ + + $this->lvTabs = new Tabs(['parent' => "\$\$WH.ge('tabs-generic')"], 'tabsRelated'); + + // tab: members + $member = new LocalProfileList(array(['atm.arenaTeamId', $this->typeId])); + $this->lvTabs->addListviewTab(new Listview(array( + 'data' => $member->getListviewData(PROFILEINFO_CHARACTER | PROFILEINFO_ARENA), + 'sort' => [-15], + 'visibleCols' => ['race', 'classs', 'level', 'talents', 'gearscore', 'rating', 'wins', 'losses'], + 'hiddenCols' => ['guild', 'location'] + ), ProfileList::$brickFile)); + } + + private function notFound() : never + { + parent::generateNotFound(Lang::game('arenateam'), Lang::profiler('notFound', 'arenateam')); + } +} + +?> diff --git a/endpoints/arena-team/resync.php b/endpoints/arena-team/resync.php new file mode 100644 index 00000000..dc16f103 --- /dev/null +++ b/endpoints/arena-team/resync.php @@ -0,0 +1,48 @@ + ['filter' => FILTER_CALLBACK, 'options' => [self::class, 'checkIdList'] ], + 'profile' => ['filter' => FILTER_CALLBACK, 'options' => [self::class, 'checkEmptySet']] + ); + + public function __construct(string $pageParam) + { + parent::__construct($pageParam); + + if (!Cfg::get('PROFILER_ENABLE')) + $this->generate404(); + } + + /* params + id: + user: [optional, not used] + profile: [optional, also get related chars] + return: 1 + */ + protected function generate() : void + { + if (!$this->assertGET('id')) + return; + + if ($teams = DB::Aowow()->select('SELECT `realm`, `realmGUID` FROM ?_profiler_arena_team WHERE `id` IN (?a)', $this->_get['id'])) + foreach ($teams as $t) + Profiler::scheduleResync(Type::ARENA_TEAM, $t['realm'], $t['realmGUID']); + + if ($this->_get['profile']) + if ($chars = DB::Aowow()->select('SELECT `realm`, `realmGUID` FROM ?_profiler_profiles p JOIN ?_profiler_arena_team_member atm ON atm.`profileId` = p.`id` WHERE atm.`arenaTeamId` IN (?a)', $this->_get['id'])) + foreach ($chars as $c) + Profiler::scheduleResync(Type::PROFILE, $c['realm'], $c['realmGUID']); + + $this->result = 1; // as string? + } +} + +?> diff --git a/endpoints/arena-team/status.php b/endpoints/arena-team/status.php new file mode 100644 index 00000000..b9029d61 --- /dev/null +++ b/endpoints/arena-team/status.php @@ -0,0 +1,29 @@ + ['filter' => FILTER_CALLBACK, 'options' => [self::class, 'checkIdList']] + ); + + public function __construct(string $pageParam) + { + parent::__construct($pageParam); + + if (!Cfg::get('PROFILER_ENABLE')) + $this->generate404(); + } + + protected function generate() : void + { + $this->result = Profiler::resyncStatus(Type::ARENA_TEAM, $this->_get['id']); + } +} + +?> diff --git a/endpoints/arena-teams/arena-teams.php b/endpoints/arena-teams/arena-teams.php new file mode 100644 index 00000000..2b8dbf73 --- /dev/null +++ b/endpoints/arena-teams/arena-teams.php @@ -0,0 +1,152 @@ + Profiler > Arena Teams + + protected array $dataLoader = ['realms']; + protected array $scripts = array( + [SC_JS_FILE, 'js/filters.js'], + [SC_JS_FILE, 'js/profile_all.js'], + [SC_JS_FILE, 'js/profile.js'] + ); + protected array $expectedGET = array( + 'filter' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => Filter::PATTERN_PARAM]] + ); + + public int $type = Type::ARENA_TEAM; + + private int $sumSubjects = 0; + + public function __construct(string $pageParam) + { + if (!Cfg::get('PROFILER_ENABLE')) + $this->generateError(); + + $this->getSubjectFromUrl($pageParam); + + parent::__construct($pageParam); + + $realms = []; + 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 arena_team'); + $realms[] = $idx; + } + + $this->subCat = $pageParam !== '' ? '='.$pageParam : ''; + $this->filter = new ArenaTeamListFilter($this->_get['filter'] ?? '', ['realms' => $realms]); + $this->filterError = $this->filter->error; + } + + protected function generate() : void + { + $this->h1 = Lang::game('arenateams'); + + + /*************/ + /* Menu Path */ + /*************/ + + $this->followBreadcrumbPath(); + + + /**************/ + /* Page Title */ + /**************/ + + if ($this->realm) + array_unshift($this->title, $this->realm,/* Cfg::get('BATTLEGROUP'),*/ Lang::profiler('regions', $this->region), Lang::game('arenateams')); + else if ($this->region) + array_unshift($this->title, Lang::profiler('regions', $this->region), Lang::game('arenateams')); + else + array_unshift($this->title, Lang::game('arenateams')); + + + /****************/ + /* Main Content */ + /****************/ + + $conditions = []; + if (!User::isInGroup(U_GROUP_EMPLOYEE)) + $conditions[] = ['at.seasonGames', 0, '>']; + + if ($_ = $this->filter->getConditions()) + $conditions[] = $_; + + $this->getRegions(); + + $tabData = array( + 'id' => 'arena-teams', + 'data' => [], + 'hideCount' => 1, + 'sort' => [-16], + 'extraCols' => ['$Listview.extraCols.members'], + 'visibleCols' => ['rank', 'wins', 'losses', 'rating'], + 'hiddenCols' => ['arenateam', 'guild'] + ); + + if (!$this->filter->values['sz']) + $tabData['visibleCols'][] = 'size'; + + if ($this->filter->values['si']) + $tabData['hiddenCols'][] = 'faction'; + + $miscParams = ['calcTotal' => true]; + if ($this->realm) + $miscParams['sv'] = $this->realm; + if ($this->region) + $miscParams['rg'] = $this->region; + + $teams = new RemoteArenaTeamList($conditions, $miscParams); + if (!$teams->error) + { + $teams->initializeLocalEntries(); + + $tabData['data'] = $teams->getListviewData(); + + // create note if search limit was exceeded + if ($this->filter->query && $teams->getMatches() > Cfg::get('SQL_LIMIT_DEFAULT')) + { + $tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_arenateamsfound2', $this->sumSubjects, $teams->getMatches()); + $tabData['_truncated'] = 1; + } + else if ($teams->getMatches() > Cfg::get('SQL_LIMIT_DEFAULT')) + $tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_arenateamsfound', $this->sumSubjects, 0); + } + + $this->lvTabs = new Tabs(['parent' => "\$\$WH.ge('tabs-generic')"], 'tabsRelated'); + + $this->lvTabs->addListviewTab(new Listview($tabData, ArenaTeamList::$brickFile, 'membersCol')); + + parent::generate(); + + $this->result->registerDisplayHook('filter', [self::class, 'filterFormHook']); + } + + public static function filterFormHook(Template\PageTemplate &$pt, ArenaTeamListFilter $filter) : void + { + // sort for dropdown-menus + Lang::sort('game', 'cl'); + Lang::sort('game', 'ra'); + } +} + +?> diff --git a/includes/ajaxHandler/arenateam.class.php b/includes/ajaxHandler/arenateam.class.php deleted file mode 100644 index 093555e7..00000000 --- a/includes/ajaxHandler/arenateam.class.php +++ /dev/null @@ -1,83 +0,0 @@ - ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkIdList' ], - 'profile' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkEmptySet'], - ); - - public function __construct(array $params) - { - parent::__construct($params); - - if (!$this->params) - return; - - switch ($this->params[0]) - { - case 'resync': - $this->handler = 'handleResync'; - break; - case 'status': - $this->handler = 'handleStatus'; - break; - } - } - - /* params - id: - user: [optional, not used] - profile: [optional, also get related chars] - return: 1 - */ - protected function handleResync() : string - { - if ($teams = DB::Aowow()->select('SELECT realm, realmGUID FROM ?_profiler_arena_team WHERE id IN (?a)', $this->_get['id'])) - foreach ($teams as $t) - Profiler::scheduleResync(Type::ARENA_TEAM, $t['realm'], $t['realmGUID']); - - if ($this->_get['profile']) - if ($chars = DB::Aowow()->select('SELECT realm, realmGUID FROM ?_profiler_profiles p JOIN ?_profiler_arena_team_member atm ON atm.profileId = p.id WHERE atm.arenaTeamId IN (?a)', $this->_get['id'])) - foreach ($chars as $c) - Profiler::scheduleResync(Type::PROFILE, $c['realm'], $c['realmGUID']); - - return '1'; - } - - /* params - id: - return - - [ - nQueueProcesses, - [statusCode, timeToRefresh, curQueuePos, errorCode, nResyncTries], - [] - ... - ] - - not all fields are required, if zero they are omitted - statusCode: - 0: end the request - 1: waiting - 2: working... - 3: ready; click to view - 4: error / retry - errorCode: - 0: unk error - 1: char does not exist - 2: armory gone - */ - protected function handleStatus() : string - { - return Profiler::resyncStatus(Type::ARENA_TEAM, $this->_get['id']); - } -} - -?> diff --git a/includes/dbtypes/arenateam.class.php b/includes/dbtypes/arenateam.class.php index aae55283..8bb26a37 100644 --- a/includes/dbtypes/arenateam.class.php +++ b/includes/dbtypes/arenateam.class.php @@ -58,7 +58,8 @@ class ArenaTeamListFilter extends Filter 'si' => [parent::V_LIST, [1, 2], false], // side 'sz' => [parent::V_LIST, [2, 3, 5], false], // tema size 'rg' => [parent::V_CALLBACK, 'cbRegionCheck', false], // region - 'sv' => [parent::V_CALLBACK, 'cbServerCheck', false], // server + 'bg' => [parent::V_EQUAL, null, false], // battlegroup - unsued here, but var expected by template + 'sv' => [parent::V_CALLBACK, 'cbServerCheck', false] // server ); public array $extraOpts = []; diff --git a/localization/locale_dede.php b/localization/locale_dede.php index 4914a797..5c2867c5 100644 --- a/localization/locale_dede.php +++ b/localization/locale_dede.php @@ -232,7 +232,7 @@ $lang = array( 'guildRoster' => "Gildenliste für <%s>", 'arenaRoster' => "Arena-Teamliste für <%s>", 'atCaptain' => "Teamkapitän", - + 'atSize' => "Größe: ", 'profiler' => "Charakter-Profiler", 'notFound' => array( 'guild' => "Diese Gilde existiert nicht oder wurde noch nicht in die Datenbank übernommen.", diff --git a/localization/locale_enus.php b/localization/locale_enus.php index 2cb842d5..edc82692 100644 --- a/localization/locale_enus.php +++ b/localization/locale_enus.php @@ -232,7 +232,7 @@ $lang = array( 'guildRoster' => "Guild Roster for <%s>", 'arenaRoster' => "Arena Team Roster for <%s>", 'atCaptain' => "Arena Team Captain", - + 'atSize' => "Size: ", 'profiler' => "Character Profiler", 'notFound' => array( 'guild' => "This Guild doesn't exist or is not yet in the database.", diff --git a/localization/locale_eses.php b/localization/locale_eses.php index ad8370d6..979a603b 100644 --- a/localization/locale_eses.php +++ b/localization/locale_eses.php @@ -232,7 +232,7 @@ $lang = array( 'guildRoster' => "Lista de miembros de hermandad para <%s>", 'arenaRoster' => "Personajes del Equipo de Arena para <%s>", 'atCaptain' => "Capitán de equipo de arena", - + 'atSize' => "Tamaño: ", 'profiler' => "Gestor de Perfiles", // Perfiles de Personaje? (character profiler) 'notFound' => array( 'guild' => "Esta hermandad no existe o aún no está en la base de datos.", diff --git a/localization/locale_frfr.php b/localization/locale_frfr.php index adb2170e..9f9acf20 100644 --- a/localization/locale_frfr.php +++ b/localization/locale_frfr.php @@ -232,7 +232,7 @@ $lang = array( 'guildRoster' => "Liste des membres pour la guilde de <%s>", 'arenaRoster' => "[Arena Team Roster for <%s>]", // string probably lost 'atCaptain' => "Capitaine d'équipe", - + 'atSize' => "Type : ", 'profiler' => "Profiler de Personnage", 'notFound' => array( 'guild' => "[This Guild doesn't exist or is not yet in the database.]", diff --git a/localization/locale_ruru.php b/localization/locale_ruru.php index c7925e0f..f6d74b02 100644 --- a/localization/locale_ruru.php +++ b/localization/locale_ruru.php @@ -232,7 +232,7 @@ $lang = array( 'guildRoster' => "Список членов гильдии <%s>", 'arenaRoster' => "[Arena Team Roster for <%s>]", // string probably lost 'atCaptain' => "Капитан команды арены", - + 'atSize' => "Численности: ", 'profiler' => "Профили персонажей", 'notFound' => array( 'profile' => "Этот персонаж не существует, либо еще не добавлен в базу данных.", diff --git a/localization/locale_zhcn.php b/localization/locale_zhcn.php index 91be4de5..0bfd5a87 100644 --- a/localization/locale_zhcn.php +++ b/localization/locale_zhcn.php @@ -232,7 +232,7 @@ $lang = array( 'guildRoster' => "公会成员名单 <%s>", 'arenaRoster' => "竞技场战队名单 <%s>", 'atCaptain' => "竞技场战队队长", - + 'atSize' => "团队规模:", 'profiler' => "角色概况", 'notFound' => array( 'guild' => "该公会不存在或尚未被收录到数据库中。", diff --git a/pages/arenateam.php b/pages/arenateam.php deleted file mode 100644 index 1595ece2..00000000 --- a/pages/arenateam.php +++ /dev/null @@ -1,152 +0,0 @@ -error(); - - $params = array_map('urldecode', explode('.', $pageParam)); - if ($params[0]) - $params[0] = Profiler::urlize($params[0]); - if (isset($params[1])) - $params[1] = Profiler::urlize($params[1]); - - if (count($params) == 1 && intval($params[0])) - { - $this->subject = new LocalArenaTeamList(array(['at.id', intval($params[0])])); - if ($this->subject->error) - $this->notFound(); - - header('Location: '.$this->subject->getProfileUrl(), true, 302); - } - else if (count($params) == 3) - { - $this->getSubjectFromUrl($pageParam); - if (!$this->subjectName) - $this->notFound(); - - // 3 possibilities - // 1) already synced to aowow - if ($subject = DB::Aowow()->selectRow('SELECT id, realmGUID, cuFlags FROM ?_profiler_arena_team WHERE realm = ?d AND nameUrl = ?', $this->realmId, Profiler::urlize($this->subjectName))) - { - if ($subject['cuFlags'] & PROFILER_CU_NEEDS_RESYNC) - { - $this->handleIncompleteData($subject['realmGUID']); - return; - } - - $this->subjectGUID = $subject['id']; - $this->subject = new LocalArenaTeamList(array(['id', $subject['id']])); - if ($this->subject->error) - $this->notFound(); - - $this->name = sprintf(Lang::profiler('arenaRoster'), $this->subject->getField('name')); - } - // 2) not yet synced but exists on realm (wont work if we get passed an urlized name, but there is nothing we can do about it) - else if ($team = DB::Characters($this->realmId)->selectRow('SELECT at.arenaTeamId AS realmGUID, at.name, at.type FROM arena_team at WHERE at.name = ?', Util::ucFirst($this->subjectName))) - { - $team['realm'] = $this->realmId; - $team['cuFlags'] = PROFILER_CU_NEEDS_RESYNC; - - // create entry from realm with basic info - DB::Aowow()->query('INSERT IGNORE INTO ?_profiler_arena_team (?#) VALUES (?a)', array_keys($team), array_values($team)); - - $this->handleIncompleteData($team['realmGUID']); - } - // 3) does not exist at all - else - $this->notFound(); - } - else - $this->notFound(); - } - - protected function generateTitle() - { - $team = !empty($this->subject) ? $this->subject->getField('name') : $this->subjectName; - $team .= ' ('.$this->realm.' - '.Lang::profiler('regions', $this->region).')'; - - array_unshift($this->title, $team, Util::ucFirst(Lang::profiler('profiler'))); - } - - protected function generateContent() - { - if ($this->doResync) - return; - - $this->addScript([SC_JS_FILE, '?data=realms.weight-presets']); - - $this->redButtons[BUTTON_RESYNC] = [$this->subjectGUID, 'arena-team']; - - /****************/ - /* Main Content */ - /****************/ - - - // statistic calculations here - - - /**************/ - /* Extra Tabs */ - /**************/ - - // tab: members - $member = new LocalProfileList(array(['atm.arenaTeamId', $this->subjectGUID])); - if (!$member->error) - { - $this->lvTabs[] = [ProfileList::$brickFile, array( - 'data' => array_values($member->getListviewData(PROFILEINFO_CHARACTER | PROFILEINFO_ARENA)), - 'sort' => [-15], - 'visibleCols' => ['race', 'classs', 'level', 'talents', 'gearscore', 'rating', 'wins', 'losses'], - 'hiddenCols' => ['guild', 'location'] - )]; - } - } - - public function notFound(string $title = '', string $msg = '') : never - { - parent::notFound($title ?: Util::ucFirst(Lang::profiler('profiler')), $msg ?: Lang::profiler('notFound', 'arenateam')); - } - - private function handleIncompleteData($teamGuid) - { - //display empty page and queue status - $newId = Profiler::scheduleResync(Type::ARENA_TEAM, $this->realmId, $teamGuid); - - $this->doResync = ['arena-team', $newId]; - $this->initialSync(); - } -} - -?> diff --git a/pages/arenateams.php b/pages/arenateams.php deleted file mode 100644 index e56e2ebe..00000000 --- a/pages/arenateams.php +++ /dev/null @@ -1,135 +0,0 @@ - ['filter' => FILTER_UNSAFE_RAW]]; - - public function __construct($pageCall, $pageParam) - { - parent::__construct($pageCall, $pageParam); - - if (!Cfg::get('PROFILER_ENABLE')) - $this->error(); - - $this->filterObj = new ArenaTeamListFilter($this->_get['filter'] ?? ''); - - $this->getSubjectFromUrl($pageParam); - - 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 arena_team'); - } - - $this->name = Lang::profiler('arenaTeams'); - $this->subCat = $pageParam ? '='.$pageParam : ''; - } - - protected function generateTitle() - { - if ($this->realm) - array_unshift($this->title, $this->realm,/* Cfg::get('BATTLEGROUP'),*/ Lang::profiler('regions', $this->region), Lang::profiler('arenaTeams')); - else if ($this->region) - array_unshift($this->title, Lang::profiler('regions', $this->region), Lang::profiler('arenaTeams')); - else - array_unshift($this->title, Lang::profiler('arenaTeams')); - } - - protected function generateContent() - { - $this->addScript([SC_JS_FILE, '?data=realms']); - - $conditions = []; - if (!User::isInGroup(U_GROUP_EMPLOYEE)) - $conditions[] = ['at.seasonGames', 0, '>']; - - $this->filterObj->evalCriteria(); - - if ($_ = $this->filterObj->getConditions()) - $conditions[] = $_; - - $tabData = array( - 'id' => 'arena-teams', - 'hideCount' => 1, - 'sort' => [-16], - 'extraCols' => ['$Listview.extraCols.members'], - 'visibleCols' => ['rank', 'wins', 'losses', 'rating'], - 'hiddenCols' => ['arenateam', 'guild'], - ); - - if (!$this->filterObj->values['sz']) - $tabData['visibleCols'][] = 'size'; - - $miscParams = ['calcTotal' => true]; - if ($this->realm) - $miscParams['sv'] = $this->realm; - if ($this->region) - $miscParams['rg'] = $this->region; - - $teams = new RemoteArenaTeamList($conditions, $miscParams); - if (!$teams->error) - { - $teams->initializeLocalEntries(); - - $dFields = $teams->hasDiffFields('faction', 'type'); - if (!($dFields & 0x1)) - $tabData['hiddenCols'][] = 'faction'; - - $tabData['data'] = array_values($teams->getListviewData()); - - // create note if search limit was exceeded - if ($this->filterObj->query && $teams->getMatches() > Cfg::get('SQL_LIMIT_DEFAULT')) - { - $tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_arenateamsfound2', $this->sumSubjects, $teams->getMatches()); - $tabData['_truncated'] = 1; - } - else if ($teams->getMatches() > Cfg::get('SQL_LIMIT_DEFAULT')) - $tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_arenateamsfound', $this->sumSubjects, 0); - - if ($this->filterObj->error) - $tabData['_errors'] = 1; - } - - $this->lvTabs[] = [ArenaTeamList::$brickFile, $tabData, 'membersCol']; - } - - protected function postCache() - { - // sort for dropdown-menus - Lang::sort('game', 'cl'); - Lang::sort('game', 'ra'); - } -} - -?> diff --git a/template/pages/arena-teams.tpl.php b/template/pages/arena-teams.tpl.php index 3bcdc325..144069a9 100644 --- a/template/pages/arena-teams.tpl.php +++ b/template/pages/arena-teams.tpl.php @@ -1,10 +1,11 @@ - - brick('header'); -$f = $this->filterObj->values // shorthand -?> + namespace Aowow\Template; + use \Aowow\Lang; + +$this->brick('header'); +$f = $this->filter->values; // shorthand +?>
@@ -12,47 +13,48 @@ $f = $this->filterObj->values // shorthand brick('announcement'); -$this->brick('pageTemplate', ['fiQuery' => $this->filterObj->query, 'fiMenuItem' => [2]]); +$this->brick('pageTemplate', ['fiQuery' => $this->filter->query, 'fiMenuItem' => array_slice($this->pageTemplate['breadcrumb'], 0, -1)]); -# for some arcane reason a newline (\n) means, the first childNode is a text instead of the form for the following div +# pr_setRegionRealm($WH.ge('fi').firstChild, realm, region) - never have \n\s before
, it will become firstChild (a text node) ?> -
+
+brick('headIcons'); + +$this->brick('redButtons'); +?> +

h1; ?>

+
- + - + - +
ucFirst(Lang::main('name')).Lang::main('colon'); ?> - - + +
 />  /> />  />
        
    Size     
@@ -68,7 +70,7 @@ $this->brick('pageTemplate', ['fiQuery' => $this->filterObj->query, 'fiMenuItem'
-brick('filter'); ?> +renderFilter(12); ?> brick('lvTabs'); ?>