<f:comment><!-- Displays a matomo widget --></f:comment>

<f:comment>
<!--
   The following arguments are expected here:
   * {title}           (string)   The widget title
   * {id}              (string)   an html id
   * {matomoSiteId}    (int)      the matomo site's id
   * {matomoToken}     (string)   the matomo's user token
   * {module}          (string)   the matomo 'moduleToWidgetize' parameter
   * {action}          (string)   the matomo 'actionToWidgetize' parameter
   * {period}      (string)   The analysis period ('day', 'month' or 'year')
   * {additionalUrl}   (string)   [Optional] This string will be added at the end of the iframe's url without any formatting
   * {width}           (int)      [Optional] Override the default card width
   * {height}          (int)      [Optional] Override the default card height, and disable auto-resizing
 -->
</f:comment>

<div class="reportCard">
    <h4>{title}</h4>
    <div class="widgetIframe">
        <iframe width="{f:if(condition: '{width} > 0', then: width, else: '500')}"
                height="{f:if(condition: '{height} > 0', then: height, else: '300')}"
                id="{id}"
				src="https://stats.2iopenservice.com/index.php?module=Widgetize
						&action=iframe
						&disableLink=1
						&widget=1
						&moduleToWidgetize={module}
						&actionToWidgetize={action}
						&idSite={matomoSiteId}
						&period={period}
						&date=today
						&token_auth={matomoToken}
						{additionalUrl}"
                scrolling="yes"
                frameborder="0"
                marginheight="0"
                marginwidth="0"></iframe>
        <f:if condition="{height}>0"><f:then>
            <f:comment><!-- no resizing --></f:comment>
        </f:then><f:else>
            <script defer>iFrameResize(<f:format.raw value="{"/>heightCalculationMethod:'grow'<f:format.raw value="}"/>, '#{id}')</script>
        </f:else></f:if>
    </div>
</div>
