<?php 

class modReportGeneratorView {
  private $scope;
    
  public function __construct(modReportGenerator $reportGenerator) {
    if (isset($reportGenerator)) {
      $this->scope = $reportGenerator->get("scope");
	}

    $controlsInstances = new EntryInit('reportgenerator');
    $entryInit = $controlsInstances->get("entryInit");
    foreach ($entryInit as $instance) {
//print_r ($instance);
//print_r ("<br>");        
      eval ($instance);
    }
  }

  public function output() {

    $layout = "
<div class='container'>	
  <div class='row'>
    <div class='col-md-12'>
      <div id='slide-queryform' class='slide-panel slide-queryform'>
        <table class='table table-condensed'>
          <tr>
      $this->rg_idKeyLayout
            <td style='width:34%;'>
      $this->inpReportNameLayout
            </td>
            <td colspan='2' style='width:66%;'>
      $this->inpRepDescriptionLayout
            </td>
          </tr>
          <tr>
            <td colspan='3'>
      $this->inpQuerySelectLayout
            </td>
          </tr>
          <tr>
            <td colspan='3'>
      $this->inpQueryFromLayout
            </td>
          </tr>
          <tr>
            <td colspan='3'>
      $this->inpQueryWhereLayout
            </td>
          </tr>
          <tr>
          <tr>
            <td style='width:34%;'>
      $this->selQueryCombineLayout
            </td>
            <td colspan='2' style='width:66%;'>
      $this->inpQueryOrganizeLayout
            </td>
          </tr>
          <tr>
            <td colspan='3'>
      $this->putReportGeneratorLayout
            </td>
          </tr>
        </table>  
      </div>    

    $this->sumReportGeneratorLayout
      <table class='table table-condensed'>
        <tr>
          <td>
    $this->delReportGeneratorLayout
          </td>
          <td>
          </td>
          <td>
    $this->togQueryEditFormLayout
          </td>
        </tr>
        <tr>
          <td>
    $this->runQueryCriteriaLayout
          </td>
          <td>
    $this->expQueryCriteriaLayout
          </td>
          <td>
    $this->togQuerySetupFormLayout
          </td>
        </tr>
    </table>
    <div id='slide-setupform' class='slide-panel slide-setupform'>
        <table class='table table-condensed'>
          <tr>
            <td>
    $this->chkIncludeHeaderLayout
            </td>
            <td>
    $this->inpReportFileNameLayout
            </td>
            <td>
            </td>
          </tr>
          <tr>
            <td colspan='3'>
      $this->putProceeReportSetupLayout
            </td>
          </tr>
        </table>  
      </div>    
    
    <table class='table table-condensed'>
        <tr>  
          <td colspan='3'>
      $this->setQueryCriteriaLayout
          </td>
        </tr>
      </table>
    </div> 

  </div>

  <div id='dlModal' class='modal fade' role='dialog'>
    <div class='modal-dialog modal-sm'>

      <!-- Modal content-->
      <div class='modal-content'>
        <div class='modal-header'>
          <button type='button' class='close' data-dismiss='modal'>&times;</button>
          <h4 class='modal-title'>File Download</h4>
        </div>
        <div class='modal-body'>
          <form onsubmit=\"download(this['name'].value, this['text'].value)\">
            <input type='text' name='name' value='test.txt'>
            <textarea name='text'></textarea>
            <input type='submit' value='Download'>
          </form>
        </div>
        <div class='modal-footer'>
          <button type='button' class='btn btn-default' data-dismiss='modal'>Close</button>
        </div>
      </div>
    </div>
  </div> 
</div> 

<script>

$(document).ready(function(){
  $('#togreportquery').click(function(){
    $('.slide-panel').each (function () {
      if ($(this).prop('id') != 'slide-queryform')
        $(this).slideUp('slow');
    });  
    $('#slide-queryform').toggle('slow');
  });
});

$(document).ready(function(){
  $('#tog2reportquery').click(function(){
    $('.slide-panel').each (function () {
      if ($(this).prop('id') != 'slide-setupform')
        $(this).slideUp('slow');
    });  
    $('#slide-setupform').toggle('slow');
  });
});

$this->chkIncludeHeaderScript
$this->selQueryCombineScript
$this->setQueryCriteriaScript
$this->sumReportGeneratorScript

</script>
  ";
 
  return $layout;
  }	

}

?>