<?php 

class NoteTextArea  {
  private $scope;
  private $label;
  private $iterator;
  private $areaRows;

  public function __construct($entry) {

    if (isset($entry)) {
      $this->scope    = $entry->scope;
      $this->iterator = $entry->iterator;
      $this->areaRows = $entry->areaRows;

      if (isset($entry->label))
        $this->label = "<label>$entry->label</label><br>";
      else
        $this->label = "";
              
      if (isset($entry->placeholder))
        $this->placeholder = "placeholder='$entry->placeholder'";
      else
        $this->spaceholder = "";
    }
  }

  public function outputLayout() {


    $layout = "

$this->label    
<textarea rows='$this->areaRows' id='$this->scope' class='$this->iterator'
  name='$this->scope' $this->placeholder></textarea>

     ";
  
 	return $layout;
  }	

  public function outputScript() {

	$script = "

$(document).ready(function() {

  if ('$this->dbValue' != '') {
    set$this->scope ('$this->dbValue', '', 'formentry');
    send$this->scope ('$this->entry', '');
  }
});

$(document).on('change', '#$this->scope', function (e) {
  send$this->scope ($(this).val(), '');
});

function set$this->scope (value, text, source) {
  document.getElementById('$this->scope').value = value;
}

multiFunction['set$this->scope'] = {
  set$this->scope: set$this->scope
};  

function send$this->scope (value, text) {
  var msgContent = [];
  msgContent.$this->scope = [value, text, 'formentry', '$this->scope', 'new field value'];
  newValue$this->iterator (msgContent);
}


	  
    "; 
    return $script;
  }
}

?>