application/ship-simu/main/actions/web/.htaccess -text
application/ship-simu/main/actions/web/class_WebShipSimuLogin -text
application/ship-simu/main/actions/web/class_WebShipSimuLoginCompanyAction.php -text
+application/ship-simu/main/actions/web/class_WebShipSimuLoginGovermentTrainingAction.php -text
application/ship-simu/main/actions/web/class_WebShipSimuLoginLogoutAction.php -text
application/ship-simu/main/actions/web/class_WebShipSimuLoginRefillAction.php -text
application/ship-simu/main/actions/web/class_WebShipSimuLoginWelcomeAction.php -text
application/ship-simu/main/factories/.htaccess -text
application/ship-simu/main/factories/class_ShipSimuWebNewsFactory.php -text
application/ship-simu/main/filter/.htaccess -text
+application/ship-simu/main/filter/goverment/.htaccess -text
+application/ship-simu/main/filter/goverment/class_ShipSimuGovermentPaysTrainingFilter.php -text
application/ship-simu/main/filter/page/.htaccess -text
application/ship-simu/main/filter/page/class_RefillPageFilter.php -text
application/ship-simu/main/filter/validator/.htaccess -text
application/ship-simu/templates/de/.htaccess -text
application/ship-simu/templates/de/code/action_ship_simu_login_company.ctp -text
application/ship-simu/templates/de/code/action_ship_simu_login_goverment_startup_help.ctp -text
+application/ship-simu/templates/de/code/action_ship_simu_login_goverment_training.ctp -text
application/ship-simu/templates/de/code/action_ship_simu_login_logout.ctp -text
application/ship-simu/templates/de/code/action_ship_simu_login_profile.ctp -text
application/ship-simu/templates/de/code/action_ship_simu_login_refill.ctp -text
} // END - if
// Is the password correct?
- if (!$userInstance->ifPasswordHashMatches($requestInstance)) {
+ if ($userInstance->ifPasswordHashMatches($requestInstance) === false) {
// Mismatching password
throw new UserPasswordMismatchException(array($this, $userInstance), BaseUser::EXCEPTION_USER_PASS_MISMATCH);
} // END - if
// CFG: PAYMENT-DISCOVERY-FILTER
$cfg->setConfigEntry('payment_discovery_filter', "PaymentDiscoveryFilter");
+// CFG: GOVERMENT-PAYS-TRAINING-FILTER
+$cfg->setConfigEntry('goverment_pays_training_filter', "ShipSimuGovermentPaysTrainingFilter");
+
// CFG: NEWS-HOME-LIMIT
$cfg->setConfigEntry('news_home_limit', 10);
* @param $controllerInstance A controller instance
* @param $requestInstance An instance of a class with an Requestable interface
* @return void
- * @todo Add some filters here
+ * @todo Add some more filters here
*/
public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
- // Unfinished method
+ // Check for user status by default
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter'));
}
}
--- /dev/null
+<?php
+/**
+ * An action for trainings payed by goverment
+ *
+ * @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 WebShipSimuLoginGovermentTrainingAction extends BaseAction implements Commandable, Registerable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this action
+ *
+ * @param $resolverInstance An instance of an action resolver
+ * @return $actionInstance An instance of this action class
+ */
+ public final static function createWebShipSimuLoginGovermentTrainingAction (ActionResolver $resolverInstance) {
+ // Get a new instance
+ $actionInstance = new WebShipSimuLoginGovermentTrainingAction();
+
+ // Set the resolver instance
+ $actionInstance->setResolverInstance($resolverInstance);
+
+ // Return the instance
+ return $actionInstance;
+ }
+
+ /**
+ * Executes the command with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ * @todo 0% done
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Unfinished method
+ }
+
+ /**
+ * Adds extra filters to the given controller instance
+ *
+ * @param $controllerInstance A controller instance
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @return void
+ * @todo Add some more filters here
+ */
+ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+ // Check for user status by default
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter'));
+
+ // Check if goverment can pay a training
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('goverment_pays_training_filter'));
+ }
+}
+
+// [EOF]
+?>
* @return void
*/
public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+ // Check for user status by default
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter'));
+
// Is the refill page active?
$controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('refill_page_filter'));
$year = mt_rand(($currYear - $this->MIN_AGE), ($currYear - $this->MAX_AGE));
$month = 0;
$day = 0;
- while (!$this->isDateValid($year, $month, $day)) {
+ while ($this->isDateValid($year, $month, $day) === false) {
$month = mt_rand(1, 12);
switch ($month) {
case 1:
$day = mt_rand(1, 28);
}
break;
- } // switch - END
- } // while - END
+ } // END - switch
+ } // END - while
// Set the new birthday
$this->setBirthday($year, $month, $day);
if (!$partInstance instanceof ConstructableShipPart) {
// Ship part not constructable!
throw new ShipPartNotConstructableException(array($shipPart), self::EXCEPTION_NOT_CONSTRUCTABLE);
- } elseif (!$this->getShipInstance()->createShipPart($partInstance, $parentPart)) {
+ } elseif ($this->getShipInstance()->createShipPart($partInstance, $parentPart) === false) {
// Schiff konnte nicht gebaut werden!
throw new ShipNotConstructedException(sprintf("Das Schiff <strong>%s</strong> konnte wegen eines Fehlers nicht gebaut werden. Siehe obere Meldungen.",
$this->getShipInstance()->getShipName()
$iterator->seek($pos);
// Is the current position valid?
- if (!$iterator->valid()) {
+ if ($iterator->valid() === false) {
// Should normally not happen... :(
throw new StructuresOutOfBoundsException($idx, self::EXCEPTION_INDEX_OUT_OF_BOUNDS);
} // END - if
// Iterate through all employees
for ($idx = $this->employeeList->getIterator(); $idx->valid(); $idx->next()) {
// Is the shipyard iterator still okay?
- if (!$shipyardIter->valid()) {
+ if ($shipyardIter->valid() === false) {
// Rewind to first position
$shipyardIter->seek(0);
- }
+ } // END - if
// Get Shipyard object
$shipyard = $shipyardIter->current();
} elseif (!is_object($shipyard)) {
// Not an object! ;-(
throw new NoObjectException($shipyard, self::EXCEPTION_IS_NO_OBJECT);
- } elseif (!$shipyard->isClass("Shipyard")) {
+ } elseif ($shipyard->isClass("Shipyard") === false) {
// Nope, so throw exception
throw new ClassMismatchException(array($shipyard->__toString(), "Shipyard"), self::EXCEPTION_CLASSES_NOT_MATCHING);
}
} elseif (!is_object($shipyard)) {
// Not an object! ;-(
throw new NoObjectException($shipyard, self::EXCEPTION_IS_NO_OBJECT);
- } elseif (!$shipyard->isClass("Shipyard")) {
+ } elseif ($shipyard->isClass("Shipyard") === false) {
// Class is not a shipyard
throw new ClassMismatchException(array($shipyard->__toString(), "Shipyard"), self::EXCEPTION_CLASSES_NOT_MATCHING);
}
// Add the new ship type to the shipyard
$shipyard->addNewConstructableShipType($shipType);
- }
+ } // END - for
}
// Validate the requested ship type with the company if they can construct it
} elseif (!is_object($shipyard)) {
// Not an object! ;-(
throw new NoObjectException($shipyard, self::EXCEPTION_IS_NO_OBJECT);
- } elseif (!$shipyard->isClass("Shipyard")) {
+ } elseif ($shipyard->isClass("Shipyard") === false) {
// Class is not a shipyard
throw new ClassMismatchException(array($shipyard->__toString(), "Shipyard"), self::EXCEPTION_CLASSES_NOT_MATCHING);
}
// Does this shipyard construct the requested ship type?
if ($result) break; // Then abort the search!
- }
+ } // END - for
// Debug message
if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> hat die Suche nach einer Werft beendet, die Schiffe vom Typ <strong>%s</strong> bauen kann.",
// Sign a contract with an other party which must also implement Customer
public function signContract (SignableContract $contractInstance, ContractPartner $partnerInstance) {
// Check wether the other party is our contract partner
- if (!$partnerInstance->isContractPartner($contractInstance)) {
+ if ($partnerInstance->isContractPartner($contractInstance) === false) {
// Invalid contract partner!
throw new InvalidContractPartnerException($partnerInstance, self::EXCEPTION_CONTRACT_PARTNER_INVALID);
- }
+ } // END - if
// Determine if company "signs" own contract (must be done) or with an other party
if ($this->equals($partnerInstance)) {
} elseif (!is_object($contractInstance)) {
// Not an object! ;-(
throw new NoObjectException($contractInstance, self::EXCEPTION_IS_NO_OBJECT);
- } elseif (!$contractInstance->isClass('WorksContract')) {
+ } elseif ($contractInstance->isClass("WorksContract") === false) {
// Is not a merchant
throw new ClassMismatchException(array($contractInstance->__toString(), "WorksContract"), self::EXCEPTION_CLASSES_NOT_MATCHING);
}
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A filter for checking if goverment can pay a training for current user
+ *
+ * @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 ShipSimuGovermentPaysTrainingFilter extends BaseFrameworkSystem implements Filterable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Clean up a little
+ $this->removeNumberFormaters();
+ $this->removeSystemArray();
+ }
+
+ /**
+ * Creates an instance of this filter class
+ *
+ * @return $filterInstance An instance of this filter class
+ */
+ public final static function createShipSimuGovermentPaysTrainingFilter () {
+ // Get a new instance
+ $filterInstance = new ShipSimuGovermentPaysTrainingFilter();
+
+ // Return the instance
+ return $filterInstance;
+ }
+
+ /**
+ * Executes the filter with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ * @todo 0% done
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get the user instance from registry
+ $userInstance = Registry::getRegistry()->getInstance('user');
+
+ // Now simply check for it
+ if ((!$userInstance instanceof ManageableMember) || ($userInstance->ifGovermentPaysTraining() === false)) {
+ // Request is invalid
+ $requestInstance->requestIsValid(false);
+
+ // Add a message to the response
+ $responseInstance->addFatalMessage('goverment_pays_no_training');
+
+ // Abort here
+ return false;
+ } // END - if
+ }
+}
+
+// [EOF]
+?>
*/
public function execute (Requestable $requestInstance, Responseable $responseInstance) {
// Are all required request fields set?
- if ((!$requestInstance->isRequestElementSet('type')) || (!$requestInstance->isRequestElementSet('amount'))) {
+ if (($requestInstance->isRequestElementSet('type') === false) || ($requestInstance->isRequestElementSet('amount') === false)) {
// Something important is missing
$requestInstance->requestIsValid(false);
} // END - if
// Is the password correct?
- if (!$userInstance->ifPasswordHashMatches($requestInstance)) {
+ if ($userInstance->ifPasswordHashMatches($requestInstance) === false) {
// Mismatching password
throw new UserPasswordMismatchException(array($this, $userInstance), BaseUser::EXCEPTION_USER_PASS_MISMATCH);
} // END - if
} // END - if
// Is the password correct?
- if (!$userInstance->ifPasswordHashMatches($requestInstance)) {
+ if ($userInstance->ifPasswordHashMatches($requestInstance) === false) {
// Mismatching password
throw new UserPasswordMismatchException(array($this, $userInstance), BaseUser::EXCEPTION_USER_PASS_MISMATCH);
} // END - if
}
// Ist the given birthday valid?
- if (!$personellInstance->isDateValid($year, $month, $day)) {
+ if ($personellInstance->isDateValid($year, $month, $day) === false) {
// Something is wrong ...
throw new BirthdayInvalidException(array($year, $month, $day), self::EXCEPTION_BIRTH_DATE_IS_INVALID);
- }
+ } // END - if
// Set birthday
$personellInstance->setBirthday($year, $month, $day);
$userInstance->setUserName($userName);
// Check if the username exists
- if (!$userInstance->ifUsernameExists()) {
+ if ($userInstance->ifUsernameExists() === false) {
// Throw an exception here
throw new UsernameMissingException(array($userInstance, $userName), self::EXCEPTION_USERNAME_NOT_FOUND);
- }
+ } // END - if
// Return the instance
return $userInstance;
$userInstance->setUserName($userName);
// Check if the username exists
- if (!$userInstance->ifUsernameExists()) {
+ if ($userInstance->ifUsernameExists() === false) {
// Throw an exception here
throw new UsernameMissingException(array($userInstance, $userName), self::EXCEPTION_USERNAME_NOT_FOUND);
- }
+ } // END - if
// Return the instance
return $userInstance;
// Maximum of allowed companies reached?
if ($linkInstance->getValueInstance()->ifUserCreatedMaximumAllowedCompanies()) {
// No more companies allowed to found
- $linkInstance->addLinkNote("Du hast zu viele Firmen gegründet. Bitte denke über eine Fusion (Zusammenlegung) nach.");
+ $linkInstance->addLinkNote('company_maximum', "Du hast zu viele Firmen gegründet. Bitte denke über eine Fusion (Zusammenlegung) nach.");
} elseif ($linkInstance->getValueInstance()->ifUserHasRequiredPoints('found_new_company')) {
// Enough money to found company
$linkInstance->addActionLink('company_found', "Gründe eine virtuelle Firma und mache dich (virtuell) selbstständig.");
-} else {
- // No more money left for founding company so place link here to refill page/money bank
- if ($linkInstance->getValueInstance()->ifUserAllowedTakeCreditsFromMoneyBank()) {
- // Display link to money bank page
- $linkInstance->addActionLink('moneybank', "Jetzt zur Bank gehen und mehr {?currency?} leihen.");
- } elseif ($linkInstance->getValueInstance()->ifUserHasMaximumCreditsWithMoneyBank()) {
- // Maximum credits reached which a money bank can lent
- $linkInstance->addLinkNote("Die Bank kann dir kein Geld mehr leihen, bitte zahle es auch wieder zurück.");
- $linkInstance->addActionLink('moneybank&sub=payback_credits', "Jetzt deinen Kredit tilgen.");
- } else {
- // Money bank is closed!
- $linkInstance->addLinkNote("Die Bank hat derzeit geschlossen. Bitte später nochmal versuchen.");
- }
}
// Add link group for goverment
} elseif ($linkInstance->getValueInstance()->ifGovermentPaysTraining()) {
// Goverment is able to pay a training in general
$linkInstance->addActionLink('goverment_training', "Jetzt zur virtuellen Kurswelt und ein Training auswählen.");
+
+ // Can the goverment pay startup help?
+ if ($linkInstance->getValueInstance()->ifGovermentPaysStartupHelp()) {
+ // Add link note
+ $linkInstance->addLinkNote('goverment_startup_help', "Virtuelle Starthilfe beantragen:");
+
+ // Display link to goverment for startup help
+ $linkInstance->addActionLink('goverment_startup_help', "Direkt zum Antragsformular für deine Starthilfe.");
+ } // END - if
} elseif ($linkInstance->getValueInstance()->ifGovermentPaysStartupHelp()) {
// Display link to goverment for startup help
$linkInstance->addActionLink('goverment_startup_help', "Direkt zum Antragsformular für deine Starthilfe.");
} else {
// Even goverment cannot help the gamer here
- $linkInstance->addLinkNote("Leider kann dir der Staat nicht mehr weiterhelfen, dich zu bewerben, da du zu oft Starthilfen erhalten hast. Hier muss aber noch weiter am Spiel gearbeitet werden. :-)");
+ $linkInstance->addLinkNote('goverment_depleted', "Leider kann dir der Staat nicht mehr weiterhelfen, dich zu bewerben, da du zu oft Starthilfen erhalten hast oder ein Training absolviert hast. Hier muss aber noch weiter am Spiel gearbeitet werden. :-)");
}
// Add link group for money bank
$linkInstance->addLinkGroup('moneybank', "Leihe dir zu günstigen Zinsen virtuelles Geld aus, wenn du mehr brauchst!");
+// Add link to moneybank
if ($linkInstance->getValueInstance()->ifUserAllowedTakeCreditsFromMoneyBank()) {
// Display link to money bank page
$linkInstance->addActionLink('moneybank', "Jetzt zur virtuellen Bank gehen.");
} elseif ($linkInstance->getValueInstance()->ifUserHasMaximumCreditsWithMoneyBank()) {
// Maximum credits reached which a money bank can lent
- $linkInstance->addLinkNote("Die Bank kann dir kein Geld mehr leihen, bitte zahle es auch wieder zurück.");
+ $linkInstance->addLinkNote('moneybank_depleted', "Die Bank kann dir kein Geld mehr leihen, bitte zahle es auch wieder zurück.");
$linkInstance->addActionLink('moneybank_payback_credits', "Jetzt deinen Kredit tilgen.");
} else {
// Money bank is closed!
- $linkInstance->addLinkNote("Die Bank hat derzeit geschlossen. Bitte später nochmal versuchen.");
+ $linkInstance->addLinkNote('moneybank_closed', "Die Bank hat derzeit geschlossen. Bitte später nochmal versuchen.");
}
// Add link group for refill page
$linkInstance->addActionLink('refill', "Jetzt dein virtuelles Geld aufladen.");
} else {
// Refill page not active
- $linkInstance->addLinkNote("Das Aufladen ist derzeit nicht möglich oder gestört und wurde von uns deaktiviert.");
+ $linkInstance->addLinkNote('refill_disabled', "Das Aufladen ist derzeit nicht möglich oder gestört und wurde von uns deaktiviert.");
}
// Flush content to the template
<?php
// Get form helper instance
-$helper = WebFormHelper::createWebFormHelper($this, 'shipsimu_startup_form');
+$helperInstance = WebFormHelper::createWebFormHelper($this, 'shipsimu_startup_form');
+
+// Prefetch user instance
+$helperInstance->prefetchValueInstance('user');
// Add main form group
-$helper->addFormNote('reality_warning', "WARNUNG: Bitte dieses Formular nicht mit echten Angaben ausfüllen!");
+$helperInstance->addFormNote('reality_warning', "WARNUNG: Bitte dieses Formular nicht mit echten Angaben ausfüllen!");
// Flush the finished form
-$helper->flushContent();
+$helperInstance->flushContent();
?>
<div id="goverment_frame">
--- /dev/null
+<?php
+// Get form helper instance
+$helperInstance = WebFormHelper::createWebFormHelper($this, 'shipsimu_training_form');
+
+// Prefetch user instance
+$helperInstance->prefetchValueInstance('user');
+
+// Add main form group
+$helperInstance->addFormNote('reality_warning', "WARNUNG: Bitte dieses Formular nicht mit echten Angaben ausfüllen!");
+
+// Flush the finished form
+$helperInstance->flushContent();
+
+?>
+<div id="goverment_frame">
+ <div id="goverment_header">
+ Virtuelle Beantragung eines Training-Kursus
+ </div>
+
+ <div id="goverment_form">
+ {?shipsimu_training_form?}
+ </div>
+</div>
<?php
// Get helper instance
-$helper = WebLinkHelper::createWebLinkHelper($this, 'logout_now_link', 'index.php?app={?app_short_name?}&page=logout');
+$helperInstance = WebLinkHelper::createWebLinkHelper($this, 'logout_now_link', 'index.php?app={?app_short_name?}&page=logout');
// Set link text
-$helper->addLinkWithTextById('logout_now_link_text');
+$helperInstance->addLinkWithTextById('logout_now_link_text');
// Flush the content
-$helper->flushContent();
+$helperInstance->flushContent();
// Get helper instance
-$helper = WebLinkHelper::createWebLinkHelper($this, 'return_login_link', 'index.php?app={?app_short_name?}&page=login_area');
+$helperInstance = WebLinkHelper::createWebLinkHelper($this, 'return_login_link', 'index.php?app={?app_short_name?}&page=login_area');
// Set link text
-$helper->addLinkWithTextById('return_login_link_text');
+$helperInstance->addLinkWithTextById('return_login_link_text');
// Flush the content
-$helper->flushContent();
+$helperInstance->flushContent();
// [EOF]
?>
// 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
// BaseHelper.
-$helper = WebFormHelper::createWebFormHelper($this, "shipsimu_profile");
+$helperInstance = WebFormHelper::createWebFormHelper($this, "shipsimu_profile");
// Pre-fetch field data with a given registry key
-$helper->prefetchValueInstance('user');
+$helperInstance->prefetchValueInstance('user');
// Password can only be changed when the old one is entered and new one twice!
-$helper->addFormGroup('pass', "Neues Passwort einrichten:");
-$helper->addFormSubGroup('pass', "Bitte gebe zum Ändern deines Passwortes zweimal das gewünschte neue Passwort ein.");
-$helper->addFieldText('pass1', "Neues Passwort:");
-$helper->addInputPasswordField('pass1');
-$helper->addFieldText('pass2', "Neues Passwort, Wiederholung:");
-$helper->addInputPasswordField('pass2');
+$helperInstance->addFormGroup('pass', "Neues Passwort einrichten:");
+$helperInstance->addFormSubGroup('pass', "Bitte gebe zum Ändern deines Passwortes zweimal das gewünschte neue Passwort ein.");
+$helperInstance->addFieldText('pass1', "Neues Passwort:");
+$helperInstance->addInputPasswordField('pass1');
+$helperInstance->addFieldText('pass2', "Neues Passwort, Wiederholung:");
+$helperInstance->addInputPasswordField('pass2');
// Display current email
-$helper->addFormNote('current_email', "Derzeitige Email-Adresse: <span id=\"displayed_field\">".$helper->getValueField('email')."</span>");
+$helperInstance->addFormNote('current_email', "Derzeitige Email-Adresse: <span id=\"displayed_field\">".$helperInstance->getValueField('email')."</span>");
// Only for changing email address
-if ($helper->ifEmailChangeAllowed()) {
- $helper->addFormGroup('email', "Änderung deiner Email-Addresse:");
- $helper->addFormSubGroup('email', "Gebe nur deine Email-Adresse zweimal ein, wenn du diese ändern möchtest!");
- $helper->addFieldText('email1', "Email-Adresse:");
- $helper->addInputTextField('email1');
- $helper->addFieldText('email2', "Wiederholung Email-Adresse:");
- $helper->addInputTextField('email2');
-
- if ($helper->ifEmailMustBeUnique()) {
- $helper->addFormNote('email', "Die von dir eingegebene Email-Adresse darf nur einmal im Spiel verwendet worden sein.");
+if ($helperInstance->ifEmailChangeAllowed()) {
+ $helperInstance->addFormGroup('email', "Änderung deiner Email-Addresse:");
+ $helperInstance->addFormSubGroup('email', "Gebe nur deine Email-Adresse zweimal ein, wenn du diese ändern möchtest!");
+ $helperInstance->addFieldText('email1', "Email-Adresse:");
+ $helperInstance->addInputTextField('email1');
+ $helperInstance->addFieldText('email2', "Wiederholung Email-Adresse:");
+ $helperInstance->addInputTextField('email2');
+
+ if ($helperInstance->ifEmailMustBeUnique()) {
+ $helperInstance->addFormNote('email', "Die von dir eingegebene Email-Adresse darf nur einmal im Spiel verwendet worden sein.");
} // END - Unique email addresses
- if ($helper->ifEmailChangeRequireConfirmation()) {
- $helper->addFormNote('confirm_link', "Es wird ein Bestätigungslink an deine neue Email-Adresse gesendet. Bitte klicke diesen dann möglichst schnell an.");
+ if ($helperInstance->ifEmailChangeRequireConfirmation()) {
+ $helperInstance->addFormNote('confirm_link', "Es wird ein Bestätigungslink an deine neue Email-Adresse gesendet. Bitte klicke diesen dann möglichst schnell an.");
} // END - Change requires confirmation
} // END - email change allowed
// Add form group for user profile
-$helper->addFormGroup('profile', "Hier kannst du deine Profildaten ändern.");
+$helperInstance->addFormGroup('profile', "Hier kannst du deine Profildaten ändern.");
// Persoenliche Daten mit in der Anmeldung abfragen?
-if ($helper->ifRegisterIncludesPersonaData()) {
- $helper->addFormSubGroup('persona', "Wenn du magst, dann vervollständige deine komplette Adresse mit deinem Namen.");
- $helper->addFieldText('surname', "Dein Vorname:");
- $helper->addInputTextFieldWithDefault('surname');
- $helper->addFieldText('family', "Dein Nachname:");
- $helper->addInputTextFieldWithDefault('family');
- $helper->addFieldText('street', "Strasse und Hausnummer:");
- $helper->addInputTextFieldWithDefault('street');
- $helper->addFieldText('city', "Wohnort:");
- $helper->addInputTextFieldWithDefault('city');
+if ($helperInstance->ifRegisterIncludesPersonaData()) {
+ $helperInstance->addFormSubGroup('persona', "Wenn du magst, dann vervollständige deine komplette Adresse mit deinem Namen.");
+ $helperInstance->addFieldText('surname', "Dein Vorname:");
+ $helperInstance->addInputTextFieldWithDefault('surname');
+ $helperInstance->addFieldText('family', "Dein Nachname:");
+ $helperInstance->addInputTextFieldWithDefault('family');
+ $helperInstance->addFieldText('street', "Strasse und Hausnummer:");
+ $helperInstance->addInputTextFieldWithDefault('street');
+ $helperInstance->addFieldText('city', "Wohnort:");
+ $helperInstance->addInputTextFieldWithDefault('city');
} // END - Persona data
// Add su group for zip code
-$helper->addFormSubGroup('zip', "Magst du uns auch deine Postleitzahl verraten?");
-$helper->addFieldText('zip', "Postleitzahl:");
-$helper->addInputTextFieldWithDefault('zip');
+$helperInstance->addFormSubGroup('zip', "Magst du uns auch deine Postleitzahl verraten?");
+$helperInstance->addFieldText('zip', "Postleitzahl:");
+$helperInstance->addInputTextFieldWithDefault('zip');
// Add sub group for chat protocols
-$helper->addFormSubGroup('chat', "Gebe hier deine Nicknames bzw. Nummern an:");
+$helperInstance->addFormSubGroup('chat', "Gebe hier deine Nicknames bzw. Nummern an:");
// Add ICQ chat?
-if ($helper->ifChatEnabled('icq')) {
- $helper->addFieldText('icq', "ICQ-Nummer:");
- $helper->addInputTextFieldWithDefault('icq');
+if ($helperInstance->ifChatEnabled('icq')) {
+ $helperInstance->addFieldText('icq', "ICQ-Nummer:");
+ $helperInstance->addInputTextFieldWithDefault('icq');
} // END - if
// Add Jabber chat?
-if ($helper->ifChatEnabled('jabber')) {
- $helper->addFieldText('jabber', "Jabber:");
- $helper->addInputTextFieldWithDefault('jabber');
+if ($helperInstance->ifChatEnabled('jabber')) {
+ $helperInstance->addFieldText('jabber', "Jabber:");
+ $helperInstance->addInputTextFieldWithDefault('jabber');
} // END - if
// Add Yahoo! chat?
-if ($helper->ifChatEnabled('yahoo')) {
- $helper->addFieldText('yahoo', "Yahoo!:");
- $helper->addInputTextFieldWithDefault('yahoo');
+if ($helperInstance->ifChatEnabled('yahoo')) {
+ $helperInstance->addFieldText('yahoo', "Yahoo!:");
+ $helperInstance->addInputTextFieldWithDefault('yahoo');
} // END - if
// Add AOL chat?
-if ($helper->ifChatEnabled('aol')) {
- $helper->addFieldText('aol', "AOL-Screenname:");
- $helper->addInputTextFieldWithDefault('aol');
+if ($helperInstance->ifChatEnabled('aol')) {
+ $helperInstance->addFieldText('aol', "AOL-Screenname:");
+ $helperInstance->addInputTextFieldWithDefault('aol');
} // END - if
// Add MSN chat?
-if ($helper->ifChatEnabled('msn')) {
- $helper->addFieldText('msn', "MSN:");
- $helper->addInputTextFieldWithDefault('msn');
+if ($helperInstance->ifChatEnabled('msn')) {
+ $helperInstance->addFieldText('msn', "MSN:");
+ $helperInstance->addInputTextFieldWithDefault('msn');
} // END - if
-if (!$helper->ifRegisterRequiresEmailVerification()) {
- $helper->addFormExtraNote(1, "Die Benachrichtigungen per sind im Loginbereich verfeinerbar, welche du genau haben willst.");
+if (!$helperInstance->ifRegisterRequiresEmailVerification()) {
+ $helperInstance->addFormExtraNote(1, "Die Benachrichtigungen per sind im Loginbereich verfeinerbar, welche du genau haben willst.");
} // END - Extra note
// Rules already accepted?
-if ($helper->ifRulesHaveChanged()) {
- $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);
+if ($helperInstance->ifRulesHaveChanged()) {
+ $helperInstance->addFormGroup('rules', "Bitte lese dir die Spieleregeln gut durch und kreuze dann "Ja, ich akzeptiere die aktuellen Spielregeln" an.");
+ $helperInstance->addFieldText('rules', "Ja, ich akzeptiere die aktuellen Spielregeln:");
+ $helperInstance->addInputCheckboxField('rules', false);
} else {
- $helper->addFormNote('rules_accepted', "Du hast die aktuellen Spielregeln akzeptiert. Vielen Dank!");
- $helper->addInputHiddenField('rules', "1");
+ $helperInstance->addFormNote('rules_accepted', "Du hast die aktuellen Spielregeln akzeptiert. Vielen Dank!");
+ $helperInstance->addInputHiddenField('rules', "1");
}
// Ask again for current account password
-$helper->addFormGroup('pass_old', "Bitte gebe zur Bestätigung der Änderungen dein derzeitiges Passwort ein.");
-$helper->addFieldText('pass_old', "Derzeitiges Passwort:");
-$helper->addInputPasswordField('pass_old');
+$helperInstance->addFormGroup('pass_old', "Bitte gebe zur Bestätigung der Änderungen dein derzeitiges Passwort ein.");
+$helperInstance->addFieldText('pass_old', "Derzeitiges Passwort:");
+$helperInstance->addInputPasswordField('pass_old');
// Abschliessender Hinweis und Abschluss des Formulars
-$helper->addFormGroup('buttons', "Sind alle Daten nun korrekt eingegeben? Dann sende sie mit einem Klick einfach ab!");
-$helper->addInputResetButton("Alles nochmal eingeben");
-$helper->addInputSubmitButton("Accountdaten aktualisieren");
-$helper->addFormNote('data_protection', "Deine Daten werden nach den gültigen Datenschutzgesetzten gespeichert und werden nicht an Dritte weitergegeben. Weiteres dazu siehe Link "Datenschutz".");
-$helper->flushContent();
+$helperInstance->addFormGroup('buttons', "Sind alle Daten nun korrekt eingegeben? Dann sende sie mit einem Klick einfach ab!");
+$helperInstance->addInputResetButton("Alles nochmal eingeben");
+$helperInstance->addInputSubmitButton("Accountdaten aktualisieren");
+$helperInstance->addFormNote('data_protection', "Deine Daten werden nach den gültigen Datenschutzgesetzten gespeichert und werden nicht an Dritte weitergegeben. Weiteres dazu siehe Link "Datenschutz".");
+$helperInstance->flushContent();
?>
<div id="content_header">
Deine Profildaten bearbeiten
<?php
// Neue Helper-Instanz holen
-$helper = WebFormHelper::createWebFormHelper($this, 'refill_form');
+$helperInstance = WebFormHelper::createWebFormHelper($this, 'refill_form');
// Pre-fetch payment types
-$helper->prefetchValueInstance('payments');
+$helperInstance->prefetchValueInstance('payments');
// Add form group
-$helper->addFormGroup('refill_form', "Bitte wähle aus, was du nachbestellen willst und gebe die Menge an.");
+$helperInstance->addFormGroup('refill_form', "Bitte wähle aus, was du nachbestellen willst und gebe die Menge an.");
// Add sub group
-$helper->addInputSelectField('type', "--- Bitte auswählen ---");
+$helperInstance->addInputSelectField('type', "--- Bitte auswählen ---");
// In-game currencies (if more than default add them here!)
-$helper->addSelectSubOption('currencies', "--- Währungen ---");
-$helper->addSelectOption('currency', "{?currency?}");
+$helperInstance->addSelectSubOption('currencies', "--- Währungen ---");
+$helperInstance->addSelectOption('currency', "{?currency?}");
// Raw materials
-$helper->addSelectSubOption('raw_materials', "--- Rohstoffe ---");
-$helper->addSelectOption('raw_wood', "Holz");
-$helper->addSelectOption('raw_iron', "Metall");
-$helper->addSelectOption('raw_stones', "Steine");
+$helperInstance->addSelectSubOption('raw_materials', "--- Rohstoffe ---");
+$helperInstance->addSelectOption('raw_wood', "Holz");
+$helperInstance->addSelectOption('raw_iron', "Metall");
+$helperInstance->addSelectOption('raw_stones', "Steine");
// This is needed to close the select tag
-$helper->addInputSelectField('type', "");
+$helperInstance->addInputSelectField('type', "");
// Field for amount
-$helper->addFormSubGroup('amount', "Gebe hier in ganzen Zahlen die Menge an, die du nachbestellen willst.");
-$helper->addInputTextField('amount', 1000);
+$helperInstance->addFormSubGroup('amount', "Gebe hier in ganzen Zahlen die Menge an, die du nachbestellen willst.");
+$helperInstance->addInputTextField('amount', 1000);
// Add payments
-$helper->getValueInstance()->addResultsToHelper($helper);
+$helperInstance->getValueInstance()->addResultsToHelper($helperInstance);
// Ask again for current account password
-$helper->addFormGroup('pass_old', "Bitte gebe zur Bestätigung der Nachbestellung dein derzeitiges Passwort ein.");
-$helper->addFieldText('pass_old', "Derzeitiges Passwort:");
-$helper->addInputPasswordField('pass_old');
+$helperInstance->addFormGroup('pass_old', "Bitte gebe zur Bestätigung der Nachbestellung dein derzeitiges Passwort ein.");
+$helperInstance->addFieldText('pass_old', "Derzeitiges Passwort:");
+$helperInstance->addInputPasswordField('pass_old');
// CAPTCHA enbaled?
-if ($helper->ifFormSecuredWithCaptcha()) {
- $helper->addFormGroup('captcha_refill', "Bitte wiederhole den angezeigten Code:");
- $helper->addCaptcha();
+if ($helperInstance->ifFormSecuredWithCaptcha()) {
+ $helperInstance->addFormGroup('captcha_refill', "Bitte wiederhole den angezeigten Code:");
+ $helperInstance->addCaptcha();
} // END - if
// Submit button
-$helper->addFormGroup('buttons_refill', "Mit Absenden des Formulars wird deine Nachbestellung verbindlich!");
-$helper->addInputResetButton("Eingaben löschen");
-$helper->addInputSubmitButton("Nachbestellung verbindlich aufgeben");
-$helper->flushContent();
+$helperInstance->addFormGroup('buttons_refill', "Mit Absenden des Formulars wird deine Nachbestellung verbindlich!");
+$helperInstance->addInputResetButton("Eingaben löschen");
+$helperInstance->addInputSubmitButton("Nachbestellung verbindlich aufgeben");
+$helperInstance->flushContent();
?>
<div id="refill_frame">
<div class="content_header">
// 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
// BaseHelper.
-$helper = WebFormHelper::createWebFormHelper($this, "resend_link");
+$helperInstance = WebFormHelper::createWebFormHelper($this, "resend_link");
// Pre-fetch field data with a given registry key
-$helper->prefetchValueInstance('user');
+$helperInstance->prefetchValueInstance('user');
// Add submit button or notice
-if ($helper->ifUserAccountUnconfirmed()) {
+if ($helperInstance->ifUserAccountUnconfirmed()) {
// Add submit button
- $helper->addInputHiddenFieldWithDefault('email');
- $helper->addInputSubmitButton("Bestätigungslink erneut aussenden");
-} elseif ($helper->ifUserAccountLocked()) {
+ $helperInstance->addInputHiddenFieldWithDefault('email');
+ $helperInstance->addInputSubmitButton("Bestätigungslink erneut aussenden");
+} elseif ($helperInstance->ifUserAccountLocked()) {
// Account is locked
- $helper->addFormNote('status_locked', "Dein Account wurde gesperrt! Grund der Sperre:
- <span id=\"lock_reason\">".$helper->getValueField('lock_reason')."</span>
+ $helperInstance->addFormNote('status_locked', "Dein Account wurde gesperrt! Grund der Sperre:
+ <span id=\"lock_reason\">".$helperInstance->getValueField('lock_reason')."</span>
Bitte melde dich beim Support, damit dieser dir weiterhelfen kann."
);
-} elseif ($helper->ifUserAccountGuest()) {
+} elseif ($helperInstance->ifUserAccountGuest()) {
// Account is guest account
- $helper->addFormNote('status_guest', "Gästeaccounts sind in der Funktionalität
+ $helperInstance->addFormNote('status_guest', "Gästeaccounts sind in der Funktionalität
leicht eingeschränkt. Bitte melde dich an, damit du ein
vollwertiges Account bekommst."
);
}
// Flush content and automatically close the form
-$helper->flushContent();
+$helperInstance->flushContent();
-if ($helper->ifUserAccountUnconfirmed()) {
+if ($helperInstance->ifUserAccountUnconfirmed()) {
// Build the form for confirmation
- $helper = WebFormHelper::createWebFormHelper($this, "confirm_code");
+ $helperInstance = WebFormHelper::createWebFormHelper($this, "confirm_code");
// Add code box
- $helper->addFormGroup('code', "Bitte gebe hier den Bestätigungscode aus der Willkommensemail ein. Solltest du diese nicht erhalten haben, kannst du dir diesen jetzt zusenden lassen.");
- $helper->addFieldText('code', "Bestätigungscode aus der Mail:");
- $helper->addInputTextField('code');
+ $helperInstance->addFormGroup('code', "Bitte gebe hier den Bestätigungscode aus der Willkommensemail ein. Solltest du diese nicht erhalten haben, kannst du dir diesen jetzt zusenden lassen.");
+ $helperInstance->addFieldText('code', "Bestätigungscode aus der Mail:");
+ $helperInstance->addInputTextField('code');
// Add submit button
- $helper->addFormGroup('buttons', "Bitte einmal abschicken und das Ergebnis abwarten!");
- $helper->addInputResetButton("Nochmal eingeben");
- $helper->addInputSubmitButton("Bestätigungscode absenden");
+ $helperInstance->addFormGroup('buttons', "Bitte einmal abschicken und das Ergebnis abwarten!");
+ $helperInstance->addInputResetButton("Nochmal eingeben");
+ $helperInstance->addInputSubmitButton("Bestätigungscode absenden");
// Flush content and automatically close the form
- $helper->flushContent();
+ $helperInstance->flushContent();
} // END - if
?>
<div id="content_header">
<?php
// Get helper instance
-$helper = WebLinkHelper::createWebLinkHelper($this, 'direct_login_link', 'index.php?app={?app_short_name?}&page=login');
+$helperInstance = WebLinkHelper::createWebLinkHelper($this, 'direct_login_link', 'index.php?app={?app_short_name?}&page=login');
// Set link text
-$helper->addLinkWithTextById('direct_login_link_text');
+$helperInstance->addLinkWithTextById('direct_login_link_text');
// Flush the content
-$helper->flushContent();
+$helperInstance->flushContent();
// [EOF]
?>
<?php
// Get helper instance
-$helper = WebLinkHelper::createWebLinkHelper($this, 'login_retry_link', 'index.php?app={?app_short_name?}&page=login');
+$helperInstance = WebLinkHelper::createWebLinkHelper($this, 'login_retry_link', 'index.php?app={?app_short_name?}&page=login');
// Set link text
-$helper->addLinkWithTextById('login_retry_text');
+$helperInstance->addLinkWithTextById('login_retry_text');
// Flush the content
-$helper->flushContent();
+$helperInstance->flushContent();
// [EOF]
?>
// 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
// BaseHelper.
-$helper = WebFormHelper::createWebFormHelper($this, 'shipsimu_user_login');
+$helperInstance = WebFormHelper::createWebFormHelper($this, 'shipsimu_user_login');
// Formular deaktiviert?
-if ($helper->ifLoginIsEnabled()) {
+if ($helperInstance->ifLoginIsEnabled()) {
// Formular ist aktiv
- $helper->addFormGroup('login', "Gebe hier deine Logindaten ein:");
+ $helperInstance->addFormGroup('login', "Gebe hier deine Logindaten ein:");
// Welches Loginverfahren wurde konfiguriert?
- if ($helper->ifLoginWithUsername()) {
+ if ($helperInstance->ifLoginWithUsername()) {
// Login mit Username
- $helper->addFormSubGroup('username', "Bitte mit deinem Nickname einloggen.");
- $helper->addFieldText('username', "Dein Nickname:");
- $helper->addInputTextField('username');
- } elseif ($helper->ifLoginWithEmail()) {
+ $helperInstance->addFormSubGroup('username', "Bitte mit deinem Nickname einloggen.");
+ $helperInstance->addFieldText('username', "Dein Nickname:");
+ $helperInstance->addInputTextField('username');
+ } elseif ($helperInstance->ifLoginWithEmail()) {
// Login mit Email
- $helper->addFormSubGroup('email', "Bitte mit deiner Email-Adresse einloggen.");
- $helper->addFieldText('email', "Deine Email-Addresse:");
- $helper->addInputTextField('email');
+ $helperInstance->addFormSubGroup('email', "Bitte mit deiner Email-Adresse einloggen.");
+ $helperInstance->addFieldText('email', "Deine Email-Addresse:");
+ $helperInstance->addInputTextField('email');
} else {
// Login mit Email/Username
- $helper->addFormSubGroup('user_email', "Bitte mit deinem Nickname oder Email-Adresse einloggen.");
- $helper->addFieldText('user_email', "Dein Nickname/Email:");
- $helper->addInputTextField('user_email');
+ $helperInstance->addFormSubGroup('user_email', "Bitte mit deinem Nickname oder Email-Adresse einloggen.");
+ $helperInstance->addFieldText('user_email', "Dein Nickname/Email:");
+ $helperInstance->addInputTextField('user_email');
}
- $helper->addFormSubGroup('pass', "Gebe dein Passwort von der Anmeldung ein.");
- $helper->addFieldText('pass', "Dein Passwort:");
- $helper->addInputPasswordField('pass');
+ $helperInstance->addFormSubGroup('pass', "Gebe dein Passwort von der Anmeldung ein.");
+ $helperInstance->addFieldText('pass', "Dein Passwort:");
+ $helperInstance->addInputPasswordField('pass');
// CAPTCHA enabled?
- if ($helper->ifFormSecuredWithCaptcha()) {
- $helper->addFormGroup('captcha_user', "Unser Benuzter-Login ist durch ein CAPTCHA geschützt. Bitte wiederhole den angezeigten Code, damit du dich einloggen kannst.");
- $helper->addCaptcha();
+ if ($helperInstance->ifFormSecuredWithCaptcha()) {
+ $helperInstance->addFormGroup('captcha_user', "Unser Benuzter-Login ist durch ein CAPTCHA geschützt. Bitte wiederhole den angezeigten Code, damit du dich einloggen kannst.");
+ $helperInstance->addCaptcha();
} // END - if
// Submit buttons
- $helper->addFormGroup('buttons_user', "Alles richtig eingegeben?");
- $helper->addInputResetButton("Formular leeren");
- $helper->addInputSubmitButton("Zum Spiel einloggen");
+ $helperInstance->addFormGroup('buttons_user', "Alles richtig eingegeben?");
+ $helperInstance->addInputResetButton("Formular leeren");
+ $helperInstance->addInputSubmitButton("Zum Spiel einloggen");
} else {
// Formular deaktiviert
- $helper->addFormNote('form_deactivated', "Einloggen in's Spiel ist derzeit administrativ deaktiviert worden. Bitte komme später noch mal wieder.");
- $helper->addFormNote('admin_notice', "Nachricht vom Admin: <span id=\"disabled_reason\">".$this->getConfigInstance()->readConfig('login_disabled_reason')."</span>");
+ $helperInstance->addFormNote('form_deactivated', "Einloggen in's Spiel ist derzeit administrativ deaktiviert worden. Bitte komme später noch mal wieder.");
+ $helperInstance->addFormNote('admin_notice', "Nachricht vom Admin: <span id=\"disabled_reason\">".$this->getConfigInstance()->readConfig('login_disabled_reason')."</span>");
}
// Formular schliessen
-$helper->flushContent();
+$helperInstance->flushContent();
// Ist Gastlogin erlaubt?
-if ($helper->ifGuestLoginAllowed()) {
+if ($helperInstance->ifGuestLoginAllowed()) {
// Neue Helper-Instanz holen
- $helper = WebFormHelper::createWebFormHelper($this, 'shipsimu_guest_login');
- $helper->addInputHiddenConfiguredField('user', 'guest_login');
- $helper->addInputHiddenConfiguredField('passwd', 'guest_login');
+ $helperInstance = WebFormHelper::createWebFormHelper($this, 'shipsimu_guest_login');
+ $helperInstance->addInputHiddenConfiguredField('user', 'guest_login');
+ $helperInstance->addInputHiddenConfiguredField('passwd', 'guest_login');
// CAPTCHA enbaled?
- if ($helper->ifFormSecuredWithCaptcha()) {
- $helper->addFormGroup('captcha_guest', "Unser Gast-Login ist durch ein CAPTCHA geschützt. Bitte wiederhole den angezeigten Code, damit du dich einloggen kannst.");
- $helper->addCaptcha();
+ if ($helperInstance->ifFormSecuredWithCaptcha()) {
+ $helperInstance->addFormGroup('captcha_guest', "Unser Gast-Login ist durch ein CAPTCHA geschützt. Bitte wiederhole den angezeigten Code, damit du dich einloggen kannst.");
+ $helperInstance->addCaptcha();
} // END - if
// Submit button
- $helper->addFormGroup('buttons_guest', "Gastlogins sind in der Funkionsweise eingeschränkt. Mehr dazu unter "Gastlogin".");
- $helper->addInputSubmitButton("Als Gast einloggen");
- $helper->flushContent();
+ $helperInstance->addFormGroup('buttons_guest', "Gastlogins sind in der Funkionsweise eingeschränkt. Mehr dazu unter "Gastlogin".");
+ $helperInstance->addInputSubmitButton("Als Gast einloggen");
+ $helperInstance->flushContent();
}
// Get helper instance
-$helper = WebLinkHelper::createWebLinkHelper($this, 'register_login_form_link', 'index.php?app={?app_short_name?}&page=register');
+$helperInstance = WebLinkHelper::createWebLinkHelper($this, 'register_login_form_link', 'index.php?app={?app_short_name?}&page=register');
// Set link text
-$helper->addLinkWithTextById('register_login_form_link_text');
+$helperInstance->addLinkWithTextById('register_login_form_link_text');
// Flush the content
-$helper->flushContent();
+$helperInstance->flushContent();
?>
<div id="content_header">
<?php
// Get helper instance
-$helper = WebLinkHelper::createWebLinkHelper($this, 'relogin_link', 'index.php?app={?app_short_name?}&page=login');
+$helperInstance = WebLinkHelper::createWebLinkHelper($this, 'relogin_link', 'index.php?app={?app_short_name?}&page=login');
// Set link text
-$helper->addLinkWithTextById('relogin_link_text');
+$helperInstance->addLinkWithTextById('relogin_link_text');
// Flush the content
-$helper->flushContent();
+$helperInstance->flushContent();
// [EOF]
?>
// 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
// BaseHelper.
-$helper = WebFormHelper::createWebFormHelper($this, 'shipsimu_register');
+$helperInstance = WebFormHelper::createWebFormHelper($this, 'shipsimu_register');
// Always ask at least for nickname and password
-$helper->addFormGroup('login', "Bitte gebe hier gewünschten Nickname und dein Zugangspasswort ein.");
-$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');
-$helper->addFormSubGroup('pass', "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('pass1', "Passwort:");
-$helper->addInputPasswordField('pass1');
-$helper->addFieldText('pass2', "Passwortwiederholung:");
-$helper->addInputPasswordField('pass2');
-
-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');
- $helper->addFieldText('email2', "Wiederholung Email-Adresse:");
- $helper->addInputTextField('email2');
-
- if ($helper->ifEmailMustBeUnique()) {
- $helper->addFormNote('email', "Die von dir eingegebene Email-Adresse darf nur einmal im Spiel verwendet worden sein.");
+$helperInstance->addFormGroup('login', "Bitte gebe hier gewünschten Nickname und dein Zugangspasswort ein.");
+$helperInstance->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.");
+$helperInstance->addFieldText('username', "Nickname im Spiel:");
+$helperInstance->addInputTextField('username');
+$helperInstance->addFormSubGroup('pass', "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.");
+$helperInstance->addFieldText('pass1', "Passwort:");
+$helperInstance->addInputPasswordField('pass1');
+$helperInstance->addFieldText('pass2', "Passwortwiederholung:");
+$helperInstance->addInputPasswordField('pass2');
+
+if ($helperInstance->ifRegisterRequiresEmailVerification()) {
+ $helperInstance->addFormGroup('email', "Bitte gebe deine Email zweimal (ein zweites Mal zur Bestätigung) ein, damit wir dir deinen Freischaltlink zusenden können.");
+ $helperInstance->addFieldText('email1', "Email-Adresse:");
+ $helperInstance->addInputTextField('email1');
+ $helperInstance->addFieldText('email2', "Wiederholung Email-Adresse:");
+ $helperInstance->addInputTextField('email2');
+
+ if ($helperInstance->ifEmailMustBeUnique()) {
+ $helperInstance->addFormNote('email', "Die von dir eingegebene Email-Adresse darf nur einmal im Spiel verwendet worden sein.");
} // END - Unique email addresses
} // END - email verification
-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 ($helperInstance->ifRegisterIncludesProfile()) {
+ $helperInstance->addFormGroup('profile', "Hier kannst du zusätzlich deine Profildaten vorweg eingeben, du kannst sie aber auch nach dem Login vervollständigen!");
- 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');
+ if (!$helperInstance->ifRegisterRequiresEmailVerification()) {
+ $helperInstance->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.");
+ $helperInstance->addFieldText('email1', "Email-Adresse:");
+ $helperInstance->addInputTextField('email1');
} // END - No email verification
// Persoenliche Daten mit in der Anmeldung abfragen?
- 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');
- $helper->addFieldText('family', "Dein Nachname:");
- $helper->addInputTextField('family');
- $helper->addFieldText('street', "Strasse und Hausnummer:");
- $helper->addInputTextField('street');
- $helper->addFieldText('city', "Wohnort:");
- $helper->addInputTextField('city');
+ if ($helperInstance->ifRegisterIncludesPersonaData()) {
+ $helperInstance->addFormSubGroup('persona', "Wenn du magst, dann vervollständige deine komplette Adresse mit deinem Namen.");
+ $helperInstance->addFieldText('surname', "Dein Vorname:");
+ $helperInstance->addInputTextField('surname');
+ $helperInstance->addFieldText('family', "Dein Nachname:");
+ $helperInstance->addInputTextField('family');
+ $helperInstance->addFieldText('street', "Strasse und Hausnummer:");
+ $helperInstance->addInputTextField('street');
+ $helperInstance->addFieldText('city', "Wohnort:");
+ $helperInstance->addInputTextField('city');
} // END - Persona data
- $helper->addFormSubGroup('zip', "Magst du uns auch deine Postleitzahl verraten?");
- $helper->addFieldText('zip', "Postleitzahl:");
- $helper->addInputTextField('zip');
+ $helperInstance->addFormSubGroup('zip', "Magst du uns auch deine Postleitzahl verraten?");
+ $helperInstance->addFieldText('zip', "Postleitzahl:");
+ $helperInstance->addInputTextField('zip');
- $helper->addFormSubGroup('chat', "Gebe hier deine Nicknames bzw. Nummern an:");
+ $helperInstance->addFormSubGroup('chat', "Gebe hier deine Nicknames bzw. Nummern an:");
- if ($helper->ifChatEnabled('icq')) {
- $helper->addFieldText('icq', "ICQ-Nummer:");
- $helper->addInputTextField('icq');
+ if ($helperInstance->ifChatEnabled('icq')) {
+ $helperInstance->addFieldText('icq', "ICQ-Nummer:");
+ $helperInstance->addInputTextField('icq');
} // END - if
- if ($helper->ifChatEnabled('jabber')) {
- $helper->addFieldText('jabber', "Jabber:");
- $helper->addInputTextField('jabber');
+ if ($helperInstance->ifChatEnabled('jabber')) {
+ $helperInstance->addFieldText('jabber', "Jabber:");
+ $helperInstance->addInputTextField('jabber');
} // END - if
- if ($helper->ifChatEnabled('yahoo')) {
- $helper->addFieldText('yahoo', "Yahoo!:");
- $helper->addInputTextField('yahoo');
+ if ($helperInstance->ifChatEnabled('yahoo')) {
+ $helperInstance->addFieldText('yahoo', "Yahoo!:");
+ $helperInstance->addInputTextField('yahoo');
} // END - if
- if ($helper->ifChatEnabled('aol')) {
- $helper->addFieldText('aol', "AOL-Screenname:");
- $helper->addInputTextField('aol');
+ if ($helperInstance->ifChatEnabled('aol')) {
+ $helperInstance->addFieldText('aol', "AOL-Screenname:");
+ $helperInstance->addInputTextField('aol');
} // END - if
- if ($helper->ifChatEnabled('msn')) {
- $helper->addFieldText('msn', "MSN:");
- $helper->addInputTextField('msn');
+ if ($helperInstance->ifChatEnabled('msn')) {
+ $helperInstance->addFieldText('msn', "MSN:");
+ $helperInstance->addInputTextField('msn');
} // END - if
- if (!$helper->ifRegisterRequiresEmailVerification()) {
- $helper->addFormExtraNote(1, "Die Benachrichtigungen per sind im Loginbereich verfeinerbar, welche du genau haben willst.");
+ if (!$helperInstance->ifRegisterRequiresEmailVerification()) {
+ $helperInstance->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);
+$helperInstance->addFormGroup('rules', "Bitte lese dir die Spieleregeln gut durch und kreuze dann "Ja, ich akzeptiere die aktuellen Spielregeln" an.");
+$helperInstance->addFieldText('rules', "Ja, ich akzeptiere die aktuellen Spielregeln:");
+$helperInstance->addInputCheckboxField('rules', false);
// Add CAPTCHA?
-if ($helper->ifFormSecuredWithCaptcha()) {
- $helper->addFormGroup('captcha', "Bitte wiederhole den angezeigten Code damit die Anmeldung abgeschlossen werden kann.");
- $helper->addCaptcha();
+if ($helperInstance->ifFormSecuredWithCaptcha()) {
+ $helperInstance->addFormGroup('captcha', "Bitte wiederhole den angezeigten Code damit die Anmeldung abgeschlossen werden kann.");
+ $helperInstance->addCaptcha();
} // END - if
// Final note and submit buttons
-$helper->addFormGroup('buttons', "Wenn du alle benötigten Felder korrekt ausgefüt hast, kannst du die Anmeldung abschliessen.");
+$helperInstance->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('data_protection', "Deine Daten werden nach den gültigen Datenschutzgesetzten gespeichert und werden nicht an Dritte weitergegeben. Weiteres dazu siehe Link "Datenschutz".");
-$helper->flushContent();
+$helperInstance->addInputResetButton("Alles nochmal eingeben");
+$helperInstance->addInputSubmitButton("Anmeldung zum Spiel abschliessen");
+$helperInstance->addFormNote('data_protection', "Deine Daten werden nach den gültigen Datenschutzgesetzten gespeichert und werden nicht an Dritte weitergegeben. Weiteres dazu siehe Link "Datenschutz".");
+$helperInstance->flushContent();
?>
<div id="content_header">
Anmeldung bei <span class="app_name">{?app_full_name?}</span>
// Set real class
$this->setRealClass($className);
- // Initialize the class if the registry is there
+ // Initialize the class if the class Registry is there
if ((class_exists('Registry')) && (Registry::isInitialized() === false)) {
+ // Initialize the registry automatically
$this->initInstance();
} // END - if
}
/**
* Debugs this instance by putting out it's full content
*
+ * @param $message Optional message to show in debug output
* @return void
*/
- public final function debugInstance () {
+ public final function debugInstance ($message = "") {
// Restore the error handler to avoid trouble with missing array elements or undeclared variables
restore_error_handler();
+ // Init content
+ $content = "";
+
+ // Is a message set?
+ if (!empty($message)) {
+ // Construct message
+ $content = sprintf("<div class=\"debug_message\">Message: %s</div>\n", $message);
+ } // END - if
+
// Generate the output
- $content = sprintf("<pre>%s</pre>",
+ $content .= sprintf("<pre>%s</pre>",
trim(
htmlentities(
print_r($this, true)
if (is_object($debugInstance)) {
// Use debug output handler
$debugInstance->output($message);
- if (!$doPrint) die(); // Die here if not printed
+ if ($doPrint === false) die(); // Die here if not printed
} else {
// Put directly out
if ($doPrint) {
$this->getResultInstance()->rewind();
// Do we have an entry?
- if (!$this->getResultInstance()->valid()) {
+ if ($this->getResultInstance()->valid() === false) {
throw new InvalidDatabaseResultException(array($this, $this->getResultInstance()), DatabaseResult::EXCEPTION_INVALID_DATABASE_RESULT);
} // END - if
*
* @param $resolverInstance An instance of a command resolver class
* @return $controllerInstance A prepared instance of this class
+ * @todo Add some morer filters to this controller
*/
public final static function createWebLoginAreaController (CommandResolver $resolverInstance) {
// Create the instance
// News proccess/display-preparation
$controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_filter'));
- /* @todo: Add some filters to this controller */
-
// Return the prepared instance
return $controllerInstance;
}
// Set the command resolver
$controllerInstance->setResolverInstance($resolverInstance);
- // Add user auth filter (we don't need an update of the user here because it will be redirected)
- $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_filter'));
-
- // Check for user status by default
- $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter'));
-
// Return the prepared instance
return $controllerInstance;
}
}
// Does the email exist?
- if (!$userInstance->ifEmailAddressExists()) {
+ if ($userInstance->ifEmailAddressExists() === false) {
// This email has not being used yet
$alreadyTaken = false;
}
}
// Does the username exist?
- if ((is_null($userInstance)) || (!$userInstance->ifUsernameExists())) {
+ if ((is_null($userInstance)) || ($userInstance->ifUsernameExists() === false)) {
// This username is still available
$alreadyTaken = false;
} // END - if
// Abort here
return false;
- } elseif (!$this->ifUserGuestIsTaken($userName)) {
+ } elseif ($this->ifUserGuestIsTaken($userName) === false) {
// Username is already taken
$requestInstance->requestIsValid(false);
}
// Does the username exist?
- if ((is_null($userInstance)) || (!$userInstance->ifUsernameExists())) {
+ if ((is_null($userInstance)) || ($userInstance->ifUsernameExists() === false)) {
// This username is still available
$alreadyTaken = false;
}
// Abort here
return false;
- } elseif (!$this->ifUserNameIsTaken($userName)) {
+ } elseif ($this->ifUserNameIsTaken($userName) === false) {
// Username is already taken
$requestInstance->requestIsValid(false);
}
// Does the username exist?
- if ((is_null($userInstance)) || (!$userInstance->ifUsernameExists())) {
+ if ((is_null($userInstance)) || ($userInstance->ifUsernameExists() === false)) {
// This username is still available
$alreadyTaken = false;
} // END - if
$userInstance = call_user_func_array(array($userClass, 'createMemberByRequest'), array($requestInstance));
// Is the email address valid?
- if (!$userInstance->ifEmailAddressExists()) {
+ if ($userInstance->ifEmailAddressExists() === false) {
// Request is invalid!
$requestInstance->requestIsValid(false);
*
* @param $groupId Group id to open
* @param $content Initial content to add to the group
+ * @param $tag HTML tag used to open this group
* @return void
* @throws HelperGroupAlreadyCreatedException If the group was already created before
*/
- protected function openGroupByIdContent ($groupId, $content) {
- //* DEBUG: */ echo "OPEN:groupId={$groupId}<br />\n";
+ protected function openGroupByIdContent ($groupId, $content, $tag) {
+ //* DEBUG: */ echo "OPEN:groupId={$groupId},content=<pre>".htmlentities($content)."</pre>\n";
// Is the group already there?
if (isset($this->groups[$groupId])) {
// Then throw an exception here
// Add the group to the stack
$this->groups[$this->totalCounter] = $groupId;
$this->groups[$groupId]['opened'] = true;
- $this->groups[$groupId]['content'] = $content."\n";
+ $this->groups[$groupId]['content'] = sprintf("<!-- group %s opened (length: %s, tag: %s) //-->%s\n", $groupId, strlen($content), $tag, $content);
+ $this->groups[$groupId]['tag'] = $tag;
// Mark this group as previously opened
$this->setPreviousGroupId($groupId);
* Closes the previously opened group by added given content to it or
* throws an exception if no previous group was opened
*
- * @param $content Content for previously opened grouop
+ * @param $content Content for previously opened group, or empty to use tag of opener
* @return void
* @throws HelperNoPreviousOpenedGroupException If no previously opened group was found
*/
- public function closePreviousGroupByContent ($content) {
+ public function closePreviousGroupByContent ($content = "") {
+ // Check if any sub group was opened before
+ if ($this->ifSubGroupOpenedPreviously()) {
+ // Close it automatically
+ $this->closePreviousSubGroupByContent();
+ } // END - if
+
// Check if any group was opened before
- if (!$this->ifGroupOpenedPreviously()) {
+ if ($this->ifGroupOpenedPreviously() === false) {
// Then throw an exception
throw new HelperNoPreviousOpenedGroupException(array($this, $content), self::EXCEPTION_NO_PREVIOUS_SUB_GROUP_OPENED);
} // END - if
// Get previous group
$groupId = $this->getPreviousGroupId();
+ // Is the content empty?
+ if ((empty($content)) && (!empty($this->groups[$groupId]['tag']))) {
+ // Get it from opener
+ $content = sprintf("<!-- group %s auto-closed //--></%s>", $groupId, $this->groups[$groupId]['tag']);
+ } // END - if
+
// Add content to it and mark it as closed
- $this->groups[$groupId]['content'] .= $content."\n";
+ $this->groups[$groupId]['content'] .= sprintf("<!-- group %s closed (length: %s, tag: %s) //-->%s\n", $groupId, strlen($content), $this->groups[$groupId]['tag'], $content);
$this->groups[$groupId]['opened'] = false;
// Mark previous group as closed
*
* @param $subGroupId Sub group id to open
* @param $content Initial content to add to the sub group
+ * @param $tag HTML tag used to open this group
* @return void
* @throws HelperSubGroupAlreadyCreatedException If the sub group was already created before
*/
- protected function openSubGroupByIdContent ($subGroupId, $content) {
+ protected function openSubGroupByIdContent ($subGroupId, $content, $tag) {
//* DEBUG: */ echo "OPEN:subGroupId={$subGroupId},content=".htmlentities($content)."<br />\n";
// Is the group already there?
if (isset($this->subGroups[$subGroupId])) {
// Add the group to the stack
$this->subGroups[$this->totalCounter] = $subGroupId;
$this->subGroups[$subGroupId]['opened'] = true;
- $this->subGroups[$subGroupId]['content'] = $content."\n";
+ $this->subGroups[$subGroupId]['content'] = sprintf("<!-- sub-group %s opened (length: %s, tag: %s) //-->%s\n", $subGroupId, strlen($content), $tag, $content);
+ $this->subGroups[$subGroupId]['tag'] = $tag;
// Mark this group as previously opened
$this->setPreviousSubGroupId($subGroupId);
* Closes the previously opened sub group by added given content to it or
* throws an exception if no previous sub group was opened
*
- * @param $content Content for previously opened sub grouop
+ * @param $content Content for previously opened sub group, or leave empty to use div/span of openener
* @return void
* @throws HelperNoPreviousOpenedSubGroupException If no previously opened sub group was found
*/
- public function closePreviousSubGroupByContent ($content) {
+ public function closePreviousSubGroupByContent ($content = "") {
// Check if any sub group was opened before
- if (!$this->ifSubGroupOpenedPreviously()) {
+ if ($this->ifSubGroupOpenedPreviously() === false) {
// Then throw an exception
throw new HelperNoPreviousOpenedSubGroupException(array($this, $content), self::EXCEPTION_NO_PREVIOUS_SUB_GROUP_OPENED);
} // END - if
// Get previous sub group
$subGroupId = $this->getPreviousSubGroupId();
+ // Is the content empty?
+ if ((empty($content)) && (!empty($this->subGroups[$subGroupId]['tag']))) {
+ // Get it from opener
+ $content = sprintf("<!-- sub-group %s auto-closed //--></%s>", $subGroupId, $this->subGroups[$subGroupId]['tag']);
+ } // END - if
+
// Add content to it and mark it as closed
- $this->subGroups[$subGroupId]['content'] .= $content."\n";
+ $this->subGroups[$subGroupId]['content'] .= sprintf("<!-- sub-group %s closed (length: %s, tag: %s) //-->%s\n", $subGroupId, strlen($content), $this->subGroups[$subGroupId]['tag'], $content);
$this->subGroups[$subGroupId]['opened'] = false;
// Mark previous sub group as closed
// Is this a group and is it closed?
if ((isset($this->groups[$idx])) && ($this->groups[$this->groups[$idx]]['opened'] === false)) {
// Then add it's content
- $groupContent = $this->groups[$this->groups[$idx]]['content'];
+ $groupContent = trim($this->groups[$this->groups[$idx]]['content']);
//* DEBUG: */ echo "group={$this->groups[$idx]},content=<pre>".htmlentities($groupContent)."</pre><br />\n";
$content .= $groupContent;
} elseif ((isset($this->subGroups[$idx])) && ($this->subGroups[$this->subGroups[$idx]]['opened'] === false)) {
// Then add it's content
$subGroupContent = $this->subGroups[$this->subGroups[$idx]]['content'];
//* DEBUG: */ echo "subgroup={$this->subGroups[$idx]},content=<pre>".htmlentities($subGroupContent)."</pre><br />\n";
- $content .= $subGroupContent;
+ $content .= trim($subGroupContent);
} else {
// Something went wrong
- $this->debugInstance();
+ $this->debugInstance(__METHOD__."(): Something unexpected happened here.");
}
-
} // END - for
// Is footer content there?
} // END - if
// At least the group name should be set
- if ((empty($groupId)) && (!$this->ifGroupOpenedPreviously())) {
+ if ((empty($groupId)) && ($this->ifGroupOpenedPreviously() === false)) {
// Throw exception here
throw new EmptyVariableException(array($this, 'groupId'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
} elseif (empty($groupId)) {
}
// Same group to open?
- if ((!$this->ifGroupOpenedPreviously()) && ($groupId == $this->getPreviousGroupId())) {
+ if (($this->ifGroupOpenedPreviously() === false) && ($groupId === $this->getPreviousGroupId())) {
// Abort here silently
return false;
} // END - if
$content = " </div>\n</div><!-- Group - CLOSE //-->";
// Is this group opened?
- if (!$this->ifGroupOpenedPreviously()) {
+ if ($this->ifGroupOpenedPreviously() === false) {
// Begin the div/span blocks
$content = sprintf("<!-- Group %s - OPEN //-->
<div class=\"group_box\" id=\"%s_group_box\">
);
// Switch the state
- $this->openGroupByIdContent($groupId, $content);
+ $this->openGroupByIdContent($groupId, $content, "div");
} else {
// Is a sub group opened?
if ($this->ifSubGroupOpenedPreviously()) {
*/
public function addFormSubGroup ($subGroupId = "", $subGroupText = "") {
// Is a group opened?
- if (!$this->ifGroupOpenedPreviously()) {
+ if ($this->ifGroupOpenedPreviously() === false) {
// Throw exception here
throw new FormFormClosedException(array($this, $subGroupId), self::EXCEPTION_UNEXPECTED_CLOSED_GROUP);
} // END - if
// At least the sub group name should be set
- if ((empty($subGroupId)) && (!$this->ifSubGroupOpenedPreviously())) {
+ if ((empty($subGroupId)) && ($this->ifSubGroupOpenedPreviously() === false)) {
// Throw exception here
throw new EmptyVariableException(array($this, 'subGroupId'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
} elseif (empty($subGroupId)) {
}
// Same sub group to open?
- if ((!$this->ifSubGroupOpenedPreviously()) && ($subGroupId == $this->getPreviousSubGroupId())) {
+ if (($this->ifSubGroupOpenedPreviously() === false) && ($subGroupId == $this->getPreviousSubGroupId())) {
// Abort here silently
return false;
} // END - if
$content = " </div>\n</div><!-- Sub group- CLOSE //-->";
// Is this group opened?
- if (!$this->ifSubGroupOpenedPreviously()) {
+ if ($this->ifSubGroupOpenedPreviously() === false) {
// Begin the span block
$content = sprintf("<!-- Sub group %s - OPEN //-->
<div class=\"subgroup_box\" id=\"%s_subgroup_box\">
);
// Switch the state and remeber the name
- $this->openSubGroupByIdContent($subGroupId, $content);
+ $this->openSubGroupByIdContent($subGroupId, $content, "div");
} else {
// Get previous sub group id
$prevSubGroupId = $this->getPreviousSubGroupId();
} // END - if
// Shall we close or open the sub group?
- if ((!$this->ifSubGroupOpenedPreviously()) && ($this->getPreviousSubGroupId() !== $selectId)) {
+ if (($this->ifSubGroupOpenedPreviously() === false) && ($this->getPreviousSubGroupId() !== $selectId)) {
// Initialize first entry (which might be non-selectable if content is provided
if (!empty($firstEntry)) {
// Add selection around it
);
// Open the sub group
- $this->openSubGroupByIdContent($selectId, $content);
+ $this->openSubGroupByIdContent($selectId, $content, "select");
} elseif ($this->getPreviousSubGroupId() != $selectId) {
// Something went wrong!
- $this->debugInstance();
+ $this->debugInstance(__METHOD__."(): Previous sub group id {$this->getPreviousSubGroupId()} does not match current id {$selectId}.");
} else {
// Close the sub group
$this->closePreviousSubGroupByContent("</select>");
*/
public function addSelectSubOption ($subName, $subValue) {
// Is there a sub group (shall be a selection box!)
- if (!$this->ifSubGroupOpenedPreviously()) {
+ if ($this->ifSubGroupOpenedPreviously() === false) {
// Then throw an exception here
throw new HelperNoPreviousOpenedSubGroupException(array($this, $content), self::EXCEPTION_NO_PREVIOUS_SUB_GROUP_OPENED);
} // END - if
*/
public function addSelectOption ($optionName, $optionValue) {
// Is there a sub group (shall be a selection box!)
- if (!$this->ifSubGroupOpenedPreviously()) {
+ if ($this->ifSubGroupOpenedPreviously() === false) {
// Then throw an exception here
throw new HelperNoPreviousOpenedSubGroupException(array($this, $content), self::EXCEPTION_NO_PREVIOUS_SUB_GROUP_OPENED);
} // END - if
$helperInstance->setLinkBase($linkBase);
// Add default group
- $helperInstance->openGroupByIdContent('main', "");
+ $helperInstance->openGroupByIdContent('main', "", "");
// Return the prepared instance
return $helperInstance;
*
* @param $groupId Id string of the group
* @param $groupText Text for this group to add
+ * @param $groupCode Code to open and close groups
* @return void
*/
- public function addLinkGroup ($groupId, $groupText) {
+ public function addLinkGroup ($groupId, $groupText, $groupCode = "div") {
// Is a group with that name open?
- if ($this->ifGroupIsOpened($groupId)) {
+ if ($this->ifGroupOpenedPreviously()) {
// Then close it here
- $this->closePreviousGroupByContent("</div>");
- } else {
- // Is a previous opened group still open?
- if ($this->ifGroupOpenedPreviously()) {
- // Then close it
- $this->closePreviousGroupByContent("</div>");
- } // END - if
-
- // Generate the group content
- $content = sprintf("<div id=\"group_%s_%s\">%s",
- $this->getLinkName(),
- $groupId,
- $groupText
- );
-
- // Open the new group
- $this->openGroupByIdContent($groupId, $content);
- }
+ $this->closePreviousGroupByContent("");
+ } // END - if
+
+ // Generate the group content
+ $content = sprintf("<{$groupCode} id=\"group_%s_%s\">%s",
+ $this->getLinkName(),
+ $groupId,
+ $groupText
+ );
+
+ // Open the new group
+ $this->openGroupByIdContent($groupId, $content, $groupCode);
}
/**
* Adds text (note) to the previously opened group or throws an exception
* if no previous group was opened.
*
+ * @param $groupId Group id to set
* @param $groupNote Note to be added to a group
+ * @param $groupCode Code to open and close groups
* @return void
* @throws NoGroupOpenedException If no previous group was opened
*/
- public function addLinkNote ($groupNote) {
+ public function addLinkNote ($groupId, $groupNote, $groupCode = "div") {
// Check if a previous group was opened
- if (!$this->ifGroupOpenedPreviously()) {
+ if ($this->ifGroupOpenedPreviously() === false) {
// No group was opened before!
throw new NoGroupOpenedException(array($this, $groupNote), self::EXCEPTION_GROUP_NOT_OPENED);
} // END - if
- // Add the content to the previous group
- $this->addContentToPreviousGroup($groupNote);
+ // Is a previous sub group open?
+ if ($this->ifSubGroupOpenedPreviously()) {
+ // Then close it
+ $this->closePreviousSubGroupByContent("</{$groupCode}>");
+ } // END - if
+
+ // Generate the group content
+ $content = sprintf("<{$groupCode} id=\"subgroup_%s_%s\">%s",
+ $this->getLinkName(),
+ $groupId,
+ $groupNote
+ );
+
+ // Open the sub group
+ $this->openSubGroupByIdContent($groupId, $content, $groupCode);
}
/**
*/
public function addActionLink ($linkAction, $linkText) {
// Check if a previous group was opened
- if (!$this->ifGroupOpenedPreviously()) {
+ if ($this->ifGroupOpenedPreviously() === false) {
// No group was opened before!
throw new NoGroupOpenedException(array($this, $linkAction."(".$linkText.")"), self::EXCEPTION_GROUP_NOT_OPENED);
} // END - if
if (empty($actionName)) {
// Then thrown an exception here
throw new EmptyVariableException(array($resolverInstance, 'defaultAction'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
- } elseif (!$resolverInstance->isActionValid($actionName)) {
+ } elseif ($resolverInstance->isActionValid($actionName) === false) {
// Invalid action found
throw new InvalidActionException(array($resolverInstance, $actionName), self::EXCEPTION_INVALID_ACTION);
}
if (empty($actionName)) $actionName = $this->getConfigInstance()->readConfig('default_action');
// Check if the action is valid
- if (!$this->isActionValid($actionName)) {
+ if ($this->isActionValid($actionName) === false) {
// This action is invalid!
throw new InvalidActionException(array($this, $actionName), self::EXCEPTION_INVALID_ACTION);
} // END - if
if (empty($actionName)) $actionName = $this->getConfigInstance()->readConfig('default_action');
// Check if the action is valid
- if (!$this->isActionValid($actionName)) {
+ if ($this->isActionValid($actionName) === false) {
// This action is invalid!
throw new InvalidActionException(array($this, $actionName), self::EXCEPTION_INVALID_ACTION);
}
if (empty($commandName)) {
// Then thrown an exception here
throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
- } elseif (!$resolverInstance->isCommandValid($commandName)) {
+ } elseif ($resolverInstance->isCommandValid($commandName) === false) {
// Invalid command found
throw new InvalidCommandException(array($resolverInstance, $commandName), self::EXCEPTION_INVALID_COMMAND);
}
if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_image_command');
// Check if the command is valid
- if (!$this->isCommandValid($commandName)) {
+ if ($this->isCommandValid($commandName) === false) {
// This command is invalid!
throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
} // END - if
if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_image_command');
// Check if the command is valid
- if (!$this->isCommandValid($commandName)) {
+ if ($this->isCommandValid($commandName) === false) {
// This command is invalid!
throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
}
if (empty($commandName)) {
// Then thrown an exception here
throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
- } elseif (!$resolverInstance->isCommandValid($commandName)) {
+ } elseif ($resolverInstance->isCommandValid($commandName) === false) {
// Invalid command found
throw new InvalidCommandException(array($resolverInstance, $commandName), self::EXCEPTION_INVALID_COMMAND);
}
if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_web_command');
// Check if the command is valid
- if (!$this->isCommandValid($commandName)) {
+ if ($this->isCommandValid($commandName) === false) {
// This command is invalid!
throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
} // END - if
if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_web_command');
// Check if the command is valid
- if (!$this->isCommandValid($commandName)) {
+ if ($this->isCommandValid($commandName) === false) {
// This command is invalid!
throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
}
));
// Try it hard to get an controller
- while (!$isValid) {
+ while ($isValid === false) {
// Is this class already loaded?
if (class_exists($this->getClassName())) {
// This class does exist. :-)
if (empty($controllerName)) {
// Then thrown an exception here
throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
- } elseif (!$resolverInstance->isControllerValid($controllerName)) {
+ } elseif ($resolverInstance->isControllerValid($controllerName) === false) {
// Invalid command found
throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
}
if (empty($controllerName)) {
// Then thrown an exception here
throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
- } elseif (!$resolverInstance->isControllerValid($controllerName)) {
+ } elseif ($resolverInstance->isControllerValid($controllerName) === false) {
// Invalid command found
throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
}
* already sent
*/
public function flushBuffer ($force = false) {
- if ((headers_sent()) && (!$force)) {
+ if ((headers_sent()) && ($force === false)) {
// Headers are already sent!
throw new ResponseHeadersAlreadySentException($this, self::EXCEPTION_HEADERS_ALREADY_SENT);
} elseif (!headers_sent()) {
$userInstance->setUserName($userName);
// Check if the username exists
- if (!$userInstance->ifUsernameExists()) {
+ if ($userInstance->ifUsernameExists() === false) {
// Throw an exception here
throw new UsernameMissingException(array($userInstance, $userName), self::EXCEPTION_USERNAME_NOT_FOUND);
- }
+ } // END - if
// Return the instance
return $userInstance;
$userInstance->setUserName($userName);
// Check if the username exists
- if (!$userInstance->ifUsernameExists()) {
+ if ($userInstance->ifUsernameExists() === false) {
// Throw an exception here
throw new UsernameMissingException(array($userInstance, $userName), self::EXCEPTION_USERNAME_NOT_FOUND);
- }
+ } // END - if
// Return the instance
return $userInstance;