<?php
class Zend_View_Helper_BooleanRadios {

  /**
   * generate yes/no radio buttons
   * @param String $name
   * @param String $selected
   * @param Boolean $reverse
   * @param String $separator
   * @return String
   */
  public function booleanRadios($name = NULL, $selected = "1", $reverse = FALSE, $separator = "&nbsp;") {
    $radios = array();

    $options = array("1" => "Yes", "0" => "No");

    if($reverse) {
      $options = array_reverse($options);
    }

    // check for null
    if($selected == NULL){
      $selected = "1";
    }
    foreach($options as $o => $v){
      $sel = $o == $selected ? "checked='checked'" : "";

      $radios[] = "<input type='radio' name='$name' {$sel} value='{$o}'>{$v}";
    }

    return join($radios, $separator);

  }

}