<?php 

class ConfirmModal  {
  private $scope;
  private $headText;
  private $bodyText;

  public function __construct($entry) {

    if (isset($entry)) {
      $this->scope    = $entry->scope;
      $this->headText = $entry->headText;
      $this->bodyText = $entry->bodyText;
      $this->target   = $entry->target;
    }
  }

  public function outputLayout() {

    $layout = "
<div class='modal fade' id='modal$this->scope' tabindex='-1' role='dialog'>
  <div class='modal-dialog modal-sm' role='document'>
    <div class='modal-content'>
      <div class='modal-header'>
        <button type='button' class='close' data-dismiss='modal'>&times;</button>
        <h4 class='modal-title'>$this->headText</h4>
      </div>
      <div class='modal-body'>
        <label>$this->bodyText
        <button type='button' id='ok$this->scope' class='btn btn-inverse' style='width:70px'>OK</button>
        <button type='button' data-dismiss='modal' class='btn btn-inverse' style='width:70px'>Cancel</button>
        </label>
      </div>
    </div>
  </div>    
</div> 
    ";

 	return $layout;
  }	

  public function outputScript() {

	$script = "
	
function show$this->scope (){
  $('#modal$this->scope').modal('show');
}

function hide$this->scope (){
  $('#modal$this->scope').modal('hide');
}

$(document).on('click', '#ok$this->scope', function (e) {
  putdel$this->target ();
});

$('#modal$this->scope').on('hidden.bs.modal', function () {
  get$this->target ();
})


    "; 
    return $script;
  }
}

?>