<?php 

class modSiteDefinitionView {
  
  public function __construct(modSiteDefinition $siteDefinition) {
    if (isset($siteDefinition)) {

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

      $controlsControls = new EntryInit('sitedefinition');
      $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='4'>
    $this->selPropPartLayout
            </td>
            <td colspan='5'>
          </tr>
          <tr>          
            </td>
            <td colspan='4'>
    $this->selSiteNameLayout
            </td>
            <td colspan='5'>
            </td>
          </tr>
          <tr>          
            <td colspan='6' style='width:33%;'> 
    $this->inpSiteDescrLayout
            </td>
            <td colspan='3' style='width:34%;'>          
    $this->selSiteInterpLayout
            </td>
          </tr>
          <tr>
            <td colspan='3' style='width:33%;'>          
    $this->inpSiteLocationLayout
            </td>
            <td colspan='3' style='width:33%;'>          
    $this->selPlanShapeLayout
            </td>
            <td colspan='3' rowspan='3' style='width:34%;'>          
    $this->inpRationaleNoteLayout
            </td>
          </tr>
          <tr>
            <td colspan='2' style='width:22%;'>          
    $this->selTopographyLayout
            </td>
            <td style='width:11%;'>          
    $this->inpDefMapidLayout
            </td>
            <td style='width:11%;'>          
    $this->inpLongAxisLayout
            </td>
            <td style='width:11%;'>          
    $this->inpShortAxisLayout
            </td>
            <td style='width:11%;'>          
    $this->selOrientationLayout
            </td>
          </tr>
          <tr>
            <td colspan='1' style='width:12%;'>          
    $this->selStg2RecommLayout
            </td>
            <td colspan='3' style='width:36%;'>          
    $this->selRecRationaleLayout
            </td>
            <td colspan='1' style='width:12%;'>          
    $this->selBordenizableLayout
            </td>
            <td colspan='3' style='width:36%;'>          
    $this->selBordRationaleLayout
            </td>
            <td colspan='1' style='width:12%;'>          
            </td>
          </tr>
          <tr>
            <td colspan='8' style='width:12%;'>
    $this->inpCultunitNoteLayout
            </td>
            <td colspan='1' style='width:11%;'>
    $this->putCulturalunitLayout
            </td>
          </tr>
          <tr>          
            <td colspan='9'>
    $this->togShovelTestLayout
    $this->togPedestrianLayout
            </td>
          </tr>  
        </tbody>
      </table>
      <div id='slide-pedest' class='slide-panel slide-pedest'>	
        <table class='table table-condensed'>
          <tr>
            <td style='width:25%'>
             <label>Pedestrian Survey</label>
            </td>
            <td style='width:25%'>
            </td>
            <td style='width:25%'>
            </td>
            <td style='width:25%'>
            </td>
          </tr>  
          <tr>
            <td style='width:25%'>
    $this->selOperationLotLayout
            </td>
            <td rowspan='2' style='width:25%'>
    $this->inpIntensifDescrLayout
            </td>
            <td rowspan='2' style='width:25%'>
    $this->inpIntRationaleLayout
            </td>
          </tr>
          <tr>
            <td style='width:25%'>
    $this->selIntensifTypeLayout
            </td>
            <td colspan='3'>
    $this->putOperationLotLayout
            </td>
          </tr>
          <tr>
            <td colspan='4' style='width:25%'>
    $this->togPositionPointsLayout
            </td>
          </tr>
        </table>
      </div>
      
      <!-- POSITION POINTS -->
      <div id='slide-pospoints' class='slide-panel slide-pospoints'>	
    $this->colPositionPointsLayout
     </div>
            
     <div id='slide-shovel1' class='slide-panel slide-shovel'>	
        <table>
          <tr>
            <td colspan='3'>
             <label>Shovel Testing</label>
            </td>
          </tr>  
          <tr>
    $this->su_idKeyLayout
          
            <td style='width:25%'>
    $this->inpPTPNameLayout
            </td>
            <td style='width:25%'>
    $this->inpPTPLocationLayout
            </td>
            <td colspan='2' style='width:50%' >
    $this->putSpatialunitLayout
            </td>
          </tr>
          <tr>
            <td colspan='4'>
    $this->togTestpitLotsLayout
            </td>
          </tr>
        </table>
      </div>
      
      <!-- LOT FORM -->
      <div id='slide-lot' class='slide-panel slide-lot'>
        <table class='table table-condensed'>
          <tr>
    $this->lo_idKeyLayout
            <td colspan='2' style='width:40%'>
    $this->selPTPLotNameLayout
            </td>
            <td style='width:20%'>
    $this->inpPTPLotDepthLayout
            </td>
            <td rowspan='3' style='width:25%'>
    $this->colRelatedLotLayout
            </td>
            <td style='width:20%'>
            </td>
          </tr>
          <tr>
            <td style='width:20%'>
    $this->inpElevationPosLayout
            </td>
            <td colspan='2' style='width:40%'>
    $this->selElevationMarkLayout
            </td>
            <td style='width:20%'>
    $this->putPTPLotDetlLayout
            </td>
          </tr>
        </table>
      </div>


          <tr>
            <td>
    $this->togArtifactBagLayout
            </td>
          </tr>
      
     <!-- BAG FORM -->
     <div id='slide-ptpbag1' class='slide-panel slide-ptpbag'>	
        <table>
          <tr>
            <td style='width:25%'>
    $this->inpPTPBagRefLayout
            </td>
            <td style='width:25%'>
    $this->inpPTPBagTitleLayout
            </td>
            <td colspan='2' style='width:50%' >
    $this->putPTPBagLayout
            </td>
          </tr>
          <tr>
            <td colspan='4'>
    $this->togPTPAddArtifactsLayout
            </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->inpAddObservationsLayout
            </td>
            <td style='width:5%'>
    $this->putPTPArtifactsLayout
            </td>
          </tr>
        </table>
      </div>

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

      <!-- BAG SUMMARY -->
      <div id='slide-bagsum' class='slide-panel slide-bagsum'>	
    $this->sumPTPBagsLayout  
      </div>
      <!-- LOT SUMMARY -->
      <div id='slide-lotsum' class='slide-panel slide-lotsum'>	
    $this->sumPTPLotsLayout  
      </div>
      
      $this->togPTPImagesLayout
      <div id='slide-ptpimg' class='slide-panel slide-ptpimp'>	
    $this->colPTPImagesLayout  
      </div>
      
    <!-- PTP SUMMARY -->
      <div id='slide-ptpsum' class='slide-panel slide-ptpsum'>	
    $this->sumShovelPTPsLayout  
      </div>

      $this->togIntenImagesLayout
      <div id='slide-intensif' class='slide-panel'>		  
    $this->colIntensImagesLayout
      </div>
    $this->sumDefinitionsLayout
    $this->delCulturalunitLayout
    </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-lotsum').toggle('slow');
    $('#slide-lot').toggle('slow');
  });
});

$(document).ready(function(){
  $('#tog4culturalunit').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(){
  $('#tog3culturalunit').click(function(){
    $('.slide-panel').each (function () {
      if ($(this).prop('id') != 'slide-intensif')
        $(this).slideUp('slow');
    });  
    $('#slide-intensif').toggle('slow');
  });
});

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

$(document).ready(function(){
  $('#tog2culturalunit').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->selPropPartScript

$this->selSiteNameScript

$this->chkArtDiagnosticsScript
 
$this->colPositionPointsScript

$this->colPTPImagesScript

$this->colIntensImagesScript

$this->putPedestrianReqScript

$this->selPTPLotNameScript

// PTP LOTS
$this->sumPTPLotsScript  

$this->colRelatedLotScript

$this->sumPTPBagsScript  

$this->sumPTPArtifactsScript  

$this->sumShovelPTPsScript  

$this->sumDefinitionsScript


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

?>