]>
src.bluestatic.org Git - isso.git/blob - PrinterRootElementForm.php
2 /*=====================================================================*
3 || ###################################################################
4 || # Blue Static ISSO Framework
5 || # Copyright (c)2002-2007 Blue Static
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 2 of the License.
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
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 \*=====================================================================*/
23 * Printer Root Element: Form (PrinterRootElementForm.php)
28 require_once('ISSO/PrinterRootElement.php');
31 * Printer Root Element: Form
33 * Represents a <form> object. This can have a parent or not: if it does,
34 * then it will be painted as a child, otherwise it will act as a root.
37 * @copyright Copyright (c)2002 - 2007, Blue Static
41 class BSPrinterRootElementForm
extends BSPrinterRootElement
44 * The form's action (or the controller to respond to)
62 * This form is upload-ready
67 // ###################################################################
71 public function __construct($controller, $action, $name = 'issoform')
73 $this->controller
= $controller;
74 $this->action
= $action;
78 // ###################################################################
80 * Should this form be used for upload?
84 public function setUpload($upload)
86 $this->upload
= $upload;
89 // ###################################################################
91 * Adds a table row into the child list
93 * @param BSPrinterElement Table element
95 public function addChild(BSPrinterElement
$tr)
97 $this->children
[] = $tr;
100 // ###################################################################
102 * Returns the HTML for all printed children elements
104 * @return string Printed HTML
106 protected function _paintChildren()
110 foreach ($this->children
AS $child)
112 $builder .= "\n" . $child->paint();
118 // ###################################################################
122 * @return string Table HTML code
124 public function paint()
126 array_push($this->children
, new BSPrinterBaseElement('hidden', 'action', $this->action
));
128 return "\n<form name=\"" . $this->name
. "\" action=\"" . $this->controller
. "\" method=\"post\"" . ($this->upload
? ' enctype="mime/multi-part"' : '') . ">\n" . $this->_paintChildren() . "\n</form>";