<?php 

class modDailyJournalView {
    
  public function __construct(modDailyJournal $dailyJournal) {
    if (isset($dailyJournal)) {

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

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

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

    $layout = "
    
$this->beforeMenu 
<div id='divdailyjournal' 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 style='max-width:50px'>
    $this->selLogTimeLayout
            </td>
            <td style='width:13%'>
    $this->selCloudCoverLayout
            </td>
            <td style='width:13%'>
    $this->selAtmosphereLayout
            </td>
            <td style='width:13%'>
    $this->inpTemperatureLayout
            </td>
            <td style='width:13%'>
    $this->inpHumidityLayout
            </td>
            <td style='width:13%'>
    $this->selLightLevelLayout
            </td>
            <td style='width:13%'>
    $this->selPrecipitationLayout
            </td>
            <td style='width:10%'>
    $this->frmWeatherLogLayout
            </td>
          </tr>     
          <tr>
            <td colspan='6'>
            <div id='valmsgfrmWeatherLog' style='color:red'></div>
            </td>
          </tr>
        </table>
      </div>		
    </div>

    <div class='row' style='margin-top:10px;'>
      <div class='col-md-12'>
    $this->sumWeatherLogsLayout
      </div>
    </div>

    <div class='row'>
      <div class='col-md-12'>
    $this->delWeatherLogLayout  
      </div>
    </div>

    <div class='row' style='margin-top:10px;margin-bottom:10px;'>
      <div class='col-md-12'>
        <table>
          <tr>
            <td>
    $this->inpJournalNoteLayout        
            </td>
            <td style='width:10%;vertical-align:top;'>
    $this->frmDailyJournalLayout        
            </td>
          <tr> 
          <tr>
            <td colspan='6'>
            <div id='valmsgfrmDailyJournal' style='color:red'></div>
            </td>
          </tr>
        </table> 
      </div>    
    </div>
  </div>
</div>

$this->afterMenu 

<script>  

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

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

$this->frmWeatherLogScript  
$this->frmDailyJournalScript        
$this->selLogTimeScript
$this->selCloudCoverScript
$this->selAtmosphereScript
$this->inpTemperatureScript
$this->inpHumidityScript
$this->selLightLevelScript
$this->selPrecipitationScript
$this->sumWeatherLogsScript
$this->inpJournalNoteScript        
</script>
  ";

  return $layout;
  }	

}

?>