]>
src.bluestatic.org Git - isso.git/blob - PrinterRootElementForm.php
2 /*=====================================================================*
3 || ###################################################################
4 || # Blue Static ISSO Framework
5 || # Copyright ©2002-[#]year[#] 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 [#]gpl[#] 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 - [#]year[#], Blue Static
42 class BSPrinterRootElementForm
extends BSPrinterRootElement
45 * The form's action (or the controller to respond to)
63 * This form is upload-ready
68 // ###################################################################
72 public function __construct($controller, $action, $name = 'issoform')
74 $this->controller
= $controller;
75 $this->action
= $action;
79 // ###################################################################
81 * Should this form be used for upload?
85 public function setUpload($upload)
87 $this->upload
= $upload;
90 // ###################################################################
92 * Adds a table row into the child list
94 * @param BSPrinterElement Table element
96 public function addChild(BSPrinterElement
$tr)
98 $this->children
[] = $tr;
101 // ###################################################################
103 * Returns the HTML for all printed children elements
105 * @return string Printed HTML
107 protected function _paintChildren()
111 foreach ($this->children
AS $child)
113 $builder .= "\n" . $child->paint();
119 // ###################################################################
123 * @return string Table HTML code
125 public function paint()
127 if (BSRegister
::GetType('Router') AND (!defined('ISSO_ROUTER_NO_REWRITE') OR !constant('ISSO_ROUTER_NO_REWRITE')))
129 $action = $this->controller
. "." . $this->action
;
131 else if (BSRegister
::GetType('Router'))
133 $action = 'index.php?controller=' . $this->controller
. '&action=' . $this->action
;
137 $action = $this->controller
;
138 array_push($this->children
, new BSPrinterBaseElement('hidden', 'action', $this->action
));
140 return "\n<form name=\"" . $this->name
. "\" action=\"$action\" method=\"post\"" . ($this->upload
? ' enctype="mime/multi-part"' : '') . ">\n" . $this->_paintChildren() . "\n</form>";
144 /*=====================================================================*
145 || ###################################################################
148 || ###################################################################
149 \*=====================================================================*/