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:LocationsLanding/List
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 getArgs = require('Module:Arguments').getArgs local cargo = mw.ext.cargo local LocationWidget = require('Module:Infobox/Widget/Location') local p = {} function p.main(frame) local args = getArgs(frame) local whereStr = '' if args.type then whereStr = whereStr .. 'Locations.type HOLDS "' .. args.type .. '"' end if args.country then local countries = mw.text.split(args.country, ',') if whereStr ~= '' then whereStr = whereStr .. ' AND ' end whereStr = whereStr .. '(' for i = 1, #countries do if i > 1 then whereStr = whereStr .. ' OR ' end whereStr = whereStr .. 'Locations.country="' .. countries[i] .. '"' end whereStr = whereStr .. ')' end if args.name then whereStr = whereStr .. (whereStr ~= '' and ' AND ' or '') .. 'Locations._pageName LIKE "%' .. args.name .. '%"' end local tables = 'Locations, _pageData, Logos' local fields = 'Locations._pageName=_pageName, Locations.franchise=franchise, Locations.country=country, Locations.city=city, Locations.type=type, Logos.logoAll=logoAll, Logos.logoLight=logoLight, Logos.logoDark=logoDark' local cargoArgs = { join = 'Locations._pageName = _pageData._pageName, Locations._pageName=Logos._pageName', where = whereStr, limit = 20, orderBy = "_pageData._modificationDate DESC", } local results = cargo.query(tables, fields, cargoArgs) local container = mw.html.create('div'):addClass('locations__container') if #results > 0 then for i = 1, #results do local result = results[i] local img = result.logoAll or result.logoLight or result.logoDark if not img and result.franchise then tables = 'Logos' fields = '_pageName, logoLight, logoDark, logoAll, iconAll, iconLight, iconDark, start, end' currentDate = os.date('%Y-%m-%d') cargoArgs = { where = '(_pageName = "' .. result.franchise .. '") AND (start is NULL OR start < "' .. currentDate .. '") AND (end is NULL OR end > "' .. currentDate .. '")' } local logoResults = cargo.query(tables, fields, cargoArgs) if #logoResults > 0 then local res = logoResults[1] img = res.logoAll or res.logoLight or res.logoDark or res.iconAll or res.iconLight or res.iconDark end end if not img then img = 'Team_placeholder_light.png' end local image = mw.html.create('div'):wikitext('[[File:' .. img .. '|250x250px|link=]]') local title = mw.html.create('div'):addClass('location__title'):wikitext(mw.ext.displaytitle.get(result._pageName)) local country = LocationWidget.make(result.country, result.city, 'Locations') local type = mw.html.create('div'):wikitext(result.type) local text = mw.html.create('div'):addClass('location__text'):node(country):node(type) local newsItem = mw.html.create('div'):addClass('location__item'):node(title):node(image):node(text):node(mw.html.create('div'):addClass('link-overlay'):wikitext('[[File:Team_placeholder_light.png|1x1px|link=' .. result._pageName .. ']]')) container:node(newsItem) end return container 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:LocationsLanding/List/doc
(
edit
)
No categories
Edit