Advertisement

Module:SubpageNavbox

To edit the documentation or categories for this module, click here.


local util_args = require("Module:ArgsUtil")
local util_cargo = require('Module:CargoUtil')
local util_vars = require('Module:VarsUtil')

local h = {}
local p = {}
function p.navbox(tabstype)
	if tabstype ~= 'Player' and tabstype ~= 'Team' then
		return nil
	end
	local teamAndSystem = h.getTeamAndSystem(
		tabstype,
		mw.title.getCurrentTitle().rootText
	)
	local ret = {
		h.clpnArgs(teamAndSystem, tabstype),
		h.orgNavboxArgs(teamAndSystem, tabstype)
	}
	return ret
end

function h.getTeamAndSystem(tabstype, title)
	if tabstype == 'Team' then
		return { Team = title }
	end
	return h.getTeamFromPlayer(title)
end

function h.getTeamFromPlayer(title)
	local query = {
		tables = 'Players',
		fields = { 'Team', 'TeamSystem=System' },
		where = string.format('_pageName="%s"', title)
	}
	return util_cargo.getOneRow(query) or {}
end

function h.orgNavboxArgs(teamAndSystem, tabstype)
	return {
		title = 'OrgNavbox',
		events = { showAll = true },
		args = {
			teamAndSystem.Team,
			system = teamAndSystem.System,
			suffix = util_args.boolToStringYN(true),
			from_player = tabstype == 'Player'
		},
	}
end

function h.clpnArgs(teamAndSystem, tabstype)
	return {
		title = 'CurrentLeagueParticipantNavbox',
		events = { showAll = true },
		args = { teamAndSystem.Team, suffix = util_args.boolToStringYN(true) },
		pagetype = tabstype
	}
end

return p

Power Rankings of Brazil and Oceania are not yet updated to the last season, we are doing our best to update them before the start of the new competitive season. Please be patient.

READ MORE