/**
* Prints a simple button to close a window
*/
-function close_window_button($name='closewindow') {
-
- echo '<center>' . "\n";
- echo '<script type="text/javascript">' . "\n";
- echo '<!--' . "\n";
- echo "document.write('<form>');\n";
- echo "document.write('<input type=\"button\" onclick=\"self.close();\" value=\"".get_string("closewindow")."\" />');\n";
- echo "document.write('<\/form>');\n";
- echo '-->' . "\n";
- echo '</script>' . "\n";
- echo '<noscript>' . "\n";
- print_string($name);
- echo '</noscript>' . "\n";
- echo '</center>' . "\n";
+function close_window_button($name='closewindow', $return=false) {
+ $output = '';
+
+ $output .= '<center>' . "\n";
+ $output .= '<script type="text/javascript">' . "\n";
+ $output .= '<!--' . "\n";
+ $output .= "document.write('<form>');\n";
+ $output .= "document.write('<input type=\"button\" onclick=\"self.close();\" value=\"".get_string("closewindow")."\" />');\n";
+ $output .= "document.write('<\/form>');\n";
+ $output .= '-->' . "\n";
+ $output .= '</script>' . "\n";
+ $output .= '<noscript>' . "\n";
+ $output .= get_string($name);
+ $output .= '</noscript>' . "\n";
+ $output .= '</center>' . "\n";
+
+ if ($return) {
+ return $output;
+ } else {
+ echo $output;
+ }
}
/*
* @param string $name Name of the radiogroup (unique in the form)
* @param string $checked The value that is already checked
*/
-function choose_from_radio ($options, $name, $checked='') {
+function choose_from_radio ($options, $name, $checked='', $return=false) {
static $idcounter = 0;
$output .= '</span>' . "\n";
- echo $output;
+ if ($return) {
+ return $output;
+ } else {
+ echo $output;
+ }
}
/** Display an standard html checkbox with an optional label
* @param string $label The label to be showed near the text field
* @param string $alt The info to be inserted in the alt tag
*/
-function print_textfield ($name, $value, $alt = '',$size=50,$maxlength= 0,$return=false) {
+function print_textfield ($name, $value, $alt = '',$size=50,$maxlength=0, $return=false) {
static $idcounter = 0;