<?php $encodedViolationsCountByTimespanStatsData = CJSON::encode($violationsCountByTimespanStatsData);; ?>
<?php $encodedApprovedViolationsCountByTimespanStatsData = CJSON::encode($approvedViolationsCountByTimespanStatsData);; ?>
<?php $encodedInvalidViolationsCountByTimespanStatsData = CJSON::encode($invalidViolationsCountByTimespanStatsData);; ?>
<?php $encodedPendingViolationsCountByTimespanStatsData = CJSON::encode($pendingViolationsCountByTimespanStatsData);; ?>
<?php $encodedExportedEventsCountByTimespanStatsData = CJSON::encode($exportedEventsCountByTimespanStatsData);; ?>
<?php $encodedViolationsCountByGate = CJSON::encode($violationsCountByGate);; ?>
<?php $encodedApprovedViolationsCountByGate = CJSON::encode($approvedViolationsCountByGate);; ?>
<?php $encodedInvalidViolationsCountByGate = CJSON::encode($invalidViolationsCountByGate);; ?>
<?php $encodedExportedEventsCountByGate = CJSON::encode($exportedEventsCountByGate);; ?>
<?php $searchGateList = ""; ?>
<?php foreach($gates as $gate) { ?>
  <?php if (isset($eventsStatisticsSearchForm->gates) && in_array($gate['ID'], $eventsStatisticsSearchForm->gates)) { ?>
    <?php $searchGateList.= $gate->Descrizione . ", "; ?>
  <?php } ?>
<?php } ?>
<?php $searchGateList = rtrim($searchGateList, ", "); ?>
<div class="stats-violation-management-search-results">
  <div class="print-only" style="margin-left: 1cm;margin-top: 1cm;margin-bottom:2cm">
    <h1 style="text-align:center;margin-bottom: 1cm;">
      <?php echo htmlspecialchars(t('Violations Management'),ENT_QUOTES,'UTF-8'); ?>
    </h1>
    <p style="font-size:22px;">
      <strong>
        <?php echo htmlspecialchars(t('Date') . ":",ENT_QUOTES,'UTF-8'); ?>
      </strong>
      <?php echo htmlspecialchars(t('From'),ENT_QUOTES,'UTF-8'); ?>
      <?php echo htmlspecialchars($eventsStatisticsSearchForm->startDateTime,ENT_QUOTES,'UTF-8'); ?>
      <?php echo htmlspecialchars(t('To'),ENT_QUOTES,'UTF-8'); ?>
      <?php echo htmlspecialchars($eventsStatisticsSearchForm->endDateTime,ENT_QUOTES,'UTF-8'); ?>
      <?php if (isset($eventsStatisticsSearchForm->gates)) { ?>
        <br />
        <br />
        <strong>
          <?php echo htmlspecialchars(t('Gates') . ":",ENT_QUOTES,'UTF-8'); ?>
        </strong>
        <?php echo htmlspecialchars($searchGateList,ENT_QUOTES,'UTF-8'); ?>
      <?php } ?>
    </p>
  </div>
  <div class="row stats-violations-management-overview">
    <div class="span12">
      <div id="violations-management-graph-container">
        <canvas id="violations-management-graph" style="height:70%;width:40%;"></canvas>
      </div>
    </div>
  </div>
  <div class="row stats-violations-management-overview">
    <div class="span12">
      <div id="violations-management-exported-graph-container">
        <canvas id="violations-management-exported-graph" style="height:70%;width:40%;"></canvas>
      </div>
    </div>
  </div>
  <div class="row stats-violations-management-overview">
    <div class="span12">
      <div id="violations-management-by-gate-graph-container">
        <canvas id="violations-management-by-gate-graph" style="height:70%;width:40%;"></canvas>
      </div>
    </div>
  </div>
</div>
<input <?php echo MtHaml\Runtime::renderAttributes(array(array('id', 'violations-count-by-timespan-graph-data'), array('type', ('hidden')), array('value', $encodedViolationsCountByTimespanStatsData)), 'html5', 'UTF-8'); ?> />
<input <?php echo MtHaml\Runtime::renderAttributes(array(array('id', 'approved-violations-count-by-timespan-graph-data'), array('type', ('hidden')), array('value', $encodedApprovedViolationsCountByTimespanStatsData)), 'html5', 'UTF-8'); ?> />
<input <?php echo MtHaml\Runtime::renderAttributes(array(array('id', 'invalid-violations-count-by-timespan-graph-data'), array('type', ('hidden')), array('value', $encodedInvalidViolationsCountByTimespanStatsData)), 'html5', 'UTF-8'); ?> />
<input <?php echo MtHaml\Runtime::renderAttributes(array(array('id', 'pending-violations-count-by-timespan-graph-data'), array('type', ('hidden')), array('value', $encodedPendingViolationsCountByTimespanStatsData)), 'html5', 'UTF-8'); ?> />
<input <?php echo MtHaml\Runtime::renderAttributes(array(array('id', 'exported-violations-count-by-timespan-graph-data'), array('type', ('hidden')), array('value', $encodedExportedEventsCountByTimespanStatsData)), 'html5', 'UTF-8'); ?> />
<input <?php echo MtHaml\Runtime::renderAttributes(array(array('id', 'violations-count-by-gate-graph-data'), array('type', ('hidden')), array('value', $encodedViolationsCountByGate)), 'html5', 'UTF-8'); ?> />
<input <?php echo MtHaml\Runtime::renderAttributes(array(array('id', 'approved-violations-count-by-gate-graph-data'), array('type', ('hidden')), array('value', $encodedApprovedViolationsCountByGate)), 'html5', 'UTF-8'); ?> />
<input <?php echo MtHaml\Runtime::renderAttributes(array(array('id', 'invalid-violations-count-by-gate-graph-data'), array('type', ('hidden')), array('value', $encodedInvalidViolationsCountByGate)), 'html5', 'UTF-8'); ?> />
<input <?php echo MtHaml\Runtime::renderAttributes(array(array('id', 'exported-violations-count-by-gate-graph-data'), array('type', ('hidden')), array('value', $encodedExportedEventsCountByGate)), 'html5', 'UTF-8'); ?> />
