$ret[] = sprintf('<label for="edit_%s">%s</label><br>', $id, $info['name']);
$ret[] = sprintf('<input type="checkbox" id="edit_%s" name="%s">', $id, $id);
} elseif ($info['type'] == 'select') {
+ $v = array('id="edit_'.$id.'"',
+ 'name="'.$id.'"');
+ if (array_key_exists('onchange',$info))
+ $v[] = sprintf('onchange="%s"', $info['onchange']);
+
$ret[] = sprintf('<label for="edit_%s">%s</label><br>', $id, $info['name']);
- $ret[] = sprintf('<select id="edit_%s" name="%s">', $id, $id);
+ $ret[] = sprintf('<select %s>', implode(' ', $v));
if (is_array($info['options'])) $options = $info['options'];
else $options = query_db($info['options']);
foreach ($options as $row)
$ret[] = sprintf('<option value="%s">%s</option>', $row['id'], $row['text']);
$ret[] = '</select>';
+ } elseif ($info['type'] == 'textarea') {
+ $ret[] = sprintf('<label for="edit_%s">%s</label><br>', $id, $info['name']);
+ $v = array('id="edit_'.$id.'"',
+ 'name="'.$id.'"');
+ $v[] = sprintf('cols="%d"', empty($info['columns'])?33:$info['columns']);
+ $v[] = sprintf('rows="%d"', empty($info['rows'])?5:$info['columns']);
+ $ret[] = sprintf('<textarea %s></textarea>', implode(' ', $v));
}
if (array_key_exists('comment',$info))
$ret[] = sprintf('<span class="comment">%s</span>', $info['comment']);
$ret[] = sprintf('<h3>%s</h3>', $details['title']);
if (array_key_exists('subtitle', $details))
$ret[] = sprintf('<p class="subtitle">%s</p>', $details['subtitle']);
- $ret[] = '<ul>';
- foreach ($details['list'] as $name => $info) {
- $ret[] = sprintf('<li>%s: <span id="detail_%s"></span></li>', $info['name'], $name);
+ if (array_key_exists('html',$details)) {
+ $ret[] = $details['html'];
+ } elseif (array_key_exists('list',$details)) {
+ $ret[] = '<ul>';
+ foreach ($details['list'] as $name => $info) {
+ $ret[] = sprintf('<li>%s: <span id="detail_%s"></span></li>', $info['name'], $name);
+ }
+ $ret[] = '</ul>';
}
- $ret[] = '</ul>';
$ret[] = '</div>';
return $ret;