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:Sponsored teams
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 Sponsored = {} function Sponsored.get(frame) local container = mw.html.create('div') :addClass('sponsored') local currentTitle = mw.title.getCurrentTitle().text -- Look up Cargo table teams with current page as sponsor local tables = 'Sponsors' local fields = '_pageName, start, end, startRef, startRefName, endRef, endRefName' local currentDate = os.date('%Y-%m-%d') local cargoArgs = { where = 'id ="' .. currentTitle .. '" AND type="team" AND (end is NULL OR end > "' .. currentDate .. '")', limit=10, orderBy='start' } local results = cargo.query(tables, fields, cargoArgs) local list = mw.html.create('table') :addClass('sortable striped-table') if #results > 0 then local titleRow = mw.html.create('tr') :addClass('headerRow') local nameCell = mw.html.create('th') :wikitext('Team') local startCell = mw.html.create('th') :wikitext('Sponsored since') local endCell = mw.html.create('th') :wikitext('Sponsored until') list:node(titleRow:node(nameCell):node(startCell):node(endCell)) for r = 1, #results do local result = results[r] local teamRow = mw.html.create('tr') :addClass('bodyRow') local teamName = mw.html.create('td') :addClass('linkID') tables = 'Logos' fields = '_pageName, logoLight, logoDark, logoAll, iconLight, iconDark, iconAll' local pageNameSplit = mw.text.split(result._pageName,'/')[2] or '' cargoArgs = { where = '(_pageName="' .. result._pageName .. '" OR _pageName ="' .. pageNameSplit.. '" ) AND (start is null or start < "' .. currentDate.. '") AND (end is NULL OR end > "' .. currentDate .. '")' } local iconResult = cargo.query(tables, fields, cargoArgs) if #iconResult > 0 then if iconResult[1].iconAll then teamName:wikitext('<span class="team-icon">[[File:' .. iconResult[1].iconAll .. '|20px]]</span>') else if iconResult[1].iconLight and iconResult[1].iconDark then teamName:wikitext('<span class="team-icon light">[[File:' .. iconResult[1].iconLight .. '|18px]]</span>') teamName:wikitext('<span class="team-icon dark-inline-flex">[[File:' .. iconResult[1].iconDark .. '|18px]]</span>') elseif iconResult[1].iconLight or iconResult[1].iconDark then local file = iconResult[1].iconLight or iconResult[1].iconDark teamName:wikitext('<span class="team-icon">[[File:' .. file .. '|20px]]</span>') end end end teamName:wikitext('[[' .. result._pageName .. ']]') if result.startRef then local startRefName = result.startRefName or '' teamName:wikitext(frame:preprocess('<ref name='.. startRefName .. '>' ..result.startRef .. '</ref>')) end local startDate = mw.html.create('td') :addClass('tc') :wikitext(result.start) local endDate = mw.html.create('td') :addClass('tc') :wikitext(result['end']) list:node(teamRow:node(teamName):node(startDate):node(endDate)) end else return nil end return container:node(list) end return Sponsored
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:Sponsored teams/doc
(
edit
)
No categories
Edit