<?php 

class modRunProcedureView {
  private $scope;
    
  public function __construct(modRunProcedure $runProcedure) {
    if (isset($runProcedure)) {
      $this->scope = $runProcedure->get("scope");

      $lo_id = (isset($_SESSION['login'])) ? $_SESSION['login'] : 0;
      $this->lo_id = $lo_id;

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

      $controlsInstances = new EntryInit('runprocedure');
      $entryInit = $controlsInstances->get("entryInit");

      foreach ($entryInit as $instance) {
//print_r ($instance);
//print_r ("<br>");        
       eval ($instance);
      }
    }  
  }

  public function output() {

    $layout = "

    $this->beforeMenu

<div class='container'>	
  <div class='row'>
    <div class='col-md-12'>
      <div id='slidetogEditQueryForm' class='slide-panel'>	
        <table class='table table-condensed'>
          <tr>
            <td colspan='2' style='width:40%;'>
    $this->inpProcedureNameLayout
            </td>
            <td colspan='3' style='width:60%;'>
    $this->inpRoutineNameLayout
            </td>
          </tr>
          <tr>
            <td colspan='5' style='width:100%;'>
    $this->inpProcedureDescrLayout
            </td>
          </tr>
          <tr>
            <td colspan='5' style='width:100%;'>
    $this->inpProcCommentsLayout
            </td>
          </tr>
          <tr>
            <td colspan='5' style='width:100%;'>
    $this->inpProcParametersLayout
            </td>
          </tr>
          <tr>
            <td colspan='5' style='width:100%;'>
    $this->inpFilenameDefLayout
            </td>
          </tr>
          <tr>
            <td colspan='2'>
            <div id='valmsgfrmStoredProcedure' style='color:red'></div>
            </td>
          </tr>
          <tr>
            <td colspan='4' style='width:80%;'>
            </td>
            <td colspan='1' style='width:20%;'>
    $this->frmStoredProcedureLayout
            </td>
          </tr>
        </table>  
      </div>    

    $this->togEditProcFormLayout

    $this->sumStoredProceduresLayout
    $this->delStoredProcedureLayout

    $this->repSetupProcessLayout

    </div>
  </div> 
</div> 

    $this->afterMenu

<script>

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


document.getElementById('tagrunprocedure').click();

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

$this->frmStoredProcedureScript
$this->inpProcedureNameScript
$this->inpProcedureDescrScript
$this->inpRoutineNameScript
$this->inpProcCommentsScript
$this->inpProcParametersScript
$this->inpFilenameDefScript
$this->togEditProcFormScript
$this->sumStoredProceduresScript
$this->delStoredProcedureScript
$this->repSetupProcessScript

</script>
  ";
 
  return $layout;
  }	

}

?>