Difference between revisions of "Template:EventsForThisPage"

From Culture.si
Line 1: Line 1:
{{{fld={{{field|Related}}}}}}
+
{{{fld=Event.{{{field|Related}}}}}}
 
{{#arr:dataloop
 
{{#arr:dataloop
 
|{{#data:select
 
|{{#data:select
 
   | Event.#
 
   | Event.#
   | #where = (Event.{{{fld}}}={{#cast:ref|{{{1|{{{page|{{PAGENAME}}}}}}}}|db}} or Event.{{{fld}}} in (select page_title from redirect join page on rd_from=page_id where rd_title={{#cast:ref|{{{1|{{{page|{{PAGENAME}}}}}}}}|db}})) and Event.Country!='Slovenia'
+
   | #where = ({{{fld}}}={{#cast:ref|{{{1|{{{page|{{PAGENAME}}}}}}}}|db}} or {{{fld}}} in (select page_title from redirect join page on rd_from=page_id where rd_title={{#cast:ref|{{{1|{{{page|{{PAGENAME}}}}}}}}|db}})) and Event.Country!='Slovenia'
 
   | #limit = 1
 
   | #limit = 1
 
}}
 
}}
Line 26: Line 26:
 
   | #limit = 150
 
   | #limit = 150
 
   | #groupby = 1,2,3,4,5,6,7,8,9
 
   | #groupby = 1,2,3,4,5,6,7,8,9
   | #where = (Event.{{{fld}}}={{#cast:ref|{{{1|{{{page|{{PAGENAME}}}}}}}}|db}} or Event.{{{fld}}} in (select page_title from redirect join page on rd_from=page_id where rd_title={{#cast:ref|{{{1|{{{page|{{PAGENAME}}}}}}}}|db}})) and (Event.Country!='Slovenia') and to_char(coalesce(Event.End,Event.Start),'YYYYMMDD') >= '{{#timel:Ymd|{{CURRENTDATE}}}}'
+
   | #where = ({{{fld}}}={{#cast:ref|{{{1|{{{page|{{PAGENAME}}}}}}}}|db}} or {{{fld}}} in (select page_title from redirect join page on rd_from=page_id where rd_title={{#cast:ref|{{{1|{{{page|{{PAGENAME}}}}}}}}|db}})) and (Event.Country!='Slovenia') and to_char(coalesce(Event.End,Event.Start),'YYYYMMDD') >= '{{#timel:Ymd|{{CURRENTDATE}}}}'
 
   | #orderby = Event.Start ASC
 
   | #orderby = Event.Start ASC
 
}}
 
}}
Line 49: Line 49:
 
   | Country = {{groupLinks|Event.Country}}
 
   | Country = {{groupLinks|Event.Country}}
 
   | #groupby = 1,2,3,4,5,6,7,8,9
 
   | #groupby = 1,2,3,4,5,6,7,8,9
   | #where = (Event.{{{fld}}}={{#cast:ref|{{{1|{{{page|{{PAGENAME}}}}}}}}|db}} or Event.{{{fld}}} in (select page_title from redirect join page on rd_from=page_id where rd_title={{#cast:ref|{{{1|{{{page|{{PAGENAME}}}}}}}}|db}})) and (Event.Country!='Slovenia') and to_char(coalesce(Event.End,Event.Start),'YYYYMMDD') < '{{#timel:Ymd|{{CURRENTDATE}}}}'
+
   | #where = ({{{fld}}}={{#cast:ref|{{{1|{{{page|{{PAGENAME}}}}}}}}|db}} or {{{fld}}} in (select page_title from redirect join page on rd_from=page_id where rd_title={{#cast:ref|{{{1|{{{page|{{PAGENAME}}}}}}}}|db}})) and (Event.Country!='Slovenia') and to_char(coalesce(Event.End,Event.Start),'YYYYMMDD') < '{{#timel:Ymd|{{CURRENTDATE}}}}'
 
   | #limit = 150
 
   | #limit = 150
 
   | #orderby = Event.Start DESC
 
   | #orderby = Event.Start DESC

Revision as of 18:34, 25 April 2018


field: Event.Related
{ {#arr:dataloop

|
SELECT DISTINCT
	(__Event."Description") AS "Description",
	(__Event."Start") AS "Start",
	(__Event."End") AS "End",
	(__Event."Url") AS "Url",
	(__Event."Editcall") AS "Editcall",
	(__Event."Organizer_url") AS "Organizer_url",
	(__Event."More_url") AS "More_url",
	(__Event."Work_url") AS "Work_url",
	(__Event."Festival") AS "Festival",
	(array_to_string(array_agg(DISTINCT replace(__Event__x__City._multi_to,'_',' ')),',')) AS "City",
	(array_to_string(array_agg(DISTINCT replace(__Event__x__Venue._multi_to,'_',' ')),',')) AS "Venue",
	(array_to_string(array_agg(DISTINCT replace(__Event__x__Country._multi_to,'_',' ')),',')) AS "Country" 
FROM "tbl_Event" AS __Event
LEFT JOIN "tbl__Event__x__City" AS __Event__x__City ON (__Event._row_ref = __Event__x__City._multi_from)
LEFT JOIN "tbl__Event__x__Venue" AS __Event__x__Venue ON (__Event._row_ref = __Event__x__Venue._multi_from)
LEFT JOIN "tbl__Event__x__Country" AS __Event__x__Country ON (__Event._row_ref = __Event__x__Country._multi_from)
LEFT JOIN "tbl__Event__x__Related" AS __Event__x__Related ON (__Event._row_ref = __Event__x__Related._multi_from) 
WHERE (__Event__x__Related._multi_to='EventsForThisPage' or __Event__x__Related._multi_to in (select page_title from redirect join page on rd_from=page_id where rd_title='EventsForThisPage')) and (__Event__x__Country._multi_to!='Slovenia') and to_char(coalesce(__Event."End",__Event."Start"),'YYYYMMDD') >= '20241126' 
GROUP BY 1,2,3,4,5,6,7,8,9  
ORDER BY __Event."Start" ASC 
LIMIT  150 
OFFSET 0
| first =
    | each =
  • 26 Nov 2024

    {{{Country}}} {{{City}}} {{{Venue}}}




    {{{Description}}}




  • | last =

}}