<?php 

class SelectHour {
  private $scope;
  private $iterator;
  private $selected;
  private $options;
  private $label;

  public function __construct($entry) {
    if (isset($entry)) {
      $this->scope    = $entry->scope;
      $this->selected = $entry->selected;
      $this->iterator = $entry->iterator;
      $this->options  = explode (",", $entry->options);
      $this->label    = ucwords(str_replace("_", " ", $this->scope)) . ":";
    } 
  }

  public function outputLayout() {

    $layout = "
      <label for='$this->scope'>$this->label</label>
      <select id=$this->scope class=$this->iterator name='$this->scope' >
	";
    for ($i=0; $i<count($this->options); $i++) {
      $selAttr = "";
      if ($this->options[$i] == $this->selected)
        $selAttr = "selected";

      $inner = $this->options[$i];
      $layout .= "
        <option value=$inner $selAttr>$inner</option>
      ";
    }
  
    $layout .= "
      </select>
    "; 
    return $layout;
  }

  public function outputScript() {
    $script = "";
    return $script;
  }

}

?>