inc/classes/exceptions/database/local_file/class_SavePathIsNoDirectoryException.php -text
inc/classes/exceptions/database/local_file/class_SavePathReadProtectedException.php -text
inc/classes/exceptions/database/local_file/class_SavePathWriteProtectedException.php -text
+inc/classes/exceptions/helper/.htaccess -text
+inc/classes/exceptions/helper/class_FormClosedException.php -text
+inc/classes/exceptions/helper/class_FormGroupClosedException.php -text
+inc/classes/exceptions/helper/class_FormOpenedException.php -text
+inc/classes/exceptions/helper/class_InvalidFormNameException.php -text
inc/classes/exceptions/io/.htaccess -text
inc/classes/exceptions/io/class_DirPointerNotOpenedException.php -text
inc/classes/exceptions/io/class_FilePointerNotOpenedException.php -text
inc/classes/exceptions/template/class_BasePathIsEmptyException.php -text
inc/classes/exceptions/template/class_BasePathIsNoDirectoryException.php -text
inc/classes/exceptions/template/class_BasePathReadProtectedException.php -text
-inc/classes/exceptions/template/class_FormClosedException.php -text
-inc/classes/exceptions/template/class_FormOpenedException.php -text
inc/classes/exceptions/template/class_InvalidBasePathStringException.php -text
-inc/classes/exceptions/template/class_InvalidFormNameException.php -text
inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php -text
inc/classes/exceptions/template/class_UnexpectedTemplateTypeException.php -text
inc/classes/exceptions/template/class_UnsupportedTemplateEngineException.php -text
inc/classes/main/factories/web/class_NewsFactory.php -text
inc/classes/main/helper/.htaccess -text
inc/classes/main/helper/class_ -text
-inc/classes/main/helper/class_BaseTemplateHelper.php -text
+inc/classes/main/helper/class_BaseHelper.php -text
inc/classes/main/helper/web/.htaccess -text
-inc/classes/main/helper/web/class_HtmlFormHelper.php -text
+inc/classes/main/helper/web/class_WebFormHelper.php -text
inc/classes/main/io/.htaccess -text
inc/classes/main/io/class_FileIoStream.php -text
inc/classes/main/io/class_FrameworkDirectoryPointer.php -text
-<!-- A compileable template for the application selector //-->
-
{?header?}
{?navigation?}
<div id="main_header">
- [HEADER_APPLICATION_SELECTOR]
+[HEADER_APPLICATION_SELECTOR]
</div>
<div id="main_content">
- {?selector_apps?}
+{?selector_apps?}
+</div>
+
+<div id="main_footer">
+[FOOTER_APPLICATION_SELECTOR]
</div>
-{?footer_msg:footer_msg=[FOOTER_APPLICATION_SELECTOR]?}
+{?footer?}
// CFG: HOME-WITH-NEWS
$cfg->setConfigEntry("home_with_news", "Y");
+// CFG: FORM-ACTION
+$cfg->setConfigEntry("form_action", "index.php?app={?app_short_name?}&page=do_form");
+
+// CFG: FORM-METHOD
+$cfg->setConfigEntry("form_method", "post");
+
+// CFG: FORM-TARGET
+$cfg->setConfigEntry("form_target", "_self");
+
+// CFG: REGISTRATION-REQUIRES-EMAIL
+$cfg->setConfigEntry("register_requires_email", "Y");
+
+// CFG: REGISTRATION-INCLUDES-PROFILE
+$cfg->setConfigEntry("register_includes_profile", "Y");
+
+// CFG: REGISTRATION-PERSONAL-DATA
+$cfg->setConfigEntry("register_personal_data", "Y");
+
+// CFG: CHAT-ENABLED-ICQ
+$cfg->setConfigEntry("chat_enabled_icq", "Y");
+
+// CFG: CHAT-ENABLED-JABBER
+$cfg->setConfigEntry("chat_enabled_jabber", "Y");
+
+// CFG: CHAT-ENABLED-YAHOO
+$cfg->setConfigEntry("chat_enabled_yahoo", "Y");
+
+// CFG: CHAT-ENABLED-AOL
+$cfg->setConfigEntry("chat_enabled_aol", "Y");
+
+// CFG: CHAT-ENABLED-MSN
+$cfg->setConfigEntry("chat_enabled_msn", "Y");
+
+// CFG: COMMAND-PARAMETER
+$cfg->setConfigEntry("command_parameter", "page");
+
// [EOF]
?>
<meta name="keywords" content="$config[meta_keywords]" />
<meta name="robots" content="index,follow" />
<meta name="description" content="$config[meta_description]" />
- <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="content-style-type" content="text/css" />
<meta http-equiv="content-script-type" content="text/javascript" />
<meta http-equiv="language" content="de" />
<?php
-// Get helper instance for HTML forms. This will add the opening form-tag to
+// Get helper instance for web forms. This will add the opening form-tag to
// the helper's render cache which is simply a small variable in the class
-// BaseTemplateHelper.
-$helper = HtmlFormHelper::createHtmlFormHelper($this, "register_form");
+// BaseHelper.
+$helper = WebFormHelper::createWebFormHelper($this, "shipsimu_register");
// Nickname und Passwort sollten immer abgefragt werden, die Email als Loginname
// wuerde aber auch gehen.
$helper->addFormGroup("login", "Bitte gebe hier gewünschten Nickname und dein Zugangspasswort ein.");
-$helper->addFormSubGroup("username", "Dein Nickname wird nach Absenden des Formulares erst geprüft. Später bauen wir dann einen automatischen Test ein, der dir sofort zeigt, ob der Nickname bereits vergeben ist.");
+$helper->addFormSubGroup("username", "Dein Nickname wird erst nach Absenden des Formulares geprüft. Später bauen wir dann einen automatischen Test ein, der dir sofort zeigt, ob der Nickname bereits vergeben ist.");
$helper->addFieldText("username", "Nickname im Spiel:");
$helper->addInputTextField("username", 10, 255);
$helper->addFormSubGroup("password", "Dein Passwort sollte nicht zu leicht erratbar sein. Später bauen wir hier noch einen automatischen Test ein, der dir sofort die Passwortstärke anzeigt.");
$helper->addFieldText("pass2", "Passwortwiederholung:");
$helper->addInputPasswordField("pass2", 5, 255);
-if ($helper->ifRegistrationRequiresEmailVerification()) {
+if ($helper->ifRegisterRequiresEmailVerification()) {
$helper->addFormGroup("email", "Bitte gebe deine Email zweimal (ein zweites Mal zur Bestätigung) ein, damit wir dir deinen Freischaltlink zusenden können.");
$helper->addFieldText("email1", "Email-Adresse:");
$helper->addInputTextField("email1", 15, 255);
$helper->addInputTextField("email2", 15, 255);
} // END - email verification
-if ($helper->ifRegistrationIncludesProfile()) {
+if ($helper->ifRegisterIncludesProfile()) {
$helper->addFormGroup("profile", "Hier kannst du zusätzlich deine Profildaten vorweg eingeben, du kannst sie aber auch nach dem Login vervollständigen!");
- if (!$helper->ifRegistrationRequiresEmailVerification()) {
+ if (!$helper->ifRegisterRequiresEmailVerification()) {
$helper->addFormSubGroup("email", "Die Angabe deiner Email-Adresse ist nur dann nötig, wenn du auch Email-Benachrichtigungen (<span id=\"add_note\">*1</span>) haben möchtest.");
$helper->addFieldText("email1", "Email-Adresse:");
$helper->addInputTextField("email1", 15, 255);
} // END - No email verification
// Persoenliche Daten mit in der Anmeldung abfragen?
- if ($helper->ifRegistrationIncludesPersonaData()) {
+ if ($helper->ifRegisterIncludesPersonaData()) {
$helper->addFormSubGroup("persona", "Wenn du magst, dann vervollständige deine komplette Adresse mit deinem Namen.");
$helper->addFieldText("surname", "Dein Vorname:");
$helper->addInputTextField("surname", 10, 255);
}
if ($helper->ifChatEnabled("jabber")) {
$helper->addFieldText("jabber", "Jabber:");
- $helper->addInputTextField("jabber", 10, 15);
+ $helper->addInputTextField("jabber", 15, 50);
}
if ($helper->ifChatEnabled("yahoo")) {
$helper->addFieldText("yahoo", "Yahoo!:");
- $helper->addInputTextField("yahoo", 10, 15);
+ $helper->addInputTextField("yahoo", 15, 50);
}
if ($helper->ifChatEnabled("aol")) {
$helper->addFieldText("aol", "AOL-Screenname:");
- $helper->addInputTextField("aol", 10, 15);
+ $helper->addInputTextField("aol", 15, 50);
}
if ($helper->ifChatEnabled("msn")) {
$helper->addFieldText("msn", "MSN:");
- $helper->addInputTextField("msn", 10, 15);
+ $helper->addInputTextField("msn", 15, 50);
}
- if (!$helper->ifRegistrationRequiresEmailVerification()) {
+ if (!$helper->ifRegisterRequiresEmailVerification()) {
$helper->addFormExtraNote(1, "Die Benachrichtigungen per sind im Loginbereich verfeinerbar, welche du genau haben willst.");
} // END - Extra note
} // END - ask profile data
// Spielregeln abfragen
$helper->addFormGroup("rules", "Bitte lese dir die Spieleregeln gut durch und kreuze dann "Ja, ich akzeptiere die aktuellen Spielregeln" an.");
+$helper->addFieldText("rules", "Ja, ich akzeptiere die aktuellen Spielregeln:");
$helper->addInputCheckboxField("rules", false);
// Abschliessender Hinweis und Abschluss des Formulars
+$helper->addFormGroup("buttons", "Wenn du alle benötigten Felder korrekt ausgefüt hast, kannst du die Anmeldung abschliessen.");
+$helper->addInputResetButton("Alles nochmal eingeben");
+$helper->addInputSubmitButton("Anmeldung zum Spiel abschliessen");
$helper->addFormNote("Deine Daten werden nach den gültigen Datenschutzgesetzten gespeichert und werden nicht an Dritte weitergegeben. Weiteres dazu siehe Link "Datenschutz".");
$helper->addFormTag();
$helper->flushContent();
</div>
<div id="register_box">
- {?register_form?}
+ {?shipsimu_register?}
</div>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An exception thrown when the form is still closed but input field shall be
+ * added to it. This should normally not happen, but well, who knows?
+ *
+ * @author Roland Haeder <webmaster@mxchange.org>
+ * @version 0.0.0
+ * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class FormClosedException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $classArray Class throwing the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public function __construct (array $classArray, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Could not add form element <u>%s</u> because form is closed.",
+ $classArray[0]->__toString(),
+ $this->getLine(),
+ $classArray[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when a form group is still closed.
+ *
+ * @author Roland Haeder <webmaster@mxchange.org>
+ * @version 0.0.0
+ * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class FormGroupClosedException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $classArray Class throwing the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public function __construct (array $classArray, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Could not add sub group <u>%s</u> because no form group has been opened before.",
+ $classArray[0]->__toString(),
+ $this->getLine(),
+ $classArray[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when the form is still opened but we e.g. shall flush
+ * the content.
+ *
+ * @author Roland Haeder <webmaster@mxchange.org>
+ * @version 0.0.0
+ * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class FormOpenedException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $class Class throwing the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public function __construct (BaseFrameworkSystem $class, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Form is not yet closed. Close it with method <u>%s::addFormTag()</u> and add no parameters.",
+ $class->__toString(),
+ $this->getLine(),
+ $class->__toString()
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when the form name is invalid (set to false)
+ *
+ * @author Roland Haeder <webmaster@mxchange.org>
+ * @version 0.0.0
+ * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class InvalidFormNameException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $class Class throwing the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public function __construct (BaseFrameworkSystem $class, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Form name not set.",
+ $class->__toString(),
+ $this->getLine()
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when the form is still closed but input field shall be
- * added to it. This should normally not happen, but well, who knows?
- *
- * @author Roland Haeder <webmaster@mxchange.org>
- * @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class FormClosedException extends FrameworkException {
- /**
- * The constructor
- *
- * @param $classArray Class throwing the exception
- * @param $code Code number for the exception
- * @return void
- */
- public function __construct (array $classArray, $code) {
- // Add a message around the missing class
- $message = sprintf("[%s:%d] Could not add form element <u>%s</u> because form is closed.",
- $classArray[0]->__toString(),
- $this->getLine(),
- $classArray[1]
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when the form is still opened but we e.g. shall flush
- * the content.
- *
- * @author Roland Haeder <webmaster@mxchange.org>
- * @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class FormOpenedException extends FrameworkException {
- /**
- * The constructor
- *
- * @param $class Class throwing the exception
- * @param $code Code number for the exception
- * @return void
- */
- public function __construct (BaseFrameworkSystem $class, $code) {
- // Add a message around the missing class
- $message = sprintf("[%s:%d] Form is not yet closed. Close it with method <u>%s::addFormTag()</u> and add no parameters.",
- $class->__toString(),
- $this->getLine(),
- $class->__toString()
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when the form name is invalid (set to false)
- *
- * @author Roland Haeder <webmaster@mxchange.org>
- * @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class InvalidFormNameException extends FrameworkException {
- /**
- * The constructor
- *
- * @param $class Class throwing the exception
- * @param $code Code number for the exception
- * @return void
- */
- public function __construct (BaseFrameworkSystem $class, $code) {
- // Add a message around the missing class
- $message = sprintf("[%s:%d] Form name not set.",
- $class->__toString(),
- $this->getLine()
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
* @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
+ * @deprecated
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* The constructor
*
* @param $classArray An array holding our informations
- * @param $code Code number for the exception
+ * @param $code Code number for the exception
* @return void
*/
public function __construct (array $classArray, $code) {
}
/**
- * Output a partial stub message for the given method name
+ * Output a partial stub message for the caller method
*
- * @param $methodName Name of the partially finished method
* @return void
*/
- protected function partialStub ($methodName) {
+ protected function partialStub () {
+ // Get the backtrace
+ $backtrace = debug_backtrace();
+
+ // Generate the class::method string
+ $methodName = "UnknownClass::unknownMethod";
+ if ((isset($backtrace[1]['class'])) && (isset($backtrace[1]['function']))) {
+ $methodName = $backtrace[1]['class']."::".$backtrace[1]['function'];
+ }
+
// Debug instance is there?
if (!is_null($this->getDebugInstance())) {
// Output stub message
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class extends BaseTemplateHelper {
+class extends BaseHelper {
/**
* Private constructor
*
--- /dev/null
+<?php
+/**
+ * A generic helper class with generic methods
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class BaseHelper extends BaseFrameworkSystem {
+ /**
+ * Template engine instance
+ */
+ private $templateInstance = null;
+
+ /**
+ * Rendered content created by the helper class
+ */
+ private $content = "";
+
+ /**
+ * Private constructor
+ *
+ * @param $className Real name of the class
+ * @return void
+ */
+ protected function __construct ($className) {
+ // Call parent constructor
+ parent::__construct($className);
+
+ // Create unique ID number
+ $this->createUniqueID();
+
+ // Clean up a little
+ $this->removeNumberFormaters();
+ $this->removeSystemArray();
+ }
+
+ /**
+ * Setter for template engine instances
+ *
+ * @param $templateInstance An instance of a template engine class
+ * @return void
+ */
+ protected final function setTemplateInstance (CompileableTemplate $templateInstance) {
+ $this->templateInstance = $templateInstance;
+ }
+
+ /**
+ * Getter for template engine instances
+ *
+ * @return $templateInstance An instance of a template engine class
+ */
+ protected final function getTemplateInstance () {
+ return $this->templateInstance;
+ }
+
+ /**
+ * Add content
+ *
+ * @param $newContent New content to add
+ * @return void
+ */
+ protected final function addContent ($newContent) {
+ $this->content .= (string) trim($newContent)."\r\n";
+ }
+
+ /**
+ * Getter for content
+ *
+ * @return $content The rendered content by this helper
+ */
+ protected final function getContent () {
+ return $this->content;
+ }
+}
+
+// [EOF]
+?>
+++ /dev/null
-<?php
-/**
- * A generic helper class with generic methods
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class BaseTemplateHelper extends BaseFrameworkSystem {
- /**
- * Template engine instance
- */
- private $templateInstance = null;
-
- /**
- * Rendered content created by the helper class
- */
- private $content = "";
-
- /**
- * Private constructor
- *
- * @param $className Real name of the class
- * @return void
- */
- protected function __construct ($className) {
- // Call parent constructor
- parent::__construct($className);
-
- // Create unique ID number
- $this->createUniqueID();
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
- }
-
- /**
- * Setter for template engine instances
- *
- * @param $templateInstance An instance of a template engine class
- * @return void
- */
- public final function setTemplateInstance (CompileableTemplate $templateInstance) {
- $this->templateInstance = $templateInstance;
- }
-
- /**
- * Getter for template engine instances
- *
- * @return $templateInstance An instance of a template engine class
- */
- public final function getTemplateInstance () {
- return $this->templateInstance;
- }
-
- /**
- * Add content
- *
- * @param $newContent New content to add
- * @return void
- */
- public final function addContent ($newContent) {
- $this->content .= (string) trim($newContent)."\r\n";
- }
-
- /**
- * Getter for content
- *
- * @return $content The rendered content by this helper
- */
- public final function getContent () {
- return $this->content;
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * A helper for constructing HTML forms
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class HtmlFormHelper extends BaseTemplateHelper {
- /**
- * Wether the form tag is opened (keep at false or else your forms will
- * never work!)
- */
- private $formOpened = false;
-
- /**
- * Name of the form
- */
- private $formName = "";
-
- /**
- * Wether the group is opened or not
- */
- private $groupOpened = false;
-
- /**
- * Wether the sub group is opened or not
- */
- private $subGroupOpened = false;
-
- // Class Constants
- const EXCEPTION_FORM_NAME_INVALID = 0xb00;
- const EXCEPTION_CLOSED_FORM = 0xb01;
- const EXCEPTION_OPENED_FORM = 0xb02;
-
- /**
- * Private constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("HTML-Formularhilfsklasse");
- }
-
- /**
- * Creates the helper class with the given template engine instance and form name
- *
- * @param $templateInstance An instance of a valid template engine
- * @param $formName Name of the form
- * @param $formId Value for "id" attribute (default: $formName)
- * @return $helperInstance A preparedf instance of this class
- */
- public final static function createHtmlFormHelper (CompileableTemplate $templateInstance, $formName, $formId = false) {
- // Get new instance
- $helperInstance = new HtmlFormHelper();
-
- // Set template instance
- $helperInstance->setTemplateInstance($templateInstance);
-
- // Is the form id not set?
- if ($formId === false) {
- // Use form id from form name
- $formId = $formName;
- }
-
- // Create the form
- $helperInstance->addFormTag($formName, $formId);
-
- // Return the prepared instance
- return $helperInstance;
- }
-
- /**
- * Add the form tag or close it an already opened form tag
- *
- * @param $formName Name of the form (default: false)
- * @param $formId Id of the form (attribute "id"; default: false)
- * @return void
- * @throws InvalidFormNameException If the form name is invalid (=false)
- */
- public function addFormTag ($formName = false, $formId = false) {
- // When the form is not yet opened at least form name must be valid
- if ((!$this->formOpened) && ($formName === false)) {
- // Thrown an exception
- throw new InvalidFormNameException ($this, self::EXCEPTION_FORM_NAME_INVALID);
- }
-
- // Close the form is default
- $formContent = "</form>";
-
- // Check wether we shall open or close the form
- if (!$this->formOpened) {
- // Add HTML code
- $formContent = sprintf("<form name=\"%s\" action=\"%s\" method=\"%s\" target=\"%s\"",
- $formName,
- $this->getConfigInstance()->readConfig("form_action"),
- $this->getConfigInstance()->readConfig("form_method"),
- $this->getConfigInstance()->readConfig("form_target")
- );
-
- // Is the form id set?
- if ($formId !== false) {
- // Then add it as well
- $formContent .= sprintf(" id=\"%s\"",
- $formId
- );
- }
-
- // Add close bracket
- $formContent .= ">";
-
- // Open the form and remeber the form name
- $this->formOpened = true;
- $this->formName = $formName;
- } else {
- // Add the hidden field required to identify safely this form
- $this->addInputHiddenField("form", $this->formName);
-
- // @TODO Add some unique PIN here to bypass problems with some browser and/or extensions
- // Simply close it
- $this->formOpened = false;
- }
-
- // Add it to the content
- $this->addContent($formContent);
- }
-
- /**
- * Add an input tag to the form or throw an exception if it is not yet
- * opened. The field's name will be set as id.
- *
- * @param $fieldName Input field name
- * @param $fieldSize Input size
- * @param $fieldMaxLength Input max length
- * @param $fieldValue Input default value (default: empty)
- * @return void
- * @throws FormClosedException If the form is not yet opened
- */
- public function addInputTextField ($fieldName, $fieldSize, $fieldMaxLength, $fieldValue = "") {
- // Is the form opened?
- if (!$this->formOpened) {
- // Throw an exception
- throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
- }
-
- // Generate the content
- $inputContent = sprintf("<input type=\"text\" id=\"%s\" name=\"%s\" size=\"%d\" maxlength=\"%d\" value=\"%s\" />",
- $fieldName, $fieldName, $fieldSize, $fieldMaxLength, $fieldValue);
-
- // And add it
- $this->addContent($inputContent);
- }
-
- /**
- * Flushs the content out (not yet secured against open forms, etc.!) or
- * throw an exception if it is not yet closed
- *
- * @return void
- * @throws FormOpenedException If the form is still open
- */
- public function flushContent () {
- // Is the form opened?
- if ($this->formOpened) {
- // Throw an exception
- throw new FormOpenedException ($this, self::EXCEPTION_OPENED_FORM);
- }
-
- // Send content to template engine
- $this->getTemplateInstance()->assignVariable($this->formName, $this->getContent());
- }
-
- /**
- * Add a form group or close an already opened and open a new one
- *
- * @param $groupName Name of the group
- * @param $groupText Text including HTML to show above this group
- * @return void
- * @throws EmptyVariableException If $groupName is not set
- */
- public function addFormGroup ($groupName, $groupText) {
- // At least the group name should be set
- if (empty($groupName)) {
- // Throw exception here
- throw new EmptyVariableException(array($this, 'groupName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
- }
-
- // Not fully finished!
- $this->partialStub(__METHOD__);
-
- // Is this group opened?
- if (!$this->groupOpened) {
- // Switch the state
- $this->groupOpened = true;
- } else {
- // Switch the state
- $this->groupOpened = false;
-
- // All call it again
- $this->addFormGroup($groupName, $groupText);
- }
- }
-}
-
-// [EOF]
-?>
--- /dev/null
+<?php
+/**
+ * A helper for constructing web forms
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class WebFormHelper extends BaseHelper {
+ /**
+ * Wether the form tag is opened (keep at false or else your forms will
+ * never work!)
+ */
+ private $formOpened = false;
+
+ /**
+ * Name of the form
+ */
+ private $formName = "";
+
+ /**
+ * Wether the group is opened or not
+ */
+ private $groupOpened = false;
+
+ /**
+ * Wether the sub group is opened or not
+ */
+ private $subGroupOpened = false;
+
+ /**
+ * Name of the sub group
+ */
+ private $subGroupName = "";
+
+ // Class Constants
+ const EXCEPTION_FORM_NAME_INVALID = 0xb00;
+ const EXCEPTION_CLOSED_FORM = 0xb01;
+ const EXCEPTION_OPENED_FORM = 0xb02;
+ const EXCEPTION_UNEXPECTED_CLOSED_GROUP = 0xb03;
+
+ /**
+ * Private constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Set part description
+ $this->setObjectDescription("HTML-Formularhilfsklasse");
+ }
+
+ /**
+ * Creates the helper class with the given template engine instance and form name
+ *
+ * @param $templateInstance An instance of a valid template engine
+ * @param $formName Name of the form
+ * @param $formId Value for "id" attribute (default: $formName)
+ * @return $helperInstance A preparedf instance of this class
+ */
+ public final static function createWebFormHelper (CompileableTemplate $templateInstance, $formName, $formId = false) {
+ // Get new instance
+ $helperInstance = new WebFormHelper();
+
+ // Set template instance
+ $helperInstance->setTemplateInstance($templateInstance);
+
+ // Is the form id not set?
+ if ($formId === false) {
+ // Use form id from form name
+ $formId = $formName;
+ }
+
+ // Create the form
+ $helperInstance->addFormTag($formName, $formId);
+
+ // Return the prepared instance
+ return $helperInstance;
+ }
+
+ /**
+ * Add the form tag or close it an already opened form tag
+ *
+ * @param $formName Name of the form (default: false)
+ * @param $formId Id of the form (attribute "id"; default: false)
+ * @return void
+ * @throws InvalidFormNameException If the form name is invalid (=false)
+ */
+ public function addFormTag ($formName = false, $formId = false) {
+ // When the form is not yet opened at least form name must be valid
+ if (($this->formOpened === false) && ($formName === false)) {
+ // Thrown an exception
+ throw new InvalidFormNameException ($this, self::EXCEPTION_FORM_NAME_INVALID);
+ }
+
+ // Close the form is default
+ $formContent = "</form>";
+
+ // Check wether we shall open or close the form
+ if ($this->formOpened === false) {
+ // Add HTML code
+ $formContent = sprintf("<form name=\"%s\" class=\"forms\" action=\"%s\" method=\"%s\" target=\"%s\"",
+ $formName,
+ $this->getConfigInstance()->readConfig("form_action"),
+ $this->getConfigInstance()->readConfig("form_method"),
+ $this->getConfigInstance()->readConfig("form_target")
+ );
+
+ // Is the form id set?
+ if ($formId !== false) {
+ // Then add it as well
+ $formContent .= sprintf(" id=\"%s_form\"",
+ $formId
+ );
+ }
+
+ // Add close bracket
+ $formContent .= ">";
+
+ // Open the form and remeber the form name
+ $this->formOpened = true;
+ $this->formName = $formName;
+ } else {
+ // Add the hidden field required to identify safely this form
+ $this->addInputHiddenField("form", $this->formName);
+
+ // Is a group open?
+ if ($this->groupOpened === true) {
+ // Then automatically close it here
+ $this->addFormGroup("", "");
+ }
+
+ // @TODO Add some unique PIN here to bypass problems with some browser and/or extensions
+ // Simply close it
+ $this->formOpened = false;
+ }
+
+ // Add it to the content
+ $this->addContent($formContent);
+ }
+
+ /**
+ * Add a text input tag to the form or throw an exception if it is not yet
+ * opened. The field's name will be set as id.
+ *
+ * @param $fieldName Input field name
+ * @param $fieldSize Input size
+ * @param $fieldMaxLength Input max length
+ * @param $fieldValue Input default value (default: empty)
+ * @return void
+ * @throws FormClosedException If the form is not yet opened
+ */
+ public function addInputTextField ($fieldName, $fieldSize, $fieldMaxLength, $fieldValue = "") {
+ // Is the form opened?
+ if ($this->formOpened === false) {
+ // Throw an exception
+ throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
+ }
+
+ // Generate the content
+ $inputContent = sprintf("<input type=\"text\" class=\"textfield\" id=\"%s\" name=\"%s\" size=\"%d\" maxlength=\"%d\" value=\"%s\" />",
+ $fieldName, $fieldName, $fieldSize, $fieldMaxLength, $fieldValue);
+
+ // And add it maybe with a "li" tag
+ $this->addContent($inputContent);
+ }
+
+ /**
+ * Add a password input tag to the form or throw an exception if it is not
+ * yet opened. The field's name will be set as id.
+ *
+ * @param $fieldName Input field name
+ * @param $fieldSize Input size
+ * @param $fieldMaxLength Input max length
+ * @param $fieldValue Input default value (default: empty)
+ * @return void
+ * @throws FormClosedException If the form is not yet opened
+ */
+ public function addInputPasswordField ($fieldName, $fieldSize, $fieldMaxLength, $fieldValue = "") {
+ // Is the form opened?
+ if ($this->formOpened === false) {
+ // Throw an exception
+ throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
+ }
+
+ // Generate the content
+ $inputContent = sprintf("<input type=\"password\" class=\"password\" id=\"%s\" name=\"%s\" size=\"%d\" maxlength=\"%d\" value=\"%s\" />",
+ $fieldName, $fieldName, $fieldSize, $fieldMaxLength, $fieldValue);
+
+ // And add it
+ $this->addContent($inputContent);
+ }
+
+ /**
+ * Add a hidden input tag to the form or throw an exception if it is not
+ * yet opened. The field's name will be set as id.
+ *
+ * @param $fieldName Input field name
+ * @param $fieldValue Input default value (default: empty)
+ * @return void
+ * @throws FormClosedException If the form is not yet opened
+ */
+ public function addInputHiddenField ($fieldName, $fieldValue = "") {
+ // Is the form opened?
+ if ($this->formOpened === false) {
+ // Throw an exception
+ throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
+ }
+
+ // Generate the content
+ $inputContent = sprintf("<input type=\"hidden\" name=\"%s\" value=\"%s\" />",
+ $fieldName,
+ $fieldValue
+ );
+
+ // And add it
+ $this->addContent($inputContent);
+ }
+
+ /**
+ * Add a checkbox input tag to the form or throw an exception if it is not
+ * yet opened. The field's name will be set as id.
+ *
+ * @param $fieldName Input field name
+ * @param $fieldChecked Wether the field is checked (defaut: checked)
+ * @return void
+ * @throws FormClosedException If the form is not yet opened
+ */
+ public function addInputCheckboxField ($fieldName, $fieldChecked = true) {
+ // Is the form opened?
+ if ($this->formOpened === false) {
+ // Throw an exception
+ throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
+ }
+
+ // Set wether the check box is checked...
+ $checked = " checked=\"checked\"";
+ if ($fieldChecked === false) $checked = " ";
+
+ // Generate the content
+ $inputContent = sprintf("<input type=\"checkbox\" name=\"%s\" class=\"checkbox\" id=\"%s\" value=\"1\"%s/>",
+ $fieldName,
+ $fieldName,
+ $checked
+ );
+
+ // And add it
+ $this->addContent($inputContent);
+ }
+
+ /**
+ * Add a reset input tag to the form or throw an exception if it is not
+ * yet opened. The field's name will be set as id.
+ *
+ * @param $buttonText Text displayed on the button
+ * @return void
+ * @throws FormClosedException If the form is not yet opened
+ */
+ public function addInputResetButton ($buttonText) {
+ // Is the form opened?
+ if ($this->formOpened === false) {
+ // Throw an exception
+ throw new FormClosedException (array($this, "reset"), self::EXCEPTION_CLOSED_FORM);
+ }
+
+ // Generate the content
+ $inputContent = sprintf("<input type=\"reset\" class=\"reset_button\" id=\"%s_reset\" value=\"%s\" />",
+ $this->formName,
+ $buttonText
+ );
+
+ // And add it
+ $this->addContent($inputContent);
+ }
+
+ /**
+ * Add a reset input tag to the form or throw an exception if it is not
+ * yet opened. The field's name will be set as id.
+ *
+ * @param $buttonText Text displayed on the button
+ * @return void
+ * @throws FormClosedException If the form is not yet opened
+ */
+ public function addInputSubmitButton ($buttonText) {
+ // Is the form opened?
+ if ($this->formOpened === false) {
+ // Throw an exception
+ throw new FormClosedException (array($this, "submit"), self::EXCEPTION_CLOSED_FORM);
+ }
+
+ // Generate the content
+ $inputContent = sprintf("<input type=\"submit\" class=\"submit_button\" id=\"%s_submit\" name=\"%s_button\" value=\"%s\" />",
+ $this->formName,
+ $this->formName,
+ $buttonText
+ );
+
+ // And add it
+ $this->addContent($inputContent);
+ }
+
+ /**
+ * Add a form group or close an already opened and open a new one
+ *
+ * @param $groupName Name of the group
+ * @param $groupText Text including HTML to show above this group
+ * @return void
+ * @throws FormClosedException If no form has been opened before
+ * @throws EmptyVariableException If $groupName is not set
+ */
+ public function addFormGroup ($groupName, $groupText) {
+ // Is a form opened?
+ if ($this->formOpened === false) {
+ // Throw exception here
+ throw new FormClosedException(array($this, $groupName), self::EXCEPTION_CLOSED_FORM);
+ }
+
+ // At least the group name should be set
+ if ((empty($groupName)) && ($this->groupOpened === false)) {
+ // Throw exception here
+ throw new EmptyVariableException(array($this, 'groupName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ }
+
+ // Initialize content with closing div by default
+ $content = " </div>\n</div><!-- Group - CLOSE //-->";
+
+ // Is this group opened?
+ if ($this->groupOpened === false) {
+ // Begin the div/span blocks
+ $content = sprintf("<!-- Group %s - OPEN //-->
+<div class=\"group_box\" id=\"%s_group_box\">
+ <span class=\"group_text\" id=\"%s_group_text\">
+ %s
+ </span>
+ <div class=\"group_field\" id=\"%s_group_field\">",
+ $groupName,
+ $groupName,
+ $groupName,
+ $groupText,
+ $groupName
+ );
+
+ // Add the content
+ $this->addContent($content);
+
+ // Switch the state
+ $this->groupOpened = true;
+ } else {
+ // Is a sub group opened?
+ if ($this->subGroupOpened === true) {
+ // Close it here
+ $this->addFormSubGroup("", "");
+ }
+
+ // Add the content
+ $this->addContent($content);
+
+ // Switch the state
+ $this->groupOpened = false;
+
+ // All call it again if the group name is not empty
+ if (!empty($groupName)) {
+ $this->addFormGroup($groupName, $groupText);
+ }
+ }
+ }
+
+ /**
+ * Add a form sub group or close an already opened and open a new one or
+ * throws an exception if no group has been opened before or if the sub
+ * group name is empty.
+ *
+ * @param $subGroupName Name of the group
+ * @param $subGroupText Text including HTML to show above this group
+ * @return void
+ * @throws FormGroupClosedException If no group has been opened before
+ * @throws EmptyVariableException If $subGroupName is not set
+ */
+ public function addFormSubGroup ($subGroupName, $subGroupText) {
+ // Is a group opened?
+ if ($this->groupOpened === false) {
+ // Throw exception here
+ throw new FormGroupClosedException(array($this, $subGroupName), self::EXCEPTION_UNEXPECTED_CLOSED_GROUP);
+ }
+
+ // At least the sub group name should be set
+ if ((empty($subGroupName)) && ($this->subGroupOpened === false)) {
+ // Throw exception here
+ throw new EmptyVariableException(array($this, 'groupName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ }
+
+ // Initialize content with closing div by default
+ $content = " </div>\n</div><!-- Sub group- CLOSE //-->";
+
+ // Is this group opened?
+ if ($this->subGroupOpened === false) {
+ // Begin the span block
+ $content = sprintf("<!-- Sub group %s - OPEN //-->
+<div class=\"subgroup_box\" id=\"%s_subgroup_box\">
+ <span class=\"subgroup_text\" id=\"%s_subgroup_text\">
+ %s
+ </span>
+ <div class=\"subgroup_field\" id=\"%s_subgroup_field\">",
+ $subGroupName,
+ $subGroupName,
+ $subGroupName,
+ $subGroupText,
+ $subGroupName
+ );
+
+ // Add the content
+ $this->addContent($content);
+
+ // Switch the state and remeber the name
+ $this->subGroupOpened = true;
+ $this->subGroupName = $subGroupName;
+ } else {
+ // Add the content
+ $this->addContent($content);
+
+ // Switch the state
+ $this->subGroupOpened = false;
+
+ // All call it again if sub group name is not empty
+ if (!empty($subGroupName)) {
+ $this->addFormSubGroup($subGroupName, $subGroupText);
+ }
+ }
+ }
+
+ /**
+ * Add text surrounded by a span block when there is a group opened before
+ * or else by a div block.
+ *
+ * @param $fieldName Field name
+ * @param $fieldText Text for the field
+ * @return void
+ * @throws FormClosedException If the form is not yet opened
+ */
+ public function addFieldText ($fieldName, $fieldText) {
+ // Is the form opened?
+ if ($this->formOpened === false) {
+ // Throw an exception
+ throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
+ }
+
+ // Set the block type
+ $block = "div";
+ if ($this->groupOpened === true) $block = "span";
+
+ // Generate the content
+ $inputContent = sprintf(" <%s id=\"%s_text\">
+ %s
+ </%s>",
+ $block,
+ $fieldName,
+ $fieldText,
+ $block
+ );
+
+ // And add it
+ $this->addContent($inputContent);
+ }
+
+ /**
+ * Add text (notes) surrounded by a div block. Still opened groups or sub
+ * groups will be automatically closed.
+ *
+ * @param $formNotes The form notes we shell addd
+ * @return void
+ * @throws FormClosedException If the form is not yet opened
+ */
+ public function addFormNote ($formNotes) {
+ // Is the form opened?
+ if ($this->formOpened === false) {
+ // Throw an exception
+ throw new FormClosedException (array($this, "form_notes"), self::EXCEPTION_CLOSED_FORM);
+ }
+
+ // Is a group open?
+ if ($this->groupOpened === true) {
+ // Then automatically close it here
+ $this->addFormGroup("unknown", "");
+ }
+
+ // Generate the content
+ $inputContent = sprintf(" <div id=\"form_note\">
+ %s
+ </div>",
+ $formNotes
+ );
+
+ // And add it
+ $this->addContent($inputContent);
+ }
+
+ /**
+ * Checks wether the registration requires a valid email address
+ *
+ * @return $required Wether the email address is required
+ */
+ public function ifRegisterRequiresEmailVerification () {
+ $required = ($this->getConfigInstance()->readConfig("register_requires_email") == "Y");
+ return $required;
+ }
+
+ /**
+ * Checks wether profile data shall be asked
+ *
+ * @return $required Wether profile shall be asked
+ */
+ public function ifRegisterIncludesProfile () {
+ $required = ($this->getConfigInstance()->readConfig("register_includes_profile") == "Y");
+ return $required;
+ }
+
+ /**
+ * Checks wether personal data shall be asked
+ *
+ * @return $required Wether personal data shall be asked
+ */
+ public function ifRegisterIncludesPersonaData () {
+ $required = ($this->getConfigInstance()->readConfig("register_personal_data") == "Y");
+ return $required;
+ }
+
+ /**
+ * Checks wether the specified chat protocol is enabled in this form
+ *
+ * @return $required Wether the specified chat protocol is enabled
+ */
+ public function ifChatEnabled ($chatProtocol) {
+ $required = ($this->getConfigInstance()->readConfig(sprintf("chat_enabled_%s", $chatProtocol)) == "Y");
+ return $required;
+ }
+
+ /**
+ * Flushs the content out (not yet secured against open forms, etc.!) or
+ * throw an exception if it is not yet closed
+ *
+ * @return void
+ * @throws FormOpenedException If the form is still open
+ */
+ public function flushContent () {
+ // Is the form still open?
+ if ($this->formOpened === true) {
+ // Throw an exception
+ throw new FormOpenedException ($this, self::EXCEPTION_OPENED_FORM);
+ }
+
+ // Send content to template engine
+ $this->getTemplateInstance()->assignVariable($this->formName, $this->getContent());
+ }
+}
+
+// [EOF]
+?>
// Run the compilation twice to get content from helper classes in
$cnt = 0;
- while ($cnt < 2) {
+ while ($cnt < 3) {
// Finalize the compilation of template variables
$this->finalizeVariableCompilation();
// CFG: VERBOSE-LEVEL
$cfg->setConfigEntry("verbose_level", 0);
-// CFG: COMMAND-PARAMETER
-$cfg->setConfigEntry("command_parameter", "page");
-
-// CFG: FORM-ACTION
-$cfg->setConfigEntry("form_action", "index.php?app={?app_short_name?}&{?command_parameter?}=do_form");
-
-// CFG: FORM-METHOD
-$cfg->setConfigEntry("form_method", "POST");
-
-// CFG: FORM-TARGET
-$cfg->setConfigEntry("form_target", "_self");
-
// [EOF]
?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>