<?php 

class modProjectWorkdayView {
  private $pw_id;
  private $searchProjectLayout;
  private $searchProjectScript;
  private $selectParcelLayout;
  private $selectParcelScript;
  private $selectDateLayout;
  private $selectDateScript;
  private $status;

  
  public function __construct(modProjectWorkday $projectWorkday) {
    if (isset($projectWorkday)) {

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

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

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

    $panel = "

$this->beforeMenu 
<div id='divprojectworkday' 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'>
        <table class='table table-condensed' style='border-top:none;'>
          <tr>
            <td colspan='4' width='40%'>
    $this->livFieldProjectLayout
            </td>
            <td colspan='3' width='30%'>
    $this->selProjParcelLayout
            </td>
            <td colspan='3' width='30%'>
            </td>
          </tr>
          <tr>
            <td colspan='2' width='20%'>
    $this->selWorkDateLayout
            </td>
            <td colspan='1' width='10%'>
    $this->timStartTimeLayout
            </td>
            <td colspan='1' width='10%'>
    $this->timStopTimeLayout
            </td>
            <td colspan='1' width='10%'>
    $this->timBreakDurLayout
            </td>
            <td colspan='4' width='430%'>
    $this->inpTeamNoteLayout
            </td>
            <td colspan='1' width='10%'>
    $this->frmFieldProjectLayout
            </td>
          </tr>
          <tr>
          <tr>
            <td colspan='6'>
            <div id='valmsgfrmFieldProject' style='color:red'></div>
            </td>
          </tr>
        </table>
      </div>
    </div>
    
    <div class='row' style='margin-bottom:10px'>
      <div class='col-md-12'>
    $this->sumFieldProjectsLayout
      </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->cnfProjectUpdateLayout 

$this->afterMenu  

<script>

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

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

document.getElementById('tagprojectworkday').click();
document.getElementById('loginprojectworkday').innerHTML='Login: $this->loginName'

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

$this->frmFieldProjectScript

$this->sumFieldProjectsScript

$this->livFieldProjectScript 

$this->selProjParcelScript 

$this->timStartTimeScript

$this->timStopTimeScript

$this->timBreakDurScript

$this->selWorkDateScript 

$this->inpTeamNoteScript

$this->cnfProjectUpdateScript  

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

?>