// outputs this page as html in a table (suitable for inclusion in an admin pagetype)
// returns a string of the html
function output_html() {
- $return = '<table class="generaltable" width="100%" border="0" align="center" cellpadding="5" cellspacing="1">' . "\n";
+ $return = '<fieldset class="adminsettings">' . "\n";
+ $return .= '<div class="clearer"><!-- --></div>' . "\n";
foreach($this->settings as $setting) {
$return .= $setting->output_html();
}
- $return .= '</table>';
+ $return .= '</fieldset>';
return $return;
}
} else {
$current = $this->get_setting();
}
- return '<tr><td width="100" align="right" valign="top">' . $this->visiblename . '</td>' .
- '<td align="left"><input type="text" size="50" name="s_'. $this->name .'" value="'. $current .'" /></td></tr>' .
- '<tr><td> </td><td align="left">' . $this->description . '</td></tr>';
+ return format_admin_setting('text', $this->name, $this->visiblename,
+ '<input type="text" size="50" id="id_s_'.$this->name.'" name="s_'.$this->name.'" value="'.$current.'" />',
+ $this->description);
}
}
} else {
$current = $this->get_setting();
}
- return '<tr><td width="100" align="right" valign="top">' . $this->visiblename . '</td>' .
- '<td align="left"><input type="checkbox" size="50" name="s_'. $this->name .'" value="1" ' . ($current == true ? 'checked="checked"' : '') . ' /></td></tr>' .
- '<tr><td> </td><td align="left">' . $this->description . '</td></tr>';
+ return format_admin_setting('checkbox', $this->name, $this->visiblename,
+ '<input type="checkbox" size="50" id="id_s_'.$this->name.'" name="s_'. $this->name .'" value="1" ' . ($current == true ? 'checked="checked"' : '') . ' />',
+ $this->description);
}
}
} else {
$current = $this->get_setting();
}
- $return = '<tr><td width="100" align="right" valign="top">' . $this->visiblename . '</td><td align="left"><select name="s_' . $this->name .'">';
+ $return = '<select id="id_s_'.$this->name.'" name="s_' . $this->name .'">';
foreach ($this->choices as $key => $value) {
- $return .= '<option value="' . $key . '"' . ($key == $current ? ' selected="selected"' : '') . '>' . $value . '</option>';
+ $return .= '<option value="'.$key.'"'.($key==$current ? ' selected="selected"' : '').'>'.$value.'</option>';
}
- $return .= '</select></td></tr><tr><td> </td><td align="left">' . $this->description . '</td></tr>';
- return $return;
+ $return .= '</select>';
+
+ return format_admin_setting('select', $this->name, $this->visiblename, $return, $this->description);
}
}
} else {
$currentsetting = $this->get_setting();
}
- $return = '<tr><td width="100" align="right" valign="top">' . $this->visiblename . '</td><td align="left"><select name="s_' . $this->name .'[h]">';
+ $return = '<select id="id_s_'.$this->name.'h" name="s_' . $this->name .'[h]">';
foreach ($this->choices as $key => $value) {
$return .= '<option value="' . $key . '"' . ($key == $currentsetting['h'] ? ' selected="selected"' : '') . '>' . $value . '</option>';
}
- $return .= '</select> <select name="s_' . $this->name . '[m]">';
+ $return .= '</select> <select id="id_s_'.$this->name.'m" name="s_' . $this->name . '[m]">';
foreach ($this->choices2 as $key => $value) {
$return .= '<option value="' . $key . '"' . ($key == $currentsetting['m'] ? ' selected="selected"' : '') . '>' . $value . '</option>';
}
- $return .= '</select></td></tr><tr><td> </td><td align="left">' . $this->description . '</td></tr>';
- return $return;
+ $return .= '</select>';
+ return format_admin_setting('configtime', $this->name, $this->visiblename, $return, $this->description);
}
}
} else {
$currentsetting = $this->get_setting();
}
- $return = '<tr><td width="100" align="right" valign="top">' . $this->visiblename . '</td><td align="left"><select name="s_' . $this->name .'[]" size="10" multiple="multiple">';
+ $return = '<select id="id_s_'.$this->name.'" name="s_' . $this->name .'[]" size="10" multiple="multiple">';
foreach ($this->choices as $key => $value) {
$return .= '<option value="' . $key . '"' . (in_array($key,$currentsetting) ? ' selected="selected"' : '') . '>' . $value . '</option>';
}
- $return .= '</select></td></tr><tr><td> </td><td align="left">' . $this->description . '</td></tr>';
- return $return;
+ $return .= '</select>';
+ return format_admin_setting('configmultiselect', $this->name, $this->visiblename, $return, $this->description);
}
}
$currentsetting[$i] = 0;
}
}
- $return = '<tr><td width="100" align="right" valign="top">' . $this->visiblename . '</td><td align="left">';
+ $return = '';
for ($i = 0; $i < count($this->choices) - 1; $i++) {
- $return .='<select name="s_' . $this->name .'[]">';
+ $return .='<select id="id_s_'.$this->name.'" name="s_' . $this->name .'[]">';
foreach ($this->choices as $key => $value) {
$return .= '<option value="' . $key . '"' . ($key == $currentsetting[$i] ? ' selected="selected"' : '') . '>' . $value . '</option>';
}
$return .= '<br />';
}
}
- $return .= '</td></tr><tr><td> </td><td align="left">' . $this->description . '</td></tr>';
- return $return;
+ return format_admin_setting('frontpage', $this->name, $this->visiblename, $return, $this->description);
}
}
$usehtmleditor = can_use_html_editor();
- $return = '<tr><td width="100" align="right" valign="top">' . $this->visiblename . '</td>' .
- '<td>';
-
ob_start(); // double-check the number of columns below... might overrun some screen resolutions
print_textarea($usehtmleditor, 15, 60, 0, 0, 's_' . $this->name, $currentsetting);
if ($usehtmleditor) {
use_html_editor();
}
- $return .= ob_get_contents();
+ $return = ob_get_contents();
ob_end_clean();
- $return .= '</td></tr><tr><td> </td><td>' . $this->description . '</td></tr>';
- return $return;
+ return format_admin_setting('frontpagedesc', $this->name, $this->visiblename, $return, $this->description);
}
function get_setting() {
$currentsetting = $this->get_setting();
}
- $return = '<tr><td width="100" align="right" valign="top">' . $this->visiblename . '</td><td align="left">';
+ $return = '';
for ($i = 0; $i < count($currentsetting) / 2; $i++) {
$return .= '<input type="text" name="s_editorfontlist[k' . $i . ']" value="' . $currentsetting['k' . $i] . '" size="20" />';
$return .= ' ';
$return .= '<input type="text" name="s_editorfontlist[k' . ($i + 1) . ']" value="" size="20" />';
$return .= ' ';
$return .= '<input type="text" name="s_editorfontlist[v' . ($i + 1) . ']" value="" size="40" />';
- $return .= '</td></tr><tr><td> </td><td align="left">' . $this->description . '</td></tr>';
- return $return;
+
+ return format_admin_setting('editorfontlist', $this->name, $this->visiblename, $return, $this->description);
}
}
$currentsetting = $this->get_setting();
}
- $return = '<tr><td width="100" align="right" valign="top">' . $this->visiblename . '</td><td align="left">';
-
- $return .= '<table><tr><td valign="top" align="right">';
+ $return = '<table><tr><td valign="top" align="right">';
$count = 0;
}
$return .= ($value == '' ? get_string($key,'editor') : '<img width="18" height="18" src="' . $CFG->wwwroot . '/lib/editor/htmlarea/images/' . $value . '" alt="' . get_string($key,'editor') . '" title="' . get_string($key,'editor') . '" />') . ' ';
- $return .= '<input type="checkbox" value="1" name="s_' . $this->name . '[' . $key . ']"' . (in_array($key,$currentsetting) ? ' checked="checked"' : '') . ' /> ';
+ $return .= '<input type="checkbox" value="1" id="id_s_'.$this->name.$key.'" name="s_' . $this->name . '[' . $key . ']"' . (in_array($key,$currentsetting) ? ' checked="checked"' : '') . ' /> ';
$count++;
if ($count % 15 != 0) {
$return .= '<br /><br />';
$return .= '</td></tr>';
$return .= '</table>';
- $return .= '</td></tr><tr><td> </td><td align="left">' . $this->description . '</td></tr>';
- return $return;
+ return format_admin_setting('editorhidebuttons', $this->name, $this->visiblename, $return, $this->description);
}
}
$currentsetting = $currentsetting['u'] . $currentsetting['m'] . $currentsetting['t'] . $currentsetting['w'] .
$currentsetting['r'] . $currentsetting['f'] . $currentsetting['s'];
- return '<tr><td width="100" align="right" valign="top">' . $this->visiblename . '</td><td align="left">' .
- '<table><tr><td><div align="center"> ' . get_string('sunday', 'calendar') . ' </div></td><td><div align="center"> ' .
+ $return = '<table><tr><td><div align="center"> ' . get_string('sunday', 'calendar') . ' </div></td><td><div align="center"> ' .
get_string('monday', 'calendar') . ' </div></td><td><div align="center"> ' . get_string('tuesday', 'calendar') . ' </div></td><td><div align="center"> ' .
get_string('wednesday', 'calendar') . ' </div></td><td><div align="center"> ' . get_string('thursday', 'calendar') . ' </div></td><td><div align="center"> ' .
get_string('friday', 'calendar') . ' </div></td><td><div align="center"> ' . get_string('saturday', 'calendar') . ' </div></td></tr><tr>' .
- '<td><div align="center"><input type="checkbox" name="s_'. $this->name .'[u]" value="1" ' . (substr($currentsetting,0,1) == '1' ? 'checked="checked"' : '') . ' /></div></td>' .
- '<td><div align="center"><input type="checkbox" name="s_'. $this->name .'[m]" value="1" ' . (substr($currentsetting,1,1) == '1' ? 'checked="checked"' : '') . ' /></div></td>' .
- '<td><div align="center"><input type="checkbox" name="s_'. $this->name .'[t]" value="1" ' . (substr($currentsetting,2,1) == '1' ? 'checked="checked"' : '') . ' /></div></td>' .
- '<td><div align="center"><input type="checkbox" name="s_'. $this->name .'[w]" value="1" ' . (substr($currentsetting,3,1) == '1' ? 'checked="checked"' : '') . ' /></div></td>' .
- '<td><div align="center"><input type="checkbox" name="s_'. $this->name .'[r]" value="1" ' . (substr($currentsetting,4,1) == '1' ? 'checked="checked"' : '') . ' /></div></td>' .
- '<td><div align="center"><input type="checkbox" name="s_'. $this->name .'[f]" value="1" ' . (substr($currentsetting,5,1) == '1' ? 'checked="checked"' : '') . ' /></div></td>' .
- '<td><div align="center"><input type="checkbox" name="s_'. $this->name .'[s]" value="1" ' . (substr($currentsetting,6,1) == '1' ? 'checked="checked"' : '') . ' /></div></td>' .
- '</tr></table>' .
- '</td></tr><tr><td> </td><td align="left">' . $this->description . '</td></tr>';
+ '<td><div align="center"><input type="checkbox" id="id_s_'.$this->name.'u" name="s_'. $this->name .'[u]" value="1" ' . (substr($currentsetting,0,1) == '1' ? 'checked="checked"' : '') . ' /></div></td>' .
+ '<td><div align="center"><input type="checkbox" id="id_s_'.$this->name.'m" name="s_'. $this->name .'[m]" value="1" ' . (substr($currentsetting,1,1) == '1' ? 'checked="checked"' : '') . ' /></div></td>' .
+ '<td><div align="center"><input type="checkbox" id="id_s_'.$this->name.'t" name="s_'. $this->name .'[t]" value="1" ' . (substr($currentsetting,2,1) == '1' ? 'checked="checked"' : '') . ' /></div></td>' .
+ '<td><div align="center"><input type="checkbox" id="id_s_'.$this->name.'w" name="s_'. $this->name .'[w]" value="1" ' . (substr($currentsetting,3,1) == '1' ? 'checked="checked"' : '') . ' /></div></td>' .
+ '<td><div align="center"><input type="checkbox" id="id_s_'.$this->name.'r" name="s_'. $this->name .'[r]" value="1" ' . (substr($currentsetting,4,1) == '1' ? 'checked="checked"' : '') . ' /></div></td>' .
+ '<td><div align="center"><input type="checkbox" id="id_s_'.$this->name.'f" name="s_'. $this->name .'[f]" value="1" ' . (substr($currentsetting,5,1) == '1' ? 'checked="checked"' : '') . ' /></div></td>' .
+ '<td><div align="center"><input type="checkbox" id="id_s_'.$this->name.'s" name="s_'. $this->name .'[s]" value="1" ' . (substr($currentsetting,6,1) == '1' ? 'checked="checked"' : '') . ' /></div></td>' .
+ '</tr></table>';
+
+ return format_admin_setting('backupdays', $this->name, $this->visiblename, $return, $this->description);
}
$currentsetting = $this->get_setting();
}
- return '<tr><td width="100" align="right" valign="top">' . $this->visiblename . '</td><td align="left">' .
- '<table><tr><td><div align="center"> ' . get_string('sunday', 'calendar') . ' </div></td><td><div align="center"> ' .
+ $return = '<table><tr><td><div align="center"> ' . get_string('sunday', 'calendar') . ' </div></td><td><div align="center"> ' .
get_string('monday', 'calendar') . ' </div></td><td><div align="center"> ' . get_string('tuesday', 'calendar') . ' </div></td><td><div align="center"> ' .
get_string('wednesday', 'calendar') . ' </div></td><td><div align="center"> ' . get_string('thursday', 'calendar') . ' </div></td><td><div align="center"> ' .
get_string('friday', 'calendar') . ' </div></td><td><div align="center"> ' . get_string('saturday', 'calendar') . ' </div></td></tr><tr>' .
- '<td><div align="center"><input type="checkbox" name="s_'. $this->name .'[u]" value="1" ' . ($currentsetting['u'] ? 'checked="checked"' : '') . ' /></div></td>' .
- '<td><div align="center"><input type="checkbox" name="s_'. $this->name .'[m]" value="1" ' . ($currentsetting['m'] ? 'checked="checked"' : '') . ' /></div></td>' .
- '<td><div align="center"><input type="checkbox" name="s_'. $this->name .'[t]" value="1" ' . ($currentsetting['t'] ? 'checked="checked"' : '') . ' /></div></td>' .
- '<td><div align="center"><input type="checkbox" name="s_'. $this->name .'[w]" value="1" ' . ($currentsetting['w'] ? 'checked="checked"' : '') . ' /></div></td>' .
- '<td><div align="center"><input type="checkbox" name="s_'. $this->name .'[r]" value="1" ' . ($currentsetting['r'] ? 'checked="checked"' : '') . ' /></div></td>' .
- '<td><div align="center"><input type="checkbox" name="s_'. $this->name .'[f]" value="1" ' . ($currentsetting['f'] ? 'checked="checked"' : '') . ' /></div></td>' .
- '<td><div align="center"><input type="checkbox" name="s_'. $this->name .'[s]" value="1" ' . ($currentsetting['s'] ? 'checked="checked"' : '') . ' /></div></td>' .
- '</tr></table>' .
- '</td></tr><tr><td> </td><td align="left">' . $this->description . '</td></tr>';
+ '<td><div align="center"><input type="checkbox" id="id_s_'.$this->name.'u" name="s_'. $this->name .'[u]" value="1" ' . ($currentsetting['u'] ? 'checked="checked"' : '') . ' /></div></td>' .
+ '<td><div align="center"><input type="checkbox" id="id_s_'.$this->name.'m" name="s_'. $this->name .'[m]" value="1" ' . ($currentsetting['m'] ? 'checked="checked"' : '') . ' /></div></td>' .
+ '<td><div align="center"><input type="checkbox" id="id_s_'.$this->name.'t" name="s_'. $this->name .'[t]" value="1" ' . ($currentsetting['t'] ? 'checked="checked"' : '') . ' /></div></td>' .
+ '<td><div align="center"><input type="checkbox" id="id_s_'.$this->name.'w" name="s_'. $this->name .'[w]" value="1" ' . ($currentsetting['w'] ? 'checked="checked"' : '') . ' /></div></td>' .
+ '<td><div align="center"><input type="checkbox" id="id_s_'.$this->name.'r" name="s_'. $this->name .'[r]" value="1" ' . ($currentsetting['r'] ? 'checked="checked"' : '') . ' /></div></td>' .
+ '<td><div align="center"><input type="checkbox" id="id_s_'.$this->name.'f" name="s_'. $this->name .'[f]" value="1" ' . ($currentsetting['f'] ? 'checked="checked"' : '') . ' /></div></td>' .
+ '<td><div align="center"><input type="checkbox" id="id_s_'.$this->name.'s" name="s_'. $this->name .'[s]" value="1" ' . ($currentsetting['s'] ? 'checked="checked"' : '') . ' /></div></td>' .
+ '</tr></table>';
+
+ return format_admin_setting('calendarweekend', $this->name, $this->visiblename, $return, $this->description);
}
$currentsetting = $this->get_setting();
}
- return '<tr><td width="100" align="right" valign="top">' . $this->visiblename . '</td>' .
- '<td align="left"><input type="checkbox" size="50" name="s_'. $this->name .'" value="1" ' . ($currentsetting == 15 ? 'checked="checked"' : '') . ' /></td></tr>' .
- '<tr><td> </td><td align="left">' . $this->description . '</td></tr>';
+ $return = '<input type="checkbox" size="50" id="id_s_'.$this->name.'" name="s_'. $this->name .'" value="1" ' . ($currentsetting == 15 ? 'checked="checked"' : '') . ' />';
+ return format_admin_setting('checkbox', $this->name, $this->visiblename, $return, $this->description);
}
}
}
-function format_admin_setting($name, $title='', $form='', $description='') {
- $output = '<div class="adminsetting">';
- $output .= 'etc';
- $output .= '</div>';
-
- return $output;
+function format_admin_setting($class, $name, $title='', $form='', $description='') {
+ return "\n".
+ '<div class="adminsetting form-'.$class.'">'."\n".
+ '<label for="id_s_'.$name.'">'.$title."\n".
+ ' <span class="form-shortname">'.$name.'</span>'."\n".
+ '</label>'."\n".
+ $form."\n".
+ '<div class="description">'.$description.'</div>'."\n\n";
}
-?>
\ No newline at end of file
+?>