# TS Setup


# #####
# Competition-Plugin
# #####

includeLibs.tx_rnbase_controller = EXT:rn_base/class.tx_rnbase_controller.php
includeLibs.tx_t3sports_fal = EXT:rn_base/util/class.tx_rnbase_util_TSFAL.php

plugin.tx_cfcleaguefe_competition                = USER
plugin.tx_cfcleaguefe_competition.flexform       = flexform_competition.xml
plugin.tx_cfcleaguefe_competition.userFunc       = tx_rnbase_controller->main
plugin.tx_cfcleaguefe_competition.defaultAction  = tx_cfcleaguefe_actions_MatchTable
plugin.tx_cfcleaguefe_competition.qualifier      = cfc_league_fe
plugin.tx_cfcleaguefe_competition.extensionKey   = cfc_league_fe
plugin.tx_cfcleaguefe_competition.templatePath   = EXT:cfc_league_fe/views/templates
plugin.tx_cfcleaguefe_competition.locallangFilename = EXT:cfc_league_fe/locallang.xml

# This is the default TS-Setup for team notes.
# If you have defined a team note with html marker picture, make this setting in your typoscript
# template:
#  lib.t3sports.profile.tnpicture =< lib.t3sports.teamnote

# Config for lightbox template
lib.t3sports.pictures.mediaBase {
  file = IMG_RESOURCE
  file.file.import.field = file
  file.file.maxW = {$plugin.tx_cfcleaguefe_report.maxW_teamPicture}
  file.file.maxH = {$plugin.tx_cfcleaguefe_report.maxH_teamPicture}
  thumbnail < .file
  thumbnail = IMAGE
  thumbnail.file.maxW = {$plugin.tx_cfcleaguefe_report.maxW_teamThumb}
  thumbnail.file.maxH = {$plugin.tx_cfcleaguefe_report.maxH_teamThumb}
  thumbnail.params = border="0"
  thumbnail.titleText.field = title
}

lib.t3sports.stadium {
  pagebrowser =< lib.t3sports.pagebrowser
  name = TEXT
  name.current = 1
  name.ifEmpty.field = altname
  links {
    show.pid = {$plugin.tx_cfcleaguefe_report.stadiumpage}
  }
  capacity.number_format {
    dontCheckFloat = 1
    thousands_sep = .
    decimal = 0
  }
  logo = IMAGE
  logo {
    file.maxW = {$plugin.tx_cfcleaguefe_competition.maxW_teamlogo}
    file.maxH = {$plugin.tx_cfcleaguefe_competition.maxH_teamlogo}
    file.import.cObject = USER
    file.import.cObject {
      # Mit dieser Methode wird nur die erste Referenz ausgewertet 
      userFunc=tx_rnbase_util_TSFAL->fetchFirstReference
      refField=logo
      refTable=tx_cfcleague_stadiums
    }
    file.treatIdAsReference = 1
  }

  description.parseFunc =< lib.parseFunc_RTE
  description2.parseFunc =< lib.parseFunc_RTE

  pictures = USER
  pictures {
    userFunc = tx_rnbase_util_TSFAL->printImages
    refField = pictures
    refTable = tx_cfcleague_stadiums
    template = EXT:cfc_league_fe/res/lightboxpics.html
    subpartName = ###PICTURES###
    media =< lib.t3sports.pictures.mediaBase
  }
  map =< lib.t3sports.map
  map.template = {$plugin.tx_cfcleaguefe_competition.stadiumlistTemplate}
  map.stadium =< lib.t3sports.stadium
  distance {
    noTrimWrap = || km|
    required = 1
    number_format.decimal = 1
    number_format.thousands_sep = .
    number_format.dec_point = ,
  }
  # Used as base for distance calculation
  _basePosition.latitude = {$plugin.tx_cfcleaguefe_competition.basePosition_latitude}
  _basePosition.longitude = {$plugin.tx_cfcleaguefe_competition.basePosition_longitude}
}

lib.t3sports.teamnote = RECORDS
lib.t3sports.teamnote {
  source.current = 1
  tables =  tx_cfcleague_team_notes
  conf.tx_cfcleague_team_notes = CASE
  conf.tx_cfcleague_team_notes {
    1 = IMAGE
    1.file {
      maxW = 100
      maxH = 100
      treatIdAsReference = 1
      import.cObject = USER
      import.cObject {
        userFunc=tx_rnbase_util_TSFAL->fetchFirstReference
        refField=media
        refTable=tx_cfcleague_team_notes
      }
    }
    2 = TEXT
    2.field = number
    default = TEXT
    default.field = comment
#    default.debugData = 1
    key.field = mediatype
  }
}

lib.t3sports.pagebrowser {
  limit = 50
  maxPages = 11
  pagefloat = CENTER
  hideIfSinglePage = 1
  link.useKeepVars = 1
}
lib.t3sports.group {
  logo = USER
  logo {
	userFunc = tx_rnbase_util_TSFAL->printImages
    refField = logo
    refTable = tx_cfcleague_group
#    template = EXT:cfc_league_fe/res/lightboxpics.html
#    subpartName = ###PICTURES###
    media {
      file = IMAGE
      file.file.import.field = file
      file.file.maxW = {$plugin.tx_cfcleaguefe_competition.maxW_complogo}
      file.file.maxH = {$plugin.tx_cfcleaguefe_competition.maxW_complogo}
      thumbnail < .file
      thumbnail = IMAGE
      thumbnail.file.maxW = {$plugin.tx_cfcleaguefe_report.maxW_matchThumb}
      thumbnail.file.maxH = {$plugin.tx_cfcleaguefe_report.maxH_matchThumb}
      thumbnail.params = border="0"
      thumbnail.titleText.field = title
    }
  }
}

lib.t3sports.competition {
  short_name.crop = 5 | ... | 1
  short_name.ifEmpty.field = name
  logo = IMAGE
  logo {
    file.maxW = {$plugin.tx_cfcleaguefe_competition.maxW_complogo}
    file.maxH = {$plugin.tx_cfcleaguefe_competition.maxH_complogo}
    file.treatIdAsReference = 1
    file.import.cObject = USER
    file.import.cObject {
      userFunc=tx_rnbase_util_TSFAL->fetchFirstReference
      refField=logo
      refTable=tx_cfcleague_competition
    }
  }
}


# Allgemeines Formatierungsangaben für Personen
lib.t3sports.profile {
  pagebrowser =< lib.t3sports.pagebrowser

#  tnposition =< lib.t3sports.teamnote
#  tnpicture =< lib.t3sports.teamnote


  links {
    showprofile.pid = {$plugin.tx_cfcleaguefe_competition.playerpage}
    refereematches.pid = {$plugin.tx_cfcleaguefe_competition.matchtablepage}
  }
  subparts {
    isgdpr0 {
      # Marker: ###PROFILE_ISGDPR0_YES###
      marker {
        visible = YES
        hidden = NO
      }
      visible = TEXT
      visible.value = 1
      visible.if {
        value = 0
        equals.data = field:gdpr
      }
    }
    isgdpr1 < .isgdpr0
    isgdpr1.visible.if.value = 1
    isgdpr2 < .isgdpr0
    isgdpr2.visible.if.value = 2
    isdied < .isgdpr0
    isdied.visible.if.value = 1
    isdied.visible.if.equals.data = field:died
  }
  dcname = CASE
  dcname {
    default = CASE
    default {
      default = TEXT
      default.field = stage_name
      -1 = COA
      -1 {
        10 = TEXT
        10.field = first_name
        10.noTrimWrap = || |
        10.required = 1
        20 = TEXT
        20.field = last_name
      }
      key.field = stage_name
      key.ifEmpty = -1
    }
    2 = TEXT
    2.value = ###LABEL_PROFILE_ANONYMOUS###
    key.field = gdpr
  }
  dcnamerev =< lib.t3sports.profile.dcname
  dcnamerev.default.-1.5 = TEXT
  dcnamerev.default.-1.5.field = last_name
  dcnamerev.default.-1.10.noTrimWrap = |, ||
  dcnamerev.default.-1.20 = 
  description.parseFunc =< lib.parseFunc_RTE
  summary.parseFunc =< lib.parseFunc_RTE
  birthday = CASE
  birthday {
    default = TEXT
    default.field = birthday
    default.strftime = {$plugin.tx_cfcleaguefe_report.format_birthday}
    2 = TEXT
    2.value = -
    key {
      field = birthday
      ifEmpty = 2
    }
  }
  dayofdeath =< lib.t3sports.profile.birthday
  dayofdeath.default.field = dayofdeath
  dayofdeath.default.strftime = {$plugin.tx_cfcleaguefe_report.format_dayofdeath}
  dayofdeath.key.field = dayofdeath

  duration_of_contract = CASE
  duration_of_contract {
    default = TEXT
    default.field = duration_of_contract
    default.strftime = %d. %B %Y
    2 = TEXT
    2.value = -
    key {
      field = duration_of_contract
      ifEmpty = 2
    }
  }
  weight.ifEmpty = -
  height.ifEmpty = -

  pictures = USER
  pictures {
    userFunc = tx_rnbase_util_TSFAL->printImages
    refField = t3images
    refTable = tx_cfcleague_profiles
    template = EXT:cfc_league_fe/res/lightboxpics.html
    offset = 1
    subpartName = ###PICTURES###
    media {
      file = IMG_RESOURCE
      file.file.import.field = file
      file.file.maxW = {$plugin.tx_cfcleaguefe_report.maxW_profilePicture}
      file.file.maxH = {$plugin.tx_cfcleaguefe_report.maxH_profilePicture}
      thumbnail < .file
      thumbnail = IMAGE
      thumbnail.file.maxW = {$plugin.tx_cfcleaguefe_report.maxW_profileThumb}
      thumbnail.file.maxH = {$plugin.tx_cfcleaguefe_report.maxH_profileThumb}
      thumbnail.params = border="0"
      thumbnail.titleText.field = title
#      thumbnail.altText.field = description
    }
  }
  firstpicture =< lib.t3sports.profile.pictures
  firstpicture {
    limit = 1
    offset = 0
    subpartName = ###FIRSTPICTURE###
  }
  roll.value = 1
}

lib.t3sports.club {
  pagebrowser =< lib.t3sports.pagebrowser
  links {
    show.pid = {$plugin.tx_cfcleaguefe_report.clubpage}
  }
  name.blank = -
  email.typolink {
  	target = _BLANK
  	parameter.field = email
  }
  email.ifBlank = -
  www.typolink {
  	target = _BLANK
  	parameter.field = www
  }
  www.ifBlank = -
  shortinfo.br = 1
  info.parseFunc =< lib.parseFunc_RTE

  address.email =< lib.t3sports.club.email
  address.www =< lib.t3sports.club.www
  address.address.br = 1

  logo = USER
  logo {
    userFunc=tx_rnbase_util_TSFAL->printImages
    refField = logo
    refTable = tx_cfcleague_club
    template = EXT:cfc_league_fe/res/clublogo.html
    limit = 1
    media {
      file = IMAGE
      file.file.import.field = file
      file.file.maxW = {$plugin.tx_cfcleaguefe_report.maxW_logo}
      file.file.maxH = {$plugin.tx_cfcleaguefe_report.maxH_logo}
    }
  }
  dam_logo =< lib.t3sports.club.logo
  stadium =< lib.t3sports.stadium
  team =< lib.t3sports.team
  distance {
    noTrimWrap = || km|
    required = 1
    number_format.decimal = 1
    number_format.thousands_sep = .
    number_format.dec_point = ,
  }
  # Used as base for distance calculation
  _basePosition.latitude = {$plugin.tx_cfcleaguefe_competition.basePosition_latitude}
  _basePosition.longitude = {$plugin.tx_cfcleaguefe_competition.basePosition_longitude}
}

lib.t3sports.dummyImage = IMAGE
lib.t3sports.dummyImage {
  file = GIFBUILDER
  file {
    XY = 70,100
    backColor = #ffff00
    10 = TEXT
    10 {
      text = Kein Bild
      fontSize = 14
      niceText = 1
      fontColor = #000000
      offset = 5, 43
    }
  }
}

lib.t3sports.dummyLogo = IMAGE
lib.t3sports.dummyLogo {
#  file = fileadmin/images/fussball.jpg
  file = GIFBUILDER
  file {
    XY = {$plugin.tx_cfcleaguefe_report.maxW_logo},{$plugin.tx_cfcleaguefe_report.maxH_logo}
		maxW = {$plugin.tx_cfcleaguefe_report.maxW_logo}
		maxH = {$plugin.tx_cfcleaguefe_report.maxH_logo}
    backColor = #FFFFFF
  }
}

lib.t3sports.teamLogo {
  big = CASE
  big {
    # Bild im Feld logo suchen
    # Bild im Verein suchen
    0 = CASE
    0 {
      0 = CASE
      0 {
        # Dummy-Logo if no club found
        0 =< lib.t3sports.dummyLogo

        # Vereinslogo rendern
        default = RECORDS
        default {
          source.field = club
          tables =  tx_cfcleague_club
          conf.tx_cfcleague_club = CASE
          conf.tx_cfcleague_club {
            key.field = logo
            # Dummy-Logo if no logo in club found
            0 =< lib.t3sports.dummyLogo

            default = USER
            default {
              userFunc=tx_rnbase_util_TSFAL->printImages
              refField=logo
              refTable=tx_cfcleague_club
              template = EXT:cfc_league_fe/res/clublogo.html
              limit = 1
              media {
                file = IMAGE
                file.file.import.field = file
				   	    file.file.maxW = {$plugin.tx_cfcleaguefe_report.maxW_logo}
  						  file.file.maxH = {$plugin.tx_cfcleaguefe_report.maxH_logo}
              }
            }
          }
        }
        key.field = club
      }
      # FAL-Bild anzeigen (Select-Box im Team)
      default = IMAGE
      default.file {
        treatIdAsReference = 1
        import.field = logo
        maxW = {$plugin.tx_cfcleaguefe_report.maxW_logo}
        maxH = {$plugin.tx_cfcleaguefe_report.maxH_logo}
      }
      key.field = logo
    }

    # Logo des Teams rendern
    default = IMAGE
    default.file {
      import.cObject = USER
      import.cObject {
        userFunc=tx_rnbase_util_TSFAL->fetchFirstReference
        refField=t3logo
        refTable=tx_cfcleague_teams
      }
      maxW = {$plugin.tx_cfcleaguefe_report.maxW_logo}
      maxH = {$plugin.tx_cfcleaguefe_report.maxH_logo}
    }
    key.field = t3logo
    if {
	    # Nix zeigen, wenn es ein Dummy-Team ist
	    value = 0
	    equals.field = dummy
    }
  }

  small =< lib.t3sports.teamLogo.big
  small {
    # Logo des Teams
    default.file.maxW = {$plugin.tx_cfcleaguefe_competition.maxW_logo_matchtable}
    default.file.maxH = {$plugin.tx_cfcleaguefe_competition.maxH_logo_matchtable}
    # Dummy-Logo wenn kein Verein vorhanden ist
    0.0.0.file.XY = {$plugin.tx_cfcleaguefe_competition.maxW_logo_matchtable},{$plugin.tx_cfcleaguefe_competition.maxH_logo_matchtable}
    0.0.0.file.maxW = {$plugin.tx_cfcleaguefe_competition.maxW_logo_matchtable}
    0.0.0.file.maxH = {$plugin.tx_cfcleaguefe_competition.maxH_logo_matchtable}
    # Dummy-Logo wenn kein Logo im Verein 
    0.0.default.conf.tx_cfcleague_club.0.file.XY = {$plugin.tx_cfcleaguefe_competition.maxW_logo_matchtable},{$plugin.tx_cfcleaguefe_competition.maxH_logo_matchtable}
    0.0.default.conf.tx_cfcleague_club.0.file.maxW = {$plugin.tx_cfcleaguefe_competition.maxW_logo_matchtable}
    0.0.default.conf.tx_cfcleague_club.0.file.maxH = {$plugin.tx_cfcleaguefe_competition.maxH_logo_matchtable}
    # Logo aus Verein
#    0.0.default.conf.tx_cfcleague_club.default.media.file.file.XY = {$plugin.tx_cfcleaguefe_competition.maxW_logo_matchtable},{$plugin.tx_cfcleaguefe_competition.maxH_logo_matchtable}
    0.0.default.conf.tx_cfcleague_club.default.media.file.file.maxW = {$plugin.tx_cfcleaguefe_competition.maxW_logo_matchtable}
    0.0.default.conf.tx_cfcleague_club.default.media.file.file.maxH = {$plugin.tx_cfcleaguefe_competition.maxH_logo_matchtable}
    # Logo im Team (Select-Box)
    0.default.file {
        maxW = {$plugin.tx_cfcleaguefe_competition.maxW_logo_matchtable}
        maxH = {$plugin.tx_cfcleaguefe_competition.maxH_logo_matchtable}
    }
  }

}

# Allgemeines Formatierungsangaben für ein Team
lib.t3sports.team {
  pagebrowser =< lib.t3sports.pagebrowser
  links {
    showteam.pid = {$plugin.tx_cfcleaguefe_competition.teampage}
    # Link auf Spielplan
    showmatchtable.pid = {$plugin.tx_cfcleaguefe_competition.matchtablepage}
# Das sollte falsch sein...
    player.parameter = {$plugin.tx_cfcleaguefe_competition.playerpage}
    coach.parameter = {$plugin.tx_cfcleaguefe_competition.profilepage}
    supporter.parameter = {$plugin.tx_cfcleaguefe_competition.profilepage}
  }
  roll.value = 1
  listinfo.llkeyEmpty = teamlist_empty
  group =< lib.t3sports.group

  pictures = USER
  pictures {
    userFunc = tx_rnbase_util_TSFAL->printImages
    refField = t3images
    refTable = tx_cfcleague_teams
    template = EXT:cfc_league_fe/res/lightboxpics.html
    offset = 1
    subpartName = ###PICTURES###
    media =< lib.t3sports.pictures.mediaBase
  }
  firstpicture =< lib.t3sports.team.pictures
  firstpicture {
    limit = 1
    offset = 0
    subpartName = ###TEAM_FIRSTPICTURE###
    media {
      description.br = 1
      creator.wrap = Foto:&nbsp; |
      creator.ifEmpty = -
    }
  }
  # Formatierung der Spieler-, Trainer-, Betreuerdatensätze
  player =< lib.t3sports.profile
  player.birthday.strftime = %d.%m.%y
  coach =< lib.t3sports.profile
  coach.birthday.strftime = %d.%m.%y
  coach.links.showprofile.pid = {$plugin.tx_cfcleaguefe_competition.profilepage}
  
  supporter =< lib.t3sports.profile
  supporter.birthday.strftime = %d.%m.%y
  supporter.links.showprofile.pid = {$plugin.tx_cfcleaguefe_competition.profilepage}

  club =< lib.t3sports.club

  comment.parseFunc =< lib.parseFunc_RTE
  coaches_comment.parseFunc =< lib.parseFunc_RTE
  players_comment.parseFunc =< lib.parseFunc_RTE
  supporters_comment.parseFunc =< lib.parseFunc_RTE

  name.if {
    # Nix zeigen, wenn es ein Dummy-Team ist
    value = 0
    equals.field = dummy
  }
  short_name < lib.t3sports.team.name

  # Formatierung des Team-Logos
  logo =< lib.t3sports.teamLogo.big
}
# Team Small is used in matchtable etc.
lib.t3sports.teamSmall < lib.t3sports.team
lib.t3sports.teamSmall {
  logo =< lib.t3sports.teamLogo.small
}

lib.t3sports.match {
  links {
    report.pid = {$plugin.tx_cfcleaguefe_report.matchreportpage}
    ticker.pid = {$plugin.tx_cfcleaguefe_report.matchtickerpage}
  }
  competition =< lib.t3sports.competition
  date = CASE
  date {
    default = TEXT
    default.field = date
    default.strftime = %a, %d.%m.%y Anstoss: %H:%M Uhr
    H0000 = TEXT
    H0000 {
      field = date
      strftime = %A, %e. %B %Y
    }
    key {
      field = date
      strftime = H%H%M
    }
  }
  liveticker_author.wrap = Das Spielstenogramm von&nbsp;|
  liveticker_author.required = 1
  game_report_author.wrap = Der Spielbericht von&nbsp;|
  game_report_author.required = 1
  game_report.parseFunc =< lib.parseFunc_RTE

  dcresultsuffix = COA
  dcresultsuffix {
    20 = TEXT
    20.value = ###LABEL_AFTEREXTRATIME_SHORT###
    20.if {
      value = 1
      equals.field = is_extratime
    }
    30 = TEXT
    30.value = ###LABEL_ONPENALTY_SHORT###
    30.if {
      value = 1
      equals.field = is_penalty
    }
  }

  pictures = USER
  pictures {
    userFunc = tx_rnbase_util_TSFAL->printImages
    refField = t3images
    refTable = tx_cfcleague_games
    template = EXT:cfc_league_fe/res/lightboxpics.html
#    template = EXT:cfc_league_fe/res/gallerifficpics.html
    subpartName = ###PICTURES###
    media {
      file = IMG_RESOURCE
      file.file.import.field = file
      file.file.maxW = {$plugin.tx_cfcleaguefe_report.maxW_matchPicture}
      file.file.maxH = {$plugin.tx_cfcleaguefe_report.maxH_matchPicture}
      thumbnail < .file
      thumbnail = IMAGE
      thumbnail.file.maxW = {$plugin.tx_cfcleaguefe_report.maxW_matchThumb}
      thumbnail.file.maxH = {$plugin.tx_cfcleaguefe_report.maxH_matchThumb}
      thumbnail.params = border="0"
      thumbnail.titleText.field = title
    }
  }
  firstpicture =< lib.t3sports.match.pictures
  firstpicture {
    limit = 1
    offset = 0
    subpartName = ###FIRSTPICTURE###
  }
}

plugin.tx_cfcleaguefe_competition {
  teamlistTemplate = {$plugin.tx_cfcleaguefe_competition.teamlistTemplate}
  scopeTemplate = {$plugin.tx_cfcleaguefe_competition.scopeTemplate}
  matchtableTemplate = {$plugin.tx_cfcleaguefe_competition.matchtableTemplate}
  matchcrosstableTemplate = {$plugin.tx_cfcleaguefe_competition.matchcrosstableTemplate}
  leaguetableTemplate = {$plugin.tx_cfcleaguefe_competition.leaguetableTemplate}
  statisticsTemplate = {$plugin.tx_cfcleaguefe_competition.statisticsTemplate}
  tickerlistTemplate = {$plugin.tx_cfcleaguefe_competition.tickerlistTemplate}
  leaguetableAllTimeTemplate = {$plugin.tx_cfcleaguefe_competition.leaguetableAllTimeTemplate}
  stadiumlistTemplate = {$plugin.tx_cfcleaguefe_competition.stadiumlistTemplate}

  # Rendering of items. re-use the RTE parseFunc configuration for normal content
  general_stdWrap {
    parseFunc =< lib.parseFunc_RTE
  }

  scope {
    competition.options {
      orderby {
        COMPETITION.SORTING = asc
      }
    }
  }
  # Daten für die Ligatabelle
  leaguetable {
    newMode = 1
  	football.matchProviderClass = tx_cfcleaguefe_table_football_MatchProvider
  	icehockey.matchProviderClass = tx_cfcleaguefe_table_football_MatchProvider
    # Ausgabe mit HTML-Template
    viewType = HTML
    league =< lib.t3sports.competition
    # Angabe zur Tabelle
    table =< lib.t3sports.teamSmall
    table {
      roll.value = 1
#      team.name.wrap = -|-
      markClub {
        override = cfcleague-leaguetable-rowTeam
        if.value = 1
        if.equals.field = markClub
      }
      markClubsIsRunningGame {
        override = cfcleague-leaguetable-runningGame
        if.value = 1
        if.equals.field = markClubsIsRunningGame
      }
      penalties {
        override = &nbsp;*
        if.value = 0
        if.isGreaterThan.field = penalties
      }
      points2 {
        wrap = : |
        if.value = -1
        if.isGreaterThan.field = points2
      }
      # Optional ein String, der zwischen den Zeilen steht
#      implode = <br />
    }
    # Formatierung der Spielstrafen
    penalty {
      comment.wrap = |
    }
    controls {
      tabletype {
        current.noLink = 1
        current.wrap = <b>|</b>
        normal.wrap = <span>|</span>
        0.override = NORMAL
        1.override = HOME
        2.override = AWAY
        link.useKeepVars = 1
      }
      tablescope {
        current.noLink = 1
        current.wrap = <b>|</b>
        0.override = NORMAL
        1.override = FIRST
        2.override = SECOND
        link.useKeepVars = 1
      }
      pointsystem {
        current.noLink = 1
        current.wrap = <b>|</b>
        0.override = POINT3
        1.override = POINT2
        link.useKeepVars = 1
      }
    }
  }
  leaguetableAllTime {
  	fields.MATCH.STATUS.OP_IN_INT = 2
  	table < plugin.tx_cfcleaguefe_competition.leaguetable.table
  	table =< lib.t3sports.club
    tablescopeSelectionInput = 0
  }
  # Tabellenfahrt per JS
  tablechart {
    team {
      logo =< lib.t3sports.teamLogo.small
/*
      logo = IMG_RESOURCE
      logo {
        file.import.field = file
		    file.maxH = 400
		    file.maxW = 400
      }
*/
    }
  }

  # Daten für den Spielplan-View
  matchtable {
    # Ausgabe mit HTML-Template
    viewType = HTML
    _caching.disableSubstCache = 1
    filter = System25\T3sports\Filter\MatchFilter
    # With fields it is possible to defined additional query options
    # select what matches you want to show
    fields {
      # Find matches by state (0-schedules, 1-running, 2-finished, -10 rescheduled)
#      MATCH.STATUS.OP_IN_INT = 0,1,2
    }
    # With options you can set some additional params for sql query
    options {
      # Limit the number of matches
#     limit = 0
      # Show sql-query in FE (for test purposes)
#     debug = 1
      # Defined how to order matches
      orderby {
        MATCH.DATE = asc
      }
    }
    # Whether or not team uids from http-request should be ignored
    acceptTeamIdFromRequest = 1
    acceptRefereeIdFromRequest = 1
    match =< lib.t3sports.match
    match {
      filter {
        profile =< lib.t3sports.profile
        player =< lib.t3sports.profile
        coach =< lib.t3sports.profile
        referee =< lib.t3sports.profile
      }
      pagebrowser =< lib.t3sports.pagebrowser
      roll.value = 1
      stadium.ifEmpty = Ort noch unbekannt
      stadium.wrap = (|)

      # Optional ein String, der zwischen den Spielen steht
#      implode = <br />
      home =< lib.t3sports.teamSmall
      guest =< lib.t3sports.teamSmall
    }
  }

	matchcrosstable {
    _caching.disableSubstCache = 1
    headline.team =< lib.t3sports.teamSmall
    dataline.team =< lib.t3sports.teamSmall
#    dataline.implode =
    # aus Performancegründen nur die Basismarker des Spiels aktivieren
		dataline.matchFullMode = 0
		dataline.match =< lib.t3sports.match
		dataline.match.date.default.strftime = %d.%m.%y
		dataline.match.implode = <br />
		dataline.ownmatch = <td>&bull;</td>
		dataline.nomatch = <td>&nbsp;</td>
	}

  statistics {
    ####
    # Liste der Vorlagengeber
    assistlist.labels (
     headline,player,assists
    )
    assistlist.profile =< lib.t3sports.profile
	  ####
    # Liste der Torschützen
    scorerlist.labels (
     headline,player,goals,goals_own,goals_head,
     goals_home,goals_away, goals_joker, goals_penalty,
     goals_per_match, minutes_per_goal
    )
    scorerlist.profile =< lib.t3sports.profile
    scorerlist.profile {
	    assists.ifEmpty = -
	    goals_all.ifEmpty = -
	    goals_all_per_match {
	      wrap = (|)
  	    number_format.decimal = 2
	      # Auch an ganze Zahlen Nachkommastellen anfügen
	      number_format.dontCheckFloat = 1
	    }
	    goals_all_after_minutes.number_format.decimal = 0
	    goals_all_after_minutes.number_format.dontCheckFloat = 1
	    goals_home.ifEmpty = -
	    goals_away.ifEmpty = -
	    goals_own.ifEmpty = -
	    goals_head.ifEmpty = -
	    goals_head_per_match.wrap = (|)
	    goals_head_per_match.number_format.decimal = 2
	    goals_head_per_match.number_format.dontCheckFloat = 1
	    goals_penalty.ifEmpty = -
	    goals_joker.ifEmpty = -
	  }
	  ####
    # Spielerstatistik
    player.labels (
      matches,matchcount,minutes,cards,player,card_yellow,card_yellowred,card_red,
      goals,goals_own,goals_home,goals_away,assists,change,change_in,change_out
    )
    # Sortierung der Spieler: 0-alphabetisch, 1-wie im Team
    player.profileSortOrder = 0
    player.profile =< lib.t3sports.profile
    player.profile {
#      last_name.wrap = <i>|</i>
#      label_last_name.wrap = <i>|</i>
	    match_count.wrap = <b>|</b>
	    match_count.ifEmpty = -
	    match_minutes.ifEmpty = -
	    card_yellow.ifEmpty = -
	    card_yellowred.ifEmpty = -
	    card_red.ifEmpty = -
	    goals_all.ifEmpty = -
	    goals_own.ifEmpty = -
	    changed_in.ifEmpty = -
	    changed_out.ifEmpty = -
	    goals_assist.ifEmpty = -
	  }
	  ####
    # Zuschauerstatistik
    visitors { 
      labels (
       headline,team,home,away,all,total,average
      )
      # Sortierung: home_total, away_total, all_total
      sortOrder = home_average
    }
  }
  # Liste der aktuell anstehenden Liveticker
  tickerlist {
    options {
      orderby.MATCH.DATE = asc
    }
    # Die Anzahl der Spiele limitieren. 0 bedeutet keine Einschränkung
    limit = 0
    match =< lib.t3sports.match
    match {
      date.strftime  = {$plugin.tx_cfcleaguefe_competition.tickerlist_format_date}
      home =< lib.t3sports.team
      guest =< lib.t3sports.team
    }
  }
  # Angaben zur ScopeAuswahl
  scopeSelection {
    # Ausgabe mit HTML-Template
    viewType = HTML
    group.current.noLink = 1
    group.isCurrent.if.value = 1
    group.isCurrent.if.equals.field = isCurrent
    group.isCurrent.override = selected="selected"
    saison < plugin.tx_cfcleaguefe_competition.scopeSelection.group
    saison { 
      current.noLink = 1
      normal.wrap = <span>|</span>
      # String zwischen den Datensätzen
      implode = -
      eachWrap.wrap = -|-
      allWrap.wrap = #|#
    }
    competition < plugin.tx_cfcleaguefe_competition.scopeSelection.group
    round < plugin.tx_cfcleaguefe_competition.scopeSelection.group
    club < plugin.tx_cfcleaguefe_competition.scopeSelection.group

#    competition.current.noLink = 1
#    round.current.noLink = 1
#    club.current.noLink = 1
#    club.isCurrent.if.value = 1
#    club.isCurrent.if.equals.field = isCurrent
#    club.isCurrent.override = selected="selected"
  }
  teamlist {
    filter = System25\T3sports\Filter\TeamFilter
    team =< lib.t3sports.teamSmall
    options {
      orderby {
        TEAM.NAME = asc
      }
    }
    map =< lib.t3sports.map
    map.template = {$plugin.tx_cfcleaguefe_competition.teamlistTemplate}
    map.team =< lib.t3sports.teamSmall
  }
  stadiumlist {
    stadium =< lib.t3sports.stadium
    filter = System25\T3sports\Filter\StadiumFilter
    map =< lib.t3sports.map
    map.template = {$plugin.tx_cfcleaguefe_competition.stadiumlistTemplate}
    map.stadium =< lib.t3sports.stadium
  }
}

# Define a base layout for chartlines
lib.t3sports.chart {
  # defaults is used for T3sports settings
  defaults {
    # The chart title
    title = Tabellenfahrt der COMPETITION_NAME
    # The is a line definition. Some part are replace dynamically
    line = LINE
    line {
      # title is replaced with team name so don't care
      title = egal
      # The color is used from defaults.colors
      lineColor = egal
      lineStyle = solid
      lineStyle{
        thickness = 2
        color = blue
      }
#      shadow = true
      marker = circle
      marker {
        fillColor = white@0.4
        size = 3
        shadow = true
      }
    }
    colors = {$plugin.tx_cfcleaguefe_report.chartcolors}
  }

  factory = png
  width = {$plugin.tx_cfcleaguefe_report.chartwidth}
  height = {$plugin.tx_cfcleaguefe_report.chartheight}
  antialias = native
  font.default = typo3conf/ext/cfc_league_fe/res/nimbus.ttf
#  font.default = fileadmin/fonts/nimbus.ttf
  font.default {
    size = 8
  }
  background = gradient
  background {
    direction = vertical_mirrored
    startColor = steelblue
    endColor = lightcyan
  }
  borderColor = black
  10 = VERTICAL
    10 {
    percentage = 5
    10 = TITLE
    10 {
      text = Eine Tabellenfahrt
      font {
        size = 10
      }
    }
    20 = VERTICAL
    20 {
      percentage = 88
      10 = PLOTAREA
      10 {
        id = plotarea1
        axis{
          y {
            inverted = 1
            forceMinimum = 1
            labelInterval = 1
            title = Tabellenplatz
            title {
              angle = 90
              size = 8
            }
#            forceMinimum = 20
          }
          x {
            label = minimum
            axisIntersection = max
            title = Spieltag
            title {
              angle = 0
              size = 8
            }
          }
        }
        axisPadding = 10
# Hintergrund der Diagrammfläche: Bild, Farbe oder Gradient
# Beispiel für Farbe
#        fillStyle = image
#        fillStyle {
#          image = fileadmin/images/website/cfc_schraeg_420.jpg
#        }
# Beispiel für Farbe ohne Alpha-Channel
#        fillColor = yellow
# Beispiel für Farbe mit Alpha-Channel
#       fillColor = lightgrey@0.5

# Beispiel für Gradient
        fillStyle = gradient
        fillStyle {
          direction = vertical
          startColor = white@50
          endColor = lightgrey@50
        }

        10 = GRID
        10 {
          axis = y
          type = line
          lineColor = gray@0.2
        }
## Dieser Teil wird komplett ersetzt
## Einstellungen bei chartline setzen
        20 = LINE
        20 {
          title = Error: No Data delivered
          lineColor = red
          dataset {
            10 = random
            10 {
              count = 10
              minimum = 2
              maximum = 15
              includeZero = true
            }
          }
      	}
##
      }
      20 = LEGEND
      20 {
        plotarea.1 = plotarea1
      }
    }
  }
}

plugin.tx_cfcleaguefe_competition.chart =< lib.t3sports.chart

tt_content.list.20.tx_cfcleaguefe_competition    =< plugin.tx_cfcleaguefe_competition





##############################################################
# #####
# Das Report Plugin
# #####
##############################################################
#includeLibs.tx_cfcleaguefe_controllers_report = EXT:cfc_league_fe/controllers/class.tx_cfcleaguefe_controllers_report.php

lib.t3sports.mapIcon {
  file = GIFBUILDER
  file {
    XY = 22,22
    backColor = #ffffff
    10 = IMAGE
    10.offset = 22-[10.w]/2,22-[10.h]/2
    10.file {
      import.data = register:T3SPORTS_MAPICON
      maxW = 20
      maxH = 20
    }
  }
}

# Defaultsettings for GoogleMaps
lib.t3sports.map {
  width = {$plugin.tx_cfcleaguefe_report.map_width}
  height = {$plugin.tx_cfcleaguefe_report.map_height}
  # Possible Controls: largeMap,smallMap,smallZoom,scale,mapType,overviewMap
  google.controls = {$plugin.tx_cfcleaguefe_report.map_controls}
  google.forcejs = {$plugin.tx_cfcleaguefe_report.map_forceinit}
  # Possible values: RNMAP_MAPTYPE_STREET,RNMAP_MAPTYPE_SATELLITE,RNMAP_MAPTYPE_HYBRID,RNMAP_MAPTYPE_PHYSICAL
  maptype = RNMAP_MAPTYPE_STREET
  icon.teamlogo =< lib.t3sports.mapIcon
  icon.clublogo =< lib.t3sports.mapIcon
  icon.stadiumlogo =< lib.t3sports.mapIcon
}

lib.t3sports.matchreport.imgcard = IMAGE
lib.t3sports.matchreport.imgcard {
  file = EXT:cfc_league_fe/res/gelbe-karte.gif
  file.width = 7
  file.height = 10
  params = class="cfcleague-card"
}
lib.t3sports.matchreport.imggoal = IMAGE
lib.t3sports.matchreport.imggoal {
  file = EXT:cfc_league_fe/res/goal.gif
  file.width = 18
  file.height = 16
  params = class="t3sports-mnicon"
}

# CASE Anweisung für eine Spielstrafe
lib.t3sports.matchreport.penaltyType.cObject = CASE
lib.t3sports.matchreport.penaltyType.cObject {
  key.field = type
  default = TEXT
  default.value = 
  # Die Nummern entsprechen der ID des Tickertyps
  70 =< lib.t3sports.matchreport.imgcard
  71 < .70
  71.file = EXT:cfc_league_fe/res/gelbrote-karte.gif
  72 < .70
  72.file = EXT:cfc_league_fe/res/rote-karte.gif
#          noTrimWrap = | (|)|
}
# Jetzt noch ein CASE für alle anderen Tickertypen
lib.t3sports.matchreport.tickerType < lib.t3sports.matchreport.penaltyType
lib.t3sports.matchreport.tickerType.cObject {
  10 = CASE
  10 {
    key.data = register:T3SPORTS_NOTE_FAVCLUB
    1 = COA
    1.10 =< lib.t3sports.matchreport.imggoal
    1.20 = TEXT
    1.20.value = &nbsp;Tooor durch&nbsp;
    default =< lib.t3sports.matchreport.imggoal
  }


  11 < .10
  12 < .10
  30 = COA
#  30.10 =< lib.t3sports.matchreport.tickerType.cObject.10
  30.20 = TEXT
  30.20.value = Eigentor:&nbsp;
  32 = TEXT
  32.value = Elfmeter verschossen:&nbsp;
  33 = TEXT
  33.value = Eckball:&nbsp;
}

# Standardanzeige für Personen
lib.t3sports.matchreport.profiles {
  ifEmpty = unbekannt
  seperator = |, |
  profile {
    reverse = 0
    # Show name. Either first lastname or stage name
    last_name = 1
    last_name.s_weight = 2
    last_name.cObject = CASE
    last_name.cObject {
      default = TEXT
      default.field = stage_name
      -1 = COA
      -1 {
        10 = TEXT
        10.field = first_name
        10.noTrimWrap = || |
        10.required = 1
        20 = TEXT
        20.field = last_name
      }
      key.field = stage_name
      key.ifEmpty = -1
    }
  }
}

# Spieler im Spielbericht
lib.t3sports.matchreport.reportPlayers < lib.t3sports.matchreport.profiles
lib.t3sports.matchreport.reportPlayers {
  profile {
    # Den Nachnamen des Teamcaptains formatieren
    last_name.cObject {
      stdWrap.outerWrap = <b>|(C)</b>
      stdWrap.outerWrap.fieldRequired = teamCaptain
      # Vorname weg
      -1.10 >
    }
    # Die Karten einblenden
    ifPenalty {
      s_weight = 3
      ticker {
        type =< lib.t3sports.matchreport.penaltyType
      }
    }
  }
}

# Formatierung einer Tickermeldung
lib.t3sports.matchNote {
  player =< lib.t3sports.profile
  playerchangein =< lib.t3sports.profile
  playerchangeout =< lib.t3sports.profile
  dcicon = CASE
  dcicon {
    key.field = type
    10 =< lib.t3sports.matchreport.imggoal
    11 =< lib.t3sports.matchreport.imggoal
    12 =< lib.t3sports.matchreport.imggoal
    13 =< lib.t3sports.matchreport.imggoal
    30 =< lib.t3sports.matchreport.imggoal
    70 =< lib.t3sports.matchreport.imggoal
    70.file = EXT:cfc_league_fe/res/gelbe-karte.gif
    71 =< lib.t3sports.matchreport.imggoal
    71.file = EXT:cfc_league_fe/res/gelbrote-karte.gif
    72 =< lib.t3sports.matchreport.imggoal
    72.file = EXT:cfc_league_fe/res/rote-karte.gif
    
  }
  dcmessage = COA
  dcmessage.10 = CASE
  dcmessage.10 {
    key.field = type
    # Spielerwechsel
    10 = TEXT
    10.value = Tor für <strong>###MATCH_TICKER_TEAM_NAME###</strong> durch ###MATCH_TICKER_PLAYER_DCNAME###.
    11 = TEXT
    11.value = Kopfballtor für <strong>###MATCH_TICKER_TEAM_NAME###</strong> durch ###MATCH_TICKER_PLAYER_DCNAME###.
    12 = TEXT
    12.value = Elfmeter für <strong>###MATCH_TICKER_TEAM_NAME###</strong> verwandelt durch ###MATCH_TICKER_PLAYER_DCNAME###.
    13 = TEXT
    13.value = Freistoßtor für <strong>###MATCH_TICKER_TEAM_NAME###</strong> durch ###MATCH_TICKER_PLAYER_DCNAME###.
    30 = TEXT
    30.value = Eigentor durch ###MATCH_TICKER_PLAYER_DCNAME### (<strong>###MATCH_TICKER_TEAM_NAME###</strong>).
    31 = TEXT
    31.value = Torvorlage ###MATCH_TICKER_PLAYER_DCNAME###.
    32 = TEXT
    32.value = Verschossener Elfmeter durch ###MATCH_TICKER_PLAYER_DCNAME### (<strong>###MATCH_TICKER_TEAM_NAME###</strong>).
    33 = TEXT
    33.value = Eckball getreten durch ###MATCH_TICKER_PLAYER_DCNAME###.
    70 = TEXT
    70.value = Gelbe Karte ###MATCH_TICKER_PLAYER_DCNAME### (<strong>###MATCH_TICKER_TEAM_NAME###</strong>).
    71 = TEXT
    71.value = Gelb-Rot ###MATCH_TICKER_PLAYER_DCNAME### (<strong>###MATCH_TICKER_TEAM_NAME###</strong>).
    72 = TEXT
    72.value = Rote Karte ###MATCH_TICKER_PLAYER_DCNAME### (<strong>###MATCH_TICKER_TEAM_NAME###</strong>).
    80 = TEXT
    80.value = Spielerwechsel <strong>###MATCH_TICKER_TEAM_NAME###</strong>: ###MATCH_TICKER_PLAYERCHANGEIN_DCNAME### kommt für ###MATCH_TICKER_PLAYERCHANGEOUT_DCNAME###
#    default = TEXT
#    default.field = type
  }
  dcmessage.20 = TEXT
  dcmessage.20.field = comment
  dcmessage.20.required = 1
  dcmessage.20.noTrimWrap = | ||
  crdate = TEXT
  crdate.current = 1
  crdate.strftime = %a, %d %b %Y %H:%M:%S CET
  minute = COA
  minute {
    10 = TEXT
    10.field = minute
    10.wrap = |.
    # Bei Bedarf die Extrazeit einblenden
    20 = TEXT
    20.field = extra_time
    20.wrap = (+|)
    20.if.value = 0
    20.if.equals.field = extra_time
    20.if.negate = 1
  }
  dcscore = COA
  dcscore {
    20 = TEXT
    20.field = goals_home
    20.wrap = |:
    30 = TEXT
    30.field = goals_guest
  }

  subparts {
    isgoal {
      # -> Marker: _ISGOAL_YES###
      marker.visible = YES
      visible = TEXT
      visible.value = 1
      visible.if {
        isInList.field = type
        value = 10,11,12,13
      }
    }
    isgoalown =< lib.t3sports.matchNote.subparts.isgoal
    isgoalown {
      # -> Marker: _ISGOAL_YES###
      visible.if {
        equals.field = type
        value = 30
      }
    }
  }

}

plugin.tx_cfcleaguefe_report   = USER
plugin.tx_cfcleaguefe_report {
  flexform       = flexform_report.xml
  userFunc       = tx_rnbase_controller->main
  defaultAction  = tx_cfcleaguefe_actions_MatchReport
  qualifier      = cfc_league_fe
  extensionKey   = cfc_league_fe
  templatePath   = EXT:cfc_league_fe/views/templates
  locallangFilename = EXT:cfc_league_fe/locallang.xml

  scopeTemplate = {$plugin.tx_cfcleaguefe_competition.scopeTemplate}
  matchreportTemplate = {$plugin.tx_cfcleaguefe_report.matchreportTemplate}
  teamviewTemplate = {$plugin.tx_cfcleaguefe_report.teamviewTemplate}
  profileTemplate = {$plugin.tx_cfcleaguefe_report.profileTemplate}
  profilelistTemplate = {$plugin.tx_cfcleaguefe_report.profilelistTemplate}
  clubviewTemplate = {$plugin.tx_cfcleaguefe_report.clubviewTemplate}
  clublistTemplate = {$plugin.tx_cfcleaguefe_report.clublistTemplate}
  stadiumviewTemplate = {$plugin.tx_cfcleaguefe_report.stadiumviewTemplate}

  # Angaben zur ScopeAuswahl
  scopeSelection =< plugin.tx_cfcleaguefe_competition.scopeSelection
  scopeSelection {
    group.current.noLink = 1
  }

  # Rendering of news items. re-use the RTE parseFunc configuration for normal content
  general_stdWrap {
    parseFunc =< lib.parseFunc_RTE
  }

  profilelist {
  	charbrowser = 0
    profile =< lib.t3sports.profile
    profile.firstImage {
      file.maxW = 40
      file.maxH = 40
      wrap = <br />|
    }
    options.orderby {
      PROFILE.LAST_NAME = asc
      PROFILE.FIRST_NAME = asc
    }
  }
  profileview {
    profile =< lib.t3sports.profile
    profile.firstpicture.media.thumbnail {
      file.maxW = {$plugin.tx_cfcleaguefe_report.maxW_firstProfilePicture}
      file.maxH = {$plugin.tx_cfcleaguefe_report.maxH_firstProfilePicture}
    }
    nextprofile.player =< lib.t3sports.profile
    nextprofile.supporter =< lib.t3sports.profile
    nextprofile.supporter.links.showprofile.pid = {$plugin.tx_cfcleaguefe_competition.profilepage}
    nextprofile.coach =< lib.t3sports.profile
    nextprofile.coach.links.showprofile.pid = {$plugin.tx_cfcleaguefe_competition.profilepage}
    prevprofile.player =< lib.t3sports.profile
    prevprofile.coach =< lib.t3sports.profile
    prevprofile.coach.links.showprofile.pid = {$plugin.tx_cfcleaguefe_competition.profilepage}
    prevprofile.supporter =< lib.t3sports.profile
    prevprofile.supporter.links.showprofile.pid = {$plugin.tx_cfcleaguefe_competition.profilepage}
    team =< lib.t3sports.team
  }
  clubview {
    club =< lib.t3sports.club
  }
  clublist {
  	charbrowser = 0
    club =< lib.t3sports.club
    club.logo {
    }
    options.orderby {
      CLUB.NAME = asc
    }
    map =< lib.t3sports.map
    map.template = {$plugin.tx_cfcleaguefe_report.clublistTemplate}
    map.club =< lib.t3sports.club
  }

  # View TeamView
  teamview {
    team =< lib.t3sports.team
    team {
      firstpicture.media {
        thumbnail {
          file.maxW = {$plugin.tx_cfcleaguefe_report.maxW_firstTeamPicture}
          file.maxH = {$plugin.tx_cfcleaguefe_report.maxH_firstTeamPicture}
        }
      }

      # Konfiguration von verschiedenen Spielerlisten
      playerLists {
      	# damit werden die Listen mit dem Prefix ###TEAM_PLAYERLIST_### bereitgestellt
      	# Das sind nur Beispiele
        defence {
        	profile =< lib.t3sports.profile
          filter.fields.TEAMNOTE.COMMENT.OP_EQ = Abwehr
          filter.options {
#            debug = 1
            enableFieldsForAdditionalTableAliases = TEAMNOTE
          }
        }
        midfield =< plugin.tx_cfcleaguefe_report.teamview.team.playerLists.defence
        midfield.filter.fields.TEAMNOTE.COMMENT.OP_EQ = Mittelfeld
        offence =< plugin.tx_cfcleaguefe_report.teamview.team.playerLists.defence
        offence.filter.fields.TEAMNOTE.COMMENT.OP_EQ = Angriff
        goalkeeper =< plugin.tx_cfcleaguefe_report.teamview.team.playerLists.defence
        goalkeeper.filter.fields.TEAMNOTE.COMMENT.OP_EQ = Tor
      }


    }
  }
  # View MatchReport
  matchreport {
    # Ausgabe mit HTML-Template
    viewType = HTML

    # This configures the chart in match report
    svChartMatch =< lib.t3sports.chart
    # This configures historic matches
    historic {
      options.orderby.MATCH.DATE = desc
      template = {$plugin.tx_cfcleaguefe_report.matchreportTemplate}
      match =< lib.t3sports.match
    }
    # This configures matches of current round
    mtcurrentround {
      options.orderby.MATCH.DATE = asc
      template = {$plugin.tx_cfcleaguefe_report.matchreportTemplate}
      subpartName = ###CURRENTROUND_MATCHES###
      match =< lib.t3sports.match
    }

    # Anweisungen für den Spieldatensatz
    match =< lib.t3sports.match
    match {
      # Hier immer mit den Namen der Spalte verwenden
      visitors.ifEmpty = -
      arena =< lib.t3sports.stadium
      game_report.parseFunc =< lib.parseFunc_RTE
      date.default.strftime  = {$plugin.tx_cfcleaguefe_report.format_date}
      home =< lib.t3sports.team
      guest =< lib.t3sports.team
      players_home = 1
      players_guest = 1
      chart {
      	template.file = EXT:cfc_league_fe/views/templates/tablechart.html
      	template.subpart = ###FLOT###
      }

	    media {
	      mp3 {
	        player {
	          backgroundColor = 88C0E8
	          autoStart = 0
	          autoReplay = 0
	        }
	      }
	    }

      # Tickerlisten verfolgen den selben Zweck wie die dynaMarkers nur mit einer anderen Technik
      # Die Ausgabe erfolgt hier wie in ganz normalen Listen
      tickerLists {
      # damit wird die Liste ###MATCH_TICKERS### bereitgestellt

        ticker =< lib.t3sports.matchNote
        ticker {
          filter.fields.MATCHNOTE.MINUTE.OP_GTEQ_INT = 0
          filter.fields.MATCHNOTE.TYPE.OP_NOTIN_INT = 200
          filter.options {
            orderby.MATCHNOTE.MINUTE = DESC
            orderby.MATCHNOTE.EXTRA_TIME = DESC
            orderby.MATCHNOTE.UID = DESC
          }
        }

        goal =< lib.t3sports.matchNote
        goal {
          filter.fields.MATCHNOTE.MINUTE.OP_GTEQ_INT = 0
          filter.fields.MATCHNOTE.TYPE.OP_IN_INT = 10,11,12,30,13
          filter.options {
            orderby.MATCHNOTE.MINUTE = DESC
            orderby.MATCHNOTE.EXTRA_TIME = DESC
            orderby.MATCHNOTE.UID = DESC
          }
        }

      }
      # Mit den DynaMarkern können Listen von Spiel-Ereignissen zusammengestellt werden
      # Der Zugriff im HTML-Template erfolgt nach folgendem Prinzip: 
      # der DynaMarker "scorerHome" hat den Marker ###MATCH_SCORERHOME###
      # Es können beliebige weitere Listen erstellt werden. Bei der Benennung sollten aber
      # Kollisionen mit Attributen des Datensatzes "Spiel" vermieden werden.
      dynaMarkers {
        exchangeHome {
          cron = 1
          ifEmpty.cObject = TEXT
          ifEmpty.cObject.value.field = scorer_home_stat
          ifEmpty.cObject.value.ifEmpty = -
          ifEmpty.cObject.value.br = 1
          # Possible values are home and guest. Empty for both
          noteTeam = home
          noteType = 80,81
          #          noteIgnoreType = ??
          #          implode = <br />
          seperator = |<br/>|
          ticker {
            minute.s_weight = 0
            minute.wrap = |.&nbsp;
            profile =< lib.t3sports.matchreport.profiles.profile
            profile.s_weight = 5
            profile {
              ifChangedOut {
                # Position des ChangeOut-Tickers
                s_weight = 4
                ticker {
                  #minute.wrap = |.&nbsp;
                  minute >
                  profile >
                  profile2 =< lib.t3sports.matchreport.reportPlayers.profile
                  profile2 {
                    s_weight = 4
                    # Falls der eingewechselte Spieler wieder raus muss
                    ifChangedOut {
                      s_weight = 2
                      ticker {
                        minute.wrap = |.&nbsp;
                        profile2 =< lib.t3sports.matchreport.reportPlayers.profile
                        noTrimWrap = |, ||
                      }
                    }
                    # Wenn der auch wieder raus musste, könnte es hier weitergehen...
                  }
                  #          wrap = &nbsp;(|)
                  noTrimWrap = | wird ersetzt durch | |
                }
              }
            }
            # Type nicht anzeigen
            type >
            # Spielstandsanzeige entfernen
            goals_home >
          }
        }
        exchangeGuest =< plugin.tx_cfcleaguefe_report.matchreport.match.dynaMarkers.exchangeHome
        exchangeGuest.noteTeam = guest
        exchangeGuest.ifEmpty.cObject.value.field = scorer_guest_stat
        # Die Heimtorschützen anzeigen
        scorerHome {
		      cron = 1
          ifEmpty.cObject = TEXT
          ifEmpty.cObject.value.field = scorer_home_stat
          ifEmpty.cObject.value.ifEmpty = -
          ifEmpty.cObject.value.br = 1
          # Possible values are home and guest. Empty for both
          noteTeam = home
          noteType = 10,11,12,30
#          noteIgnoreType = ??
#          implode = <br />
		      seperator = |<br/>|
		      ticker {
		        minute.s_weight = 0
		        minute.wrap = |.&nbsp;
		        type.s_weight = 3
		        # Typname bei Kopf, Elfm, und Eigentor anzeigen
		        type.cObject = CASE
		        type.cObject {
						  key.field = type
						  default = TEXT
						  default.value = 
						  11 = TEXT
						  11.value = Kopfball
						  12 = TEXT
						  12.value = Elfmeter
						  30 = TEXT
						  30.value = Eigentor
		        }
		        type.required = 1
		        type.wrap = &nbsp;(|)
		        profile =< lib.t3sports.matchreport.profiles.profile
		        profile.s_weight = 2
		        # Spielstandsanzeige
		        goals_home >
		        goals_home.s_weight = 5
		        goals_home.cObject = COA
		        goals_home.cObject {
		          20 = TEXT
		          20.field = goals_home
		          20.wrap = &nbsp;|:
		          30 = TEXT
		          30.field = goals_guest
		        }
		      }
        }
        # Beim Gastteam ändern wir nur ein Attribut
        scorerGuest =< plugin.tx_cfcleaguefe_report.matchreport.match.dynaMarkers.scorerHome
        scorerGuest.noteTeam = guest
        scorerGuest.ifEmpty.cObject.value.field = scorer_guest_stat

        # Der MatchTicker wird dynamisch erstellt
        tickerlist {
		      cron = 1
          noteIgnoreType = 200,31
          noteMinimumMinute = 0
		      seperator = |<br/>|
		      ticker {
		        minute >
		        minute.cObject = COA
		        minute.cObject {
		          10 = TEXT
		          10.field = minute
		          10.wrap = <div class="cfcleague-report-ticker-head"><span class="cfcleague-ticker-min">|.
		          # Bei Bedarf die Extrazeit einblenden
		          20 = TEXT
		          20.field = extra_time
		          20.wrap = <span class="cfcleague-ticker-min">(+|)</span>
		          20.if.value = 0
		          20.if.equals.field = extra_time
		          20.if.negate = 1
		          30 = TEXT
		          30.value = &nbsp;min </span>
		        }
		        # Spielstandsanzeige
		        goals_home >
		        goals_home.s_weight = 5
		        goals_home.cObject = COA
		        goals_home.cObject {
		          10 = TEXT
		          10.value = <span class="cfcleague-ticker-score">Spielstand:&nbsp;
		          20 = TEXT
		          20.field = goals_home
		          20.wrap = |:
		          30 = TEXT
		          30.field = goals_guest
		          90 = TEXT
		          90.value = </span></div><div class="cfcleague-report-ticker-msg">
		        }

		        # Anzeige des Typs
		        type =< lib.t3sports.matchreport.tickerType
		        # Typ vor dem Spieler anzeigen
		        type.s_weight = 7
		        type.required = 1
		        type.wrap >

		        profile =< lib.t3sports.matchreport.profiles.profile
		        profile.s_weight = 10
						# Bei Auswechslungen auch den zweiten Spieler zeigen
						profile2 =< lib.t3sports.matchreport.profiles.profile
		        profile2 {
		          s_weight = 9
		          noTrimWrap = || kommt f&uuml;r |
		          required = 1
		        }

		        comment.s_weight = 100
		        comment.wrap = <br /><span class="cfcleague-ticker-comment">|</span></div>
		      }
        }
      }
      leaguetable {
        template = EXT:cfc_league_fe/views/templates/leaguetable_teaser.html
        subpartName = ###LEAGUE_TABLE###
      }
    }

    # Im Report werden Listen von Personen und Ticker gezeigt. Diese basieren nicht auf
    # HTML-Templates, sondern können nur per TS formatiert werden. Die folgenden Listen
    # werden vom System vorgegeben. Zusätzlich können im Match über die dynaMarkers
    # eigene Listen erstellt werden

    coachnames =< lib.t3sports.matchreport.profiles
    lineuphome {
      staticField = players_home_stat
		  strategy.enable = 1
		  strategy.seperator = | - |
		  seperator = |, |
      profile < lib.t3sports.matchreport.reportPlayers.profile
      ifEmpty.cObject = TEXT
      ifEmpty.cObject.value.field = players_home_stat
      ifEmpty.cObject.value.ifEmpty = unbekannt
      ifEmpty.cObject.value.br = 1
    }
    lineuphome.profile {
      first_name >
      last_name.wrap = <span class="player lineup">|</span>
      # Bei Auswechslungen einen Tickerwrap setzen
      ifChangedOut {
        # Position des ChangeOut-Tickers
        s_weight = 4
        ticker {
          minute.wrap = |.&nbsp;
          profile >
          profile2 =< lib.t3sports.matchreport.reportPlayers.profile
          profile2 {
            last_name.wrap = <span class="player lineup change">|</span>
            s_weight = 2
            # Falls der eingewechselte Spieler wieder raus muss
            ifChangedOut {
              s_weight = 4
              ticker {
                minute.wrap = |.&nbsp;
                profile2 =< lib.t3sports.matchreport.reportPlayers.profile
                profile2.wrap = <span class="player lineup change">|</span>
                noTrimWrap = |, ||
              }
            }
            # Wenn der auch wieder raus musste, könnte es hier weitergehen...
          }
#          wrap = &nbsp;(|)
          noTrimWrap = | (|)|
        }
      }
    }
    lineupguest =< plugin.tx_cfcleaguefe_report.matchreport.lineuphome
    lineupguest {
      staticField = players_guest_stat
      ifEmpty.cObject = TEXT
      ifEmpty.cObject.value.field = players_guest_stat
      ifEmpty.cObject.value.ifEmpty = unbekannt
      ifEmpty.cObject.value.br = 1
    }

    substnameshome {
		  seperator = |, |
      profile < lib.t3sports.matchreport.reportPlayers.profile
      ifEmpty.cObject = TEXT
      ifEmpty.cObject.value.field = substitutes_home_stat
      ifEmpty.cObject.value.ifEmpty = unbekannt
      ifEmpty.cObject.value.br = 1
      profile {
        first_name >
        last_name.wrap = <span class="player subst">|</span>
        # Die Karten einblenden
        ifPenalty {
          s_weight = 3
          ticker {
            type =< lib.t3sports.matchreport.penaltyType
          }
        }
#        seperator = |, |
      }
    }
    substnamesguest =< plugin.tx_cfcleaguefe_report.matchreport.substnameshome
    substnamesguest.ifEmpty.cObject.value.field = substitutes_guest_stat

    refereenames =< lib.t3sports.matchreport.profiles
    refereenames.profile {
      # Heimatstadt des Schiedsrichters anzeigen
      home_town {
        s_weight = 10
        wrap = &nbsp;(|)
        required = 1
      }
    }

    assistsnames =< lib.t3sports.matchreport.profiles
    assistsnames{
      seperator = | und |
    }
  }

  stadiumview {
    stadium =< lib.t3sports.stadium
  }
}

tt_content.list.20.tx_cfcleaguefe_report    =< plugin.tx_cfcleaguefe_report

# Prepare some links from tt_news
plugin.tt_news {
  external_links {
    matchreport {
      ext_parameters = matchId
      pid = {$plugin.tx_cfcleaguefe_report.matchreportpage}
    }
    profile {
      ext_parameters = profileId
      pid = {$plugin.tx_cfcleaguefe_competition.playerpage}
    }
  }
}

lib.tx_t3twig {
    extensions {
        t3sports_DataProvider = System25\T3sports\Twig\Extension\DataProvider
    }
}

plugin.tx_cfcleaguefe_report {
	_CSS_DEFAULT_STYLE (
[class^="glyphicon-t3sports-"],
[class*=" glyphicon-t3sports-"] {
  background-image: url("/typo3conf/ext/cfc_league_fe/Resources/Public/Css/icons.png");
}
.glyphicon-t3sports-goal { background-position : 0px 0px; width : 14px; height : 14px;  }
.glyphicon-t3sports-card-yellow { background-position : -13px 0px; width : 14px; height : 14px;  }
.glyphicon-t3sports-card-yellowred { background-position : -26px 0px; width : 14px; height : 14px;  }
.glyphicon-t3sports-card-red { background-position : -39px 0px; width : 14px; height : 14px;  }
	)
}
