3 * This class simply puts HTML code / JavaScript code or CSS code out to the
6 * @author Roland Haeder <webmaster@ship-simu.org>
8 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
9 * @license GNU GPL 3.0 or any newer version
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 class WebOutput extends BaseFrameworkSystem implements OutputStreamer {
26 * The instance for the singleton design pattern
28 private static $webInstance = null;
35 private function __construct () {
36 // Call parent constructor
37 parent::constructor(__CLASS__);
40 $this->setPartDescr("Web-Ausgabe-Handler");
42 // Create an unique ID
43 $this->createUniqueID();
47 * Create a new web output system and set the content type
49 * @param $contentType A valid content-type
50 * @return $debugInstance An instance of this middleware class
52 public final static function createWebOutput ($contentType) {
53 // Is there no instance?
54 if (is_null(self::$webInstance)) {
55 // Cast the content-type to string and trim it
56 $contentType = (string) $contentType;
57 $contentType = trim($contentType);
59 // Set the content type
60 if (!empty($contentType)) {
61 @header(sprintf("Content-type: %s",
66 // Get a new instance and set it
67 self::$webInstance = new WebOutput();
71 return self::$webInstance;
75 * Assigns a variable for output
77 * @param $var The variable we shall assign
78 * @param $value The value to store in the variable
81 public function assignVariable($var, $value) {
82 // Stub message because we don't have it here
83 trigger_error(__METHOD__.": Stub!");
91 public final function output ($outStream=false) {