<table class="table table-condensed span12">
  <thead>
    <tr>
      <th>
        <?php echo htmlspecialchars(t('Gate'),ENT_QUOTES,'UTF-8'); ?>
      </th>
      <?php foreach($months as $month) { ?>
        <th>
          <a <?php echo MtHaml\Runtime::renderAttributes(array(array('href', (Yii::app()->createUrl('ExportRegistrationReport/serverFinalReport', array('idServer' => $eventServer->id , 'year' => $month['year'], 'month' => $month['month'], 'gate' => -1)))), array('target', '_blank')), 'html5', 'UTF-8'); ?>>
            <?php echo htmlspecialchars($month['month'].'/'.$month['year'],ENT_QUOTES,'UTF-8'); ?>
          </a>
        </th>
      <?php } ?>
    </tr>
  </thead>
  <tbody>
    <?php foreach($gates as $gate) { ?>
      <tr>
        <td>
          <?php echo htmlspecialchars($gate->gate_sn,ENT_QUOTES,'UTF-8'); ?>
        </td>
        <?php foreach($months as $month) { ?>
          <?php $mn = $month['month'];; ?>
          <?php $yr = $month['year'];  ; ?>
          <?php $exp = isEmpty($expCounters["$gate->gate_sn"]["$yr"]["$mn"]['exported']) ? 0: $expCounters["$gate->gate_sn"]["$yr"]["$mn"]['exported']; ; ?>
          <?php $del = isEmpty($expCounters["$gate->gate_sn"]["$yr"]["$mn"]['deleted']) ? 0: $expCounters["$gate->gate_sn"]["$yr"]["$mn"]['deleted'];; ?>
          <td>
            <a <?php echo MtHaml\Runtime::renderAttributes(array(array('href', (Yii::app()->createUrl('ExportRegistrationReport/serverFinalReport', array('idServer' => $eventServer->id , 'year' => $month['year'], 'month' => $month['month'], 'gate' => $gate->gate_sn)))), array('target', '_blank')), 'html5', 'UTF-8'); ?>>
              <?php echo htmlspecialchars($exp.'/'.$del,ENT_QUOTES,'UTF-8'); ?>
            </a>
          </td>
        <?php } ?>
      </tr>
    <?php } ?>
  </tbody>
</table>
