<?php 

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

      $this->loginName = $siteDefinition->get('login_name');
      $this->lo_id     = $siteDefinition->get('lo_id');
      $this->pw_id     = $siteDefinition->get('pw_id');

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

      $panelFields = new FieldInit('sitedefinition'); 
      $fields = $panelFields->get("fieldInit");
      foreach ($fields as $field) {
//print_r ($field);
//print_r ("<br>");        
        eval ($field);
      }
    }  
  }
  
  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->frmSetSiteNameLayout
              </td>
              <td colspan='3' style='width:30%'>
    $this->sasSiteNameLayout
              </td>
              <td colspan='3' style='width:30%'>
              </td>
              <td colspan='2' style='width:20%'>
              </td>
            </tr>
            <tr>
              <td colspan='5'>
                <div id='valmsgfrmSetSiteName' style='color:red'></div>
              </td>
            </tr>
            <tr>
              <td colspan='5'>
              </td>
            </tr>
            <tr>
              <td colspan='3' rowspan='2' style='width:30%;'>          
    $this->inpSiteLocationLayout
              </td>
              <td colspan='4' style='width:40%;'>          
    $this->selPlanShapeLayout
              </td>
              <td colspan='3' rowspan='3' style='width:30%;'>          
    $this->addSiteInterpretLayout
              </td>
            </tr>
            <tr>
              <td colspan='2' style='width:20%;'>          
    $this->inpLongAxisLayout
              </td>
              <td colspan='2' style='width:20%;'>          
    $this->inpShortAxisLayout
              </td>
            </tr>
            <tr>
              <td colspan='3' rowspan='2' style='width:30%;'> 
    $this->inpSiteDescrLayout
              </td>
              <td colspan='3' style='width:30%;'>          
    $this->selOrientationLayout
              </td>
              <td colspan='1' style='width:10%;'>
    $this->inpSiteMapidLayout
              </td>
            </tr>
            <tr>
              <td colspan='4' style='width:40%;'>          
    $this->selTopographyLayout
              </td>
              <td colspan='3' rowspan='3' style='width:30%;'>          
    $this->inpSiteRationaleLayout
              </td>
            </tr>
            <tr>
              <td colspan='3' style='width:30%;vertical-align:middle;text-align:center;'>          
    $this->chkRecFurtherLayout
              </td>
              <td colspan='4' style='width:40%;'>          
    $this->selBordenizableLayout
              </td>
            </tr>
            <tr>
              <td colspan='3' style='width:30%;'>          
    $this->addRecRationaleLayout
              </td>
              <td colspan='4' style='width:40%;'>          
    $this->selBordenRationaleLayout
              </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->togShovelTestLayout
    $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='5' style='width:50%;'>
                <label>Intensification</label>
              </td>
              <td colspan='3' style='width:30%;'>
                <label>Extent and Shape</label>
              </td>
            </tr>  
            <tr>
              <td colspan='2' style='width:20%;'>
    $this->selPedestrianLotLayout
              </td>
              <td colspan='1' style='width:10%;'>
    $this->selIntervalMetresLayout
              </td>
              <td colspan='2' style='width:20%;'>
    $this->selExpansion20mLayout
              </td>
              <td colspan='2' style='width:20%;'>
    $this->selObservedDepositLayout
              </td>
              <td colspan='3' style='width:30%;'>
    $this->selPointDeviceLayout
              </td>
            </tr>
            <tr>
              <td colspan='2'  rowspan='3' style='width:20%;'>
    $this->addConcentrationsLayout
              </td>
              <td colspan='3' style='width:30%;'>
    $this->selCollectStrategyLayout
              </td>
              <td colspan='2' style='width:20%;'>
    $this->selStationRecordLayout
              </td>
              <td colspan='3' rowspan='2' style='width:30%;'>
    $this->addPolygonPointsLayout
              </td>
            </tr>
            <tr>
              <td colspan='5' rowspan='2' style='width:50%;'>
    $this->inpIntensifNoteLayout
              </td>
            </tr>
            </tr>
              <td colspan='3' style='width:30%;'>
    $this->frmPedestrianLayout
              </td>
            </tr>
            <tr>
              <td colspan='10'>
                <div id='valmsgfrmPedestrian' style='color:red'></div>
              </td>
            </tr>
          </table>
        </div>
      
       <div class='panel1 slidetogShovelTest'>	
          <table>
            <tr>
              <td colspan='5'>
                 <label>Shovel Testing</label>
              </td>
            </tr>  
            <tr>
              <td style='width:20%;'>
    $this->sasPositiveTestPitLayout
              </td>
              <td style='width:20%;'>
    $this->inpPTPMapidLayout
              </td>
              <td style='width:20%;'>
    $this->selGPSPositioningLayout
              </td>
              <td style='width:20%;'>
    $this->inpPTPPosLayout
              </td>
              <td style='width:20%;'>
    $this->frmShovelTestLayout
              </td>
            </tr>
            <tr>
              <td colspan='5'>
                <div id='valmsgfrmShovelTest' style='color:red'></div>
              </td>
            </tr>
            <tr>
              <td colspan='5'>
    $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 slidetogShovelTest'>	
    $this->sumShovelTestsLayout  
        </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();
document.getElementById('loginsitedefinition').innerHTML='Login: $this->loginName'

if ($this->pw_id == 0) {
  document.getElementById('divsitedefinition').style.display='none';
  document.getElementById('hdrmsgsitedefinition').innerHTML='Pre-select an Project Work Event';    
}


$this->frmSetSiteNameScript
$this->frmSiteDefinitionScript
$this->frmPedestrianScript
$this->frmShovelTestScript
$this->frmPTPLotScript
$this->cxtSiteDefinitionScript
$this->fkyProjectParcelScript
$this->fkyPropertyPartScript
$this->fkyDailyOperationScript
$this->sasSiteNameScript
$this->inpSiteLocationScript
$this->selPlanShapeScript
$this->addSiteInterpretScript
$this->inpLongAxisScript
$this->inpShortAxisScript
$this->inpSiteDescrScript
$this->selOrientationScript
$this->inpSiteMapidScript
$this->selTopographyScript
$this->inpSiteRationaleScript
$this->chkRecFurtherScript
$this->selBordenizableScript
$this->addRecRationaleScript
$this->selBordenRationaleScript
$this->inpSiteNoteScript
$this->frmSiteDefinitionScript
$this->togShovelTestScript
$this->togPedestrianScript
$this->selPedestrianLotScript
$this->fkyProjectParcelPedScript
$this->fkyDailyOperationPedScript
$this->fkySiteDefinitionPedScript
$this->selIntervalMetresScript
$this->selExpansion20mScript
$this->selObservedDepositScript
$this->selPointDeviceScript
$this->addConcentrationsScript
$this->selCollectStrategyScript
$this->selStationRecordScript
$this->addPolygonPointsScript
$this->inpIntensifNoteScript

$this->sasPositiveTestPitScript
$this->fkyProjectParcelShoScript
$this->fkySiteDefinitionShoScript
$this->fkyDailyOperationShoScript
$this->inpPTPMapidScript
$this->selGPSPositioningScript
$this->inpPTPPosScript
$this->togPTPLotScript

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

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

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

?>