#set ( $currYYYYMM = $templateLogic.visualFormatter.formatDate($templateLogic.visualFormatter.parseDate("", ""), $templateLogic.getLanguageCode($templateLogic.getLanguageId()), "yyyy.MM") )
#macro(getChildren)
#set ($childCounter = -1)
#foreach($item in $contentItems)
#if ($templateLogic.getContent($item.id).getName()== $currYYYYMM)
#if($templateLogic.getContent($item.id).getIsBranch()==true)
#foreach($subItem in $templateLogic.getChildContents($item.id, true))
#if ($templateLogic.getContentAttribute($subItem.id, "MonatsHighlight") == "MonatsHighlight")
#set ($childCounter = $childCounter + 1)
#end
#end
#else
#if ($templateLogic.getContentAttribute($item.id, "MonatsHighlight") == "MonatsHighlight")
#set ($childCounter = $childCounter + 1)
#end
#end
#end
#end
#if ($childCounter > 0)
#set ($childCounter = 0)
#end
#if ($childCounter == 0)
#set ($myRandom = 0)
#end
#end
#macro(getRandom )
#set ($mySecondRandom = $templateLogic.MathHelper.getRandom($childCounter))
#if ($mySecondRandom == $myRandom && $loopCounter < 10)
#if ($childCounter==1 && $myRandom==0)
#set ($mySecondRandom=1)
#else
#set ( $loopCounter = $loopCounter + 1)
#getRandom()
#end
#end
#end
#macro(getNextMonth $YYYYMM)
#set ( $currYYYY = $templateLogic.visualFormatter.formatDate($templateLogic.visualFormatter.parseDate("$YYYYMM", "yyyy.MM"), $templateLogic.getLanguageCode($templateLogic.getLanguageId()), "yyyy") )
#set ( $currMM = $templateLogic.visualFormatter.formatDate($templateLogic.visualFormatter.parseDate("$YYYYMM", "yyyy.MM"), $templateLogic.getLanguageCode($templateLogic.getLanguageId()), "MM") )
#if ($templateLogic.getMathHelper().stringToInteger($currMM)<11)
#set ($currMM = $templateLogic.getMathHelper().stringToInteger($currMM)+1)
#else
#set ($currMM = "1")
#set ($currYYYY = $templateLogic.getMathHelper().stringToInteger($currYYYY)+1)
#end
#set ( $currYYYYMM = $templateLogic.visualFormatter.formatDate($templateLogic.visualFormatter.parseDate("$currYYYY.$currMM","yyyy.M"), $templateLogic.getLanguageCode($templateLogic.getLanguageId()), "yyyy.MM") )
#set ( $currMM = $templateLogic.visualFormatter.formatDate($templateLogic.visualFormatter.parseDate("$currYYYYMM","yyyy.M"), $templateLogic.getLanguageCode($templateLogic.getLanguageId()), "MM") )
#getChildren()
#end
#set ( $contentItems = $templateLogic.getChildContents($templateLogic.componentLogic.getBoundContentId("khz-content-folder"), false))
#getChildren()
#if ($childCounter == -1)
#set ( $currYYYYMM = $templateLogic.visualFormatter.formatDate($templateLogic.visualFormatter.parseDate("", ""), $templateLogic.getLanguageCode($templateLogic.getLanguageId()), "yyyyMM") )
#getNextMonth($currYYYYMM)
#end
#if ($childCounter == -1)
#getNextMonth($currYYYYMM)
#end
#if ($childCounter == -1)
#getNextMonth($currYYYYMM)
#end
#if ($childCounter == -1)
#getNextMonth($currYYYYMM)
#end
#if ($childCounter == -1)
#getNextMonth($currYYYYMM)
#end
#if ($childCounter == -1)
#getNextMonth($currYYYYMM)
#end
#if ($childCounter != -1)
#set ($contentFound = 0)
#set ($childCounter = -1)
#foreach($item in $contentItems)
#if ($templateLogic.getContent($item.id).getName()== $currYYYYMM)
#if($templateLogic.getContent($item.id).getIsBranch()==true)
#foreach($subItem in $templateLogic.getChildContents($item.id, true))
#if ($templateLogic.getContentAttribute($subItem.id, "MonatsHighlight") == "MonatsHighlight")
#set ($childCounter = $childCounter + 1)
#if ($contentFound < 1 && ($childCounter == $myRandom || $childCounter == $mySecondRandom) )
#set ( $contentFound = $contentFound + 1)
#set ( $contentTitel = $templateLogic.getContentAttribute($subItem.id, "Titel"))
#set ( $contentDateFrom = $templateLogic.getContentAttribute($subItem.id, "DateFrom"))
#set ( $contentDateTo = $templateLogic.getContentAttribute($subItem.id, "DateTo"))
#set ( $contentAbstract = $templateLogic.getContentAttribute($subItem.id, "Abstract"))
#set ( $contentImage = $templateLogic.componentLogic.getAssetUrl($subItem.id, "HighlightImage"))
#if ( $contentImage == "")
#set ( $contentImage = $templateLogic.componentLogic.getAssetUrl($subItem.id, "Image"))
#end
#if ( $contentDateFrom != "")
#set ($contentDateFrom = $templateLogic.visualFormatter.formatDate($templateLogic.visualFormatter.parseDate($contentDateFrom, "yyyy.mm.dd"), "dd.mm.yyyy"))
#end
#if ( $contentDateTo != "")
#set ($contentDateTo = $templateLogic.visualFormatter.formatDate($templateLogic.visualFormatter.parseDate($contentDateTo, "yyyy.mm.dd"), "dd.mm.yyyy"))
#end
$templateLogic.getComponentLogic().getContentAttribute("khz-properties", "MonatsHighlightText1")
$contentTitel
$templateLogic.getComponentLogic().getContentAttribute("khz-properties", "MonatsHighlightText2")
#end
#end
#end
#else
#if ($templateLogic.getContentAttribute($item.id, "MonatsHighlight") == "MonatsHighlight")
#set ($childCounter = $childCounter + 1)
#if ($contentFound < 1 && ($childCounter == $myRandom || $childCounter == $mySecondRandom) )
#set ( $contentFound = $contentFound + 1)
#set ( $contentTitel = $templateLogic.getContentAttribute($item.id, "Titel"))
#set ( $contentDateFrom = $templateLogic.getContentAttribute($item.id, "DateFrom"))
#set ( $contentDateTo = $templateLogic.getContentAttribute($item.id, "DateTo"))
#set ( $contentAbstract = $templateLogic.getContentAttribute($item.id, "Abstract"))
#set ( $contentImage = $templateLogic.componentLogic.getAssetUrl($item.id, "HighlightImage"))
#if ( $contentDateFrom != "")
#set ($contentDateFrom = $templateLogic.visualFormatter.formatDate($templateLogic.visualFormatter.parseDate($contentDateFrom, "yyyy.mm.dd"), "dd.mm.yyyy"))
#end
#if ( $contentDateTo != "")
#set ($contentDateTo = $templateLogic.visualFormatter.formatDate($templateLogic.visualFormatter.parseDate($contentDateTo, "yyyy.mm.dd"), "dd.mm.yyyy"))
#end
$templateLogic.getComponentLogic().getContentAttribute("khz-properties", "MonatsHighlightText1")
$contentTitel
$templateLogic.getComponentLogic().getContentAttribute("khz-properties", "MonatsHighlightText2")
#end
#end
#end
#end
#end
#end