<?php 

class modProjectParcelView {

  public function __construct(modProjectParcel $projectParcel) {
    if (isset($projectParcel)) {

      $this->loginName = $projectParcel->login_name;
      $this->lo_id = $projectParcel->lo_id;

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

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

    $layout = "
    
$this->beforeMenu 

<div id='divprojectparcel' style='border:1px solid black;border-bottom:none;'>
  <div class='container'>
    <div class='row' style='margin-top:10px;'>
      <div class='col-md-12'>
        <table class='table table-condensed'>
          <tr>
            <td colspan='1' style='width:10%'>
    $this->frmSetParcelProjectLayout
            </td>
            <td colspan='4' style='width:40%'>
    $this->sasProjectNameLayout
            </td>
            <td colspan='4' style='width:40%'>
    $this->selImportParcelLayout
            </td>
            <td colspan='1' style='width:10%'>
            </td>
          </tr>
          <tr>
            <td colspan='1' style='width:10%'>
            </td>
            <td colspan='4' style='width:40%'>
    $this->inpProjShortnameLayout
            </td>
            <td colspan='4' style='width:40%'>
            </td>
            <td colspan='1' style='width:10%'>
            </td>
          </tr>
          <tr>
            <td colspan='1' style='width:10%'>
            </td>
            <td colspan='4' style='width:40%'>
    $this->inpProjectRefNoLayout
            </td>
            <td colspan='4' style='width:40%'>
            </td>
            <td colspan='1' style='width:10%'>
            </td>
          </tr>
          <tr>
            <td colspan='5'>
              <div id='valmsgfrmSetParcelProject' style='color:red'></div>
            </td>
            <td colspan='5'>
            </td>
          </tr>
          <tr>
            <td colspan='6' style='width:60%;'>
    $this->inpParcelNameLayout
            </td>
            <td colspan='4' style='width:40%;'>
    $this->fkyParcelProjectLayout
            </td>
          </tr>  
          <tr>
            <td colspan='10'>
    $this->inpParcelLocationLayout
            </td>
          </tr>  
          <tr>
            <td colspan='10'>
    $this->inpNaturalContextLayout
            </td>
          </tr>  
          <tr>
            <td colspan='10'>
    $this->inpLocationDirectionsLayout
            </td>
          </tr>  
          <tr>
            <td colspan='10'>
              <div id='valmsgfrmProjectParcel' style='color:red'></div>
            </td>
          </tr>    
          <tr>
            <td colspan='10'>
    $this->frmProjectParcelLayout
            </td>
          </tr>     
          <tr>
            <td colspan='10'>
    $this->sumProjectParcelsLayout
            </td>
          </tr>
          <tr>
            <td colspan='10'>
    $this->delProjectParcelLayout
            </td>
          </tr>
        </table>
      </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('tagprojectparcel').click();
document.getElementById('loginprojectparcel').innerHTML='Login: $this->loginName'

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

$this->frmProjectParcelScript
$this->frmSetParcelProjectScript
$this->sasProjectNameScript
$this->selImportParcelScript
$this->inpProjShortnameScript
$this->inpProjectRefNoScript
$this->inpParcelNameScript
$this->fkyParcelProjectScript
$this->inpParcelLocationScript
$this->inpNaturalContextScript
$this->inpLocationDirectionsScript
$this->sumProjectParcelsScript
$this->delProjectParcelScript


</script>
  ";

  return $layout;
  }	

}

?>