Exemplo n.º 1
0
 /**
  * View this PHAT_Radiobutton
  *
  * The view function provides the HTML for a user to view the PHAT_Radiobutton.
  *
  * @return string The HTML to be shown
  * @access public
  */
 function view($value = NULL)
 {
     $label = $this->getLabel();
     if (isset($_REQUEST['PHAT_' . $label])) {
         $this->setValue($_REQUEST['PHAT_' . $label]);
     }
     if ($this->isRequired()) {
         $viewTags['REQUIRED_FLAG'] = '*';
     }
     $viewTags['BLURB'] = PHPWS_Text::parseOutput($this->getBlurb(), ENCODE_PARSED_TEXT, false, true);
     $viewTags['RADIO_BUTTONS'] = '';
     $optionText = $this->getOptionText();
     $optionValues = $this->getOptionValues();
     for ($i = 0; $i < sizeof($optionText); $i++) {
         $option_value = $optionValues[$i];
         $element = new Form_RadioButton('PHAT_' . $label, $option_value);
         $element->setMatch($this->getValue());
         $id = preg_replace('/\\W/', '', $option_value) . $i;
         $viewTags['RADIO_BUTTONS'] .= '<div class="radio"><label>' . $element->get() . ' ' . $optionText[$i] . "</label></div>\n";
     }
     return PHPWS_Template::processTemplate($viewTags, 'phatform', 'radiobutton/view.tpl');
 }
Exemplo n.º 2
0
 public static function formRadio($name, $value, $match = null, $match_diff = null, $label = null)
 {
     $element = new Form_RadioButton($name, $value);
     $element->setMatch($match);
     return $element->get() . ' ' . $label;
 }