Homepage
Games
News
News βΎ
All
Transfers
Drama
Business
Sponsors
Mergers
Investors
Hires
Companies
More
People
Tournaments
Brands
Brands βΎ
Companies
Organizations
Sponsors
Other
Locations
Search
Editing
Module:PageTabs person
From TwogPedia
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local cargo = mw.ext.cargo local p = {} function p.main(frame) local currentTitle = mw.title.getCurrentTitle().text local split = mw.text.split(currentTitle, '/') local parent = split[1] .. '/' .. split[2] local subPage = split[3] local str = '{{Tabs|name1=Overview|link1=' .. parent local order = 1 if subPage == 'Results' then order = order + 1 str = str .. '|name' .. order .. '=Results' .. '|link' .. order .. '=' .. currentTitle else -- Check if results in soloMatches local tables = "AllMatches" local fields = '_pageName' local cargoArgs = { where = '(p1 = "' .. parent .. '" OR p2="' .. parent .. '") AND winner IS NOT NULL AND winner != "0"', limit = 1, } local soloMatches = cargo.query(tables, fields, cargoArgs) local hadResults = false if #soloMatches > 0 then hadResults = true else -- Check if part of tournament prizes tables = 'Participants, Prizes' fields = 'Participants._pageName=_pageName' cargoArgs = { join = 'Participants._pageName=Prizes._pageName', where = '(Participants.players HOLDS "' .. parent .. '" AND Prizes.teams HOLDS Participants.team ) OR Prizes.players HOLDS "' .. parent .. '"', limit = 1 } local placementResults = cargo.query(tables, fields, cargoArgs) if #placementResults > 0 then hadResults = true end end if hadResults then order = order + 1 str = str .. '|name' .. order .. '=Results' .. '|link' .. order .. '=' .. parent .. '/Results' end -- Check for broadcasts if subPage == 'Broadcasts' then order = order + 1 str = str .. '|name' .. order .. '=Broadcasts' .. '|link' .. order .. '=' .. currentTitle else -- Check if observer or caster in matches tables = 'AllMatches' fields = '_pageName' cargoArgs = { where = '(casters HOLDS "' .. parent .. '" OR observers HOLDS "' .. parent .. '") AND winner IS NOT NULL AND winner != "0"', limit = 1, } local matchBroadcasts = cargo.query(tables, fields, cargoArgs) local hadBroadcasts = false if #matchBroadcasts > 0 then hadBroadcasts = true else -- Check if is in list of tournament talent tables = 'Talent, Tournaments' fields = 'Tournaments._pageName=_pageName' cargoArgs = { join = 'Talent._pageName=Tournaments._pageName', where = 'Talent.people HOLDS "' .. parent .. '"', limit = 1 } local talentTournaments = cargo.query(tables, fields, cargoArgs) if #talentTournaments > 0 then hadBroadcasts = true end end if hadBroadcasts then order = order + 1 str = str .. '|name' .. order .. '=Broadcasts' .. '|link' .. order .. '=' .. parent .. '/Broadcasts' end end end str = str .. '}}' if order > 1 then return frame:preprocess(str) end end return p
Summary:
Please note that all contributions to TwogPedia may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
TwogPedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Preview page with this template
Template used on this page:
Module:PageTabs person/doc
(
edit
)
No categories
Edit