<?php 

class ToggleSlider {
  private $scope;
  private $position;
  private $label;
  private $idProp;
  private $disabled;

  public function __construct ($entry) {
    if (isset($entry)) {
      $this->scope    = $entry->scope;
      $this->disabled = $entry->disabled;
      $this->iterator = $entry->iterator;
      $this->label    = $entry->label;

      $this->onOpenClose = "";
      if (null !== $entry->onOpenClose) {
        $close = explode(",", $entry->onOpenClose);
        for ($i=0; $i<count($close); $i++) {
          $this->onOpenClose .= "$('.slide$close[$i]').slideUp('slow'); ";
        }
      }    

      if (isset($entry->position) && $entry->position == "left")
        $this->position = "left";
      else
        $this->position = "right";
    }
  }
  
  public function outputLayout() {
  
    $html = "
<button id='$this->scope' class='btn btn-inverse tog$this->iterator'
  $this->disabled style='float:$this->position;'>$this->label</button>
    ";
  	return $html;
  }
  
  public function outputScript() {
		
    $script = " 

$('#$this->scope').click(function(){
  $('.slide$this->scope').toggle('slow');
  $this->onOpenClose  
});


    
    ";
    return $script;
  }
}

?>
