Yay for ISSO::get()
[isso.git] / printer.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Iris Studios Shared Object Framework [#]version[#]
5 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
6 || #
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
10 || #
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 || # more details.
15 || #
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
21
22 /**
23 * Printer
24 * printer.php
25 *
26 * @package ISSO
27 */
28
29 /**
30 * Printer
31 *
32 * This framework generates standard HTML through various functions. The purpose
33 * is generally so that things like the admin system can be created without templates.
34 *
35 * Constants:
36 * ISSO_PRINTER_DONE_HEADER - An internal constant that is used to check to see
37 * if the page header has already been printed
38 * ISSO_PRINTER_HIDE_SETUP - Will stop the page footer data (copyright and debug
39 * box) from being printed
40 *
41 * Hooks:
42 * _printer_page_start() - Define function to echo() data after the page header
43 * has been outputted
44 *
45 * @author Iris Studios, Inc.
46 * @copyright Copyright ©2002 - [#]year[#], Iris Studios, Inc.
47 * @version $Revision$
48 * @package ISSO
49 *
50 */
51 class Printer
52 {
53 /**
54 * Framework registry object
55 * @var object
56 * @access private
57 */
58 var $registry = null;
59
60 /**
61 * Realm that we are operating in (displayed in the <title>)
62 * @var string
63 * @access private
64 */
65 var $realm = '[UNDEFINED REALM]';
66
67 /**
68 * CSS to place in the page
69 * @var string
70 * @access private
71 */
72 var $css = '';
73
74 /**
75 * Fields array that is used in this module
76 * @var array
77 * @access private
78 */
79 var $fields = array(
80 'realm' => array(REQ_YES, null, false)
81 );
82
83 // ###################################################################
84 /**
85 * Constructor
86 */
87 function __construct(&$registry)
88 {
89 $this->registry =& $registry;
90 }
91
92 // ###################################################################
93 /**
94 * (PHP 4) Constructor
95 */
96 function Printer(&$registry)
97 {
98 $this->__construct($registry);
99 }
100
101 // ###################################################################
102 /**
103 * Sets an ISSO field
104 *
105 * @access public
106 *
107 * @param string Field name
108 * @param mixed Value of the field
109 */
110 function set($name, $value)
111 {
112 $this->registry->do_set($name, $value, 'printer');
113 }
114
115 // ###################################################################
116 /**
117 * Gets an ISSO field
118 *
119 * @access public
120 *
121 * @param string Field name
122 *
123 * @return mixed Value of the field
124 */
125 function get($fieldname)
126 {
127 return $this->registry->do_get($fieldname, 'printer');
128 }
129
130 // ###################################################################
131 /**
132 * Creates a redirect to another page; constructs the header and footer
133 * (therefore execution stops)
134 *
135 * @access public
136 *
137 * @param string Location to redirect to
138 * @param integer Time to wait before the redirect
139 * @param array An aray of POST variables to send through on the redirect
140 */
141 function redirect($location, $timeout = 10, $postvars = array())
142 {
143 $timeout = $timeout * 200;
144
145 if ($postvars)
146 {
147 $js = <<<JS
148 <script type="text/javascript">
149 <!--
150 var timeout = $timeout;
151
152 if (timeout > 0)
153 {
154 setTimeout("redirect()", $timeout);
155 }
156 else
157 {
158 redirect();
159 }
160
161 function redirect()
162 {
163 document.forms.postvars.submit();
164 }
165
166 //-->
167 </script>
168 JS;
169 }
170 else
171 {
172 $js = <<<JS
173 <script type="text/javascript">
174 <!--
175 var timeout = $timeout;
176
177 if (timeout > 0)
178 {
179 setTimeout("redirect()", $timeout);
180 }
181 else
182 {
183 redirect();
184 }
185
186 function redirect()
187 {
188 window.location = "$location";
189 }
190 //-->
191 </script>
192 JS;
193 }
194
195 $this->page_start($this->registry->modules['localize']->string('Redirect'));
196
197 if ($postvars)
198 {
199 $this->form_start($location, null, false, 'postvars');
200
201 foreach ($postvars AS $key => $value)
202 {
203 $this->form_hidden_field($key, $value);
204 }
205
206 $this->form_end();
207 }
208
209 $this->page_message($this->registry->modules['localize']->string('Redirect'), sprintf($this->registry->modules['localize']->string('Please wait to be redirected. If you are not redirected in a few seconds, click <a href="%1$s">here</a>.'), $location));
210
211 $this->page_code($js);
212
213 $this->page_end();
214 }
215
216 // ###################################################################
217 /**
218 * Throws a fatal error; constructs the header and footer
219 *
220 * @access public
221 *
222 * @param string Error messsage text
223 */
224 function error($message)
225 {
226 $this->page_start($this->registry->modules['localize']->string('Error'));
227 $this->page_message($this->registry->modules['localize']->string('Error'), $message);
228 $this->page_end();
229
230 exit;
231 }
232
233 // ###################################################################
234 /**
235 * Outputs the header of the page: doctype, <html>, <head>, <title>,
236 * <body> and imbeds the style information
237 *
238 * @access public
239 *
240 * @param string Title of the page
241 * @param string Class of the page to be applied to the body
242 * @param integer Margin of the <div> that all content is placed in
243 * @param string Extra HTML to imbed in the <head> tag
244 * @param string <body> onLoad action to imbed
245 * @param integer Margin of the actual <body > tag
246 * @param string Relative path where the CSS data is stored
247 * @param bool Will force re-print the header if it has already been printed
248 */
249 function page_start($actiontitle, $pageclass = ':default:', $pagemargin = 15, $extra = '', $onload = false, $margin = 0, $dotpath = '.', $override = false)
250 {
251 $this->registry->check_isso_fields(get_class($this));
252
253 if ($this->registry->debug AND isset($_GET['query']))
254 {
255 ob_start();
256 }
257
258 if (defined('ISSO_PRINTER_DONE_HEADER') AND !$override)
259 {
260 if (constant('ISSO_PRINTER_DONE_HEADER') AND !$override)
261 {
262 return;
263 }
264 }
265
266 $title = sprintf($this->registry->modules['localize']->string('%1$s - %2$s - %3$s'), $this->registry->application, $this->realm, $actiontitle);
267
268 echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
269 echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>";
270 echo "\n\t<title>$title</title>";
271 echo "\n\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />";
272 echo $this->css;
273 echo ($extra ? "\n$extra" : '');
274 echo "\n</head>\n<body style=\"margin: {$margin}px;\"" . (($pageclass !== ':default:') ? " class=\"$pageclass\"" : '') . (($onload) ? " onload=\"$onload\"" : '') . ">\n";
275
276 if (!defined('ISSO_PRINTER_HIDE_SETUP') AND function_exists('_printer_page_start'))
277 {
278 _printer_page_start();
279 }
280
281 echo "<div style=\"margin: {$pagemargin}px;\">\n<!-- / page head -->\n\n";
282
283 if (!defined('ISSO_PRINTER_DONE_HEADER'))
284 {
285 define('ISSO_PRINTER_DONE_HEADER', 1);
286 }
287 }
288
289 // ###################################################################
290 /**
291 * Links CSS to the page from a given relative path
292 *
293 * @access public
294 *
295 * @param string Relative path to the CSS file
296 */
297 function css_link($path)
298 {
299 $this->css .= "\n\t<link rel=\"stylesheet\" href=\"$path\" />";
300 }
301
302 // ###################################################################
303 /**
304 * Imbeds actual CSS information into the page in <style> tags
305 *
306 * @access public
307 *
308 * @param string Path of the CSS file to be imbeded
309 */
310 function css_imbed($path)
311 {
312 $data = require_once($path);
313 $css = preg_replace('#/\*(.*?)\*/(\r|\n)*#s', '', $css);
314 $css = trim($css);
315 $this->css .= "\n\t<style type=\"text/css\">\n\t<!--\n" . $css . "\n\t//-->\n\t</style>";
316 }
317
318 // ###################################################################
319 /**
320 * Places raw HTML code directly into the documet at the current
321 * position
322 *
323 * @access public
324 *
325 * @param string HTML code
326 */
327 function page_code($code)
328 {
329 echo "\n\n$code\n\n";
330 }
331
332 // ###################################################################
333 /**
334 * A block function that produces a table with a message in it. This
335 * does not print the header and footer.
336 *
337 * @access public
338 *
339 * @param string The title of the message (appears at the top of the block)
340 * @param string Content of the message
341 */
342 function page_message($title, $message)
343 {
344 $this->table_start(true, '75%');
345 $this->table_head($title, 1);
346 $this->row_span("<blockquote>$message</blockquote>", ':swap:', 'left', 1);
347 $this->table_end();
348 }
349
350 // ###################################################################
351 /**
352 * Produces an entire page layout that asks the user whether or not
353 * they want to perform X action and provides a link to the YES and NO
354 * action
355 *
356 * @access public
357 *
358 * @param string Message that asks if they want to do X
359 * @param string Location to go for YES
360 * @param string DO action to pass
361 * @param array Hidden parameters to pass to the next page
362 */
363 function page_confirm($message, $location, $action, $params)
364 {
365 $this->page_start($this->registry->modules['localize']->string('Confirm'));
366
367 $this->form_start($location, $action);
368 foreach ($params AS $key => $value)
369 {
370 $this->form_hidden_field($key, $value);
371 }
372
373 $this->table_start(true, '75%');
374 $this->table_head($this->registry->modules['localize']->string('Confirm'), 1);
375 $this->row_span("<blockquote>$message</blockquote>", ':swap:', 'left', 1);
376 $this->row_submit('<input type="button" class="button" name="no" value=" ' . $this->registry->modules['localize']->string('No') . ' " onclick="history.back(1); return false;" />', $this->registry->modules['localize']->string('Yes'), '');
377 $this->table_end();
378
379 $this->form_end();
380
381 $this->page_end();
382 }
383
384 // ###################################################################
385 /**
386 * Closes the HTML document structure an adds the copyright; this also
387 * stops execution of the page
388 *
389 * @access public
390 */
391 function page_end()
392 {
393 if ($this->registry->debug AND isset($_GET['query']))
394 {
395 ob_clean();
396 ob_end_clean();
397
398 if (is_array($this->registry->modules[ISSO_DB_LAYER]->history))
399 {
400 echo '<pre>';
401 foreach ($this->registry->modules[ISSO_DB_LAYER]->history AS $query)
402 {
403 echo $query . "\n\n<hr />\n\n";
404 }
405 echo '</pre>';
406 }
407 exit;
408 }
409
410 $copyright = "\n<br />\n<p align=\"center\" class=\"copyright\">\n\t<a href=\"http://www.iris-studios.com\" target=\"_blank\">" . $this->registry->get('application') . ' ' . $this->registry->get('appversion') . ", &copy; 2002 - " . date('Y') . " Iris Studios, Inc.</a>\n</p>";
411
412 if (!defined('ISSO_PRINTER_HIDE_SETUP'))
413 {
414 echo "\n<!-- page end -->\n</div>\n$copyright";
415 echo $this->registry->construct_debug_block(false);
416 }
417 else
418 {
419 echo "\n<!-- page end -->\n</div>";
420 }
421
422 echo "\n\n</body>\n</html>";
423
424 exit;
425 }
426
427 // -------------------------------------------------------------------
428
429 // ###################################################################
430 /**
431 * Opens a <table> tag with styling
432 *
433 * @access public
434 *
435 * @param bool Whether to add a <br /> before the table
436 * @param string Value of the width attribute
437 */
438 function table_start($break = true, $width = '90%')
439 {
440 if ($break)
441 {
442 echo '<br />';
443 }
444
445 echo "\n<table cellpadding=\"4\" cellspacing=\"0\" border=\"0\" align=\"center\" width=\"$width\" class=\"tborder\">\n";
446 }
447
448 // ###################################################################
449 /**
450 * Adds a table row that is sued to head the entire table
451 *
452 * @access public
453 *
454 * @param string Title string
455 * @param integer Colspan attribute value
456 * @param bool Whether to bold the title
457 */
458 function table_head($title, $colspan = 2, $strong = true)
459 {
460 echo "<tr>\n\t<td class=\"tcat\" align=\"center\" colspan=\"$colspan\">" . (($strong) ? "<strong>$title</strong>" : $title) . "</td>\n</tr>\n";
461 }
462
463 // ###################################################################
464 /**
465 * Creates column headings; useful for a grid-style page. This uses a
466 * different styling than table_head() and is usually used directly
467 * after a table header.
468 *
469 * @access public
470 *
471 * @param array Array of titles to print
472 */
473 function table_column_head($columnarray)
474 {
475 if (is_array($columnarray))
476 {
477 $render = "<tr valign=\"top\" align=\"center\">\n";
478
479 foreach ($columnarray AS $header)
480 {
481 $render .= "\t<td class=\"thead\" align=\"center\">$header</td>\n";
482 }
483
484 $render .= "</tr>\n";
485
486 echo $render;
487 }
488 }
489
490 // ###################################################################
491 /**
492 * Closes a <table> tag
493 *
494 * @access public
495 */
496 function table_end()
497 {
498 echo "\n</table>\n";
499 }
500
501 // -------------------------------------------------------------------
502
503 // ###################################################################
504 /**
505 * Starts a <form> tag and adds the DO hidden input field
506 *
507 * @access public
508 *
509 * @param string Action/name of the file to action to
510 * @param string Value of the DO parameter; used to do-branch
511 * @param bool Enctype attribute; used for mime/multi-part
512 * @param string Name of the form; this only matters for DOM access
513 * @param string Method to action as; POST or GET (default is POST)
514 */
515 function form_start($action, $do, $enctype = false, $name = 'inputform', $submitmethod = 'post')
516 {
517 echo "\n<!-- input form -->\n<form name=\"$name\" action=\"$action\"" . (($enctype) ? " enctype=\"$enctype\"" : '') . " method=\"$submitmethod\">\n";
518
519 if ($do !== null)
520 {
521 $this->form_hidden_field('do', $do);
522 }
523 }
524
525 // ###################################################################
526 /**
527 * Adds a hidden field at the current location
528 *
529 * @access public
530 *
531 * @param string Name of the field
532 * @param string Value of the field
533 */
534 function form_hidden_field($name, $value)
535 {
536 echo "<input type=\"hidden\" name=\"$name\" value=\"$value\" />\n";
537 }
538
539 // ###################################################################
540 /**
541 * Closes a <form> tag
542 *
543 * @access public
544 */
545 function form_end()
546 {
547 echo "</form>\n<!-- / input form -->\n";
548 }
549
550 // -------------------------------------------------------------------
551
552 // ###################################################################
553 /**
554 * Creates a table row that spans an entire row; this is used to divide
555 * sections, usually
556 *
557 * @access public
558 *
559 * @param string Text to place in the row
560 * @param string Class name to style with; by default it alternates between alt1 and alt2 (use :swap: to do that)
561 * @param string Alignment of the text in the row
562 * @param integer Colspan attribute
563 */
564 function row_span($text, $class = ':swap:', $align = 'left', $colspan = 2)
565 {
566 if ($class === ':swap:')
567 {
568 $this->registry->modules['functions']->exec_swap_bg();
569 $row_class = $this->registry->modules['functions']->bgcolour;
570 $is_style_element = false;
571 }
572 else
573 {
574 if (preg_match('#:style:(.*?)#i', $class))
575 {
576 $is_style_element = true;
577 $style = str_replace(':style:', '', $class);
578 }
579 else
580 {
581 $row_class = $class;
582 $is_style_element = false;
583 }
584 }
585
586 echo "\n<tr>\n\t<td ". (($is_style_element) ? "style=\"$style\"" : "class=\"$row_class\"") . " colspan=\"$colspan\" align=\"$align\">$text</td>\n</tr>";
587 }
588
589 // ###################################################################
590 /**
591 * Creates a table row that has more than two columns; this is used in
592 * conjunction with table_column_head() usually; it takes an array of
593 * values
594 *
595 * @access public
596 *
597 * @param array Array of values in form value => alignment key (c for center, l for left, and r for right)
598 */
599 function row_multi_item($row_array)
600 {
601 $this->registry->modules['functions']->exec_swap_bg();
602
603 foreach ($row_array AS $item => $align)
604 {
605 $row_data["$align"][] = $item;
606 }
607
608 echo "<tr valign=\"top\">";
609
610 foreach ($row_data AS $align_key => $item_array)
611 {
612 if ($align_key == 'c')
613 {
614 $align = 'center';
615 }
616 else if ($align_key == 'l')
617 {
618 $align = 'left';
619 }
620 else if ($align_key == 'r')
621 {
622 $align = 'right';
623 }
624
625 foreach ($item_array AS $value)
626 {
627 echo "\n\t<td class=\"{$this->registry->modules['functions']->bgcolour}\" align=\"$align\">$value</td>";
628 }
629 }
630
631 echo "\n</tr>\n";
632 }
633
634 // ###################################################################
635 /**
636 * Generic row creation function that has two columns: label and value;
637 * this is used for many other form functions, but can also be used for
638 * non-editable fields
639 *
640 * @access public
641 *
642 * @param string Label text
643 * @param string HTML or text to place in the value column
644 * @param string Vertical align (valign attribute) for the row
645 * @param integer Colspan attribute
646 * @param string Class to style the row with; default is to alternate
647 */
648 function row_text($label, $value = '&nbsp;', $valign = 'top', $colspan = 2, $class = -1)
649 {
650 global $IS_SETTINGS;
651
652 if ($class == -1)
653 {
654 if (!$IS_SETTINGS)
655 {
656 $this->registry->modules['functions']->exec_swap_bg();
657 $row_class = $this->registry->modules['functions']->bgcolour;
658 }
659 else
660 {
661 $row_class = 'alt2';
662 }
663 }
664 else
665 {
666 $row_class = $class;
667 }
668
669 echo "<tr valign=\"$valign\">";
670 echo "\n\t<td class=\"$row_class\">$label</td>";
671 echo "\n\t<td class=\"$row_class\">$value</td>";
672
673 if ($colspan > 2)
674 {
675 echo "\n\t<td class=\"$row_class\" colspan=\"" . $colspan - 2 . "\">&nbsp;</td>";
676 }
677
678 echo "\n</tr>\n";
679 }
680
681 // ###################################################################
682 /**
683 * Creates a table row with an <input> text field as the value column
684 *
685 * @access public
686 *
687 * @param string Label text
688 * @param string Name of the <input> field
689 * @param string Value of the field
690 * @param integer Colspan attribute
691 * @param integer Size of the <input> field
692 * @param integer Length attribute; use FALSE for no length to be specified
693 * @param bool Whether to make this a password field
694 * @param string Vertical align (valign attribute)
695 */
696 function row_input($label, $name, $value = '', $colspan = 2, $size = 35, $length = false, $password = false, $lalign = 'top')
697 {
698 $this->row_text($label, "<input type=\"" . (($password) ? 'password' : 'text') . "\" class=\"input\" name=\"$name\" value=\"$value\" size=\"$size\" " . (($length) ? "maxlength=\"$length\" " : '') . "/>", $lalign, $colspan);
699 }
700
701 // ###################################################################
702 /**
703 * Creates a table row with a <textarea> as the value column
704 *
705 * @access public
706 *
707 * @param string Label text
708 * @param string Name of the <textarea>
709 * @param string Value of the <textarea>
710 * @param integer Colspan attribute
711 * @param integer Number of rows in the <textarea>
712 * @param integer Number of colums in the <textarea>
713 * @param bool Whether or not to use monospacing font
714 * @param string Extra style attributes to apply to the <textarea>
715 */
716 function row_textarea($label, $name, $value = '', $colspan = 2, $rows = 7, $cols = 50, $code = false, $style = '')
717 {
718 $this->row_text($label, "<textarea name=\"$name\" class=\"" . (($code) ? 'code' : 'input') . "\" rows=\"$rows\" cols=\"$cols\"" . (($style) ? ' style="' . $style . '"' : '') . ">$value</textarea>", 'top', $colspan);
719 }
720
721 // ###################################################################
722 /**
723 * Creates a table row with the tfoot class
724 *
725 * @access public
726 *
727 * @param string Extra text or HTML to insert into the row
728 * @param integer Colspan attribute
729 */
730 function row_tfoot($data, $colspan = 2)
731 {
732 echo $this->row_span($data, 'tfoot', 'center', $colspan);
733 }
734
735 // ###################################################################
736 /**
737 * Creates a tfoot table row with submit buttons
738 *
739 * @access public
740 *
741 * @param string Extra HTML to imbed in the row after the buttons
742 * @param string Submit button text (by default it uses pre-translated "Submit" from :save:)
743 * @param string Reset button text (default it uses pre-translated "Reset" from :reset:)
744 * @param integer Colspan attribute
745 */
746 function row_submit($extra = false, $submit = ':save:', $reset = ':reset:', $colspan = 2)
747 {
748 if ($submit === ':save:')
749 {
750 $submit = " " . $this->registry->modules['localize']->string('Submit') . " ";
751 }
752 else
753 {
754 $submit = " $submit ";
755 }
756
757 if ($reset === ':reset:')
758 {
759 $reset = " " . $this->registry->modules['localize']->string('Reset') . " ";
760 }
761 else
762 {
763 $reset = (($reset) ? " $reset " : '');
764 }
765
766 $output = "\n\t\t<input type=\"submit\" class=\"button\" name=\"__submit__\" value=\"$submit\" accesskey=\"s\" />";
767 $output .= ($reset ? "\n\t\t<input type=\"reset\" class=\"button\" name=\"__reset__\" value=\"$reset\" accesskey=\"r\" />" : '');
768 $output .= ($extra ? "\n\t\t$extra" : '');
769 $output .= "\n\t";
770 $this->row_tfoot($output, $colspan);
771 }
772
773 // ###################################################################
774 /**
775 * Creates an upload row; you need to specify some other paramaters in
776 * form_start() for this to work
777 *
778 * @access public
779 *
780 * @param string Label text
781 * @param string Upload name
782 * @param integer Colspan attribute
783 */
784 function row_upload($label, $name, $colspan = 2)
785 {
786 $this->row_text($label, "<input type=\"file\" class=\"button\" name=\"$name\" size=\"35\" />", 'top', $colspan);
787 }
788
789 // ###################################################################
790 /**
791 * Adds a name-value pair to an array that is constructed into a
792 * <select> list
793 *
794 * @access public
795 *
796 * @param string Text displayed for the option
797 * @param string Value of the option
798 * @param bool Whether or not to select this particluar option
799 */
800 function list_item($name, $value, $selected = false)
801 {
802 global $listitem;
803
804 $listitem[] = "\n\t<option value=\"$value\"" . (($selected == true) ? ' selected="selected"' : '') . ">$name</option>";
805 }
806
807 // ###################################################################
808 /**
809 * Assembles a <select> table row from list_item() items
810 *
811 * @access public
812 *
813 * @param string Label text
814 * @param string Name of the <select>
815 * @param bool Automatically submit the form on a change?
816 * @param integer Colspan attribute
817 */
818 function row_list($label, $name, $is_jump = false, $colspan = 2)
819 {
820 global $listitem;
821
822 foreach ($listitem AS $option)
823 {
824 $optionlist .= $option;
825 }
826
827 $listitem = '';
828
829 $this->row_text($label, "\n<select class=\"button\" name=\"$name\"" . (($is_jump) ? " onchange=\"this.form.submit();\"" : '') . ">$optionlist\n</select>" . (($is_jump) ? "\n<input type=\"submit\" class=\"button\" value=\" " . $this->registry->modules['localize']->string('Go') . " \" accesskey=\"g\" />" : '') . "\n", $colspan);
830 }
831
832 // ###################################################################
833 /**
834 * Creates a row with two radio buttons: yes and now
835 *
836 * @access public
837 *
838 * @param string Label text
839 * @param string Name of the BOOL flag
840 * @param bool TRUE to select the YES by default; FALSE for NO
841 * @param integer Colspan attribute
842 */
843 function row_yesno($label, $name, $value, $colspan = 2)
844 {
845 $this->row_text($label, "<input type=\"radio\" name=\"$name\" value=\"1\"" . (($value) ? ' checked="checked"' : '') . " /> " . $this->registry->modules['localize']->string('Yes') . " <input type=\"radio\" name=\"$name\" value=\"0\"" . ((!$value) ? ' checked="checked"' : '') . " /> " . $this->registry->modules['localize']->string('No'), $colspan);
846 }
847 }
848
849 /*=====================================================================*\
850 || ###################################################################
851 || # $HeadURL$
852 || # $Id$
853 || ###################################################################
854 \*=====================================================================*/
855 ?>