<script type="text/javascript" src="../../js/license_plate_controller.js"></script>
<?php if(isset(Yii::app()->params['showICETRATooltip']) && Yii::app()->params['showICETRATooltip']==="true") { ?>
  <script type="text/javascript" src="../../js/icetra.js"></script>
<?php } ?>
<?php if(Yii::app()->params['photoEditingMode']=="all") { ?>
  <?php $secondStepName = t('Transits all'); ?>
<?php } ?>
<?php if(Yii::app()->params['photoEditingMode']=="none") { ?>
  <?php $secondStepName = t('Transits'); ?>
<?php } ?>
<?php if(Yii::app()->params['photoEditingMode']=="select") { ?>
  <?php $secondStepName = t('Transits select'); ?>
<?php } ?>
<?php if(Yii::app()->params['photoEditingMode']=="facecrop") { ?>
  <?php $secondStepName = t('Images Selection Crop'); ?>
<?php } ?>
<?php if(Yii::app()->params['photoEditingMode']=="obscure") { ?>
  <?php $secondStepName = t('Transits obscure'); ?>
<?php } ?>
<?php $DIMENSIONE_IMMAGINI = 250; ?>
<?php $FATTORE_ZOOM = 6; ?>
<?php $ZOOM_SPEED = 0.3; ?>
<?php $OCR_PRECISION = 0; ?>
<?php $thirdColumnName="none"; ?>
<?php $defaultActive = 0; ?>
<?php $hasSpeedBehaviour = false; ?>
<?php foreach ($eventBehaviors as $index => $eventBehavior) { ?>
  <?php if($eventBehavior->behavior->name == "spot speed") { ?>
    <?php $hasSpeedBehaviour = true; ?>
    <?php $thirdColumnName = t('Animation'); ?>
  <?php } else { ?>
    <?php $thirdColumnName = "Video"; ?>
  <?php } ?>
<?php } ?>
<?php $isWhitelist = false; ?>
<?php $isRed = false; ?>
<?php if($gateBehaviors != null && is_array($gateBehaviors)) { ?>
  <?php foreach ($gateBehaviors as $index => $gateBehavior) { ?>
    <?php if($gateBehavior->is_whitelist) { ?>
      <?php $isWhitelist = true; ?>
    <?php } ?>
  <?php } ?>
<?php } ?>
<?php if($isWhitelist) { ?>
  <?php $plateAjaxUrl = CController::createUrl('event/ajaxWhitelistSmartTips'); ?>
  <?php $plateAjax = array('type' =>'POST','url' => $plateAjaxUrl,'update' => '#whitelist-smart-tips');; ?>
<?php } ?>
<?php $platesClass = paramdeep('validation','plate','alphanumeric') ? 'alphanumeric' : ''; ?>
<?php $nextEvent = $queue->getNextEvent ( $event );; ?>
<?php $previousEvent = $queue->getPreviousEvent ( $event );; ?>
<?php $ocrQualityClassHTML = "";; ?>
<?php if(isset(Yii::app()->params['showOcrTooltip']) && Yii::app()->params['showOcrTooltip']!=="false") { ?>
  <?php if (!$event->hasCorrectedPlate()) { ?>
    <?php if (!is_null($event->ocrQuality)) { ?>
      <?php $ocrQualityRate = round($event->ocrQuality, $OCR_PRECISION) . '%';; ?>
      <?php $ocrQualityClass = $event->ocrQualityClass;; ?>
      <?php $ocrQualityClassHTML = "ocrQuality" . ucfirst($ocrQualityClass);; ?>
      <?php $ocrQualityClassHTML .= " ocrQualityTooltip";; ?>
    <?php } else { ?>
      <?php $ocrQualityRate = Yii::t('app', "Not Available");; ?>
      <?php $ocrQualityClassHTML = "ocrQualityTooltip";; ?>
    <?php } ?>
  <?php } ?>
<?php } ?>
<div id="event-page">
  <div class="page-header span11">
    <div class="span5">
      <h5 class="progress-title">
        Completed Task
        <?php echo htmlspecialchars(($queue->getEventIndex($event) + 1),ENT_QUOTES,'UTF-8'); ?>
        <?php echo htmlspecialchars(Yii::t('app', 'of'),ENT_QUOTES,'UTF-8'); ?>
        <?php echo htmlspecialchars(($queue->getEventsCount()),ENT_QUOTES,'UTF-8'); ?>
      </h5>
      <div>
        <div class="progress">
          <div <?php echo MtHaml\Runtime::renderAttributes(array(array('class', ('bar' . ' ' . 'bar-success')), array('style', ('width:' . ((intval((($queue->getEventIndex($event)+1)/($queue->getEventsCount()))*100))) . '%;'))), 'html5', 'UTF-8'); ?>>
            <div class="progress-value"></div>
          </div>
        </div>
      </div>
    </div>
    <div class="span3" style="text-align:center;">
      <h4 style="margin-top: 0px;margin-bottom: 19px;">
        <?php echo htmlspecialchars(Yii::t('app', 'Event #'),ENT_QUOTES,'UTF-8'); ?>
        <?php echo htmlspecialchars($event->ID,ENT_QUOTES,'UTF-8'); ?>
        <small>
          <?php if (isset($event->service)) { ?>
            <?php echo htmlspecialchars(Yii::t('app', 'Task'),ENT_QUOTES,'UTF-8'); ?>
            <?php echo htmlspecialchars($event->service->ID,ENT_QUOTES,'UTF-8'); ?>
          <?php } ?>
        </small>
      </h4>
      <?php if ($event->isExamined()) { ?>
        <span class="label"><?php echo htmlspecialchars(Yii::t('app', 'Examined'),ENT_QUOTES,'UTF-8'); ?></span>
      <?php } ?>
      <?php if ($event->isValidated()) { ?>
        <span class="label"><?php echo htmlspecialchars(Yii::t('app', 'Validated'),ENT_QUOTES,'UTF-8'); ?></span>
      <?php } ?>
    </div>
    <div class="span2" style="margin-top: 33px;">
      <?php if (Yii::app()->user->checkAccess('edit_event_behaviors')) { ?>
        <div class="btn-group pull-right" style="font-weight: initial;">
          <a <?php echo MtHaml\Runtime::renderAttributes(array(array('class', 'btn'), array('href', (Yii::app()->createAbsoluteUrl('event/indexFilter', array('service' => $service, 'scope' => $scope))))), 'html5', 'UTF-8'); ?>>
            <?php echo htmlspecialchars(Yii::t("app", "All"),ENT_QUOTES,'UTF-8'); ?>
          </a>
          <a <?php echo MtHaml\Runtime::renderAttributes(array(array('class', 'btn'), array('href', (Yii::app()->createAbsoluteUrl('event/indexFilter', array('service' => $service, 'scope' => $scope, 'toValidateOnly' => true))))), 'html5', 'UTF-8'); ?>>
            <?php echo htmlspecialchars(Yii::t("app", "to be Validated"),ENT_QUOTES,'UTF-8'); ?>
          </a>
        </div>
      <?php } ?>
    </div>
  </div>
  <?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm',      array('type' => 'horizontal','action' => Yii::app()->createUrl('event/update', array('id' => $event->ID, 'service' => $service, 'scope' => $scope, 'toValidateOnly' => $toValidateOnly)),'htmlOptions' => array('id' => 'event-form','data-event-id' => $event->ID,),)); ?>
  <input <?php echo MtHaml\Runtime::renderAttributes(array(array('type', 'hidden'), array('name', 'internal_gate'), array('value', ($event->Gate))), 'html5', 'UTF-8'); ?> />
  <input <?php echo MtHaml\Runtime::renderAttributes(array(array('type', 'hidden'), array('name', 'internal_timestamp'), array('value', (tts($event->StartTime)))), 'html5', 'UTF-8'); ?> />
  <?php if(isset(Yii::app()->params['photoEditingMode']) && Yii::app()->params['photoEditingMode'] !== "none") { ?>
    <input type="hidden" id="croppedImagesData" name="croppedImagesData" value="0" />
  <?php } ?>
  <div class="container">
    <?php if(Yii::app()->user->checkAccess('media_view_photo') || Yii::app()->user->checkAccess('media_view_video')) { ?>
      <?php $mainMediaCount = 3; ?>
      <?php $mainMediaColumnSize = 33; ?>
      <div class="row">
        <div class="span12">
          <div class="tabbable">
            <ul id="step" class="nav nav-tabs">
              <li class="active">
                <a href="#plate" data-toggle="tab">
                  <?php echo htmlspecialchars(t('Event Check'),ENT_QUOTES,'UTF-8'); ?>
                </a>
              </li>
              <li class="hide">
                <a href="#transit" data-toggle="tab">
                  <?php echo htmlspecialchars($secondStepName,ENT_QUOTES,'UTF-8'); ?>
                </a>
              </li>
              <li class="hide">
                <a href="#video" data-toggle="tab">
                  <?php echo htmlspecialchars($thirdColumnName,ENT_QUOTES,'UTF-8'); ?>
                </a>
              </li>
              <li class="hide">
                <a href="#final_check" data-toggle="tab">
                  <?php echo htmlspecialchars(t('Final_check'),ENT_QUOTES,'UTF-8'); ?>
                </a>
              </li>
            </ul>
            <div class="tab-content">
              <?php if(user()->checkAccess('media_view_photo')) { ?>
                <?php $photoBW = $event->PreviewPhoto; ?>
                <?php if(Yii::app()->params['deviceType']=="section") { ?>
                  <?php $photoBW2 = $event->getCorrectMediaById(1001); ?>
                <?php } ?>
                <?php $photoCOL= $event->PreviewColorPhoto; ?>
                <?php $extraPhotos = $event->PreviewExtraCameraPhoto;; ?>
                <div id="plate" class="tab-pane active">
                  <div class="span6" style="margin-left:0px;">
                    <?php if($photoBW!=null) { ?>
                      <div id="photoBW1_frame" class="alert alert-error" style="margin-bottom:0px;width:84.5%;position:relative;">
                        <?php echo htmlspecialchars(t('Start Section Vehicle Image'),ENT_QUOTES,'UTF-8'); ?>
                        <?php $plateRect = $photoBW->getPlateRectangle(); ?>
                        <?php if($plateRect!=null && $plateRect->width>0) { ?>
                          <?php $point = $plateRect->center; ?>
                          <?php $scala = $photoBW->width/$plateRect->width; ?>
                          <?php $scala /= 1.75; ?>
                          <?php $this->dragonImageSingle($photoBW->UrlEnhanced, "500px", $DIMENSIONE_IMMAGINI."px", array(), array("style" => "border: 2px solid #000;border-radius: 5px;margin-top: 10px;"),$point->X, $point->Y); ?>
                        <?php } else { ?>
                          <?php $this->renderHtml("<div class=\"info\" ><img src=\"$photoBW->UrlEnhanced\" style=\"height: {$DIMENSIONE_IMMAGINI}px;\" alt=\"\"></div>"); ?>
                        <?php } ?>
                      </div>
                    <?php } ?>
                    <?php if($photoBW2!=null) { ?>
                      <div id="photoBW2_frame" class="alert alert-error" style="margin-bottom:0px;width:84.5%;margin-top:10px;position:relative;">
                        <?php echo htmlspecialchars(t('End Section Vehicle Image'),ENT_QUOTES,'UTF-8'); ?>
                        <?php $plateRect = $photoBW2->getPlateRectangle(); ?>
                        <?php if($plateRect!=null && $plateRect->width>0) { ?>
                          <?php $point = $plateRect->center; ?>
                          <?php $scala = $photoBW2->width/$plateRect->width; ?>
                          <?php $scala /= 1.75; ?>
                          <?php $this->dragonImageSingle($photoBW2->UrlEnhanced, "500px", $DIMENSIONE_IMMAGINI."px", array(), array("style" => "border: 2px solid #000;border-radius: 5px;margin-top: 10px;"),$point->X, $point->Y); ?>
                        <?php } else { ?>
                          <?php $this->renderHtml("<div class=\"info\" ><img src=\"$photoBW->UrlEnhanced\" style=\"height: {$DIMENSIONE_IMMAGINI}px;\" alt=\"\"></div>"); ?>
                        <?php } ?>
                      </div>
                    <?php } ?>
                  </div>
                  <div class="span6" style="margin-left:0px;margin-left:-30px;">
                    <?php if(($photoBW!=null) && ($photoBW2!=null)) { ?>
                      <svg id="Checker_frame" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 614 515" style="overflow:visible">
                        <style type="text/css">
                          <?php echo htmlspecialchars(".shape-error{fill:#f2dede;}",ENT_QUOTES,'UTF-8'); ?>
                          <?php echo htmlspecialchars(".shape-success{fill:#dff0d8;}",ENT_QUOTES,'UTF-8'); ?>
                          <?php echo htmlspecialchars(".stroke-error{stroke:#eed3d7;}",ENT_QUOTES,'UTF-8'); ?>
                          <?php echo htmlspecialchars(".stroke-success{stroke:#d6e9c6;}",ENT_QUOTES,'UTF-8'); ?>
                          <?php echo htmlspecialchars(".txt-error{fill:#b94a48;}",ENT_QUOTES,'UTF-8'); ?>
                          <?php echo htmlspecialchars(".txt-success{fill:#468847;}",ENT_QUOTES,'UTF-8'); ?>
                        </style>
                        <path class="shape-error" style="stroke-miterlimit:10;stroke-width:0.5px" d="M71,437.3l1-332.1a5,5,0,0,1,5-5H609a5,5,0,0,0,5-5V5.3a5,5,0,0,0-5-5H49a5,5,0,0,0-5,5L43.5,127a5,5,0,0,1-5,5H23v-8.5l-23,23,23,23V161H38.5a5,5,0,0,1,5,5V465.8a5,5,0,0,1-5,5H23v-8.5l-23,23,23,23v-8.5H66a5,5,0,0,0,5-5Z"></path>
                        <g id="btn_plate_check">
                          <foreignobject class="node" x="92" y="17" width="500" height="63">
                            <div></div>
                            <?php echo htmlspecialchars(t('Please, check if vehicle and license plate match over the section'),ENT_QUOTES,'UTF-8'); ?>
                            <div style="margin-top:10px;text-align:center;">
                              <a class="btn btn-danger" href="#" onclick="DoubleCheckPlate(false,false);">
                                <span class="icon-remove"></span>
                                No
                              </a>
                              <a class="btn btn-success" href="#" onclick="DoubleCheckPlate(true,false);">
                                <span class="icon-ok"></span>
                                <?php echo htmlspecialchars(t('Match'),ENT_QUOTES,'UTF-8'); ?>
                              </a>
                            </div>
                          </foreignobject>
                        </g>
                        <g>
                          <foreignobject class="node" x="92" y="120" width="505" height="380" style="border: 3px solid #a5a5a554;">
                            <div class="plate-info-container" style="float:right;margin-right:40px;display:none;margin-top: 15px;">
                              <?php if($isWhitelist) { ?>
                                <?php echo $form->textFieldRow($event, 'Plate', array('class' => "touppercase {$platesClass} platefield plate-white-list {$ocrQualityClassHTML} span2", 'id'=>'Plate', 'data-title' => Yii::t('app', 'Accuracy: ') . $ocrQualityRate)); ?>
                              <?php } else { ?>
                                <?php echo $form->textFieldRow($event, 'Plate', array('class' => "touppercase {$platesClass} platefield {$ocrQualityClassHTML} span2",'data-title' => Yii::t('app', 'Accuracy: ') . $ocrQualityRate)); ?>
                              <?php } ?>
                              <?php if(paramdeep('validation','plate','suggestions')) { ?>
                                <?php $this->addPlateSuggestionsJS($event); ?>
                              <?php } ?>
                              <?php if($isWhitelist) { ?>
                                <?php echo $form->dropDownListRow($event, 'custom_nationality', array_merge(array('' => ''), CountryList::localized()), array('class' => 'chzn-select span2','data-placeholder' => Yii::t('app', 'Country...'))); ?>
                              <?php } else { ?>
                                <?php echo $form->dropDownListRow($event, 'custom_nationality', array_merge(array('' => ''), CountryList::localized()), array('class' => 'chzn-select span2', 'data-placeholder' => Yii::t('app', 'Country...'))); ?>
                              <?php } ?>
                              <?php if($isWhitelist) { ?>
                                <div id="whitelist-smart-tips"></div>
                              <?php } ?>
                              <?php echo $form->dropDownListRow($event, 'custom_vehicle_type', array_merge(array('' => ''), VehicleTypes::localizedForValidation()), array('class' => 'chzn-select span2','data-placeholder' => Yii::t('app', 'Class...'))); ?>
                              <?php echo $form->dropDownListRow($event, 'custom_plate_type',  array_merge(array('' => ''), CHtml::listData(CustomPlateType::model()->findAll(), 'type', 'label')), array('class' => 'chzn-select span2','data-placeholder' => Yii::t('app', 'Plate Type...'))); ?>
                              <?php echo $form->dropDownListRow($event, 'custom_property_type', array_merge(array('' => ''), CHtml::listData(CustomPropertyType::model()->findAll(), 'type', 'label')), array('class' => 'chzn-select span2','data-placeholder' => Yii::t('app', 'Custom Property...'))); ?>
                              <div class="control-group input-append" style="float:right;">
                                <?php echo $form->textField($event, 'Kemler', array('class'=>'')); ?>
                                <div class="btn-group">
                                  <button class="btn dropdown-toggle" type="button" data-toggle="dropdown">
                                    <?php echo htmlspecialchars(t('Kemler-ONU'),ENT_QUOTES,'UTF-8'); ?>
                                    <span class="caret"></span>
                                  </button>
                                  <ul class="dropdown-menu">
                                    <li>
                                      <a href="#" data-set-value="" data-set-target="#Event_Kemler">
                                        <?php echo htmlspecialchars(t('None'),ENT_QUOTES,'UTF-8'); ?>
                                      </a>
                                    </li>
                                    <li>
                                      <a href="#" data-set-value="GENERIC" data-set-target="#Event_Kemler">
                                        <?php echo htmlspecialchars(t('Generic'),ENT_QUOTES,'UTF-8'); ?>
                                      </a>
                                    </li>
                                    <li class="divider"></li>
                                    <li>
                                      <a id="kemler-toggle" href="#">
                                        <?php echo htmlspecialchars(t('Search Kemler-ONU'),ENT_QUOTES,'UTF-8'); ?>
                                      </a>
                                    </li>
                                  </ul>
                                </div>
                              </div>
                            </div>
                          </foreignobject>
                        </g>
                        <g>
                          <foreignobject class="node" x="92" y="437" width="500" height="28">
                            <div class="plate-info-container" style="text-align:center;width:500px;display:none;margin-top: 15px;">
                              <?php if(Yii::app()->params['photoEditingMode']=="facecrop") { ?>
                                <a class="btn btn-success" href="#" onclick="DoubleCheckPlate(true,true)">
                                  <span class="icon-ok">
                                    <?php echo htmlspecialchars(t('Done'),ENT_QUOTES,'UTF-8'); ?>
                                  </span>
                                </a>
                              <?php } else { ?>
                                <a class="btn btn-success" href="#" onclick="displayNextStep(&#039;final_check&#039;,true)">
                                  <span class="icon-ok">
                                    <?php echo htmlspecialchars(t('Done'),ENT_QUOTES,'UTF-8'); ?>
                                  </span>
                                </a>
                              <?php } ?>
                            </div>
                          </foreignobject>
                        </g>
                      </svg>
                      <div id="sp_details" class="alert-info" style="float: right;margin-right: 16px;border: 1px solid #bce8f1;padding-left: 25px;padding-right: 25px;padding-top: 10px;padding-bottom: 10px;"></div>
                    <?php } else { ?>
                      ToDO
                    <?php } ?>
                  </div>
                </div>
                <div id="transit" class="tab-pane">
                  <?php if(Yii::app()->params['photoEditingMode']=="all") { ?>
                    To Do Select photoEditingMode All
                  <?php } ?>
                  <?php if(Yii::app()->params['photoEditingMode']=="none") { ?>
                    To Do Select photoEditingMode None
                  <?php } ?>
                  <?php if(Yii::app()->params['photoEditingMode']=="select") { ?>
                    To Do Select photoEditingMode Select
                  <?php } ?>
                  <?php if(Yii::app()->params['photoEditingMode']=="facecrop")   { ?>
                    <?php $photosBWCOL = array(); ?>
                    <?php if($photoBW2!=null) { ?>
                      <?php $photosBWCOL[] = $photoBW2->getUrl(true); ?>
                    <?php } ?>
                    <?php if($photoCOL!=null) { ?>
                      <?php $photosBWCOL[] = $photoCOL->getUrl(true); ?>
                    <?php } ?>
                    <?php if($photoBW!=null) { ?>
                      <?php $photosBWCOL[] = $photoBW->getUrl(true); ?>
                    <?php } ?>
                    <?php foreach($extraPhotos as $extPhoto)       { ?>
                      <?php $photosBWCOL[] = $extPhoto->getUrl(true); ?>
                    <?php } ?>
                    <?php if(count($photosBWCOL)>0); ?>
                    <div class="span8">
                      <?php $this->dragonImage($photosBWCOL, "99.5%", $DIMENSIONE_IMMAGINI."px", array(), array("style" => "border: 2px solid #000;border-radius: 5px;margin-bottom: 15px;")); ?>
                    </div>
                    <div id="thumb-selected" class="span2">
                      <ul class="thumbnails"></ul>
                    </div>
                    <div class="span10" style="text-align: right;">
                      <a class="btn btn-danger" href="#" onclick="DoubleCheckPlate(false,false)" style="width: 200px;">
                        <span class="icon-remove">
                          Not All Faces Are Selectable
                        </span>
                      </a>
                    </div>
                  <?php } ?>
                  <?php if(Yii::app()->params['photoEditingMode']=="obscure") { ?>
                    To Do Select photoEditingMode Obscure
                  <?php } ?>
                </div>
                <div id="video" class="tab-pane">
                  <?php if(user()->checkAccess('media_view_video')) { ?>
                    <?php $video = $event->video_col; ?>
                    <?php if($video==null) { ?>
                      <?php $video = $event->video_bw; ?>
                    <?php } ?>
                    <?php if($video==null) { ?>
                      <?php $video = array_first($event->videos); ?>
                    <?php } ?>
                    <?php if($video!=null) { ?>
                      <div class="span4">
                        <?php $this->renderVideo($video->url, null, $DIMENSIONE_IMMAGINI); ?>
                      </div>
                    <?php } ?>
                  <?php } ?>
                </div>
                <div id="final_check" class="tab-pane">
                  <?php if (Yii::app()->user->checkAccess('edit_event_behaviors')) { ?>
                    <h5 style="padding-left:10px;padding-top:10px;">
                      <?php echo htmlspecialchars(Yii::t('app', 'Violations'),ENT_QUOTES,'UTF-8'); ?>
                      <?php if(user()->checkAccess('event_behavior_create')) { ?>
                        <a <?php echo MtHaml\Runtime::renderAttributes(array(array('class', 'icon-plus'), array('href', (url('EventBehavior/create', array('id_event'=>$event->ID))))), 'html5', 'UTF-8'); ?>></a>
                      <?php } ?>
                    </h5>
                    <div id="sidebar2_violation" class="alert-error error" style="height: 420px;border-radius:5px;">
                      <ul class="zebra unstyled">
                        <?php foreach ($eventBehaviors as $index => $eventBehavior) { ?>
                          <li class="zebra-item">
                            <?php $this->renderPartial("_eventBehavior", array('eventBehavior' => $eventBehavior, 'event' => $event, 'form' => $form, 'index' => $index, 'suggestedCodes' => $suggestedCodes[$eventBehavior->behavior->tag])); ?>
                          </li>
                        <?php } ?>
                        <?php if($hasSpeedBehaviour) { ?>
                          <div <?php echo MtHaml\Runtime::renderAttributes(array(array('class', 'span4'), array('style', ('width: ' . $mainMediaColumnSize . 'px;'))), 'html5', 'UTF-8'); ?>>
                            <?php $this->renderHtml("<script>var index=0;var imagesArray = {$event->getImagesForGif()};function changeBanner(){ document.getElementById(\"gif_img\").setAttribute(\"src\",imagesArray[index]);index=++index%2;}window.onload = function () {setInterval(changeBanner, 500)};</script><img style=\"border: 1px solid black; height:{$DIMENSIONE_IMMAGINI}px;\" id=\"gif_img\"/>"); ?>
                          </div>
                        <?php } ?>
                      </ul>
                    </div>
                  <?php } ?>
                </div>
              <?php } ?>
            </div>
          </div>
        </div>
      </div>
    <?php } ?>
  </div>
  <?php $this->endWidget(); ?>
  <div class="span11 alert-block alert">
    <div class="span4">
      <?php echo htmlspecialchars(t('Date Time'),ENT_QUOTES,'UTF-8'); ?>
      <span class="text-info">
        <?php echo htmlspecialchars(DateHelper::formatShort($event->StartTime),ENT_QUOTES,'UTF-8'); ?>
      </span>
    </div>
    <div class="span4">
      <?php echo htmlspecialchars(t('Gate'),ENT_QUOTES,'UTF-8'); ?>
      <span class="text-info">
        <?php echo htmlspecialchars($event->GateDescription,ENT_QUOTES,'UTF-8'); ?>
      </span>
    </div>
    <div class="span2">
      <?php echo htmlspecialchars(t('Device ID'),ENT_QUOTES,'UTF-8'); ?>
      <span class="text-info">
        <?php echo htmlspecialchars($event->gate->Gate,ENT_QUOTES,'UTF-8'); ?>
      </span>
    </div>
  </div>
  <footer class="row">
    <div class="span12 gray-box">
      <div class="row">
        <div class="event-navigation span3">
          <?php $previousLink = Yii::app()->createUrl('event/edit', array('id' => $previousEvent->ID, 'service' => $service, 'scope' => $scope, 'toValidateOnly' => $toValidateOnly)); ?>
          <?php $nextLink = Yii::app()->createUrl('event/edit', array('id' => $nextEvent->ID, 'service' => $service, 'scope' => $scope, 'toValidateOnly' => $toValidateOnly)); ?>
          <?php if ($queue->isFirst($event)) { ?>
            <a class="btn btn-large disabled">
              <i class="icon-circle-arrow-left"></i>
            </a>
          <?php } else { ?>
            <a <?php echo MtHaml\Runtime::renderAttributes(array(array('class', ('btn' . ' ' . 'btn-large' . ' ' . 'cacheIgnore')), array('href', $previousLink)), 'html5', 'UTF-8'); ?>>
              <i class="icon-circle-arrow-left"></i>
            </a>
          <?php } ?>
          <?php if($queue->isLast($event)) { ?>
            <a class="btn btn-large disabled">
              <i class="icon-circle-arrow-right"></i>
            </a>
          <?php } else { ?>
            <a <?php echo MtHaml\Runtime::renderAttributes(array(array('class', ('btn' . ' ' . 'btn-large' . ' ' . 'cacheIgnore')), array('href', $nextLink)), 'html5', 'UTF-8'); ?>>
              <i class="icon-circle-arrow-right"></i>
            </a>
          <?php } ?>
        </div>
        <div class="event-buttons span5 pull-right">
          <?php if (!Yii::app()->user->checkAccess('edit_event_behaviors')) { ?>
            <button <?php echo MtHaml\Runtime::renderAttributes(array(array('id', 'suspend-btn'), array('class', 'btn'), array('type', 'button'), array('data-confirm-text', (Yii::t('app', 'Confirm'))), array('data-form-action', (Yii::app()->createUrl('event/suspend', array('id' => $event->ID, 'service' => $service, 'scope' => $scope, 'toValidateOnly' => $toValidateOnly)))), array('data-target', '#event-form')), 'html5', 'UTF-8'); ?>><?php echo htmlspecialchars(Yii::t('app', 'Suspend'),ENT_QUOTES,'UTF-8'); ?></button>
          <?php } ?>
          <button <?php echo MtHaml\Runtime::renderAttributes(array(array('id', 'save-btn'), array('class', ('btn' . ' ' . 'hide')), array('type', 'button'), array('data-confirm-text', (Yii::t('app', 'Confirm'))), array('data-form-action', (Yii::app()->createUrl('event/update', array('id' => $event->ID, 'service' => $service, 'scope' => $scope, 'toValidateOnly' => $toValidateOnly)))), array('data-target', '#event-form')), 'html5', 'UTF-8'); ?>><?php echo htmlspecialchars(Yii::t('app', 'Save & Next'),ENT_QUOTES,'UTF-8'); ?></button>
          <?php if(paramdeep('validation','showSaveAndReleaseButton')) { ?>
            <button <?php echo MtHaml\Runtime::renderAttributes(array(array('id', 'save-release-btn'), array('class', ('btn' . ' ' . 'hide')), array('type', 'button'), array('data-confirm-text', (Yii::t('app', 'Confirm'))), array('data-form-action', (Yii::app()->createUrl('event/updateRelease', array('id' => $event->ID, 'service' => $service, 'scope' => $scope, 'toValidateOnly' => $toValidateOnly)))), array('data-target', '#event-form')), 'html5', 'UTF-8'); ?>><?php echo htmlspecialchars(Yii::t('app', 'Save & Release'),ENT_QUOTES,'UTF-8'); ?></button>
          <?php } ?>
        </div>
      </div>
    </div>
  </footer>
  <div id="overlay">
    <div id="modal-image"></div>
  </div>
  <div id="kemler-modal" class="modal hide fade" tabindex="-1"></div>
  <div id="whitelist-import-modal" class="modal hide fade" tabindex="-1">
    <p>
      hallo!
    </p>
  </div>
</div>
<div id="modal-alert-photo-preview"></div>
<div id="missingPicOrCropDialog" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title">
          Attenzione
        </h5>
      </div>
      <div class="modal-body" id="modalTitle">
        Test
      </div>
      <div class="modal-footer">
        <button class="btn btn-secondary " type="button" data-dismiss="modal">
          OK
        </button>
      </div>
    </div>
  </div>
</div>
<div id="youAreDeletingRoi" title="Delete Crop?" style="display:none;">
  <p>
    This operation cannot be undone. Would you like to proceed?
  </p>
</div>
