// Function used by Quiz module for creating sets of radiobuttons // To be applied to SGL_Output.php/Output.php /** * Generate a series of linked radio buttons * @author Peter Cruickshank */ function generateRadioButtons($params, $id=null) { Base::logMessage(null, PEAR_LOG_DEBUG); $values = $params['values']; // Must be an array of form 'name' => 'description' $class = isset($params['class']) ? $params['class'] : ''; $name = isset($params['name']) ? $params['name'] : 'option'; $current = isset($params['current']) ? $params['current'] : ''; $start = @$params['start']; $end = @$params['end']; $cl = ($class!='') ? " class=$class":''; $ret = "\n"; foreach ($values as $k => $description) { $sel = ($k == $current)? ' checked="checked"' : ""; if (empty($description)) $description = $name; $description = htmlspecialchars($description); $ret .= "\t$start$end\n"; } return $ret."\n"; }