From 398ff16b655dddabca521fea94b84d508a757fd0 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Wed, 20 Aug 2025 02:46:43 +0200 Subject: [PATCH] Template/Update (Part 42) * split 'guilds' into separate endpoints --- endpoints/guild/guild.php | 151 ++++++++++++++++++++++++++ endpoints/guild/resync.php | 48 +++++++++ endpoints/guild/status.php | 29 +++++ endpoints/guilds/guilds.php | 149 +++++++++++++++++++++++++ includes/ajaxHandler/guild.class.php | 83 -------------- includes/dbtypes/guild.class.php | 3 +- localization/locale_dede.php | 7 +- localization/locale_enus.php | 7 +- localization/locale_eses.php | 7 +- localization/locale_frfr.php | 7 +- localization/locale_ruru.php | 7 +- localization/locale_zhcn.php | 7 +- pages/guild.php | 156 --------------------------- pages/guilds.php | 132 ----------------------- template/pages/guilds.tpl.php | 46 ++++---- template/pages/roster.tpl.php | 13 ++- 16 files changed, 434 insertions(+), 418 deletions(-) create mode 100644 endpoints/guild/guild.php create mode 100644 endpoints/guild/resync.php create mode 100644 endpoints/guild/status.php create mode 100644 endpoints/guilds/guilds.php delete mode 100644 includes/ajaxHandler/guild.class.php delete mode 100644 pages/guild.php delete mode 100644 pages/guilds.php diff --git a/endpoints/guild/guild.php b/endpoints/guild/guild.php new file mode 100644 index 00000000..8855b26c --- /dev/null +++ b/endpoints/guild/guild.php @@ -0,0 +1,151 @@ + Profiler > Guilds + + 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::GUILD; + + 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_guild 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::GUILD, $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 `guildid` AS "realmGUID", `name` FROM guild WHERE `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_guild (?#) VALUES (?a)', array_keys($subject), array_values($subject)); + + $this->handleIncompleteData(Type::GUILD, $subject['realmGUID']); + return; + } + + // 3) does not exist at all + $this->notFound(); + } + + protected function generate() : void + { + if ($this->doResync) + { + parent::generate(); + return; + } + + $subject = new LocalGuildList(array(['id', $this->typeId])); + if ($subject->error) + $this->notFound(); + + // guild accessed by id + if (!$this->subjectName) + $this->forward($subject->getProfileUrl()); + + $this->h1 = Lang::profiler('guildRoster', [$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 */ + /****************/ + + $this->redButtons[BUTTON_RESYNC] = [$this->typeId, 'guild']; + + // statistic calculations here + + // smuggle the guild ranks into the html + if ($ranks = DB::Aowow()->selectCol('SELECT `rank` AS ARRAY_KEY, `name` FROM ?_profiler_guild_rank WHERE `guildId` = ?d', $this->typeId)) + $this->extraHTML = ''; + + + /**************/ + /* Extra Tabs */ + /**************/ + + $this->lvTabs = new Tabs(['parent' => "\$\$WH.ge('tabs-generic')"], 'tabsRelated'); + + // tab: members + $member = new LocalProfileList(array(['p.guild', $this->typeId], Cfg::get('SQL_LIMIT_NONE'))); + $this->lvTabs->addListviewTab(new Listview(array( + 'data' => $member->getListviewData(PROFILEINFO_CHARACTER | PROFILEINFO_GUILD), + 'sort' => [-15], + 'visibleCols' => ['race', 'classs', 'level', 'talents', 'gearscore', 'achievementpoints', 'guildrank'], + 'hiddenCols' => ['guild', 'location'] + ), ProfileList::$brickFile)); + + parent::generate(); + } + + public function notFound() : never + { + parent::generateNotFound(Lang::game('guild'), Lang::profiler('notFound', 'guild')); + } + +} + +?> diff --git a/endpoints/guild/resync.php b/endpoints/guild/resync.php new file mode 100644 index 00000000..2af65bb7 --- /dev/null +++ b/endpoints/guild/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 ($guilds = DB::Aowow()->select('SELECT `realm`, `realmGUID` FROM ?_profiler_guild WHERE `id` IN (?a)', $this->_get['id'])) + foreach ($guilds as $g) + Profiler::scheduleResync(Type::GUILD, $g['realm'], $g['realmGUID']); + + if ($this->_get['profile']) + if ($chars = DB::Aowow()->select('SELECT `realm`, `realmGUID` FROM ?_profiler_profiles WHERE `guild` 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/guild/status.php b/endpoints/guild/status.php new file mode 100644 index 00000000..128cc5fd --- /dev/null +++ b/endpoints/guild/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::GUILD, $this->_get['id']); + } +} + +?> diff --git a/endpoints/guilds/guilds.php b/endpoints/guilds/guilds.php new file mode 100644 index 00000000..4142461b --- /dev/null +++ b/endpoints/guilds/guilds.php @@ -0,0 +1,149 @@ + Profiler > Guilds + + 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::GUILD; + + 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 guild'); + $realms[] = $idx; + } + + $this->subCat = $pageParam !== '' ? '='.$pageParam : ''; + $this->filter = new GuildListFilter($this->_get['filter'] ?? '', ['realms' => $realms]); + $this->filterError = $this->filter->error; + } + + protected function generate() : void + { + $this->h1 = Lang::game('guilds'); + + + /*************/ + /* 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('guilds')); + else if ($this->region) + array_unshift($this->title, Lang::profiler('regions', $this->region), Lang::game('guilds')); + else + array_unshift($this->title, Lang::game('guilds')); + + + /****************/ + /* Main Content */ + /****************/ + + $conditions = array( + ['c.deleteInfos_Account', null], + ['c.level', MAX_LEVEL, '<='], // prevents JS errors + [['c.extra_flags', Profiler::CHAR_GMFLAGS, '&'], 0] + ); + if ($_ = $this->filter->getConditions()) + $conditions[] = $_; + + $this->getRegions(); + + $tabData = array( + 'id' => 'guilds', + 'data' => [], + 'hideCount' => 1, + 'sort' => [-3], + 'visibleCols' => ['members', 'achievementpoints', 'gearscore'], + 'hiddenCols' => ['guild'] + ); + + 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; + + $guilds = new RemoteGuildList($conditions, $miscParams); + if (!$guilds->error) + { + $guilds->initializeLocalEntries(); + + $tabData['data'] = $guilds->getListviewData(); + + // create note if search limit was exceeded + if ($this->filter->query && $guilds->getMatches() > Cfg::get('SQL_LIMIT_DEFAULT')) + { + $tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_guildsfound2', $this->sumSubjects, $guilds->getMatches()); + $tabData['_truncated'] = 1; + } + else if ($guilds->getMatches() > Cfg::get('SQL_LIMIT_DEFAULT')) + $tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_guildsfound', $this->sumSubjects, 0); + } + + $this->lvTabs = new Tabs(['parent' => "\$\$WH.ge('tabs-generic')"], 'tabsRelated'); + + $this->lvTabs->addListviewTab(new Listview($tabData, GuildList::$brickFile, 'membersCol')); + + parent::generate(); + + $this->result->registerDisplayHook('filter', [self::class, 'filterFormHook']); + } + + public static function filterFormHook(Template\PageTemplate &$pt, GuildListFilter $filter) : void + { + // sort for dropdown-menus + Lang::sort('game', 'cl'); + Lang::sort('game', 'ra'); + } +} + +?> diff --git a/includes/ajaxHandler/guild.class.php b/includes/ajaxHandler/guild.class.php deleted file mode 100644 index 97ac6634..00000000 --- a/includes/ajaxHandler/guild.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 ($guilds = DB::Aowow()->select('SELECT realm, realmGUID FROM ?_profiler_guild WHERE id IN (?a)', $this->_get['id'])) - foreach ($guilds as $g) - Profiler::scheduleResync(Type::GUILD, $g['realm'], $g['realmGUID']); - - if ($this->_get['profile']) - if ($chars = DB::Aowow()->select('SELECT realm, realmGUID FROM ?_profiler_profiles WHERE guild 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::GUILD, $this->_get['id']); - } -} - -?> diff --git a/includes/dbtypes/guild.class.php b/includes/dbtypes/guild.class.php index 7a71d231..93f1c9d1 100644 --- a/includes/dbtypes/guild.class.php +++ b/includes/dbtypes/guild.class.php @@ -101,7 +101,8 @@ class GuildListFilter extends Filter 'ex' => [parent::V_EQUAL, 'on', false], // only match exact 'si' => [parent::V_LIST, [SIDE_ALLIANCE, SIDE_HORDE], false], // side '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 d934a107..4914a797 100644 --- a/localization/locale_dede.php +++ b/localization/locale_dede.php @@ -234,9 +234,6 @@ $lang = array( 'atCaptain' => "Teamkapitän", 'profiler' => "Charakter-Profiler", - 'arenaTeams' => "Arena Teams", - 'guilds' => "Gilden", - 'notFound' => array( 'guild' => "Diese Gilde existiert nicht oder wurde noch nicht in die Datenbank übernommen.", 'arenateam' => "Dieses Arena Team existiert nicht oder wurde noch nicht in die Datenbank übernommen.", @@ -332,6 +329,10 @@ $lang = array( 'icons' => "Icons", 'profile' => "Profil", // 100 'profiles' => "Profile", + 'guild' => "Gilde", // 101 + 'guilds' => "Gilden", + 'arenateam' => "Arena Team", // 102 + 'arenateams' => "Arena Teams", 'guide' => "Leitfaden", // 300 'guides' => "Leitfäden", 'emote' => "Emote", // 501 diff --git a/localization/locale_enus.php b/localization/locale_enus.php index bc8d7ff0..2cb842d5 100644 --- a/localization/locale_enus.php +++ b/localization/locale_enus.php @@ -234,9 +234,6 @@ $lang = array( 'atCaptain' => "Arena Team Captain", 'profiler' => "Character Profiler", - 'arenaTeams' => "Arena Teams", - 'guilds' => "Guilds", - 'notFound' => array( 'guild' => "This Guild doesn't exist or is not yet in the database.", 'arenateam' => "This Arena Team doesn't exist or is not yet in the database.", @@ -332,6 +329,10 @@ $lang = array( 'icons' => "icons", 'profile' => "profile", 'profiles' => "Profiles", + 'guild' => "Guild", + 'guilds' => "Guilds", + 'arenateam' => "Arena Team", + 'arenateams' => "Arena Teams", 'guide' => "Guide", 'guides' => "Guides", 'emote' => "emote", diff --git a/localization/locale_eses.php b/localization/locale_eses.php index 1b8ac56b..ad8370d6 100644 --- a/localization/locale_eses.php +++ b/localization/locale_eses.php @@ -234,9 +234,6 @@ $lang = array( 'atCaptain' => "Capitán de equipo de arena", 'profiler' => "Gestor de Perfiles", // Perfiles de Personaje? (character profiler) - 'arenaTeams' => "Equipos de Arena", - 'guilds' => "Hermandades", - 'notFound' => array( 'guild' => "Esta hermandad no existe o aún no está en la base de datos.", 'arenateam' => "Este equipo de arena no existe o aún no está en la base de datos.", @@ -332,6 +329,10 @@ $lang = array( 'icons' => "Iconos", 'profile' => "Perfile", 'profiles' => "Perfiles", + 'guild' => "Hermandad", + 'guilds' => "Hermandades", + 'arenateam' => "Equipo de arena", + 'arenateams' => "Equipos de arena", 'guide' => "Guía", 'guides' => "Guías", 'emote' => "emoción", diff --git a/localization/locale_frfr.php b/localization/locale_frfr.php index 8d94d2c5..adb2170e 100644 --- a/localization/locale_frfr.php +++ b/localization/locale_frfr.php @@ -234,9 +234,6 @@ $lang = array( 'atCaptain' => "Capitaine d'équipe", 'profiler' => "Profiler de Personnage", - 'arenaTeams' => "Équipes d'Aréna", - 'guilds' => "Guildes", - 'notFound' => array( 'guild' => "[This Guild doesn't exist or is not yet in the database.]", 'arenateam' => "[This Arena Team doesn't exist or is not yet in the database.]", @@ -332,6 +329,10 @@ $lang = array( 'icons' => "Icônes", 'profile' => "Profil", 'profiles' => "Profils", + 'guild' => "Guilde", + 'guilds' => "Guildes", + 'arenateam' => "Équipe d'arène", + 'arenateams' => "Équipes d'aréna", 'guide' => "Guide", 'guides' => "Guides", 'emote' => "emote", diff --git a/localization/locale_ruru.php b/localization/locale_ruru.php index 7304a86d..c7925e0f 100644 --- a/localization/locale_ruru.php +++ b/localization/locale_ruru.php @@ -234,9 +234,6 @@ $lang = array( 'atCaptain' => "Капитан команды арены", 'profiler' => "Профили персонажей", - 'arenaTeams' => "Команды арен", - 'guilds' => "Гильдии", - 'notFound' => array( 'profile' => "Этот персонаж не существует, либо еще не добавлен в базу данных.", 'arenateam' => "[This Arena Team doesn't exist or is not yet in the database.]", @@ -332,6 +329,10 @@ $lang = array( 'icons' => "Иконки", 'profile' => "Профиль", 'profiles' => "Профили", + 'guild' => "Гильдия", + 'guilds' => "Гильдии", + 'arenateam' => "Команда арены", + 'arenateams' => "Команды арен", 'guide' => "Руководство", 'guides' => "Руководство", 'emote' => "Эмоция", diff --git a/localization/locale_zhcn.php b/localization/locale_zhcn.php index 2ebf767e..91be4de5 100644 --- a/localization/locale_zhcn.php +++ b/localization/locale_zhcn.php @@ -234,9 +234,6 @@ $lang = array( 'atCaptain' => "竞技场战队队长", 'profiler' => "角色概况", - 'arenaTeams' => "竞技场战队", - 'guilds' => "公会", - 'notFound' => array( 'guild' => "该公会不存在或尚未被收录到数据库中。", 'arenateam' => "该竞技场战队不存在或尚未被收录到数据库中。", @@ -332,6 +329,10 @@ $lang = array( 'icons' => "图标", 'profile' => "简介", 'profiles' => "简介", + 'guild' => "公会", + 'guilds' => "公会", + 'arenateam' => "竞技场战队", + 'arenateams' => "竞技场战队", 'guide' => "指南", 'guides' => "指南", 'emote' => "表情", diff --git a/pages/guild.php b/pages/guild.php deleted file mode 100644 index 321d1b3e..00000000 --- a/pages/guild.php +++ /dev/null @@ -1,156 +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 LocalGuildList(array(['g.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_guild 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 LocalGuildList(array(['id', $subject['id']])); - if ($this->subject->error) - $this->notFound(); - - $this->name = sprintf(Lang::profiler('guildRoster'), $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 guildid AS realmGUID, name FROM guild WHERE 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_guild (?#) 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, 'guild']; - - /****************/ - /* Main Content */ - /****************/ - - - // statistic calculations here - - // smuggle the guild ranks into the html - if ($ranks = DB::Aowow()->selectCol('SELECT `rank` AS ARRAY_KEY, name FROM ?_profiler_guild_rank WHERE guildId = ?d', $this->subjectGUID)) - $this->extraHTML = ''; - - - /**************/ - /* Extra Tabs */ - /**************/ - - // tab: members - $member = new LocalProfileList(array(['p.guild', $this->subjectGUID], Cfg::get('SQL_LIMIT_NONE'))); - 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', 'achievementpoints', 'guildrank'], - 'hiddenCols' => ['guild', 'location'] - )]; - } - } - - public function notFound(string $title = '', string $msg = '') : never - { - parent::notFound($title ?: Util::ucFirst(Lang::profiler('profiler')), $msg ?: Lang::profiler('notFound', 'guild')); - } - - private function handleIncompleteData($teamGuid) - { - //display empty page and queue status - $newId = Profiler::scheduleResync(Type::GUILD, $this->realmId, $teamGuid); - - $this->doResync = ['guild', $newId]; - $this->initialSync(); - } -} - -?> diff --git a/pages/guilds.php b/pages/guilds.php deleted file mode 100644 index 099f1a91..00000000 --- a/pages/guilds.php +++ /dev/null @@ -1,132 +0,0 @@ - ['filter' => FILTER_UNSAFE_RAW]]; - - public function __construct($pageCall, $pageParam) - { - parent::__construct($pageCall, $pageParam); - - if (!Cfg::get('PROFILER_ENABLE')) - $this->error(); - - $this->getSubjectFromUrl($pageParam); - - $this->filterObj = new GuildListFilter($this->_get['filter'] ?? ''); - - 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'); - } - - $this->name = Lang::profiler('guilds'); - $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('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->addScript([SC_JS_FILE, '?data=realms']); - - $conditions = array( - ['c.deleteInfos_Account', null], - ['c.level', MAX_LEVEL, '<='], // prevents JS errors - [['c.extra_flags', Profiler::CHAR_GMFLAGS, '&'], 0] - ); - - $this->filterObj->evalCriteria(); - - if ($_ = $this->filterObj->getConditions()) - $conditions[] = $_; - - $tabData = array( - 'id' => 'guilds', - 'hideCount' => 1, - 'sort' => [-3], - 'visibleCols' => ['members', 'achievementpoints', 'gearscore'], - 'hiddenCols' => ['guild'], - ); - - $miscParams = ['calcTotal' => true]; - 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->filterObj->query && $guilds->getMatches() > Cfg::get('SQL_LIMIT_DEFAULT')) - { - $tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_guildsfound2', $this->sumSubjects, $guilds->getMatches()); - $tabData['_truncated'] = 1; - } - else if ($guilds->getMatches() > Cfg::get('SQL_LIMIT_DEFAULT')) - $tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_guildsfound', $this->sumSubjects, 0); - - if ($this->filterObj->error) - $tabData['_errors'] = 1; - } - - $this->lvTabs[] = [GuildList::$brickFile, $tabData, 'membersCol']; - } - - protected function postCache() - { - // sort for dropdown-menus - Lang::sort('game', 'cl'); - Lang::sort('game', 'ra'); - } -} - -?> diff --git a/template/pages/guilds.tpl.php b/template/pages/guilds.tpl.php index edcac5f8..fe889a9c 100644 --- a/template/pages/guilds.tpl.php +++ b/template/pages/guilds.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,40 +13,43 @@ $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; ?>

+
- + - + @@ -63,7 +67,7 @@ $this->brick('pageTemplate', ['fiQuery' => $this->filterObj->query, 'fiMenuItem'
-brick('filter'); ?> +renderFilter(12); ?> brick('lvTabs'); ?> diff --git a/template/pages/roster.tpl.php b/template/pages/roster.tpl.php index 6877e7cc..88ed8975 100644 --- a/template/pages/roster.tpl.php +++ b/template/pages/roster.tpl.php @@ -1,7 +1,8 @@ - - -brick('header'); ?> +brick('header'); +?>
@@ -16,13 +17,11 @@ $this->brick('pageTemplate');
brick('redButtons'); ?> -

name; ?>

+

h1; ?>

extraHTML)): - echo $this->extraHTML; - endif; + echo $this->extraHTML ?? ''; ?>
ucFirst(Lang::main('name')).Lang::main('colon'); ?> - - + +
 />  /> />  />