]>
src.bluestatic.org Git - isso.git/blob - PrinterRootForm.php
2 /*=====================================================================*
3 || ###################################################################
4 || # Blue Static ISSO Framework
5 || # Copyright (c)2005-2008 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 (PrinterRootForm.php)
28 require_once(ISSO
. '/PrinterRootAbstract.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)2005 - 2008, Blue Static
41 class BSPrinterRootForm
extends BSPrinterRootAbstract
62 * This form is upload-ready
70 public function __construct($action, $do, $name = 'issoform')
72 $this->action
= $action;
78 * Makes a new instance of the object in a static fashion
82 public static function make()
84 $obj = new ReflectionClass(__CLASS__
);
85 $args = func_get_args();
86 return $obj->newInstanceArgs($args);
90 * Should this form be used for upload?
94 * @return fluent interface
96 public function setUpload($upload)
98 $this->upload
= $upload;
103 * Adds a table row into the child list
105 * @param BSPrinterAbstract Table element
107 * @return fluent interface
109 public function addChild(BSPrinterAbstract
$tr)
111 $this->children
[] = $tr;
116 * Returns the HTML for all printed children elements
118 * @return string Printed HTML
120 protected function _paintChildren()
124 foreach ($this->children
as $child)
126 $builder .= "\n" . $child->paint();
135 * @return string Table HTML code
137 public function paint()
139 array_push($this->children
, new BSPrinterElement('hidden', 'do', $this->do));
141 return "\n<form name=\"" . $this->name
. "\" action=\"" . $this->action
. "\" method=\"post\"" . ($this->upload
? ' enctype="mime/multi-part"' : '') . ">\n" . $this->_paintChildren() . "\n</form>";