3 # FILE: HtmlRadioButtonSet.php 5 # Part of the ScoutLib application support library 6 # Copyright 2017 Edward Almasy and Internet Scout Research Group 7 # http://scout.wisc.edu 16 # ---- PUBLIC INTERFACE -------------------------------------------------- 29 $SelectedValue = NULL)
31 $this->ResultVar = $ResultVar;
32 $this->Options = $Options;
50 # start out with empty HTML 53 # if there are options or we are supposed to print even if no options 57 foreach ($this->Options as $Value => $Label)
59 # generate ID for elements 60 $Id = $this->ResultVar.
"_" 61 .preg_replace(
"%[^a-z0-9]%i",
"", $Value);
64 $Html .=
" <input type=\"radio\"" 65 .
" id=\"".htmlspecialchars($Id).
"\"" 66 .
" name=\"".htmlspecialchars($this->ResultVar).
"\"" 67 .
" value=\"".htmlspecialchars($Value).
"\"";
69 # add in selected attribute if appropriate 77 # add in disabled attribute if appropriate 88 $Html .=
" <label for=\"".$Id.
"\">" 89 .htmlspecialchars($Label).
"</label>\n";
93 # return generated HTML to caller 107 if ($Options !== NULL)
109 if (is_array($Options))
118 return $this->DisabledOptions;
129 if ($NewValue !== NULL)
133 return $this->SelectedValue;
147 if ($NewValue !== NULL)
151 return $this->PrintIfEmpty;
163 if ($NewValue !== NULL)
165 $this->
Disabled = $NewValue ? TRUE : FALSE;
167 return $this->Disabled;
171 # ---- PRIVATE INTERFACE ------------------------------------------------- 176 private $Disabled = FALSE;
177 private $DisabledOptions = array();
178 private $PrintIfEmpty = TRUE;
179 private $SelectedValue;