<?php 

class modExcavationUnitView {
  
  public function __construct(modExcavationUnit $excavationUnit) {
    if (isset($excavationUnit)) {

      $menu = new MainMenu('excavationunit');
      $this->beforeMenu = $menu->before();
      $this->afterMenu  = $menu->after();

      $controlsControls = new EntryInit('excavationunit');
      $entryInit = $controlsControls->get("entryInit");
      foreach ($entryInit as $control) {
//print_r ($control);
//print_r ("<br>");        
        eval ($control);
      }
    }  
  }
  
  public function output() {

  $layout = "

  $this->beforeMenu 

<div class='container'>	
  <div class='row'>
    <div class='col-md-12'>
      <table class='table table-bordered'>
        <tbody>
    $this->cu_idKeyLayout
          <tr>
            <td  colspan='3'>
    $this->selUnitSiteNameLayout
            </td>
            <td rowspan='3'>
    $this->selUnitParentLayout
           </td>
            <td rowspan='3'>
    $this->colUnitPointPosLayout
            </td>
            <td  rowspan='3'> 
    $this->putExcacationUnitLayout
            </td>
          </tr>
          <tr>          
            <td colspan='3'>
    $this->selUnitTypeLayout
            </td>
            <td rowspan='3'>
    $this->inpUnitNameLayout
           </td>
          </tr>
          <tr>
            <td style='width:13%;'>          
    $this->inpUnitMapIdLayout
            </td>
            <td style='width:33%;'>          
    $this->inpUnitDimension1Layout
            </td>
            <td  style='width:34%;'>          
    $this->inpUnitDimension2Layout
            </td>
            <td style='width:34%;'>          
    $this->selUnitLongAxisLayout
            </td>
          </tr>
        </tbody>
      </table>

      <div>		  
    $this->togExcavationImagesLayout
      </div>
      
      <div id='slide-exunitimg' class='slide-panel'>		  
    $this->colExcavationImagesLayout
      </div>

      <div>		  
    $this->togExcavatorsLayout
      </div>
      
      <div id='slide-excavators' class='slide-panel'>
        <table class='table table-bordered'>
          <tbody>
            <tr>
              <td>
    $this->selExcavatorNameLayout
              </td>
              <td>
    $this->selExStartTimeLayout
              </td>
              <td>
    $this->selExEndTimeLayout
              </td>
              <td>
              </td>
              <td>
    $this->putLinkToUnitLayout
              </td>
           </tr>
        </tbody>
      </table>

    
      <div>       
            
    $this->sumUnitExcavatorsLayout
    $this->delLinkToUnitLayout
      </div>

      <div>		  
    $this->togUnitLotsLayout
      </div>

  <div id='slide-unitlots' class='slide-panel'>
        <table class='table table-bordered'>
          <tbody>
            <tr>
              <td>
    $this->selUnitLotNameLayout
              </td>
              <td>
    $this->inpUnitLotTopPlanLayout
              </td>
              <td>
    $this->selUnitExcavateMethodLayout
              </td>
              <td>
    $this->selUnitScreenSizeLayout
              </td>
              <td>
    $this->inpMethodNoteLayout
              </td>
              <td>
    $this->selFeatureNumLayout
              </td>
           </tr>
           <tr>
             <td>
    $this->setUnitDepthsLayout
             </td>
             <td>
    $this->setUnitRelatedLotsLayout
             </td>
             <td>
    $this->UnitElevationsLayout
             </td>
             <td>
    $this->putAddLotLayout
             </td>
           </tr>
        </tbody>
      </table>
            
    $this->togUnitLotImagesLayout

     <div id='slide-lotphoto' class='slide-panel slide-lotphoto'>	
    $this->colUnitLotImagesLayout
     </div>

    $this->togUnitArtifactBagLayout

     <!-- BAG FORM -->
     <div id='slide-ptpbag1' class='slide-panel slide-ptpbag'>	
        <table>
          <tr>
            <td style='width:25%'>
    $this->inpUnitBagRefLayout
            </td>
            <td style='width:25%'>
    $this->inpUnitBagTitleLayout
            </td>
            <td colspan='2' style='width:50%' >
    $this->putUnitLayout
            </td>
          </tr>
          <tr>
            <td colspan='4'>
    $this->togUnitArtifactsLayout
            </td>
          </tr>
        </table>
      </div>

      <!-- ARTIFACT FORM -->
      <div id='slide-artifact1' class='slide-panel panel-artifact'>
        <table class='table table-condensed'>
          <tr>
            <td colspan='2' style='width:40%'>
    $this->selArtAffiliationLayout
            </td>
            <td style='width:20%'>
    $this->selArtMaterialLayout
            </td>
            <td style='width:20%'>
    $this->selArtFormLayout
            </td>
            <td style='width:15%'>
    $this->selArtCompleteLayout
            </td>
            <td style='width:5%'>
    $this->chkArtDiagnosticLayout
            </td>
            <td style='width:5%'>
            </td>
          </tr>
          <tr>          
            <td style='width:10%'>
    $this->inpCollectedCountLayout
            </td>
            <td style='width:10%'>
    $this->inpDocumentedCountLayout        
            </td>
            <td style='width:20%'>
    $this->selSampleRationaleLayout
            </td>
            <td colspan='3' style='width:55%'>
    $this->inpUnitMethodNoteLayout
            </td>
            <td style='width:5%'>
    $this->putUnitArtifactsLayout
            </td>
          </tr>
        </table>
      </div>

      <!-- ARTIFACT SUMMARY -->
      <div id='slide-unitartifacts' class='slide-panel slide-unitartifacts'>	
    $this->sumUnitArtifactsLayout  
      </div>

      <!-- BAG SUMMARY -->
      <div id='slide-unitbags' class='slide-panel slide-unitbags'>	
    $this->sumUnitBagsLayout  
      </div>
      <!-- LOT SUMMARY -->
      <div id='slide-unitlots' class='slide-panel slide-unitlots'>	
    $this->sumUnitLotsLayout  
      </div>
      
      $this->togUnitProfileImagesLayout
      <div id='slide-unitprofile' class='slide-panel slide-unitprofile'>
    $this->setUnitDrawingFaceLayout      
    $this->colUnitProfileImagesLayout  
      </div>

    $this->sumExcavationUnitsLayout
    $this->delExcavationUnitLayout
    </div>
  </div>
</div>
    
  $this->afterMenu 

<script>

$(document).ready(function(){
  $('#tog4spatialunit').click(function(){
    $('.slide-panel').each (function () {
      if ($(this).prop('id') != 'slide-pospoints' && $(this).prop('id') != 'slide-pedest')
        $(this).slideUp('slow');
    });  
    $('#slide-pospoints').toggle('slow');
  });
});

$(document).ready(function(){
  $('#tog3spatialunit').click(function(){
    $('.slide-panel').each (function () {
      if ($(this).prop('id') != 'slide-intensif')
        $(this).slideUp('slow');
    });  
    $('#slide-intensif').toggle('slow');
  });
});

$(document).ready(function(){
  $('#togspatialunit').click(function(){
    $('.slide-panel').each (function () {
      if ($(this).prop('id') != 'slide-pedest')
        $(this).slideUp('slow');
    });  
    $('#slide-pedest').toggle('slow');
  });
});

$(document).ready(function(){
  $('#tog2spatialunit').click(function(){
    $('.slide-panel').each (function () {
      if ($(this).prop('id') != 'slide-shovel1' && $(this).prop('id') != 'slide-shovel2')
        $(this).slideUp('slow');
    });  
    $('.slide-shovel').toggle('slow');
    $('.slide-ptpsum').toggle('slow');
    
  });
});

$(document).on('mouseenter', '#valSpatialunitFop', function () {
  
  if ($('#fop_name').val() == '' || $('#foptype_id').val() == 0 ||
      $('#mapareaid').val() == '' ||
     ($('#chlvalconf_office').val() == 0 && $('#textField_descr').val() == '')) {
    $('#putspatialunitfop').prop('disabled', true); 
//    alert ('not');

    }
    
  else {
    $('#putspatialunitfop').prop('disabled', false);  
//    alert ('valid');
  }  
       
});  

$(document).on('click', '#checkconf_office', function () {
  if ( $('#chkvalconf_office').val() == 1 ) {
    $('#textfield_descr').val('');
    $('#textfield_descr').prop('readonly', true);
  }  
  if ( $('#chkvalconf_office').val() == 0 ) {
    $('#textfield_descr').prop('disabled', false);
    $('#textfield_descr').focus();
  }  
});  

$this->selUnitSiteNameScript
$this->selUnitParentScript
$this->colUnitPointPosScript
$this->selUnitTypeScript
$this->selUnitLongAxisScript
$this->colExcavationImagesScript
$this->selExcavatorNameScript
$this->selExStartTimeScript
$this->selExEndTimeScript
$this->sumUnitExcavatorsScript
$this->selUnitLotNameScript
$this->selUnitExcavateMethodScript
$this->selUnitScreenSizeScript
$this->selFeatureNumScript
$this->setUnitDepthsScript
$this->setUnitRelatedLotsScript
$this->setUnitElevationsScript
$this->colUnitLotImagesScript
$this->selArtAffiliationScript
$this->selArtMaterialScript
$this->selArtFormScript
$this->selArtCompleteScript
$this->chkArtDiagnosticScript
$this->selSampleRationaleScript
$this->sumUnitArtifactsScript  
$this->sumUnitBagsScript  
$this->sumUnitLotsScript  
$this->setUnitDrawingFaceScript      
$this->colUnitProfileImagesScript  
$this->sumExcavationUnitsScript


</script>
    ";
	
    return $layout;
 
  }
}

?>