<?php $showViolationsList = paramdeep('gateStatus','showViolationsList') && user()->checkAccess('gate_status_view_violations');; ?>
<?php $showAlertsList = paramdeep('gateStatus','showAlertsList') && user()->checkAccess('gate_status_view_alerts');; ?>
<?php if($showAlertsList && $showViolationsList) { ?>
  <?php $showViolationsList = false; ?>
<?php } ?>
<?php $viewMode = 'none'; ?>
<?php if($showViolationsList) { ?>
  <?php $viewMode = 'violations'; ?>
<?php } ?>
<?php if($showAlertsList) { ?>
  <?php $viewMode = 'alerts'; ?>
<?php } ?>
<div id="gates-status-page">
  <div class="row">
    <?php if(user()->checkAccess('gate_status_view_gates')) { ?>
      <div id="gates-status-container" class="span4">
        <?php $this->renderPartial('gates/_gateList', array('gateGroups' => $gateGroups, 'viewMode' => $viewMode)); ?>
      </div>
    <?php } ?>
    <?php if($showViolationsList) { ?>
      <div id="violations-container" class="span8" data-behavior="ViolationsPreview">
        <?php $this->renderPartial('violations/_violationsTable', array('violations' => $violations, 'gate' => null, 'viewMode' => 'violations')); ?>
      </div>
    <?php } ?>
    <?php if($showAlertsList) { ?>
      <div id="alerts-container" class="span8" data-behavior="AlertsPreview">
        <?php $this->renderPartial('alerts/_alertsTable', array('alerts' => $alerts, 'gate' => null, 'viewMode' => 'alerts')); ?>
      </div>
    <?php } ?>
  </div>
</div>
