<?php $totalEventsPerUser    = 0;; ?>
<?php $totalNewPerUser       = 0;; ?>
<?php $totalExaminedPerUser  = 0;; ?>
<?php $totalValidatedPerUser = 0;; ?>
<?php $totalQueuedPerUser    = 0;; ?>
<?php $totalExportedPerUser  = 0;; ?>
<?php foreach($user->services as $service)  { ?>
  <?php $totalEventsPerUser    += $service->eventsCount; ?>
  <?php $totalNewPerUser       += $service->eventsNewCount; ?>
  <?php $totalExaminedPerUser  += $service->eventsExaminedCount; ?>
  <?php $totalValidatedPerUser += $service->eventsValidatedCount; ?>
  <?php $totalQueuedPerUser    += $service->eventsQueuedForExportCount; ?>
  <?php $totalExportedPerUser  += $service->eventsExportedCount; ?>
<?php } ?>
<div class="row">
  <div class="span8">
    <h3><?php echo htmlspecialchars(Yii::t("app", "Current Status"),ENT_QUOTES,'UTF-8'); ?></h3>
    <div class="row">
      <div class="span4">
        <table class="table widget">
          <tr>
            <td><?php echo htmlspecialchars(Yii::t("app", "In charge"),ENT_QUOTES,'UTF-8'); ?></td>
            <td colspan="2">
              <span class="badge badge-info">
                <?php echo htmlspecialchars($user->servicesCount,ENT_QUOTES,'UTF-8'); ?>
              </span>
            </td>
          </tr>
          <tr>
            <td><?php echo htmlspecialchars(Yii::t("app", "Examined"),ENT_QUOTES,'UTF-8'); ?></td>
            <td>
              <div <?php echo MtHaml\Runtime::renderAttributes(array(array('class', 'progress'), array('data-dividend', $totalExaminedPerUser), array('data-divisor', $totalNewPerUser)), 'html5', 'UTF-8'); ?>>
                <div class="bar"></div>
              </div>
            </td>
            <td>
              <?php echo htmlspecialchars($totalExaminedPerUser,ENT_QUOTES,'UTF-8'); ?>
              /
              <?php echo htmlspecialchars($totalNewPerUser,ENT_QUOTES,'UTF-8'); ?>
            </td>
            <tr>
              <td><?php echo htmlspecialchars(Yii::t("app", "Validated"),ENT_QUOTES,'UTF-8'); ?></td>
              <td>
                <div <?php echo MtHaml\Runtime::renderAttributes(array(array('class', 'progress'), array('data-dividend', $totalValidatedPerUser), array('data-divisor', $totalExaminedPerUser)), 'html5', 'UTF-8'); ?>>
                  <div class="bar"></div>
                </div>
              </td>
              <td>
                <?php echo htmlspecialchars($totalValidatedPerUser,ENT_QUOTES,'UTF-8'); ?>
                /
                <?php echo htmlspecialchars($totalExaminedPerUser,ENT_QUOTES,'UTF-8'); ?>
              </td>
            </tr>
          </tr>
        </table>
      </div>
      <div class="span4">
        <table class="table widget">
          <tr>
            <td><?php echo htmlspecialchars(Yii::t("app", "Suspended (globally)"),ENT_QUOTES,'UTF-8'); ?></td>
            <td colspan="2">
              <span class="badge badge-important">
                <?php echo htmlspecialchars(Event::model()->pending()->count(),ENT_QUOTES,'UTF-8'); ?>
              </span>
            </td>
          </tr>
          <tr>
            <td><?php echo htmlspecialchars(Yii::t("app", "Queue to CSI"),ENT_QUOTES,'UTF-8'); ?></td>
            <td>
              <div <?php echo MtHaml\Runtime::renderAttributes(array(array('class', 'progress'), array('data-dividend', $totalQueuedPerUser), array('data-divisor', $totalValidatedPerUser)), 'html5', 'UTF-8'); ?>>
                <div class="bar"></div>
              </div>
            </td>
            <td>
              <?php echo htmlspecialchars($totalQueuedPerUser,ENT_QUOTES,'UTF-8'); ?>
              /
              <?php echo htmlspecialchars($totalValidatedPerUser,ENT_QUOTES,'UTF-8'); ?>
            </td>
          </tr>
          <tr>
            <td><?php echo htmlspecialchars(Yii::t("app", "Sent to CSI"),ENT_QUOTES,'UTF-8'); ?></td>
            <td>
              <div <?php echo MtHaml\Runtime::renderAttributes(array(array('class', 'progress'), array('data-divident', $totalExportedPerUser), array('data-divisor', $totalQueuedPerUser)), 'html5', 'UTF-8'); ?>>
                <div class="bar"></div>
              </div>
            </td>
            <td>
              <?php echo htmlspecialchars($totalExportedPerUser,ENT_QUOTES,'UTF-8'); ?>
              /
              <?php echo htmlspecialchars($totalQueuedPerUser,ENT_QUOTES,'UTF-8'); ?>
            </td>
          </tr>
        </table>
      </div>
    </div>
  </div>
</div>
