<?php 

class modWorkdayOperationView {
  
  public function __construct(modWorkdayOperation $workdayOperation) {
    if (isset($workdayOperation)) {

      $lo_id = (isset($_SESSION['login'])) ? $_SESSION['login'] : 0;
      $this->pw_id = (isset($_SESSION['projectworkday'])) ? $_SESSION['projectworkday'] : 0;
        
      $menu = new MainMenu('workdayoperation', $lo_id);
      $this->beforeMenu = $menu->before();
      $this->afterMenu  = $menu->after();


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

    $layout = "

    $this->beforeMenu

<div id='divworkdayoperation' style='border:1px solid black;border-bottom:0px'>

  <div class='container'>	
    <div class='row'>
      <div class='col-md-12'>
        <table class='table table-condensed'>
          <tbody>
            <tr>
              <td colspan='4' style='width:40%'>
    $this->livOperationNameLayout
              </td>
              <td colspan='3' style='width:30%'>
    $this->selOperationTypeLayout
              </td>
              <td colspan='1' style='width:10%'>
              </td>
              <td colspan='2' style='width:20%;vertical-align:bottom;'>
    $this->togHighGranularityLayout
              </td>
            </tr>
            <tr>
              <td colspan='10'>
                <div id='valmsgfrmOperationDefinition' style='color:red'></div>
              </td>
            </tr>
          </tbody>
        </table>      
      </div>
    </div>

    <div class='panel12 slidetogHighGranularity'>	
      <div class='row'>
        <div class='col-md-12'>
          <table class='table table-condensed'>
            <tbody>
              <tr>
                <td colspan='3' style='width:30%'>
    $this->selOpStartTimeLayout
                </td>
                <td colspan='4' style='width:40%'>
    $this->selBreakDurationLayout
                </td>
                <td colspan='2' style='width:20%'>
    $this->selOpStopTimeLayout
                </td>
                <td colspan='1' style='width:10%'>
    $this->selOpDurationLayout
                </td>
              </tr>
              <tr>
                <td colspan='4' style='width:40%;'>
    $this->mulOperationCrewLayout
                </td>
                <td colspan='1' style='width:10%;'>
                </td>
                <td colspan='5' style='width:50%'>
    $this->mulOpObserversLayout
                </td>
              </tr>
            </tbody>
          </table>      
        </div>
      </div>
    </div>    

    <div class='row'>
      <div class='col-md-12'>
        <table class='table table-condensed'>
          <tbody>
            <tr>
              <td colspan='2' style='width:100%;'>
    $this->inpOperationNoteLayout
              </td>
            </tr>
            <tr>
              <td colspan='1' style='width:80%;'>
              </td>
              <td colspan='1' style='width:20%;'>
    $this->frmOperationDefinitionLayout
              </td>
            </tr>
          </tbody>
        </table>      
      </div>
    </div>
    <div class='row'>
      <div class='col-md-12'>
    $this->sumOperationDefinitionsLayout
      </div>
    </div>
    <div class='row'>
      <div class='col-md-12'>
    $this->delOperationDefintionLayout
      </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('tagworkdayoperation').click();

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

$this->frmOperationDefinitionScript
$this->livOperationNameScript
$this->selOperationTypeScript
$this->togHighGranularityScript
$this->selOpStartTimeScript
$this->selBreakDurationScript
$this->selOpStopTimeScript
$this->selOpDurationScript
$this->mulOperationCrewScript
$this->mulOpObserversScript
$this->inpOperationNoteScript
$this->sumOperationDefinitionsScript
$this->delOperationDefintionScript

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

?>