<?php 

class modContextSelectorView {
  private $scope;
    
  public function __construct(modContextSelector $contextSelector) {
    if (isset($contextSelector)) {

      $this->loginName = $contextSelector->get('login_name');
      $this->lo_id = $contextSelector->get('lo_id');

      $menu = new MainMenu('contextselector', $this->lo_id);
      $this->beforeMenu = $menu->before();
      $this->afterMenu  = $menu->after();
      
      $panelFields = new FieldInit('contextselector'); 
      $fields = $panelFields->get("fieldInit");
//print_r ("fields:");    
//print_r ($fields);
      
      foreach ($fields as $field) {
//print_r ($field);
//print_r ("<br>");        
        eval ($field);
      }
    }
  }  

  public function output() {

    $layout = "

<div class='container'>	
    $this->beforeMenu
<div id='outer-container'>
  <div id='scrollable' style='height:30em;'>
    <div  id='divcontextselector' class='row'>
      <div class='col-md-12'>
        <table class='table table-condensed'>
          <tr>
            <td style='width:10%'>
            </td>
            <td style='width:80%'>
    $this->cxtContextSelectorLayout
            </td>
            <td style='width:10%'>
            </td>
          </tr>
          <tr>
            <td colspan='3'>
            <div id='valmsgfrmContextSelector' style='color:red'></div>
            </td>
          </tr>
          <tr>
            <td colspan='3'>
    $this->tabInstrumentsLayout
            </td>
          </tr>
        </table>
      </div> 
    </div>

  </div>
</div>	
$this->afterMenu
</div>


<script>

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

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

$this->cxtContextSelectorScript
$this->tabInstrumentsScript

</script>
  ";
 
  return $layout;
  }	

}

?>