<?php $counter = array();; ?>
<?php $counter[Alert::TYPE_ALARM]    = 0; ?>
<?php $counter[Alert::TYPE_WARNING]  = 0; ?>
<?php $counter[Alert::TYPE_INFO]     = 0; ?>
<?php foreach($data->data as $alert) { ?>
  <?php $counter[$alert->type] = $alert->eventCounter; ?>
<?php } ?>
<div class="event-reporting-summary">
  <ul class="unstyled inline">
    <li>
      <?php if (Yii::app()->user->checkAccess('view_alerts')) { ?>
        <a <?php echo MtHaml\Runtime::renderAttributes(array(array('href', (Yii::app()->createAbsoluteUrl('alert/search',  array('types' => Alert::TYPE_ALARM))))), 'html5', 'UTF-8'); ?>>
          <i class="icon-exclamation-sign alarm alarm-icon"></i>
          <?php echo htmlspecialchars($counter[Alert::TYPE_ALARM],ENT_QUOTES,'UTF-8'); ?>
        </a>
      <?php } else { ?>
        <i class="icon-exclamation-sign alarm alarm-icon"></i>
        <?php echo htmlspecialchars($counter[Alert::TYPE_ALARM],ENT_QUOTES,'UTF-8'); ?>
      <?php } ?>
    </li>
    <li>
      <?php if (Yii::app()->user->checkAccess('view_alerts')) { ?>
        <a <?php echo MtHaml\Runtime::renderAttributes(array(array('href', (Yii::app()->createAbsoluteUrl('alert/search',  array('types' => Alert::TYPE_WARNING))))), 'html5', 'UTF-8'); ?>>
          <i class="icon-warning-sign alarm warning-icon"></i>
          <?php echo htmlspecialchars($counter[Alert::TYPE_WARNING],ENT_QUOTES,'UTF-8'); ?>
        </a>
      <?php } else     { ?>
        <i class="icon-warning-sign alarm warning-icon"></i>
        <?php echo htmlspecialchars($counter[Alert::TYPE_WARNING],ENT_QUOTES,'UTF-8'); ?>
      <?php } ?>
    </li>
    <li>
      <?php if (Yii::app()->user->checkAccess('view_alerts')) { ?>
        <a <?php echo MtHaml\Runtime::renderAttributes(array(array('href', (Yii::app()->createAbsoluteUrl('alert/search',  array('types' => Alert::TYPE_INFO))))), 'html5', 'UTF-8'); ?>>
          <i class="icon-info-sign alarm info-icon"></i>
          <?php echo htmlspecialchars($counter[Alert::TYPE_INFO],ENT_QUOTES,'UTF-8'); ?>
        </a>
      <?php } else     { ?>
        <i class="icon-info-sign alarm info-icon"></i>
        <?php echo htmlspecialchars($counter[Alert::TYPE_INFO],ENT_QUOTES,'UTF-8'); ?>
      <?php } ?>
    </li>
  </ul>
</div>
