<?php 

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

      $lo_id = (isset($_SESSION['login'])) ? $_SESSION['login'] : 0;
      $this->lo_id = $lo_id;

      $menu = new MainMenu('sitedefinition', $lo_id);
      $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 id='divsitedefinition' style='border:1px solid black;border-bottom:none;'>

  <div class='container'>	
    <div class='row'>
      <div class='col-md-12'>
    $this->cxtSiteDefinitionLayout
        <table class='table table-condensed'>
          <tbody>
            <tr>
              <td  colspan='2' style='width:20%'>
    $this->frmSiteNamingLayout
              </td>
              <td colspan='3' style='width:30%'>
    $this->sasSiteNameLayout
              </td>
              <td colspan='3' style='width:30%'>
    $this->sasPropertyPartLayout
              </td>
              <td colspan='2' style='width:20%'>
    $this->frmPropertyPartLayout
              </td>
            </tr>
            <tr>
              <td colspan='5'>
                <div id='valmsgfrmSiteNaming' style='color:red'></div>
              </td>
            </tr>
            <tr>
              <td colspan='5'>
                <div id='valmsgfrmPropertyPart' style='color:red'></div>
              </td>
            </tr>
            <tr>
              <td colspan='7' style='width:70%;'> 
    $this->inpSiteDescrLayout
              </td>
              <td colspan='3' style='width:30%;'>          
    $this->selSiteInterpretLayout
              </td>
            </tr>
            <tr>
              <td colspan='4' style='width:40%;'>          
    $this->inpSiteLocationLayout
              </td>
              <td colspan='3' style='width:30%;'>          
    $this->selPlanShapeLayout
              </td>
              <td colspan='3' rowspan='3' style='width:30%;'>          
    $this->inpSiteRationaleLayout
              </td>
            </tr>
            <tr>
              <td colspan='2' style='width:20%;'>          
    $this->selTopographyLayout
              </td>
              <td colspan='2' style='width:20%;'>
    $this->inpSiteMapidLayout
              </td>
              <td colspan='1' style='width:10%;'>          
    $this->inpLongAxisLayout
              </td>
              <td colspan='1' style='width:10%;'>          
    $this->inpShortAxisLayout
              </td>
              <td colspan='1' style='width:10%;'>          
    $this->selOrientationLayout
              </td>
            </tr>
            <tr>
              <td colspan='1' style='width:10%;'>          
    $this->selStg2RecommendLayout
              </td>
              <td colspan='3' style='width:30%;'>          
    $this->selRecRationaleLayout
              </td>
              <td colspan='1' style='width:10%;'>          
    $this->selBordenizableLayout
              </td>
              <td colspan='3' style='width:30%;'>          
    $this->selBordenRationaleLayout
              </td>
              <td colspan='2' style='width:20%;'>          
              </td>
            </tr>
            <tr>
              <td colspan='8' style='width:80%;'>
    $this->inpSiteNoteLayout
              </td>
              <td colspan='2' style='width:20%;'>
    $this->frmSiteDefinitionLayout
              </td>
            </tr>
            <tr>
              <td colspan='10'>
                <div id='valmsgfrmSiteDefinition' style='color:red'></div>
              </td>
            </tr>
            <tr>          
              <td colspan='10'>
    $this->togShovelPTPLayout
    $this->togPedestrianLayout
              </td>
            </tr>  
          </tbody>
        </table>
        <div class='panel1 slidetogPedestrian'>	
          <table class='table table-condensed'>
            <tr>
              <td colspan='2' style='width:20%;'>
                <label>Pedestrian Survey</label>
              </td>
              <td colspan='3' style='width:30%;'>
              </td>
              <td colspan='3' style='width:30%;'>
              </td>
              <td colspan='2' style='width:20%;'>
                <label>Points (no surveyor support)</label>
              </td>
            </tr>  
            <tr>
              <td colspan='2' style='width:20%;'>
    $this->selOperationLotLayout
              </td>
              <td colspan='3' style='width:30%'>
    $this->selIntensifTypeLayout
              </td>
              <td colspan='3' style='width:30%'>
    $this->inpIntModificationLayout
              </td>
              <td colspan='2' rowspan='2' style='width:20%'>
    $this->addPedestrianPointsLayout
              </td>
            </tr>
            <tr>
              <td colspan='2'  rowspan='2' style='width:20%;'>
    $this->selArtifactDensityLayout
              </td>
              <td colspan='3' rowspan='2' style='width:30%'>
    $this->inpIntensifDescrLayout
              </td>
              <td colspan='3' rowspan='2' style='width:30%'>
    $this->inpIntRationaleLayout
              </td>
            </tr>
            <tr>
              <td colspan='2' style='width:20%'>
    $this->frmPedestrianSurveyLayout
              </td>
            </tr>
            <tr>
              <td colspan='10'>
                <div id='valmsgfrmPedestrianSurvey' style='color:red'></div>
              </td>
            </tr>
          </table>
        </div>
      
       <div class='panel1 slidetogShovelPTP'>	
          <table>
            <tr>
              <td colspan='3'>
                 <label>Shovel Testing</label>
              </td>
            </tr>  
            <tr>
              <td style='width:25%'>
    $this->inpPTPNameLayout
              </td>
              <td style='width:25%'>
    $this->inpPTPLocationLayout
              </td>
              <td style='width:25%' >
              </td>
              <td style='width:25%' >
    $this->frmShovelPTPLayout
              </td>
            </tr>
            <tr>
              <td colspan='4'>
                <div id='valmsgfrmShovelPTP' style='color:red'></div>
              </td>
            </tr>
            <tr>
              <td colspan='4'>
    $this->togPTPLotLayout
              </td>
            </tr>
          </table>
        </div>
      
        <!-- LOT FORM -->
        <div class='panel12 slidetogPTPLot'>
          <table class='table table-condensed'>
            <tr>
              <td colspan='2' style='width:40%'>
    $this->selPTPLotNameLayout
              </td>
              <td style='width:20%'>
    $this->inpLotDepthLayout
              </td>
              <td rowspan='3' style='width:25%'>
    $this->mulRelatedLotsLayout
              </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->frmPTPLotLayout
              </td>
            </tr>
            <tr>
              <td colspan='7'>
              <div id='valmsgfrmPTPLot' style='color:red'></div>
              </td>
            </tr>
            <tr>
              <td>
              </td>
            </tr>
          </table>
        </div>
      
        <!-- LOT SUMMARY -->
        <div class='panel123 slidetogPTPAddLot'>	
      $this->sumPTPLotsLayout  
        </div>
      
      $this->togPositiveTestPitsLayout
        <div class='panel123 togPositiveTestPits'>	
    $this->imgintensificationsLayout  
        </div>
      
    <!-- PTP SUMMARY -->
        <div class='panel1 slidetogShovelPTP'>	
    $this->sumShovelPTPsLayout  
        </div>

      $this->togIntensificationLayout
        <div class='panel123 slide-intensif'>		  
    $this->imgIntensificationLayout
        </div>
    $this->sumSiteDefinitionsLayout
    $this->delSiteDefintionLayout
      </div>
    </div>
  </div>
</div>
<div id='debug' style='border:1px solid black;border-bottom:0px;'>  
  <div class='container'>	
    <div class='row' style='margin-top:10px;margin-bottom:10px;'>
      <div class='col-md-12'>
        <button class='btn btn-inverse' onclick='clearMessages();'>
          Clear
        </button>
        <table id='logmessages' class='table table-condensed'>
          <tr>
            <th>Funtion</th><th>Key</th><th>To</th><th>Value</th><th>Text</th>
            <th>Source</th><th>Index</th><th>Reason</th>
        </table>
      </div>
    </div>
  </div>
</div>

$this->afterMenu

<script>

function logMessage (message) {
  $('#logmessages').append ('<tr>' + message + '</tr>');
}

function clearMessages () {
  document.getElementById('logmessages').innerHTML = '';
}

document.getElementById('tagsitedefinition').click();

if ($this->lo_id == 0) {
  document.getElementById('divsitedefinition').style.display='none';
  document.getElementById('hdrmsgsitedefinition').innerHTML='Login';    
}


$this->frmSiteDefinitionScript
$this->frmSiteNamingScript
$this->frmPropertyPartScript
$this->frmPedestrianSurveyScript
$this->frmShovelPTPScript
$this->frmPTPLotScript

$this->sasSiteNameScript
$this->fkyPropertyPartScript
$this->sasPropertyPartScript
$this->fkyProjectParcelScript
$this->inpSiteDescrScript
$this->selSiteInterpretScript
$this->inpSiteLocationScript
$this->selPlanShapeScript
$this->inpSiteRationaleScript
$this->selTopographyScript
$this->inpSiteMapidScript
$this->inpLongAxisScript
$this->inpShortAxisScript
$this->selOrientationScript
$this->selStg2RecommendScript
$this->selRecRationaleScript
$this->selBordenizableScript
$this->selBordenRationaleScript
$this->inpSiteNoteScript

$this->togShovelPTPScript
$this->togPedestrianScript
$this->selOperationLotScript
$this->selIntensifTypeScript
$this->inpIntModificationScript
$this->addPedestrianPointsScript
$this->selArtifactDensityScript
$this->inpIntensifDescrScript
$this->inpIntRationaleScript

$this->inpPTPNameScript
$this->inpPTPLocationScript
$this->togPTPLotScript

$this->selPTPLotNameScript
$this->inpLotDepthScript
$this->mulRelatedLotsScript
$this->inpElevationPosScript
$this->selElevationMarkScript

$this->sumPTPLotsScript  
$this->togPositiveTestPitsScript
$this->imgintensificationsScript  
$this->sumShovelPTPsScript  
$this->togIntensificationScript
$this->imgIntensificationScript
$this->sumSiteDefinitionsScript
$this->delSiteDefintionScript

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

?>