From: Roland Haeder Date: Tue, 25 Aug 2015 16:50:54 +0000 (+0200) Subject: Updated 'core' + renamed 'main' -> 'classes'. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=bacc5f4ac0c29e8d038e8cb3938eab902f9e96ca;hp=c05766cedd51503851746bbb7b5fb8d2f3e87a74;p=shipsimu.git Updated 'core' + renamed 'main' -> 'classes'. Signed-off-by: Roland Haeder --- diff --git a/application/shipsimu/classes/.htaccess b/application/shipsimu/classes/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/actions/.htaccess b/application/shipsimu/classes/actions/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/actions/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/actions/class_ b/application/shipsimu/classes/actions/class_ new file mode 100644 index 0000000..d84fab7 --- /dev/null +++ b/application/shipsimu/classes/actions/class_ @@ -0,0 +1,82 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @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 . + */ +class ???Action extends BaseShipSimuAction 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 create???Action (ActionResolver $resolverInstance) { + // Get a new instance + $actionInstance = new ???Action(); + + // 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) { + // Call parent execute method + parent::execute($requestInstance, $responseInstance); + + // Add your code here + $this->partialStub("You have to implement me."); + } + + /** + * 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 filters here + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // Call parent addExtraFilters method + parent::addExtraFilters($controllerInstance, $requestInstance); + + // Unfinished method + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/actions/class_BaseShipSimuAction.php b/application/shipsimu/classes/actions/class_BaseShipSimuAction.php new file mode 100644 index 0000000..41dcce0 --- /dev/null +++ b/application/shipsimu/classes/actions/class_BaseShipSimuAction.php @@ -0,0 +1,62 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class BaseShipSimuAction extends BaseAction { + /** + * Protected constructor + * + * @param $className Name of the class + * @return void + */ + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + } + + /** + * 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 + */ + protected function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Add code here executed with every action + } + + /** + * 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 filters here + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // Unfinished method + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/actions/ship-simu/.htaccess b/application/shipsimu/classes/actions/ship-simu/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/actions/ship-simu/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/actions/ship-simu/class_ShipSimuLoginAction.php b/application/shipsimu/classes/actions/ship-simu/class_ShipSimuLoginAction.php new file mode 100644 index 0000000..2fbee37 --- /dev/null +++ b/application/shipsimu/classes/actions/ship-simu/class_ShipSimuLoginAction.php @@ -0,0 +1,65 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class ShipSimuLoginAction extends BaseShipSimuAction implements PerformableAction { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this action + * + * @return $actionInstance An instance of this action class + */ + public static final function createShipSimuLoginAction () { + // Get a new instance + $actionInstance = new ShipSimuLoginAction(); + + // 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 Maybe we need to do something later here + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Call parent execute method + parent::execute($requestInstance, $responseInstance); + + // Add your code here + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/actions/ship-simu/class_ShipSimuProfileAction.php b/application/shipsimu/classes/actions/ship-simu/class_ShipSimuProfileAction.php new file mode 100644 index 0000000..56090bf --- /dev/null +++ b/application/shipsimu/classes/actions/ship-simu/class_ShipSimuProfileAction.php @@ -0,0 +1,65 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class ShipSimuProfileAction extends BaseShipSimuAction implements PerformableAction { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this action + * + * @return $actionInstance An instance of this action class + */ + public static final function createShipSimuProfileAction () { + // Get a new instance + $actionInstance = new ShipSimuProfileAction(); + + // 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 Maybe we need to do something later here + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Call parent execute method + parent::execute($requestInstance, $responseInstance); + + // Add your code here... + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/actions/web/.htaccess b/application/shipsimu/classes/actions/web/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/actions/web/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/actions/web/class_WebShipSimuLogin b/application/shipsimu/classes/actions/web/class_WebShipSimuLogin new file mode 100644 index 0000000..d60f442 --- /dev/null +++ b/application/shipsimu/classes/actions/web/class_WebShipSimuLogin @@ -0,0 +1,82 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @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 . + */ +class WebShipSimuLogin???Action extends BaseShipSimuAction 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 createWebShipSimuLogin???Action (ActionResolver $resolverInstance) { + // Get a new instance + $actionInstance = new WebShipSimuLogin???Action(); + + // 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) { + // Execute parent method + parent::execute($requestInstance, $responseInstance); + + // Add your code here + } + + /** + * 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 filters here + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // Check for user status by default + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/actions/web/class_WebShipSimuLoginCompanyAction.php b/application/shipsimu/classes/actions/web/class_WebShipSimuLoginCompanyAction.php new file mode 100644 index 0000000..842d6cb --- /dev/null +++ b/application/shipsimu/classes/actions/web/class_WebShipSimuLoginCompanyAction.php @@ -0,0 +1,82 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class WebShipSimuLoginCompanyAction extends BaseShipSimuAction 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 static final function createWebShipSimuLoginCompanyAction (ActionResolver $resolverInstance) { + // Get a new instance + $actionInstance = new WebShipSimuLoginCompanyAction(); + + // 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 Maybe add fetching company list of current user here? + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Call parent execute method + parent::execute($requestInstance, $responseInstance); + + // Add your code here... + } + + /** + * 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')); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/actions/web/class_WebShipSimuLoginGovernmentStartupHelpAction.php b/application/shipsimu/classes/actions/web/class_WebShipSimuLoginGovernmentStartupHelpAction.php new file mode 100644 index 0000000..fa62481 --- /dev/null +++ b/application/shipsimu/classes/actions/web/class_WebShipSimuLoginGovernmentStartupHelpAction.php @@ -0,0 +1,85 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class WebShipSimuLoginGovernmentStartupHelpAction extends BaseShipSimuAction 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 static final function createWebShipSimuLoginGovernmentStartupHelpAction (ActionResolver $resolverInstance) { + // Get a new instance + $actionInstance = new WebShipSimuLoginGovernmentStartupHelpAction(); + + // 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) { + // Call parent execute method + parent::execute($requestInstance, $responseInstance); + + // Add your code here... + } + + /** + * 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 filters here + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // Check for user status by default + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); + + // Check if government can pay startup help + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('government_pays_startup_help_filter')); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/actions/web/class_WebShipSimuLoginGovernmentTrainingAction.php b/application/shipsimu/classes/actions/web/class_WebShipSimuLoginGovernmentTrainingAction.php new file mode 100644 index 0000000..fcbc711 --- /dev/null +++ b/application/shipsimu/classes/actions/web/class_WebShipSimuLoginGovernmentTrainingAction.php @@ -0,0 +1,85 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class WebShipSimuLoginGovernmentTrainingAction extends BaseShipSimuAction 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 static final function createWebShipSimuLoginGovernmentTrainingAction (ActionResolver $resolverInstance) { + // Get a new instance + $actionInstance = new WebShipSimuLoginGovernmentTrainingAction(); + + // 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) { + // Call parent execute method + parent::execute($requestInstance, $responseInstance); + + // Add your code here... + } + + /** + * 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 government can pay a training + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('government_pays_training_filter')); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/actions/web/class_WebShipSimuLoginLogoutAction.php b/application/shipsimu/classes/actions/web/class_WebShipSimuLoginLogoutAction.php new file mode 100644 index 0000000..9b066a9 --- /dev/null +++ b/application/shipsimu/classes/actions/web/class_WebShipSimuLoginLogoutAction.php @@ -0,0 +1,81 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class WebShipSimuLoginLogoutAction extends BaseShipSimuAction 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 static final function createWebShipSimuLoginLogoutAction (ActionResolver $resolverInstance) { + // Get a new instance + $actionInstance = new WebShipSimuLoginLogoutAction(); + + // 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) { + // Call parent execute method + parent::execute($requestInstance, $responseInstance); + + // Add your code here + } + + /** + * 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 + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // Check for user status by default + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/actions/web/class_WebShipSimuLoginProfileAction.php b/application/shipsimu/classes/actions/web/class_WebShipSimuLoginProfileAction.php new file mode 100644 index 0000000..58d6745 --- /dev/null +++ b/application/shipsimu/classes/actions/web/class_WebShipSimuLoginProfileAction.php @@ -0,0 +1,82 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class WebShipSimuLoginProfileAction extends BaseShipSimuAction 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 static final function createWebShipSimuLoginProfileAction (ActionResolver $resolverInstance) { + // Get a new instance + $actionInstance = new WebShipSimuLoginProfileAction(); + + // 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) { + // Call parent execute method + parent::execute($requestInstance, $responseInstance); + + // Add your code here... + } + + /** + * 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 filters here + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // Check for user status by default + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/actions/web/class_WebShipSimuLoginRefillAction.php b/application/shipsimu/classes/actions/web/class_WebShipSimuLoginRefillAction.php new file mode 100644 index 0000000..31c7337 --- /dev/null +++ b/application/shipsimu/classes/actions/web/class_WebShipSimuLoginRefillAction.php @@ -0,0 +1,87 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class WebShipSimuLoginRefillAction extends BaseShipSimuAction 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 static final function createWebShipSimuLoginRefillAction (ActionResolver $resolverInstance) { + // Get a new instance + $actionInstance = new WebShipSimuLoginRefillAction(); + + // 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) { + // Call parent execute method + parent::execute($requestInstance, $responseInstance); + + // Add your code here... + } + + /** + * 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 + */ + 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')); + + // Add payment discovery filter + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('payment_discovery_filter', array($this))); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/actions/web/class_WebShipSimuLoginStatusProblemAction.php b/application/shipsimu/classes/actions/web/class_WebShipSimuLoginStatusProblemAction.php new file mode 100644 index 0000000..8b26b8f --- /dev/null +++ b/application/shipsimu/classes/actions/web/class_WebShipSimuLoginStatusProblemAction.php @@ -0,0 +1,82 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class WebShipSimuLoginStatusProblemAction extends BaseShipSimuAction 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 static final function createWebShipSimuLoginStatusProblemAction (ActionResolver $resolverInstance) { + // Get a new instance + $actionInstance = new WebShipSimuLoginStatusProblemAction(); + + // 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) { + // Call parent method + parent::execute($requestInstance, $responseInstance); + + // Add your code + } + + /** + * 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 filters here + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // Check for user status by default + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/actions/web/class_WebShipSimuLoginWelcomeAction.php b/application/shipsimu/classes/actions/web/class_WebShipSimuLoginWelcomeAction.php new file mode 100644 index 0000000..d839bd1 --- /dev/null +++ b/application/shipsimu/classes/actions/web/class_WebShipSimuLoginWelcomeAction.php @@ -0,0 +1,81 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class WebShipSimuLoginWelcomeAction extends BaseShipSimuAction 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 static final function createWebShipSimuLoginWelcomeAction (ActionResolver $resolverInstance) { + // Get a new instance + $actionInstance = new WebShipSimuLoginWelcomeAction(); + + // 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) { + // Call parent execute method + parent::execute($requestInstance, $responseInstance); + + // Add your code here... + } + + /** + * 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 filters here + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // Unfinished method + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/bank/.htaccess b/application/shipsimu/classes/bank/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/bank/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/bank/class_BaseBank.php b/application/shipsimu/classes/bank/class_BaseBank.php new file mode 100644 index 0000000..21ae0d5 --- /dev/null +++ b/application/shipsimu/classes/bank/class_BaseBank.php @@ -0,0 +1,60 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * @todo Find an instance for all banks and move the abstract functions there + * + * 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 . + */ +abstract class BaseBank extends BaseFrameworkSystem { + /** + * Protected constructor + * + * @param $className The class' real name + * @return void + */ + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + } + + /** + * Checks wether the bank lends more money to the current user + * + * @return $lendsMoreMoney Wether this bank lends more money to the user + */ + public abstract function ifBankLendsMoreMoney (); + + /** + * Checks wethert the current user has maximum allowed credits with this bank + * + * @return $hasMaximumCredits Wether the user has maximum allowed credits + */ + public abstract function ifUserHasMaxCredits (); + + /** + * Checks wether this money bank has opened + * + * @return $hasOpened Wether this money bank has opened + */ + public abstract function ifMoneyBankHasOpened (); +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/bank/money/class_MoneyBank.php b/application/shipsimu/classes/bank/money/class_MoneyBank.php new file mode 100644 index 0000000..11d4d9e --- /dev/null +++ b/application/shipsimu/classes/bank/money/class_MoneyBank.php @@ -0,0 +1,94 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class MoneyBank extends BaseBank implements Registerable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this money bank class + * + * @param $userInstance A class instance of a user object + * @return $bankInstance An instance of this class + */ + public static final function createMoneyBank (ManageableAccount $userInstance) { + // Get a new instance + $moneyInstance = new MoneyBank(); + + // Set the user instance + $moneyInstance->setUserInstance($userInstance); + + // Return the prepared instance + return $moneyInstance; + } + + /** + * Checks wether the bank lends more money to the current user + * + * @return $lendsMoreMoney Wether this bank lends more money to the user + */ + public function ifBankLendsMoreMoney () { + $this->partialStub(); + } + + /** + * Checks wethert the current user has maximum allowed credits with this bank + * + * @return $hasMaximumCredits Wether the user has maximum allowed credits + */ + public function ifUserHasMaxCredits () { + $this->partialStub(); + } + + /** + * Checks wether this money bank has opened + * + * @return $hasOpened Wether this money bank has opened + */ + public function ifMoneyBankHasOpened () { + // Has not opened by default + $hasOpened = false; + + // Is the money bank activated in config? + if ($this->getConfigInstance()->getConfigEntry('moneybank_activated')) { + // Okay, does the user ask within the opening times? To find this out we need a OpeningTimes class + $openingInstance = ObjectFactory::createObjectByConfiguredName('moneybank_opening_class', array($this)); + + // Then we simply "ask" the opening time instance if the user asks within the opening time + $hasOpened = $openingInstance->ifWithinOpeningTimes(); + } // END - if + + // Return status + return $hasOpened; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/class_ b/application/shipsimu/classes/class_ new file mode 100644 index 0000000..956f6c5 --- /dev/null +++ b/application/shipsimu/classes/class_ @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @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 . + */ +class ??? extends BaseFrameworkSystem { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this money bank class + * + * @return $???Instance An instance of this class + */ + public final static function create??? () { + // Get a new instance + $???Instance = new ???(); + + // Return the prepared instance + return $???Instance; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/class_BasePersonell.php b/application/shipsimu/classes/class_BasePersonell.php new file mode 100644 index 0000000..8e08ec3 --- /dev/null +++ b/application/shipsimu/classes/class_BasePersonell.php @@ -0,0 +1,246 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class BasePersonell extends BaseFrameworkSystem implements Personellizer { + // Maximum/minimum age + private $MIN_AGE = 21; + private $MAX_AGE = 40; + + // Male/female + private $gender = ""; // M=Male, F=Female, empty=uninitialized + + // Year/month/day of birth + private $yearBirth = 0; + private $monthBirth = 0; + private $dayBirth = 0; + + // Surname/family name + private $surname = ""; + private $family = ""; + + // Employed? + private $employed = false; + + // Married? + private $married = false; + + // Her/his salary + private $salary = 0.00; + + // Constructor + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + } + + // Remove min/max ages + public final function removeMinMaxAge () { + unset($this->MIN_AGE); + unset($this->MAX_AGE); + } + + // Generates a birthday based on MAX_AGE/MIN_AGE and the current date + public final function createBirthday () { + // Is the birthday already set? + if ($this->isDateValid($this->yearBirth, $this->monthBirth, $this->dayBirth)) return false; + + // Get current year + $currYear = date("Y", time()); + + // Generate random year/month/day + $year = mt_rand(($currYear - $this->MIN_AGE), ($currYear - $this->MAX_AGE)); + $month = 0; + $day = 0; + while ($this->isDateValid($year, $month, $day) === false) { + $month = mt_rand(1, 12); + switch ($month) { + case 1: + case 3: + case 5: + case 7: + case 8: + case 10: + case 12: + $day = mt_rand(1, 31); + break; + + case 4: + case 6: + case 9: + case 11: + $day = mt_rand(1, 30); + break; + + case 2: // February + if ($year % 4 == 0) { + // Is a "Schaltjahr" + $day = mt_rand(1, 29); + } else { + // Regular year + $day = mt_rand(1, 28); + } + break; + } // END - switch + } // END - while + + // Set the new birthday + $this->setBirthday($year, $month, $day); + } + + // Is the current day valid? + public final function isDateValid ($year, $month, $day) { + // Create timestamp + $stamp = mktime(0, 0, 0, $month, $day, $year); + + // Get year/month/day back + $y = date("Y", $stamp); + $m = date("m", $stamp); + $d = date("d", $stamp); + + // Compare all + return (($y == $year) && ($m == $month) && ($d == $day)); + } + + // Employed? + public final function isEmployed () { + return $this->employed; + } + + // Married? + public final function isMarried () { + return $this->married; + } + + // Male? + public final function isMale () { + return ($this->gender == "M"); + } + + // Female + public final function isFemale () { + return ($this->gender == "F"); + } + + // Setter for surname + public final function setSurname ($surname) { + $this->surname = (string) $surname; + } + + // Getter for surname + public function getSurname () { + return $this->surname; + } + + // Setter for family name + public final function setFamily ($family) { + $this->family = (string) $family; + } + + // Getter for family name + public final function getFamily () { + return $this->family; + } + + // Setter for gender + public final function setGender ($gender) { + // Set random gender here + if (($gender == "M") || ($gender == "F") || ((empty($gender)) && ($this->getSurname() == ""))) { + $this->gender = $gender; + } else { + throw new WrongGenderSpecifiedException($gender, self::EXCEPTION_GENDER_IS_WRONG); + } + } + + // Getter for gender + public final function getGender () { + return $this->gender; + } + + // Setter for employment status + public final function setEmployed ($employed) { + $this->employed = (boolean) $employed; + } + + // Setter for marriage status + public final function setMarried ($married) { + $this->married = (boolean) $married; + } + + // Getter for salary + public final function getSalary () { + return $this->salary; + } + + // Increase salary + public final function increaseSalary ($add) { + $this->salary += (float) abs($add); + } + + // Decrease salary + public final function decreaseSalary ($sub) { + $this->salary -= (float) abs($sub); + } + + // Setter for birthday + public final function setBirthday ($year, $month, $day) { + $this->yearBirth = (int) abs($year); + $this->monthBirth = (int) abs($month); + $this->dayBirth = (int) abs($day); + } + + // Remove gender + public final function removeGender () { + unset($this->gender); + } + + // Remove both names + public final function removeNames () { + unset($this->surname); + unset($this->family); + } + + // Remove complete birthday + public final function removeBirthday () { + unset($this->yearBirth); + unset($this->monthBirth); + unset($this->dayBirth); + } + + // Remove salary + public final function removeSalary () { + unset($this->salary); + } + + // Remove employment status + public final function removeEmployed () { + unset($this->employed); + } + + // Remove marrital status + public final function removeMarried () { + unset($this->married); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/class_BaseSimulator.php b/application/shipsimu/classes/class_BaseSimulator.php new file mode 100644 index 0000000..e460013 --- /dev/null +++ b/application/shipsimu/classes/class_BaseSimulator.php @@ -0,0 +1,302 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class BaseSimulator extends BaseFrameworkSystem { + // Schiffsteilinstanz + private $partInstance = null; + + // Abmasse (Breite/Hoehe/Laenge) + private $width = 0; + private $height = 0; + private $length = 0; + + // Aktuelles Schiff und Schiffsteil + private $currShip = null; + private $currPart = null; + + // Faktoren zur Erweiterung der Masse. Beispielsweise soll der Maschinenraum groesser wie der Motor sein + private $resizeFactorArray = array( + 'width' => 1, + 'height' => 1, + 'length' => 1 + ); + + // Konstruktor + protected function __construct ($className) { + // Call highest constructor + parent::__construct($className); + + // Clean up a little, dies sollte ganz zum Schluss erfolgen! + $this->removeResizeFactorArray(); + $this->removeCurrPart(); + $this->removeCurrShip(); + } + + // Setter-Methode fuer Laenge + public final function setLength ($length) { + $this->length = (float) $length; + } + + // Setter-Methode fuer Breite + public final function setWidth ($width) { + $this->width = (float) $width; + } + + // Setter-Methode fuer Hoehe + public final function setHeight ($height) { + $this->height = (float) $height; + } + + // Getter-Methode fuer Laenge + public final function getLength () { + return $this->length; + } + + // Getter-Methode fuer Breite + public final function getWidth () { + return $this->width; + } + + // Getter-Methode fuer Hoehe + public final function getHeight () { + return $this->height; + } + + // Setter-Methode fuer Teil-Instanz + public final function setPartInstance (ConstructableShipPart $partInstance) { + $this->partInstance = $partInstance; + } + + // Getter-Methode fuer Teil-Instanz + public final function getPartInstance () { + if (!isset($this->partInstance)) { + return null; + } + return $this->partInstance; + } + + // Remover-Methode fuer die Teil-Instanz + public final function removePartInstance () { + unset($this->partInstance); + } + + // Prueft ob all Umberechnungsfaktoren gesetzt sind + private function isResizeFactorValid () { + return (($this->getResizeFactorElement('width') > 1) + || ($this->getResizeFactorElement('height') > 1) + || ($this->getResizeFactorElement('length') > 1) + ); + } + + // Baut einen Motor in das Schiff ein + public function addShipPartToShip (ConstructableShip $shipInstance, ConstructableShipPart $partInstance) { + // Schiff/-steil merken + $this->currShip = $shipInstance; + $this->currPart = $partInstance; + + // Passt ueberhaupt das Schiffsteil in's Schiff? + if ($this->isShipPartSizeValid()) { + // Muessen die Masse angepasst werden? + if ($this->isResizeFactorValid()) { + // Neue Angaben berechnen (wir lassen etwas Lust fuer Kabelbaeume, Roehren, Maschinisten, etc.) + $this->newWidth = (float) $this->getCurrPart()->getWidth() * $this->resizeFactorArray['width']; + $this->newHeight = (float) $this->getCurrPart()->getHeight() * $this->resizeFactorArray['height']; + $this->newLength = (float) $this->getCurrPart()->getLength() * $this->resizeFactorArray['length']; + + // Passt dies nun immer noch? + if ($this->isNewSizeValid()) { + // Das passt auch, dann Werte setzen und Motor-Instanz merken + $this->setWidth($this->newWidth); + $this->setHeight($this->newHeight); + $this->setLength($this->newLength); + + // Einige Dinge entfernen... + $this->removeAllNewAttr(); + } else { + // Passt nicht! Also wieder Exception werfen... + throw new StructureShipMismatchException(sprintf("[%s:] Das Schiffsteil %s vom Typ %s ist zu gross für das Schiff!", + $this->getCurrPart()->__toString(), + $this->getCurrPart()->getObjectDescription(), + $this->getCurrPart()->__toString() + ), 2); + } + } elseif ($this->currPart != null) { + // Aktuelle Masse setzen + $this->setWidth($this->getCurrPart()->getWidth()); + $this->setHeight($this->getCurrPart()->getHeight()); + $this->setLength($this->getCurrPart()->getLength()); + } + + // Existiert ein Schiffsteil? + if (!is_null($this->currPart)) { + // Schiffsteil-Instanz setzen + $this->setPartInstance($this->currPart); + + // Instanzen entfernen + $this->getCurrPart()->removeCurrShip(); + $this->getCurrPart()->removeCurrPart(); + $this->getCurrPart()->removePartInstance(); + $this->getCurrPart()->removeResizeFactorArray(); + } + } else { + // Exception werfen! + throw new StructureShipMismatchException(sprintf("[%s:] Das Schiffsteil %s vom Typ %s passt nicht in das Schiff!", + $this->getCurrPart()->realClass, + $this->getCurrPart()->getObjectDescription(), + $this->getCurrPart()->__toString() + ), 1); + } + + // Nochmals Clean up a little + $this->removeResizeFactorArray(); + $this->removeCurrShip(); + $this->removeCurrPart(); + } + + // Array fuer Umrechnungstabelle entfernen + public final function removeResizeFactorArray () { + unset($this->resizeFactorArray); + } + + /** + * Remove all new*** attributes + * + * @return void + */ + public final function removeAllNewAttr () { + unset($this->newWidth); + unset($this->newHeight); + unset($this->newLength); + } + + /** + * Remove current ship instance + * + * @return void + */ + public final function removeCurrShip () { + unset($this->currShip); + } + + // Aktuelle Schiffsteil-Instanz entfernen + public final function removeCurrPart () { + unset($this->currPart); + } + + // Breite entfernen + public final function removeWidth () { + unset($this->width); + } + + // Hoehe entfernen + public final function removeHeight () { + unset($this->height); + } + + // Laenge entfernen + public final function removeLength () { + unset($this->length); + } + + // Tiefgang entfernen + public final function removeDraught () { + unset($this->draught); + } + + // Getter-Methode fuer Element aus resizeFactor + public final function getResizeFactorElement ($el) { + if (isset($this->resizeFactorArray[$el])) { + // Element gefunden + return $this->resizeFactorArray[$el]; + } else { + // Element nicht gefunden! + return null; + } + } + + // Setter-Methode fuer Element in resizeFactor + public final function setResizeFactorElement ($el, $value) { + $this->resizeFactorArray[$el] = (float) $value; + } + + // Kontrolliert, ob die Abmasse Schiffsteil->Schiff stimmen + public function isShipPartSizeValid () { + return ( + ( + ( // Already defined ship messurings + ($this->getCurrPart()->getWidth() < $this->currShip->getWidth()) + && ($this->getCurrPart()->getHeight() < $this->currShip->getDraught()) + && ($this->getCurrPart()->getLength() < $this->currShip->getLength()) + ) || ( // Ship messurings shall be calculated + ($this->currShip->getWidth() == 0) + && ($this->currShip->getHeight() == 0) + && ($this->currShip->getLength() == 0) + ) + // The inserted part must be messured! + ) && ($this->getCurrPart()->getWidth() > 0) + && ($this->getCurrPart()->getHeight() > 0) + && ($this->getCurrPart()->getLength() > 0) + ); + } + + // Kontrolliert, ob die Abmasse Maschinenraum->Schiff stimmen + public function isNewSizeValid () { + return ( + ( // Already defined ship messurings + ($this->newWidth < $this->currShip->getWidth()) + && ($this->newHeight < $this->currShip->getDraught()) + && ($this->newLength < $this->currShip->getLength()) + ) || ( // Ship messurings shall be calculated + ($this->currShip->getWidth() == 0) + && ($this->currShip->getHeight() == 0) + && ($this->currShip->getLength() == 0) + ) + ); + } + + // Masse extrahieren + public function extractDimensions ($dim) { + // Abmasse setzen + if ((isset($dim)) && (is_array($dim)) && (count($dim) == 3)) { + // Abmasse aus Array holen + $this->setWidth($dim[0]); + $this->setHeight($dim[1]); + $this->setLength($dim[2]); + } else { + // Nicht gefundene Abmasse! + throw new DimNotFoundInArrayException($this, self::EXCEPTION_DIMENSION_ARRAY_INVALID); + } + } + + /** + * Getter for current part instance + * + * @return $currPart Instance of the current ship part object + */ + public final function getCurrPart () { + return $this->currPart; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/class_Merchant.php b/application/shipsimu/classes/class_Merchant.php new file mode 100644 index 0000000..648e299 --- /dev/null +++ b/application/shipsimu/classes/class_Merchant.php @@ -0,0 +1,109 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class Merchant extends BaseFrameworkSystem { + // Name des Haendlers + private $merchantName = "Namenloser Händler"; + + // Preislite (Objekte wiedermal!) + private $priceList = null; + + // Zugewiesener Hafen + private $harborInstance = null; + + // Konstruktor + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + // Haendler mit Namen erzeugen + public static final function createMerchant ($merchantName, Harbor $harborInstance) { + // String absichern + $merchantName = (string) $merchantName; + + // Get new instance + $merchantInstance = new Merchant(); + + // Debug message + if ((defined('DEBUG_MERCHANT')) || (defined('DEBUG_ALL'))) { + $merchantInstance->debugOutput(sprintf("[%s:%d] Ein Händler %s wird angelegt und soll sich am %s niederlassen.", + __CLASS__, + __LINE__, + $merchantName, + $harborInstance->getHarborName() + )); + } + + // Haendlernamen setzen + $merchantInstance->setMerchantName($merchantName); + + // In dem angegebenen Hafen den Haendler ansiedeln + $merchantInstance->setHarborInstance($harborInstance); + + // Preisliste initialisieren + $merchantInstance->createPriceList(); + + // Instanz zurueckliefern + return $merchantInstance; + } + + // Initialize pricing list + private function createPriceList () { + $this->priceList = new FrameworkArrayObject("FakedPriceList"); + } + + // Setter for merchant name + public final function setMerchantName ($merchantName) { + // Debug message + $this->merchantName = (string) $merchantName; + } + + // Getter for merchant name + public final function getMerchantName () { + return $this->merchantName; + } + + // Setter for harbor instance + public final function setHarborInstance (Harbor $harborInstance) { + $this->harborInstance = $harborInstance; + } + + // Getter for harbor instance + public final function getHarborInstance () { + return $this->harborInstance; + } + + // Add new item to merchant's price list + public function addItemToPriceList (TradeableItem $itemInstance, $price) { + $this->makeDeprecated(); + } + + // Get a price from the merchant's list + public final function getPriceFromList (TradeableItem $itemInstance) { + $this->makeDeprecated(); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/class_WorksContract.php b/application/shipsimu/classes/class_WorksContract.php new file mode 100644 index 0000000..bbe2f35 --- /dev/null +++ b/application/shipsimu/classes/class_WorksContract.php @@ -0,0 +1,329 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class WorksContract extends BaseFrameworkSystem implements SignableContract { + // Zukuenftiger Schiffsname + private $shipName = ""; + + // Instanz zum Schiffstypen + private $shipInstance = null; + + // Contract partner + private $contractPartner = null; + + // Other contract partner + private $contractParty = null; + + // Is the contract signed? + private $signed = false; + + // Merchant instance + private $merchantInstance = null; + + // Konstruktor + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + // Neuen Bauvertrag generieren + public static final function createWorksContract ($shipType, $shipName, ContractPartner $partnerInstance) { + // Strings absichern + $shipType = (string) $shipType; + $shipName = (string) $shipName; + + // Get new instance + $contractInstance = new WorksContract(); + + // Schiffsnamen setzen + $contractInstance->setShipName($shipName); + + // Existiert die Klasse ueberhaupt? + if (!class_exists($shipType)) { + // Klasse nicht gefunden + throw new NoClassException ($shipType, self::EXCEPTION_CLASS_NOT_FOUND); + } + + // Schiff-Instanz temporaer erzeugen und in den Bauvertrag einfuegen + $shipInstance = ObjectFactory::createObjectByName($shipType, array($shipName)); + $contractInstance->setShipInstance($shipInstance); + + // Remove the ship instance + unset($shipInstance); + + // Set itself as contract partner + $contractInstance->setContractPartner($partnerInstance); + + // Instanz zurueckgeben + return $contractInstance; + } + + // Setter for ship instance + private final function setShipInstance (ConstructableShip $shipInstance) { + $this->shipInstance = $shipInstance; + } + + // Setter for ship name + private final function setShipName ($shipName) { + $this->shipName = (string) $shipName; + } + + // Getter for ship name + public final function getShipName () { + return $this->shipName; + } + + // Getter for ship instance + public final function getShipInstance () { + return $this->shipInstance; + } + + // Add detail to the contract + public function addContractDetails ($shipPart, $parentPart, array $dataArray) { + // Secure strings + $shipPart = (string) $shipPart; + $parentPart = (string) $parentPart; + + // Debug message + if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiffsteil %s wird zusammen mit dem Konstruktionsteil %s in den Bauvertrag aufgenommen.", + __CLASS__, + __LINE__, + $shipPart, + $parentPart + )); + + // Initialize the instance (shall not be done within dynamic part) + $partInstance = null; + + // Try to get an instance for this ship part + try { + $partInstance = ObjectFactory::createObjectByName($shipPart, $dataArray); + } catch (DimNotFoundInArrayException $e) { + $this->debugOutput(sprintf("[main:] Die %s konnte nicht vervollständigt werden. Grund: %s
", + $this->getShipInstance()->getShipName(), + $e->getMessage() + )); + + // Debug message + if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Versuche ein Schiffsteil in den Bauvertrag aufzunehmen.", + __CLASS__, + __LINE__ + )); + + // Is this ship part constructable? + if (!$partInstance instanceof ConstructableShipPart) { + // Ship part not constructable! + throw new ShipPartNotConstructableException(array($shipPart), self::EXCEPTION_NOT_CONSTRUCTABLE); + } elseif ($this->getShipInstance()->createShipPart($partInstance, $parentPart) === false) { + // Schiff konnte nicht gebaut werden! + throw new ShipNotConstructedException(sprintf("Das Schiff %s konnte wegen eines Fehlers nicht gebaut werden. Siehe obere Meldungen.", + $this->getShipInstance()->getShipName() + )); + } + } catch (NoClassException $e) { + // Throw it again... + throw new NoClassException($e->getMessage(), $e->getCode()); + } + + // Get price for this item + $price = $this->getMerchantInstance()->getPriceFromList($partInstance); + + // Add price + $partInstance->setPrice($price); + } + + // Setter for contract partner + public final function setContractPartner (ContractPartner $partnerInstance) { + $this->contractPartner = $partnerInstance; + } + + // Getter for contract partner + public final function getContractPartner () { + return $this->contractPartner; + } + + // Setter for contract party + public final function setContractParty (ContractPartner $partyInstance) { + $this->contractParty = $partyInstance; + } + + // Getter for contract party + public final function getContractParty () { + return $this->contractParty; + } + + // Setter for signature + public final function setSigned ($signed) { + $this->signed = (boolean) $signed; + } + + // Getter for signature + public function isSigned () { + return $this->signed; + } + + // Sign the contract + public function signContract (ContractPartner $partnerInstance, ContractPartner $partyInstance) { + // Is this contract already signed? + if ($this->isSigned()) { + // Throw an exception + throw new ContractAllreadySignedException(array($this, $this->getContractPartner(), $this->getContractParty()), self::EXCEPTION_CONTRACT_ALREADY_SIGNED); + } + + // Is the first contract partner still the same? + if ($partnerInstance->equals($this->getContractPartner())) { + // Set contract party (other partner is already set) + $this->setContractParty($partyInstance); + + // Finally sign it + $this->setSigned(true); + } else { + // Throw an exception + throw new ContractPartnerMismatchException(array($this, $this->getContractPartner(), $partyInstance), self::EXCEPTION_CONTRACT_PARTNER_MISMATCH); + } + + // Debug message + if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) { + if ($partnerInstance->equals($partyInstance)) { + // With itself + $this->debugOutput(sprintf("[%s:%d] Die %s %s stimmt einem Bauvertrag über das %s %s zu.", + __CLASS__, + __LINE__, + $partnerInstance->getObjectDescription(), + $partnerInstance->getCompanyName(), + $this->getShipInstance()->getObjectDescription(), + $this->getShipInstance()->getShipName() + )); + } else { + // Other contract party + $this->debugOutput(sprintf("[%s:%d] Die %s %s geht mit der %s %s einen Bauvertrag über das %s %s ein.", + __CLASS__, + __LINE__, + $partnerInstance->getObjectDescription(), + $partnerInstance->getCompanyName(), + $partyInstance->getObjectDescription(), + $partyInstance->getCompanyName(), + $this->getShipInstance()->getObjectDescription(), + $this->getShipInstance()->getShipName() + )); + } + } + } + + // Setter for merchant instance + public final function setMerchantInstance (Merchant $merchantInstance) { + $this->merchantInstance = $merchantInstance; + } + + // Getter for merchant instance + public final function getMerchantInstance () { + return $this->merchantInstance; + } + + // Getter for total price + public final function getTotalPrice () { + // Get ship instance + $shipInstance = $this->getShipInstance(); + + // Is this a ship? + if (is_null($shipInstance)) { + // Opps! Empty partner instance? + throw new NullPointerException($shipInstance, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($shipInstance)) { + // Not an object! ;-( + throw new InvalidObjectException($shipInstance, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!$shipInstance instanceof ConstructableShip) { + // Does not have the required feature (method) + throw new ShipIsInvalidException(array($shipInstance), self::EXCEPTION_INVALID_SHIP_INSTANCE); + } + + // Get the structure array + $struct = $shipInstance->getStructuresArray(); + + // Is this a ship? + if (is_null($struct)) { + // Opps! Empty partner instance? + throw new EmptyStructuresListException($this, self::EXCEPTION_EMPTY_STRUCTURES_ARRAY); + } + + // Init total price + $totalPrice = 0; + + // Iterate through the list + for ($iter = $struct->getIterator(); $iter->valid(); $iter->next()) { + // Get item + $item = $iter->current(); + + // Is this a ship? + if (is_null($item)) { + // Opps! Empty partner instance? + throw new NullPointerException($item, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($item)) { + // Not an object! ;-( + throw new InvalidObjectException($item, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!$item instanceof BaseSimulator) { + // Does not have the required feature (method) + throw new MissingMethodException(array($item, 'getPartInstance'), self::EXCEPTION_MISSING_METHOD); + } + + // Get part instance + $part = $item->getPartInstance(); + + // Is this a ship? + if (is_null($part)) { + // Opps! Empty partner instance? + throw new NullPointerException($part, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($part)) { + // Not an object! ;-( + throw new InvalidObjectException($part, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!method_exists($part, 'getPrice')) { + // Does not have the required feature (method) + throw new MissingMethodException(array($part, 'getPrice'), self::EXCEPTION_MISSING_METHOD); + } + + // Get price for one item + $price = $part->getPrice(); + + // Is there numCabin() available? + if (method_exists($item, 'getNumCabin')) { + // Get total cabin and multiply it with the price + $price = $price * $item->getNumCabin(); + } + + // Add price to total price + $totalPrice += $price; + } + + // Total price calculated? + if ($totalPrice === 0) { + // Throw exception + throw new TotalPriceNotCalculatedException($this, self::EXCEPTION_TOTAL_PRICE_NOT_CALCULATED); + } + + // Return total price + return $totalPrice; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/commands/.htaccess b/application/shipsimu/classes/commands/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/commands/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/commands/web/.htaccess b/application/shipsimu/classes/commands/web/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/commands/web/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/commands/web/class_WebShipsimuGuestLoginCommand.php b/application/shipsimu/classes/commands/web/class_WebShipsimuGuestLoginCommand.php new file mode 100644 index 0000000..14015a3 --- /dev/null +++ b/application/shipsimu/classes/commands/web/class_WebShipsimuGuestLoginCommand.php @@ -0,0 +1,112 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class WebShipsimuGuestLoginCommand extends BaseCommand implements Commandable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this command and sets the resolver instance + * + * @param $resolverInstance An instance of a command resolver + * @return $commandInstance The created command instance + */ + public static final function createWebShipsimuGuestLoginCommand (CommandResolver $resolverInstance) { + // Get a new instance + $commandInstance = new WebShipsimuGuestLoginCommand(); + + // Set the resolver instance + $commandInstance->setResolverInstance($resolverInstance); + + // Return the prepared instance + return $commandInstance; + } + + /** + * 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 + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // First get a GuestLogin instance + $loginInstance = ObjectFactory::createObjectByConfiguredName('guest_login_class'); + + // First set request and response instance + $loginInstance->setRequestInstance($requestInstance); + + // Encrypt the password + $loginInstance->encryptPassword('passwd'); + + // Do the login here + $loginInstance->doLogin($requestInstance, $responseInstance); + + // Was the login fine? Then redirect here + if ($loginInstance->ifLoginWasSuccessfull()) { + // Try to redirect here + try { + // Redirect... + $responseInstance->redirectToConfiguredUrl('app_login'); + + // Exit here + exit(); + } catch (FrameworkException $e) { + // Something went wrong here! + $responseInstance->addFatalMessage($e->getMessage()); + } + } else { + // Attach error message to the response + $responseInstance->addFatalMessage('failed_user_login'); + } + } + + /** + * 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 more filters + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // Add username verifier filter + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_guest_verifier_filter')); + + // Add password verifier filter + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('passwd_guest_verifier_filter')); + + // Add CAPTCHA verifier code + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_guest_verifier_filter')); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/commands/web/class_WebShipsimuProfileCommand.php b/application/shipsimu/classes/commands/web/class_WebShipsimuProfileCommand.php new file mode 100644 index 0000000..a266f26 --- /dev/null +++ b/application/shipsimu/classes/commands/web/class_WebShipsimuProfileCommand.php @@ -0,0 +1,153 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class WebShipsimuProfileCommand extends BaseCommand implements Commandable { + /** + * Filtered request data + */ + private $requestData = array(); + + /** + * Allowed profile data to pass through + */ + private $allowedData = array( + 'pass' => 'pass1', + 'email' => 'email1', + 'surname', + 'family', + 'street', + 'city', + 'zip', + 'icq', + 'jabber', + 'yahoo', + 'aol', + 'msn', + 'rules', + 'birth_day', + 'birth_month', + 'birth_year' + ); + + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this command and sets the resolver instance + * + * @param $resolverInstance An instance of a command resolver + * @return $commandInstance The created command instance + */ + public static final function createWebShipsimuProfileCommand (CommandResolver $resolverInstance) { + // Get a new instance + $commandInstance = new WebShipsimuProfileCommand(); + + // Set the resolver instance + $commandInstance->setResolverInstance($resolverInstance); + + // Return the prepared instance + return $commandInstance; + } + + /** + * 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 Add functionality here + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Make sure only allowed values are comming through + foreach ($this->allowedData as $alias => $element) { + // Get data + $data = $requestInstance->getRequestElement($element); + + // Silently skip empty fields + if (empty($data)) continue; + + // Do we have an alias? + if (is_string($alias)) { + // Yes, so use it + $this->requestData[$alias] = $data; + } else { + // No, default entry + $this->requestData[$element] = $data; + } + } // END - foreach + + // Remove the array, we don't need it anymore + unset($this->allowedData); + + // Unfinished! + $this->partialStub("Unfinished work."); + $this->debugBackTrace(); + } + + /** + * 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 pre/post filters to the controller + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // 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')); + + // User status filter + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); + + // User status if not 'guest' filter + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_guest_filter')); + + // Updated rules accepted + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('rules_accepted_filter')); + + // Account password validation + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('account_password_filter')); + + // Validate CAPTCHA input + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_profile_verifier_filter')); + + // Validate birthday input + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('birthday_profile_verifier_filter')); + + // Email changed + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_change_filter')); + + // Password changed + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_change_filter')); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/commands/web/class_WebShipsimuRefillCommand.php b/application/shipsimu/classes/commands/web/class_WebShipsimuRefillCommand.php new file mode 100644 index 0000000..1c9bd8e --- /dev/null +++ b/application/shipsimu/classes/commands/web/class_WebShipsimuRefillCommand.php @@ -0,0 +1,112 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class WebShipsimuRefillCommand extends BaseCommand implements Commandable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this command and sets the resolver instance + * + * @param $resolverInstance An instance of a command resolver + * @return $commandInstance The created command instance + */ + public static final function createWebShipsimuRefillCommand (CommandResolver $resolverInstance) { + // Get a new instance + $commandInstance = new WebShipsimuRefillCommand(); + + // Set the resolver instance + $commandInstance->setResolverInstance($resolverInstance); + + // Return the prepared instance + return $commandInstance; + } + + /** + * 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 + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Get template instance + $templateInstance = $responseInstance->getTemplateInstance(); + + // Set amount and type as variables + $templateInstance->assignVariable('refill_done', $requestInstance->getRequestElement('type')); + $templateInstance->assignVariable('amount' , $requestInstance->getRequestElement('amount')); + + // This method does currently redirect if all goes right. Booking is done in filters + $responseInstance->redirectToConfiguredUrl('refill_page_done'); + } + + /** + * 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 + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // 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')); + + // Add user status filter here + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); + + // Is the refill page active? + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('refill_page_filter')); + + // Verify password + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('account_password_filter')); + + // Verify CAPTCHA code + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_refill_verifier_filter')); + + // Verify refill request + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('refill_request_validator_filter')); + + // Construct config entry for wether automatic payment from API or waiting for approval + $paymentTypeConfig = sprintf("refill_request_%s_payment_type", $requestInstance->getRequestElement('type')); + + // Prepare a filter based on the requested type we shall refill + $filterName = sprintf("refill_request_%s_%s_book_filter", + $requestInstance->getRequestElement('type'), + $this->getConfigInstance()->getConfigEntry($paymentTypeConfig) + ); + + // Now, try to load that filter + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName($filterName)); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/commands/web/class_WebShipsimuRegisterCommand.php b/application/shipsimu/classes/commands/web/class_WebShipsimuRegisterCommand.php new file mode 100644 index 0000000..181ce2f --- /dev/null +++ b/application/shipsimu/classes/commands/web/class_WebShipsimuRegisterCommand.php @@ -0,0 +1,117 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class WebShipsimuRegisterCommand extends BaseCommand implements Commandable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this command and sets the resolver instance + * + * @param $resolverInstance An instance of a command resolver + * @return $commandInstance The created command instance + */ + public static final function createWebShipsimuRegisterCommand (CommandResolver $resolverInstance) { + // Get a new instance + $commandInstance = new WebShipsimuRegisterCommand(); + + // Set the resolver instance + $commandInstance->setResolverInstance($resolverInstance); + + // Return the prepared instance + return $commandInstance; + } + + /** + * 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 + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // First get a UserRegistration instance + $registerInstance = ObjectFactory::createObjectByConfiguredName('user_registration_class'); + + // First set request and response instance + $registerInstance->setRequestInstance($requestInstance); + $registerInstance->setResponseInstance($responseInstance); + + // Encrypt the password + $registerInstance->encryptPassword('pass1'); + + // Do things before registration + $registerInstance->doPreRegistration(); + + // Register the new user + $registerInstance->registerNewUser(); + + // Do things after registration like notifying partner pages or queueing + // them for notification + $registerInstance->doPostRegistration(); + + // Redirect or login after registration + $registerInstance->doPostAction(); + } + + /** + * 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 pre/post filters to the controller + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // Validate email address (if configured: check on double email addresses) + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_validator_filter')); + + // Validate username and check if it does not exist + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_validator_filter')); + + // Validate if username is "guest" and not taken + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_is_guest_filter')); + + // Validate if password is set + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_validator_filter')); + + // Check if rules where accepted + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('rules_accepted_filter')); + + // Validate CAPTCHA input + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_register_verifier_filter')); + + // Validate birthday + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('birthday_register_verifier_filter')); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/commands/web/class_WebShipsimuUserLoginCommand.php b/application/shipsimu/classes/commands/web/class_WebShipsimuUserLoginCommand.php new file mode 100644 index 0000000..2a33a8f --- /dev/null +++ b/application/shipsimu/classes/commands/web/class_WebShipsimuUserLoginCommand.php @@ -0,0 +1,124 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class WebShipsimuUserLoginCommand extends BaseCommand implements Commandable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this command and sets the resolver instance + * + * @param $resolverInstance An instance of a command resolver + * @return $commandInstance The created command instance + */ + public static final function createWebShipsimuUserLoginCommand (CommandResolver $resolverInstance) { + // Get a new instance + $commandInstance = new WebShipsimuUserLoginCommand(); + + // Set the resolver instance + $commandInstance->setResolverInstance($resolverInstance); + + // Return the prepared instance + return $commandInstance; + } + + /** + * 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 + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // First get a UserLogin instance + $loginInstance = ObjectFactory::createObjectByConfiguredName('user_login_class'); + + // First set request and response instance + $loginInstance->setRequestInstance($requestInstance); + + // Encrypt the password + $loginInstance->encryptPassword('pass'); + + // Do the login here + $loginInstance->doLogin($requestInstance, $responseInstance); + + // Was the login fine? Then redirect here + if ($loginInstance->ifLoginWasSuccessfull()) { + // Try to redirect here + try { + // Redirect... + $responseInstance->redirectToConfiguredUrl('app_login'); + + // Exit here + exit(); + } catch (FrameworkException $e) { + // Something went wrong here! + $responseInstance->addFatalMessage($e->getMessage()); + } + } else { + // Attach error message to the response + $responseInstance->addFatalMessage('failed_user_login'); + } + } + + /** + * 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 more filters + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // Which login type do we have? + switch ($this->getConfigInstance()->getConfigEntry('login_type')) { + case 'username': // Login via username + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_verifier_filter')); + break; + + case 'email': // Login via email + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_verifier_filter')); + break; + + default: // Wether username or email is set + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_email_verifier_filter')); + break; + } + + // Password verifier filter + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_verifier_filter')); + + // Add filter for CAPTCHA + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_user_verifier_filter')); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/commands/web/company/.htaccess b/application/shipsimu/classes/commands/web/company/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/commands/web/company/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/commands/web/company/class_WebShipSimuCompanyCommand.php b/application/shipsimu/classes/commands/web/company/class_WebShipSimuCompanyCommand.php new file mode 100644 index 0000000..7fed46f --- /dev/null +++ b/application/shipsimu/classes/commands/web/company/class_WebShipSimuCompanyCommand.php @@ -0,0 +1,88 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class WebShipSimuCompanyCommand extends BaseCommand implements Commandable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this command and sets the resolver instance + * + * @param $resolverInstance An instance of a command resolver + * @return $commandInstance The created command instance + */ + public static final function createWebShipSimuCompanyCommand (CommandResolver $resolverInstance) { + // Get a new instance + $commandInstance = new WebShipSimuCompanyCommand(); + + // Set the resolver instance + $commandInstance->setResolverInstance($resolverInstance); + + // Return the prepared instance + return $commandInstance; + } + + /** + * 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 + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Get template instance + $templateInstance = $responseInstance->getTemplateInstance(); + + // Set amount and type as variables + $templateInstance->assignVariable('refill_done', $requestInstance->getRequestElement('type')); + $templateInstance->assignVariable('amount' , $requestInstance->getRequestElement('amount')); + + // This method does currently redirect if all goes right + $responseInstance->redirectToConfiguredUrl('refill_page_done'); + } + + /** + * 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 + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // 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')); + + // Add user status filter here + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/commands/web/government/.htaccess b/application/shipsimu/classes/commands/web/government/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/commands/web/government/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/commands/web/government/class_WebGovernmentFailedStartupCommand.php b/application/shipsimu/classes/commands/web/government/class_WebGovernmentFailedStartupCommand.php new file mode 100644 index 0000000..54ddb05 --- /dev/null +++ b/application/shipsimu/classes/commands/web/government/class_WebGovernmentFailedStartupCommand.php @@ -0,0 +1,146 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class WebGovernmentFailedStartupCommand extends BaseCommand implements Commandable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @param $resolverInstance An instance of a command resolver class + * @return $commandInstance An instance a prepared command class + */ + public static final function createWebGovernmentFailedStartupCommand (CommandResolver $resolverInstance) { + // Get new instance + $commandInstance = new WebGovernmentFailedStartupCommand(); + + // Set the application instance + $commandInstance->setResolverInstance($resolverInstance); + + // Return the prepared instance + return $commandInstance; + } + + /** + * Executes the given 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) { + // Get the action instance from registry + $actionInstance = Registry::getRegistry()->getInstance('action'); + + // Do we have an action here? + if ($actionInstance instanceof PerformableAction) { + // Execute the action (shall not output anything, see below why) + $actionInstance->execute($requestInstance, $responseInstance); + } // END - if + + // Get the application instance + $appInstance = $this->getResolverInstance()->getApplicationInstance(); + + // Prepare a template instance + $templateInstance = $this->prepareTemplateInstance($appInstance); + + // Assign base URL + $templateInstance->assignConfigVariable('base_url'); + + // Assign all the application's data with template variables + $templateInstance->assignApplicationData($appInstance); + + // Load the master template + $masterTemplate = $appInstance->buildMasterTemplateName(); + + // Load header template + $templateInstance->loadCodeTemplate('header'); + + // Compile and assign it with a variable + $templateInstance->compileTemplate(); + $templateInstance->assignTemplateWithVariable('header', 'header'); + + // Load footer template + $templateInstance->loadCodeTemplate('footer'); + + // Compile and assign it with a variable + $templateInstance->compileTemplate(); + $templateInstance->assignTemplateWithVariable('footer', 'footer'); + + // Load main template + $templateInstance->loadCodeTemplate('government_failed_main'); + + // Assign the main template with the master template as a content ... ;) + $templateInstance->compileTemplate(); + $templateInstance->assignTemplateWithVariable('government_failed_main', 'main_content'); + + // Load the master template + $templateInstance->loadCodeTemplate($masterTemplate); + + // Set title + $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage($requestInstance->getRequestElement('page') . '_' . $requestInstance->getRequestElement('failed') . '_title')); + + // Construct the menu in every command. We could do this in BaseCommand class. But this means + // *every* command has a navigation system and that is want we don't want. + $menuInstance = ObjectFactory::createObjectByConfiguredName('government_failed_area_menu_class', array($appInstance)); + + // Render the menu + $menuInstance->renderMenu(); + + // Transfer it to the template engine instance + $menuInstance->transferContentToTemplateEngine(); + + // ... and all variables. This should be merged together in a pattern + // to make things easier. A cache mechanism should be added between + // these two calls to cache compiled templates. + $templateInstance->compileVariables(); + + // Get the content back from the template engine and put it in response class + $templateInstance->transferToResponse($responseInstance); + } + + /** + * 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 Maybe we need some filters here? + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // Empty for now + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/commands/web/government/class_WebGovernmentFailedTrainingCommand.php b/application/shipsimu/classes/commands/web/government/class_WebGovernmentFailedTrainingCommand.php new file mode 100644 index 0000000..7119196 --- /dev/null +++ b/application/shipsimu/classes/commands/web/government/class_WebGovernmentFailedTrainingCommand.php @@ -0,0 +1,146 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class WebGovernmentFailedTrainingCommand extends BaseCommand implements Commandable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @param $resolverInstance An instance of a command resolver class + * @return $commandInstance An instance a prepared command class + */ + public static final function createWebGovernmentFailedTrainingCommand (CommandResolver $resolverInstance) { + // Get new instance + $commandInstance = new WebGovernmentFailedTrainingCommand(); + + // Set the application instance + $commandInstance->setResolverInstance($resolverInstance); + + // Return the prepared instance + return $commandInstance; + } + + /** + * Executes the given 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) { + // Get the action instance from registry + $actionInstance = Registry::getRegistry()->getInstance('action'); + + // Do we have an action here? + if ($actionInstance instanceof PerformableAction) { + // Execute the action (shall not output anything, see below why) + $actionInstance->execute($requestInstance, $responseInstance); + } // END - if + + // Get the application instance + $appInstance = $this->getResolverInstance()->getApplicationInstance(); + + // Prepare a template instance + $templateInstance = $this->prepareTemplateInstance($appInstance); + + // Assign base URL + $templateInstance->assignConfigVariable('base_url'); + + // Assign all the application's data with template variables + $templateInstance->assignApplicationData($appInstance); + + // Load the master template + $masterTemplate = $appInstance->buildMasterTemplateName(); + + // Load header template + $templateInstance->loadCodeTemplate('header'); + + // Compile and assign it with a variable + $templateInstance->compileTemplate(); + $templateInstance->assignTemplateWithVariable('header', 'header'); + + // Load footer template + $templateInstance->loadCodeTemplate('footer'); + + // Compile and assign it with a variable + $templateInstance->compileTemplate(); + $templateInstance->assignTemplateWithVariable('footer', 'footer'); + + // Load main template + $templateInstance->loadCodeTemplate('government_failed_main'); + + // Assign the main template with the master template as a content ... ;) + $templateInstance->compileTemplate(); + $templateInstance->assignTemplateWithVariable('government_failed_main', 'main_content'); + + // Load the master template + $templateInstance->loadCodeTemplate($masterTemplate); + + // Set title + $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage($requestInstance->getRequestElement('command') . '_' . $requestInstance->getRequestElement('failed') . '_title')); + + // Construct the menu in every command. We could do this in BaseCommand class. But this means + // *every* command has a navigation system and that is want we don't want. + $menuInstance = ObjectFactory::createObjectByConfiguredName('government_failed_area_menu_class', array($appInstance)); + + // Render the menu + $menuInstance->renderMenu(); + + // Transfer it to the template engine instance + $menuInstance->transferContentToTemplateEngine(); + + // ... and all variables. This should be merged together in a pattern + // to make things easier. A cache mechanism should be added between + // these two calls to cache compiled templates. + $templateInstance->compileVariables(); + + // Get the content back from the template engine and put it in response class + $templateInstance->transferToResponse($responseInstance); + } + + /** + * 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 Maybe we need some filters here? + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // Empty for now + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/commands/web/government/class_WebShipsimuGovernmentStartupCommand.php b/application/shipsimu/classes/commands/web/government/class_WebShipsimuGovernmentStartupCommand.php new file mode 100644 index 0000000..3153962 --- /dev/null +++ b/application/shipsimu/classes/commands/web/government/class_WebShipsimuGovernmentStartupCommand.php @@ -0,0 +1,96 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class WebShipsimuGovernmentStartupCommand extends BaseCommand implements Commandable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @param $resolverInstance An instance of a command resolver class + * @return $commandInstance An instance a prepared command class + */ + public static final function createWebShipsimuGovernmentStartupCommand (CommandResolver $resolverInstance) { + // Get new instance + $commandInstance = new WebShipsimuGovernmentStartupCommand(); + + // Set the application instance + $commandInstance->setResolverInstance($resolverInstance); + + // Return the prepared instance + return $commandInstance; + } + + /** + * Executes the given 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) { + // Get a wrapper instance + $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_gov_wrapper_class'); + + // Register the startup help + $wrapperInstance->registerStartupHelpByRequest($requestInstance); + } + + /** + * 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 Maybe we need some filters here? + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // 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')); + + // Add user status filter here + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); + + // Check if government can pay startup help + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('government_pays_startup_help_filter')); + + // Verify password + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('account_password_filter')); + + // Verify CAPTCHA code + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_government_verifier_filter')); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/commands/web/government/class_WebShipsimuGovernmentTrainingCommand.php b/application/shipsimu/classes/commands/web/government/class_WebShipsimuGovernmentTrainingCommand.php new file mode 100644 index 0000000..035e5e8 --- /dev/null +++ b/application/shipsimu/classes/commands/web/government/class_WebShipsimuGovernmentTrainingCommand.php @@ -0,0 +1,94 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class WebShipsimuGovernmentTrainingCommand extends BaseCommand implements Commandable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @param $resolverInstance An instance of a command resolver class + * @return $commandInstance An instance a prepared command class + */ + public static final function createWebShipsimuGovernmentTrainingCommand (CommandResolver $resolverInstance) { + // Get new instance + $commandInstance = new WebShipsimuGovernmentTrainingCommand(); + + // Set the application instance + $commandInstance->setResolverInstance($resolverInstance); + + // Return the prepared instance + return $commandInstance; + } + + /** + * Executes the given 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) { + // Get a wrapper instance + $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_gov_wrapper_class'); + + // Register the training + $wrapperInstance->registerTrainingByRequest($requestInstance); + } + + /** + * 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 Maybe we need some filters here? + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // 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')); + + // Add user status filter here + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); + + // Check if government can pay training help + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('government_pays_training_filter')); + + // Verify password + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('account_password_filter')); + + // Verify CAPTCHA code + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_refill_verifier_filter')); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/companies/.htaccess b/application/shipsimu/classes/companies/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/companies/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/companies/class_ShippingCompany.php b/application/shipsimu/classes/companies/class_ShippingCompany.php new file mode 100644 index 0000000..cee5ccc --- /dev/null +++ b/application/shipsimu/classes/companies/class_ShippingCompany.php @@ -0,0 +1,666 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class ShippingCompany extends BaseSimulator implements Customer, ContractPartner { + /** + * Full name of this company + */ + private $companyName = "Namenlose Reederei"; + + /** + * Shorted name of this company + */ + private $shortName = ""; + + /** + * Instance of the founder + */ + private $founderInstance = null; + + /** + * Headquarter harbor instance + */ + private $hqInstance = null; + + /** + * Employed people by this company + */ + private $employeeList = null; + + /** + * List of all assigned shipyards + */ + private $shipyardList = null; + + /** + * List of owned ships + */ + private $ownedShips = null; + + /** + * Work constracts this company is currently working on + */ + private $contractList = null; + + // Exception constants + const EXCEPTION_USER_OWNS_NO_COMPANY = 0x200; + + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this company class or throws an exception if the + * given user owns no company. + * + * @param $userInstance A user class + * @return $companyInstance Prepared company instance + * @todo Add functionality if user participates in a company + */ + public static final function createShippingCompany (ManageableAccount $userInstance) { + // Get new instance + $companyInstance = new ShippingCompany(); + + // Does the given user owns a company? + if ($companyInstance->ifUserParticipatesInCompany($userInstance)) { + // Then do some nasty caching here but don't throw an exception + // because then you will hurt our web helpers... :/ + $companyInstance->partialStub("Don't throw exceptions here."); + } // END - if + + // Init all lists + $companyInstance->initCompanyLists(); + + // Return instance + return $companyInstance; + } + + /** + * Checks wether the given user participates in a company + * + * @param $userInstance An instance of a user class + * @return $participates Wether the user participates at lease in one company + */ + protected function ifUserParticipatesInCompany (ManageableAccount $userInstance) { + // By default no user owns any company... ;) + $participates = false; + + // Get a company database wrapper class + $wrapperInstance = ObjectFactory::createObjectByConfiguredName('company_db_wrapper_class', array($this)); + + // Ask the wrapper if this user participates + $participates = $wrapperInstance->ifUserParticipatesInCompany($userInstance); + + // Get the result instance + $resultInstance = $wrapperInstance->getResultInstance(); + + // Caches the result instance here, if set (we don't the wrapper anymore!) + if ($resultInstance instanceof SearchableResult) { + // Set the result instance + $this->setResultInstance($resultInstance); + } // END - if + + // Return result + return $participates; + } + + /** + * Checks wether the current user in registry is the company founder + * + * @return $isFounder Wether the current user is the company founder + * @todo Check if user is company founder + */ + public function ifUserIsFounder () { + // Default is not the founder + $isFounder = false; + + // Get result instance + $resultInstance = $this->getResultInstance(); + + // Is it set? + if ($resultInstance instanceof SearchableResult) { + // Result found so analyse it + $this->partialStub("Check if user is company founder."); + } // END - if + + // Return result + return $isFounder; + } + + /** + * Checks wether the current user in registry is the company owner + * + * @return $isOwner Wether the current user is the company owner + * @todo Check if user is company owner + */ + public function ifUserIsOwner () { + // Default is not the owner + $isOwner = false; + + // Get result instance + $resultInstance = $this->getResultInstance(); + + // Is it set? + if ($resultInstance instanceof SearchableResult) { + // Result found so analyse it + $this->partialStub("Check if user is company owner."); + } // END - if + + // Return result + return $isOwner; + } + + /** + * Checks wether the current user in registry is an employee in this company + * + * @return $isOwner Wether the current user is an employee in this company + */ + public function ifUserIsEmployee () { + // Default is no employee + $isEmployee = false; + + // Get result instance + $resultInstance = $this->getResultInstance(); + + // Is it set? + if ($resultInstance instanceof SearchableResult) { + // Result found so he is employee + $isEmployee = true; + } // END - if + + // Return result + return $isEmployee; + } + + //------------------------------------------------------------------------------\ + // Below here is very old code which needs to be translated and changed heavily | + //------------------------------------------------------------------------------/ + + /** + * Intialize all lists + * + * @return void + * @todo Maybe we don't need these big lists anymore?! So we can deprecate/remove it + */ + protected function initCompanyLists () { + // Employees + $this->employeeList = new FrameworkArrayObject("FakedEmployeeList"); + + // Ship yards + $this->shipyardList = new FrameworkArrayObject("FakedShipyardList"); + + // Contracts + $this->contractList = new FrameworkArrayObject("FakedContractList"); + } + + // Setter-Methode fuer Firmennamen + public final function setCompanyName ($companyName) { + $this->companyName = (string) $companyName; + } + + // Getter-Methode fuer Firmennamen + public final function getCompanyName () { + return $this->companyName; + } + + // Setter-Methode fuer Firmensitz + public final function setHQInstance (Harbor $hqInstance) { + $this->hqInstance = $hqInstance; + } + + // Kuerzel setzen + private function initShortName () { + // Mindestens eine Leerstelle? + $dummy = explode(" ", $this->getCompanyName()); + foreach ($dummy as $part) { + $this->shortName .= substr($part, 0, 1); + } // END - if + } + + // Reedereien Werften bauen lassen + public function createShipyardInHarbor($shipyardName, Harbor $harborInstance) { + if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei %s baut im %s eine Werft %s.", + __CLASS__, + __LINE__, + $this->getCompanyName(), + $harborInstance->getHarborName(), + $shipyardName + )); + + // Wird im HQ gebaut? + if ($this->hqInstance->equals($harborInstance)) { + // Die neue Werft wird im HQ gebaut! + $this->hqInstance->addNewShipyardNotify($shipyardName, $this); + // Die Werft drueber in Kenntnis setzen, welcher Reederei sie angehoert + } else { + // Ausserhalb des Heimathafens soll eine Werft gebaut werden + $harborInstance->addNewShipyardNotify($shipyardName, $this); + } + } + + // Setter fuer Reederei-Gruender + public final function setCompanyFounder(CompanyEmployee $founderInstance) { + $this->founderInstance = $founderInstance; + } + + // Getter for founder instance + public final function getFounderInstance () { + return $this->founderInstance; + } + + // Neue(n) Angestellte(n) in Angestellten-Liste aufnehmen + public function addNewEmployee (SimulatorPersonell $employeeInstance) { + $this->employeeList->append($employeeInstance); + } + + // Neue Werft in Liste aufnehmen + public function addNewShipyard (Shipyard $shipyardInstance) { + $this->shipyardList->append($shipyardInstance); + } + + // Neue Mitarbeiter per Zufall einstellen/rekrutieren + public function recruitRandomEmployees($amount, SimulatorPersonell $personellInstance) { + // Anzahl Mitarbeiter absichern + $amount = (int) $amount; + + // Debug-Meldung ausgeben + if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei %s stellt per Zufall %d neue Mitarbeiter ein.", + __CLASS__, + __LINE__, + $this->getCompanyName(), + $amount + )); + + // Gesamtanzahl verfuegbarer Erwerbsloser holen + $totalUnemployed = $personellInstance->getAllUnemployed(); + + // Existiert die gewuenschte Anzahl freier Arbeiter? (doppelt geht derzeit nicht) + if ($totalUnemployed < $amount) { + // Reichte nicht aus! + throw new ToMuchEmployeesException(array($amount, $personellInstance->getAllUnemployed()), self::EXCEPTION_NOT_ENOUGTH_UNEMPLOYEES); + } // END - if + + // Get list for all unemployed people + $list = $personellInstance->getSpecialPersonellList(false); // Should be cached + + // Get iterator of the list + $iterator = $list->getIterator(); + + // Get the requested amount of personell + for ($idx = 0; $idx < $amount; $idx++) { + $employee = null; + // Is this personl unemployed? + while (is_null($employee) || $employee->isEmployed()) { + // Generate random number + $pos = mt_rand(0, ($totalUnemployed - 1)); // Don't remove the -1 here: + // E.g. 100 entries means latest position is 99... + + // Seek for the position + $iterator->seek($pos); + + // Is the current position valid? + if ($iterator->valid() === false) { + // Should normally not happen... :( + throw new StructuresOutOfBoundsException($idx, self::EXCEPTION_INDEX_OUT_OF_BOUNDS); + } // END - if + + // Get current element + $employee = $iterator->current(); + } // END - while + + // A dummy just for the description and real class + $dummy = CompanyEmployee::createCompanyEmployee("", "", "M", 1970, 1, 1, $employee->isMarried(), 0); + + // Make this person employed and give him some money to work + $employee->setEmployed(true); + $employee->setRealClass($dummy->__toString()); + $employee->increaseSalary((mt_rand(7, 14) * 100)); // Are 700 to 1400 EUR for the begin okay? + + // Debug message + if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei %s stellt den/die Angestellte(n) %s %s ein.", + __CLASS__, + __LINE__, + $this->getCompanyName(), + $employee->getSurname(), + $employee->getFamily() + )); + + // Add this employee + $this->addNewEmployee($employee); + } // End - for + + // Cache resetten + $personellInstance->resetCache(); + + // Debug-Meldung ausgeben + if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei %s hat per Zufall %d neue Mitarbeiter eingestellt.", + __CLASS__, + __LINE__, + $this->getCompanyName(), + $amount + )); + } // End - method + + // Distribute all personells on all shipyards + public function distributeAllPersonellOnShipyards () { + if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei %s verteilt alle ihre %d Mitarbeiter auf alle %d Werft(en).", + __CLASS__, + __LINE__, + $this->getCompanyName(), + $this->getTotalEmployee(), + $this->getTotalShipyards() + )); + + // Do we have some shipyards? + if (is_null($this->shipyardList)) { + // No shipyards created + throw new NoShipyardsConstructedException($this, self::EXCEPTION_HARBOR_HAS_NO_SHIPYARDS); + } + + // Get iterator for shipyards + $shipyardIter = $this->shipyardList->getIterator(); + + // Iterate through all employees + for ($idx = $this->employeeList->getIterator(); $idx->valid(); $idx->next()) { + // Is the shipyard iterator still okay? + if ($shipyardIter->valid() === false) { + // Rewind to first position + $shipyardIter->seek(0); + } // END - if + + // Get Shipyard object + $shipyard = $shipyardIter->current(); + + // Is this a Shipyard object? + if (is_null($shipyard)) { + // No class returned + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($shipyard)) { + // Not an object! ;-( + throw new InvalidObjectException($shipyard, self::EXCEPTION_IS_NO_OBJECT); + } elseif ($shipyard->isClass("Shipyard") === false) { + // Nope, so throw exception + throw new ClassMismatchException(array($shipyard->__toString(), "Shipyard"), self::EXCEPTION_CLASSES_NOT_MATCHING); + } + + // Add employee to the shipyard + $shipyard->addNewPersonell($idx->current()); + + // Continue to next shipyard + $shipyardIter->next(); + } + } + + // Getter for total employees + public final function getTotalEmployee () { + // Count all... + $total = $this->employeeList->count(); + + // Debug message + if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei %s hat %d Mitarbeiter.", + __CLASS__, + __LINE__, + $this->getCompanyName(), + $total + )); + + // Return amount + return $total; + } + + // Getter for total shipyards + public final function getTotalShipyards () { + if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Für die Reederei %s werden die Anzahl der Werften in allen Häfen ermittelt.", + __CLASS__, + __LINE__, + $this->getCompanyName() + )); + + // Do we have some shipyards? + if (is_null($this->shipyardList)) { + // No shipyards created + throw new NoShipyardsConstructedException($this, self::EXCEPTION_HARBOR_HAS_NO_SHIPYARDS); + } + + // Get iterator + $total = $this->shipyardList->count(); + + // Debug message + if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei %s hat %d Werft(en).", + __CLASS__, + __LINE__, + $this->getCompanyName(), + $total + )); + + // Return amount + return $total; + } + + // Add a ship type (class) to all shipyards + public function addShipTypeToAllShipyards ($shipType) { + // Secure strings + $shipType = (string) $shipType; + + // Is the class there? + if (!class_exists($shipType)) { + // Throw exception + throw new NoClassException($shipType, self::EXCEPTION_CLASS_NOT_FOUND); + } + + // Create dummy ship + eval(sprintf("\$shipInstance = %s::create%s(\"M/S Dummy\");", + $shipType, + $shipType + )); + + // Iterate shipyard list + for ($idx = $this->shipyardList->getIterator(); $idx->valid(); $idx->next()) { + // Get current element + $shipyard = $idx->current(); + + // Is this a shipyard? + if (is_null($shipyard)) { + // Opps! Empty list? + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($shipyard)) { + // Not an object! ;-( + throw new InvalidObjectException($shipyard, self::EXCEPTION_IS_NO_OBJECT); + } 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 + public function validateWorksContractShipType (SignableContract $contractInstance) { + // First get the ship type + $shipInstance = $contractInstance->getShipInstance(); + + // Ist there a ship instance? + if (is_null($shipInstance)) { + // Opps! Empty entry? + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($shipInstance)) { + // Not an object! ;-( + throw new InvalidObjectException($shipInstance, self::EXCEPTION_IS_NO_OBJECT); + } + + // Get it's real class name + $shipType = $shipInstance->__toString(); + + // Now check if ship type is in any list and return the result + return ($this->isShipTypeConstructable($shipType)); + } + + // Is the ship type constructable? + public function isShipTypeConstructable ($shipType) { + // The type must be a string! + $shipType = (string) $shipType; + + // Debug message + if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei %s fragt alle Werften ab, ob diese Schiffe vom Typ %s bauen können.", + __CLASS__, + __LINE__, + $this->getCompanyName(), + $shipType + )); + + // First everthing is failed... + $result = false; + + // Iterate through all shipyards + for ($idx = $this->shipyardList->getIterator(); $idx->valid(); $idx->next()) { + // Get current Shipyard instance + $shipyard = $idx->current(); + + // Is this a shipyard? + if (is_null($shipyard)) { + // Opps! Empty list? + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($shipyard)) { + // Not an object! ;-( + throw new InvalidObjectException($shipyard, self::EXCEPTION_IS_NO_OBJECT); + } elseif ($shipyard->isClass("Shipyard") === false) { + // Class is not a shipyard + throw new ClassMismatchException(array($shipyard->__toString(), "Shipyard"), self::EXCEPTION_CLASSES_NOT_MATCHING); + } + + // Validate if first found shipyard can construct the requested type + $result = $shipyard->isShipTypeConstructable($shipType); + + // 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 %s hat die Suche nach einer Werft beendet, die Schiffe vom Typ %s bauen kann.", + __CLASS__, + __LINE__, + $this->getCompanyName(), + $shipType + )); + + // Return result + return $result; + } + + // As a customer the shipping company can add new contracts + public function addNewWorksContract (SignableContract $contractInstance) { + $this->contractList->append($contractInstance); + } + + // As a customer the shippng company can withdraw from a contract + public function withdrawFromContract (SignableContract $contractInstance) { + ApplicationEntryPoint::app_exit("WITHDRAW:
".print_r($contractInstance, true)."
"); + } + + // Get latest added contract instance + public final function getLastContractInstance () { + // Get iterator + $iter = $this->contractList->getIterator(); + + // Get latest entry (total - 1) + $iter->seek($iter->count() - 1); + + // Return entry + return $iter->current(); + } + + // 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) === 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)) { + // With itself + if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei %s erteilt an sich selbst einen Bauauftrag für das %s "%s".", + __CLASS__, + __LINE__, + $this->getCompanyName(), + $contractInstance->getShipInstance()->getObjectDescription(), + $contractInstance->getShipInstance()->getShipName() + )); + } else { + // Other external company + if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei %s unterzeichnet einen Bauauftrag für das %s "%s" mit der %s.", + __CLASS__, + __LINE__, + $this->getCompanyName(), + $contractInstance->getShipInstance()->getObjectDescription(), + $contractInstance->getShipInstance()->getShipName(), + $partnerInstance->getCompanyName() + )); + } + + // Sign the contract + $contractInstance->signContract($this, $partnerInstance); + + /** + * @todo Maybe do something more here... + */ + } + + // Is this the right contract partner? + public function isContractPartner (SignableContract $contractInstance) { + // Get contract partner instance and compare it with $this contract partner + return ($this->equals($contractInstance->getContractPartner())); + } + + // Setter for merchant instance + public final function setMerchantInstance (Merchant $merchantInstance) { + // Get contract + $contractInstance = $this->getLastContractInstance(); + + if (is_null($contractInstance)) { + // Opps! Empty contract instance? + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($contractInstance)) { + // Not an object! ;-( + throw new InvalidObjectException($contractInstance, self::EXCEPTION_IS_NO_OBJECT); + } elseif ($contractInstance->isClass("WorksContract") === false) { + // Is not a merchant + throw new ClassMismatchException(array($contractInstance->__toString(), "WorksContract"), self::EXCEPTION_CLASSES_NOT_MATCHING); + } + + // Set the merchant in the contract (for getting prices) + $contractInstance->setMerchantInstance($merchantInstance); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/constructions/.htaccess b/application/shipsimu/classes/constructions/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/constructions/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/constructions/berths/.htaccess b/application/shipsimu/classes/constructions/berths/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/constructions/berths/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/constructions/berths/class_Berth.php b/application/shipsimu/classes/constructions/berths/class_Berth.php new file mode 100644 index 0000000..c96ba10 --- /dev/null +++ b/application/shipsimu/classes/constructions/berths/class_Berth.php @@ -0,0 +1,39 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class Berth extends BaseConstruction { + // Durchlaufende Nummer der Liegeplaetze + private $berthIndex = 0; + + // Zugewiesener Hafen + private $harborInstance = null; + + // Konstruktor + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/constructions/class_BaseConstruction.php b/application/shipsimu/classes/constructions/class_BaseConstruction.php new file mode 100644 index 0000000..af08a39 --- /dev/null +++ b/application/shipsimu/classes/constructions/class_BaseConstruction.php @@ -0,0 +1,36 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class BaseConstruction extends BaseSimulator { + // Tiefgang fuer z.B. Trockdocks + private $draught = 0; + + // Konstruktor + protected function __construct ($className) { + // Eltern-Konstrutor aufrufen + parent::__construct($className); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/constructions/docks/.htaccess b/application/shipsimu/classes/constructions/docks/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/constructions/docks/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/constructions/docks/class_DryDock.php b/application/shipsimu/classes/constructions/docks/class_DryDock.php new file mode 100644 index 0000000..c9d6f8e --- /dev/null +++ b/application/shipsimu/classes/constructions/docks/class_DryDock.php @@ -0,0 +1,36 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class DryDock extends BaseConstruction { + // Zugewiesener Hafen + private $harborInstance = null; + + // Konstruktor + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/constructions/harbors/.htaccess b/application/shipsimu/classes/constructions/harbors/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/constructions/harbors/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/constructions/harbors/class_Harbor.php b/application/shipsimu/classes/constructions/harbors/class_Harbor.php new file mode 100644 index 0000000..cf350ce --- /dev/null +++ b/application/shipsimu/classes/constructions/harbors/class_Harbor.php @@ -0,0 +1,87 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class Harbor extends BaseConstruction { + // Namen des Hafens (z.B. Hamburger Hafen) + private $harborName = "Unbekannter Hafen"; + + // Schiffsliste aller gebauten Schiffe + private $constructedShips = null; + + // Liegeplatz-Liste + private $berthList = null; + + // List of all assigned shipyards + private $shipyardList = null; + + // Constructor + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + // Creates a harbor + public static final function createHarbor ($harborName) { + // Hafen-Instanz holen + $harborInstance = new Harbor(); + + // Hafenname setzen + $harborInstance->setHarborName($harborName); + + // Werftliste initialisieren + $harborInstance->createshipyardList(); + + // Instanz zurueckliefern + return $harborInstance; + } + + // Werft-Liste generieren + public function createshipyardList () { + $this->shipyardList = new FrameworkArrayObject("FakedShipyardList"); + } + + // Setter fuer Hafennamen + public final function setHarborName ($harborName) { + $this->harborName = (string) $harborName; + } + + // Getter fuer Hafennamen + public final function getHarborName () { + return $this->harborName; + } + + // Werft in den Hafen einbauen und Werft->Reederei zuweisen + public function addNewShipyardNotify ($shipyardName, ShippingCompany $companyInstance) { + // Werft generieren und in die Werftliste aufnehmen + $this->shipyardList->append(Shipyard::createShipyardNotify($this, $shipyardName, $companyInstance)); + } + + // Werft in den Hafen einbauen ohne Zuweisung einer Reederei (gehoert der "Stadt" dann) + public function addNewShipyard ($shipyardName) { + // Werft generieren und in die Werftliste aufnehmen + $this->shipyardList->append(Shipyard::createShipyard($this, $shipyardName)); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/constructions/terminals/.htaccess b/application/shipsimu/classes/constructions/terminals/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/constructions/terminals/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/constructions/terminals/class_Terminal.php b/application/shipsimu/classes/constructions/terminals/class_Terminal.php new file mode 100644 index 0000000..9ae9985 --- /dev/null +++ b/application/shipsimu/classes/constructions/terminals/class_Terminal.php @@ -0,0 +1,36 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class Terminal extends BaseConstruction { + // Zugewiesener Hafen + private $harborInstance = null; + + // Konstruktor + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/constructions/yards/.htaccess b/application/shipsimu/classes/constructions/yards/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/constructions/yards/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/constructions/yards/class_Shipyard.php b/application/shipsimu/classes/constructions/yards/class_Shipyard.php new file mode 100644 index 0000000..1959f83 --- /dev/null +++ b/application/shipsimu/classes/constructions/yards/class_Shipyard.php @@ -0,0 +1,215 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class Shipyard extends BaseConstruction { + // Werft-Name + private $shipyardName = "Namenlose Werft"; + + // Arbeiter-Liste + private $staffList = null; + + // Queue-Liste fuer zu bauende Schiffe + private $queueList = null; + + // Aktuell im Bau befindliches Schiff + private $currShipInConst = null; + + // Liste konstruierbarer Schiffstypen + private $shipTypeList = null; + + // Zugewiesener Hafen + private $harborInstance = null; + + // Zugewiesene Reederei + private $shippingCompany = null; + + // Constructor + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + + // Staff-Liste/Schiffstyp-Liste erzeugen + $this->createStaffList(); + $this->createShipTypeList(); + } + + // Create a shipyard and notify it about it's owner + public static final function createShipyardNotify (Harbor $harborInstance, $shipyardName, ShippingCompany $companyInstance) { + // Werft-Instanz holen + $shipyardInstance = self::createShipyard($harborInstance, $shipyardName); + + // Reederei der Werft zuweisen + $shipyardInstance->setCompanyInstance($companyInstance); + + // Die Reederei ueber ihre Werft informieren + $companyInstance->addNewShipyard($shipyardInstance); + + // Instanz zurueckgeben + return $shipyardInstance; + } + + // Create a shipyard, first we need to create a harbor + public static final function createShipyard (Harbor $harborInstance, $shipyardName) { + // Instanz temporaer holen + $shipyardInstance = new Shipyard(); + + // Debug message + if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $shipyardInstance->debugOutput(sprintf("[%s:%d] Eine Werft mit dem Namen %s wird im Hafen %s konstruiert.", + __CLASS__, + __LINE__, + $shipyardName, + $harborInstance->getHarborName() + )); + + // Werft-Name setzen + $shipyardInstance->setShipyardName($shipyardName); + + // Hafen-Instanz setzen + $shipyardInstance->setHarborInstance($harborInstance); + + // Abmasse setzen in Meter + $shipyardInstance->setWidth(30); + $shipyardInstance->setHeight(30); + $shipyardInstance->setLength(100); + + // Clean up a little + $shipyardInstance->removeDraught(); + + // Debug-Meldung + if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $shipyardInstance->debugOutput(sprintf("[%s:%d] Die Werft %s wurde gebaut.", + __CLASS__, + __LINE__, + $shipyardName + )); + + // Instanz zurueckliefern + return $shipyardInstance; + } + + // Create staff list + private function createStaffList () { + $this->staffList = new FrameworkArrayObject("FakedStaffList"); + } + + // Create ship type list + private function createShipTypeList () { + $this->shipTypeList = new FrameworkArrayObject("FakedShipTypeList"); + } + + // Setter-Methode fuer Werft-Name + public final function setShipyardName ($shipyardName) { + $this->shipyardName = (string) $shipyardName; + } + + // Getter-Methode fuer Werft-Name + public final function getShipyardName () { + return $this->shipyardName; + } + + // Setter-Methode fuer Hafen-Instanz + public final function setHarborInstance (Harbor $harborInstance) { + $this->harborInstance = $harborInstance; + } + + // Getter-Methode fuer Hafen-Instanz + public final function getHarborInstance () { + return $this->harborInstance; + } + + // Setter fuer Reederei-Instanz + public final function setCompanyInstance (ShippingCompany $companyInstance) { + $this->shippingCompany = $companyInstance; + } + + // Getter fuer Reederei-Instanz + public final function getCompanyInstance () { + return $this->shippingCompany; + } + + // Add new personell + public function addNewPersonell ($personell) { + // Add to list + $this->staffList->append($personell); + } + + // Add a new ship type to our list + public function addNewConstructableShipType ($shipType) { + // This must be a string! + $shipType = (string) $shipType; + + // Debug message + if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Werft %s kann bald Schiffe vom Typ %s bauen.", + __CLASS__, + __LINE__, + $this->getShipyardName(), + $shipType + )); + + // Add to list + $this->shipTypeList->append($shipType); + } + + // Is the specified ship type in our list? + public function isShipTypeConstructable ($shipType) { + // First we can't build this ship + $result = false; + + // This must be a string! + $shipType = (string) $shipType; + + // Debug message + if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Werft %s prüft, ob Schiffe vom Typ %s baubar sind.", + __CLASS__, + __LINE__, + $this->getShipyardName(), + $shipType + )); + + // Iterate through all types + for ($idx = $this->shipTypeList->getIterator(); $idx->valid(); $idx->next()) { + // Get current ship type + $type = (string) $idx->current(); + + // Is both the same? + $result = ($type == $shipType); + + // Type is found? + if ($result) break; // Then abort the search! + } + + // Debug message + if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Werft %s hat die Suche nach dem Schiffstyp %s abgeschlossen.", + __CLASS__, + __LINE__, + $this->getShipyardName(), + $shipType + )); + + // Return result + return $result; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/controller/.htaccess b/application/shipsimu/classes/controller/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/controller/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/controller/html/.htaccess b/application/shipsimu/classes/controller/html/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/controller/html/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/controller/html/class_HtmlCompanyController.php b/application/shipsimu/classes/controller/html/class_HtmlCompanyController.php new file mode 100644 index 0000000..741cc5a --- /dev/null +++ b/application/shipsimu/classes/controller/html/class_HtmlCompanyController.php @@ -0,0 +1,106 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class HtmlCompanyController extends BaseController implements Controller { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @param $resolverInstance An instance of a command resolver class + * @return $controllerInstance A prepared instance of this class + * @todo Add some filters to this controller + */ + public static final function createHtmlCompanyController (CommandResolver $resolverInstance) { + // Create the instance + $controllerInstance = new HtmlCompanyController(); + + // Set the command resolver + $controllerInstance->setResolverInstance($resolverInstance); + + // User auth filter + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_filter')); + + // User update filter + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_update_filter')); + + // News fetcher filter + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_filter')); + + // News proccess/display-preparation + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_filter')); + + // Return the prepared instance + return $controllerInstance; + } + + /** + * Handles the given request and response + * + * @param $requestInstance An instance of a request class + * @param $responseInstance An instance of a response class + * @return void + */ + public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) { + // Get the command instance from the resolver by sending a request instance to the resolver + $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance); + + // Add more filters by the command + $commandInstance->addExtraFilters($this, $requestInstance); + + // Try to run the pre filters, if auth exceptions come through redirect here + try { + // Run the pre filters + $this->executePreFilters($requestInstance, $responseInstance); + } catch (UserAuthorizationException $e) { + // Redirect to main page + $responseInstance->redirectToConfiguredUrl('login_failed'); + + // Exit here + exit(); + } + + // This request was valid! :-D + $requestInstance->requestIsValid(); + + // Execute the command + $commandInstance->execute($requestInstance, $responseInstance); + + // Run the pre filters + $this->executePostFilters($requestInstance, $responseInstance); + + // Flush the response out + $responseInstance->flushBuffer(); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/controller/html/class_HtmlGovernmentFailedController.php b/application/shipsimu/classes/controller/html/class_HtmlGovernmentFailedController.php new file mode 100644 index 0000000..217b6b5 --- /dev/null +++ b/application/shipsimu/classes/controller/html/class_HtmlGovernmentFailedController.php @@ -0,0 +1,106 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class HtmlGovernmentFailedController extends BaseController implements Controller { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @param $resolverInstance An instance of a command resolver class + * @return $controllerInstance A prepared instance of this class + * @todo Add some filters to this controller + */ + public static final function createHtmlGovernmentFailedController (CommandResolver $resolverInstance) { + // Create the instance + $controllerInstance = new HtmlGovernmentFailedController(); + + // Set the command resolver + $controllerInstance->setResolverInstance($resolverInstance); + + // User auth filter + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_filter')); + + // User update filter + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_update_filter')); + + // News fetcher filter + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_filter')); + + // News proccess/display-preparation + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_filter')); + + // Return the prepared instance + return $controllerInstance; + } + + /** + * Handles the given request and response + * + * @param $requestInstance An instance of a request class + * @param $responseInstance An instance of a response class + * @return void + */ + public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) { + // Get the command instance from the resolver by sending a request instance to the resolver + $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance); + + // Add more filters by the command + $commandInstance->addExtraFilters($this, $requestInstance); + + // Try to run the pre filters, if auth exceptions come through redirect here + try { + // Run the pre filters + $this->executePreFilters($requestInstance, $responseInstance); + } catch (UserAuthorizationException $e) { + // Redirect to main page + $responseInstance->redirectToConfiguredUrl('login_failed'); + + // Exit here + exit(); + } + + // This request was valid! :-D + $requestInstance->requestIsValid(); + + // Execute the command + $commandInstance->execute($requestInstance, $responseInstance); + + // Run the pre filters + $this->executePostFilters($requestInstance, $responseInstance); + + // Flush the response out + $responseInstance->flushBuffer(); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/drives/.htaccess b/application/shipsimu/classes/drives/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/drives/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/drives/class_BaseDrive.php b/application/shipsimu/classes/drives/class_BaseDrive.php new file mode 100644 index 0000000..56f9802 --- /dev/null +++ b/application/shipsimu/classes/drives/class_BaseDrive.php @@ -0,0 +1,64 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class BaseDrive extends BaseSimulator { + // Price of this drive + private $price = 0.00; + // PS-Zahl + private $horsePower = 0; + // Anzahl Nocken + private $numCams = 0; + + // Konstruktor + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + } + + // Setter-Methode fuert PS-Zahl + public final function setHorsePower ($hp) { + $this->horsePower = (int) $hp; + } + + // Setter-Methode fuer Nockenanzahl + public final function setNumCams ($cams) { + $this->numCams = (int) $cams; + } + + // Setter for price + public final function setPrice ($price) { + $this->price = (float) $price; + } + + // Getter for price + public final function getPrice () { + return $this->price; + } + + public final function removePrice () { + unset($this->price); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/drives/motor/.htaccess b/application/shipsimu/classes/drives/motor/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/drives/motor/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/drives/motor/class_Motor.php b/application/shipsimu/classes/drives/motor/class_Motor.php new file mode 100644 index 0000000..2f3479e --- /dev/null +++ b/application/shipsimu/classes/drives/motor/class_Motor.php @@ -0,0 +1,56 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class Motor extends BaseDrive implements TradeableItem, ConstructableShipPart { + // Constructor + protected function __construct() { + // Call parent constructor + parent::__construct(__CLASS__); + } + + // Einen Motor erstellen + public static final function createMotor ($descr, $hp, $cams, $w, $h, $l) { + // Get new instance + $motorInstance = new Motor(); + + // Beschreibung und Abmasse setzen + $motorInstance->setWidth($w); + $motorInstance->setHeight($h); + $motorInstance->setLength($l); + + // Weitere Daten setzen + $motorInstance->setHorsePower($hp); + $motorInstance->setNumCams($cams); + + // Instanz zurueckgeben + return $motorInstance; + } + + // Overwritten method for tradeable items + public function isTradeable () { + return true; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/factories/.htaccess b/application/shipsimu/classes/factories/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/factories/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/factories/class_ShipSimuWebNewsFactory.php b/application/shipsimu/classes/factories/class_ShipSimuWebNewsFactory.php new file mode 100644 index 0000000..e42b021 --- /dev/null +++ b/application/shipsimu/classes/factories/class_ShipSimuWebNewsFactory.php @@ -0,0 +1,60 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class ShipSimuWebNewsFactory extends BaseFrameworkSystem { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @return $factoryInstance An instance of this class + */ + public static final function createShipSimuWebNewsFactory () { + // Get a new instance + $factoryInstance = new ShipSimuWebNewsFactory(); + + // Return the prepared instance + return $factoryInstance; + } + + /** + * Create the news object itself here depending on the request + * + * @param $requestInstance An instance of a request class + * @return $newsInstance An instance of a news class + */ + public function createNewObject (Requestable $requestInstance) { + // Do some stuff here + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/filter/.htaccess b/application/shipsimu/classes/filter/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/filter/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/filter/book/.htaccess b/application/shipsimu/classes/filter/book/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/filter/book/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/filter/book/refill/.htaccess b/application/shipsimu/classes/filter/book/refill/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/filter/book/refill/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/filter/book/refill/class_RefillRequestCurrencyTestBookFilter.php b/application/shipsimu/classes/filter/book/refill/class_RefillRequestCurrencyTestBookFilter.php new file mode 100644 index 0000000..b7ff113 --- /dev/null +++ b/application/shipsimu/classes/filter/book/refill/class_RefillRequestCurrencyTestBookFilter.php @@ -0,0 +1,72 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class RefillRequestCurrencyTestBookFilter extends BaseShipSimuFilter implements Filterable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this filter class + * + * @return $filterInstance An instance of this filter class + */ + public static final function createRefillRequestCurrencyTestBookFilter () { + // Get a new instance + $filterInstance = new RefillRequestCurrencyTestBookFilter(); + + // 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 Add code being executed in this filter + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Execute the parent execute method + parent::execute($requestInstance, $responseInstance); + + // Get the user instance from registry + $userInstance = Registry::getRegistry()->getInstance('user'); + + // Run the update + $userInstance->bookAmountDirectly($requestInstance); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/filter/class_ b/application/shipsimu/classes/filter/class_ new file mode 100644 index 0000000..20653ff --- /dev/null +++ b/application/shipsimu/classes/filter/class_ @@ -0,0 +1,65 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @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 . + */ +class ???Filter extends BaseShipSimuFilter implements Filterable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this filter class + * + * @return $filterInstance An instance of this filter class + */ + public final static function create???Filter () { + // Get a new instance + $filterInstance = new ???Filter(); + + // 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 Add code being executed in this filter + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Execute the parent execute method + parent::execute($requestInstance, $responseInstance); + + $this->partialStub("Add code here for your specific filter."); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/filter/class_BaseShipSimuFilter.php b/application/shipsimu/classes/filter/class_BaseShipSimuFilter.php new file mode 100644 index 0000000..7a80cf2 --- /dev/null +++ b/application/shipsimu/classes/filter/class_BaseShipSimuFilter.php @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class BaseShipSimuFilter extends BaseFilter { + /** + * Protected constructor + * + * @param $className Name of the filter class + * @return void + */ + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + } + + /** + * 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 Add something to do on every filter + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Add something to do on every filter + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/filter/government/.htaccess b/application/shipsimu/classes/filter/government/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/filter/government/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/filter/government/class_ShipSimuGovernmentPaysStartupHelpFilter.php b/application/shipsimu/classes/filter/government/class_ShipSimuGovernmentPaysStartupHelpFilter.php new file mode 100644 index 0000000..7becf12 --- /dev/null +++ b/application/shipsimu/classes/filter/government/class_ShipSimuGovernmentPaysStartupHelpFilter.php @@ -0,0 +1,78 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class ShipSimuGovernmentPaysStartupHelpFilter extends BaseShipSimuFilter implements Filterable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this filter class + * + * @return $filterInstance An instance of this filter class + */ + public static final function createShipSimuGovernmentPaysStartupHelpFilter () { + // Get a new instance + $filterInstance = new ShipSimuGovernmentPaysStartupHelpFilter(); + + // 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) { + // Execute the parent execute method + parent::execute($requestInstance, $responseInstance); + + // Get the user instance from registry + $userInstance = Registry::getRegistry()->getInstance('user'); + + // Now simply check for it + if ((!$userInstance instanceof ManageableMember) || ($userInstance->ifGovernmentPaysStartupHelp() === false)) { + // Request is invalid + $requestInstance->requestIsValid(false); + + // Redirect to configured URL + $responseInstance->redirectToConfiguredUrl('login_government_startup_failed'); + + // Stop processing here + exit(); + } // END - if + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/filter/government/class_ShipSimuGovernmentPaysTrainingFilter.php b/application/shipsimu/classes/filter/government/class_ShipSimuGovernmentPaysTrainingFilter.php new file mode 100644 index 0000000..75eb1cc --- /dev/null +++ b/application/shipsimu/classes/filter/government/class_ShipSimuGovernmentPaysTrainingFilter.php @@ -0,0 +1,78 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class ShipSimuGovernmentPaysTrainingFilter extends BaseShipSimuFilter implements Filterable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this filter class + * + * @return $filterInstance An instance of this filter class + */ + public static final function createShipSimuGovernmentPaysTrainingFilter () { + // Get a new instance + $filterInstance = new ShipSimuGovernmentPaysTrainingFilter(); + + // 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) { + // Execute the parent execute method + parent::execute($requestInstance, $responseInstance); + + // Get the user instance from registry + $userInstance = Registry::getRegistry()->getInstance('user'); + + // Now simply check for it + if ((!$userInstance instanceof ManageableMember) || ($userInstance->ifGovernmentPaysTraining() === false)) { + // Request is invalid + $requestInstance->requestIsValid(false); + + // Redirect to configured URL + $responseInstance->redirectToConfiguredUrl('login_government_training_failed'); + + // Stop processing here + exit(); + } // END - if + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/filter/page/.htaccess b/application/shipsimu/classes/filter/page/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/filter/page/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/filter/page/class_RefillPageFilter.php b/application/shipsimu/classes/filter/page/class_RefillPageFilter.php new file mode 100644 index 0000000..d4680ba --- /dev/null +++ b/application/shipsimu/classes/filter/page/class_RefillPageFilter.php @@ -0,0 +1,75 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class RefillPageFilter extends BaseShipSimuFilter implements Filterable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this filter class + * + * @return $filterInstance An instance of this filter class + */ + public static final function createRefillPageFilter () { + // Get a new instance + $filterInstance = new RefillPageFilter(); + + // 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 + * @throws FilterChainException If this filter fails to operate + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Execute the parent execute method + parent::execute($requestInstance, $responseInstance); + + // Is the configuration variable set? + if ($this->getConfigInstance()->getConfigEntry('refill_page_active') === "N") { + // Password is empty + $requestInstance->requestIsValid(false); + + // Add a message to the response + $responseInstance->addFatalMessage('refill_page_not_active'); + + // Abort here + throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); + } // END - if + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/filter/validator/.htaccess b/application/shipsimu/classes/filter/validator/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/filter/validator/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/filter/validator/class_RefillRequestValidatorFilter.php b/application/shipsimu/classes/filter/validator/class_RefillRequestValidatorFilter.php new file mode 100644 index 0000000..3abd7ba --- /dev/null +++ b/application/shipsimu/classes/filter/validator/class_RefillRequestValidatorFilter.php @@ -0,0 +1,76 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class RefillRequestValidatorFilter extends BaseShipSimuFilter implements Filterable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this filter class + * + * @return $filterInstance An instance of this filter class + */ + public static final function createRefillRequestValidatorFilter () { + // Get a new instance + $filterInstance = new RefillRequestValidatorFilter(); + + // 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 Maybe we need to added some more generic tests on the request here? + * @throws FilterChainException If this filter fails to operate + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Execute the parent execute method + parent::execute($requestInstance, $responseInstance); + + // Are all required request fields set? + if (($requestInstance->isRequestElementSet('type') === false) || ($requestInstance->isRequestElementSet('amount') === false)) { + // Something important is missing + $requestInstance->requestIsValid(false); + + // Add a message to the response + $responseInstance->addFatalMessage('refill_page_required_fields_missing'); + + // Abort here + throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); + } // END - if + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/filter/validator/class_ShipSimuUserStatusGuestFilter.php b/application/shipsimu/classes/filter/validator/class_ShipSimuUserStatusGuestFilter.php new file mode 100644 index 0000000..989e1d4 --- /dev/null +++ b/application/shipsimu/classes/filter/validator/class_ShipSimuUserStatusGuestFilter.php @@ -0,0 +1,79 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class ShipSimuUserStatusGuestFilter extends BaseShipSimuFilter implements Filterable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this filter class + * + * @return $filterInstance An instance of this filter class + */ + public static final function createShipSimuUserStatusGuestFilter () { + // Get a new instance + $filterInstance = new ShipSimuUserStatusGuestFilter(); + + // 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 Maybe we need to added some more generic tests on the request here? + * @throws FilterChainException If this filter fails to operate + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Execute the parent execute method + parent::execute($requestInstance, $responseInstance); + + // Get a user instance for comparison + $userInstance = Registry::getRegistry()->getInstance('user'); + + // Is the user account confirmed? + if ($userInstance->getField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS) == $this->getConfigInstance()->getConfigEntry('user_status_guest')) { + // Request is invalid! + $requestInstance->requestIsValid(false); + + // Redirect to configured URL + $responseInstance->redirectToConfiguredUrl('login_user_status_guest'); + + // Stop processing here + exit(); + } // END - if + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/government/.htaccess b/application/shipsimu/classes/government/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/government/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/government/class_SimplifiedGovernment.php b/application/shipsimu/classes/government/class_SimplifiedGovernment.php new file mode 100644 index 0000000..8999153 --- /dev/null +++ b/application/shipsimu/classes/government/class_SimplifiedGovernment.php @@ -0,0 +1,137 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * @todo Find an interface for governments + * + * 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 . + */ +class SimplifiedGovernment extends BaseFrameworkSystem implements Registerable { + // Constants + const STATUS_STARTER_HELP = 'STARTER_HELP'; + const STATUS_TRAINING = 'TRAINING'; + + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this government class by given user instance + * + * @param $userInstance The user instance + * @return $governmentInstance Instance of the prepared government instance + */ + public static final function createSimplifiedGovernment (ManageableAccount $userInstance) { + // Get a new instance + $governmentInstance = new SimplifiedGovernment(); + + // Set the user instance + $governmentInstance->setUserInstance($userInstance); + + // Return the prepared instance + return $governmentInstance; + } + + /** + * Checks wether the government has already payed a training course for te + * current user + * + * @return $alreadyPayed Wether the government has already payed + * @todo Needs do check training limit + */ + public function ifGovernmentAlreadyPayedTraining () { + // Default is not payed + $alreadyPayed = false; + + // Cache startup training limit + $trainingLimit = $this->getConfigInstance()->getConfigEntry('government_training_limit'); + + // Now get a search criteria and set the user's name as criteria + $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); + $searchInstance->addCriteria(UserGovernmentDatabaseWrapper::DB_COLUMN_GOV_USERID , $this->getUserInstance()->getUserId()); + $searchInstance->addCriteria(UserGovernmentDatabaseWrapper::DB_COLUMN_GOV_ACTIVITY, self::STATUS_TRAINING); + $searchInstance->setLimit(1); + + // Get a wrapper instance + $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_gov_wrapper_class'); + + // Get result back + $resultInstance = $wrapperInstance->doSelectByCriteria($searchInstance); + + // Was the query fine? + if ($resultInstance->next()) { + // Get entry + $currEntry = $resultInstance->current(); + + // Entry was found so the government can no more pay a training + $alreadyPayed = true; + } // END - if + + // Return the result + return $alreadyPayed; + } + + /** + * Checks wether the government has payed maximum of startup helps to the + * current user + * + * @return $maximumPayed Wether the government has already payed + * @todo Needs do check help limit + */ + public function ifGovernmentPayedMaxmimumStartupHelp () { + // Default is not payed + $maximumPayed = false; + + // Cache startup help limit + $helpLimit = $this->getConfigInstance()->getConfigEntry('government_startup_help_limit'); + + // Now get a search criteria and set the user's name as criteria + $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); + $searchInstance->addCriteria(UserGovernmentDatabaseWrapper::DB_COLUMN_GOV_USERID , $this->getUserInstance()->getUserId()); + $searchInstance->addCriteria(UserGovernmentDatabaseWrapper::DB_COLUMN_GOV_ACTIVITY, self::STATUS_STARTER_HELP); + $searchInstance->setLimit($helpLimit); + + // Get a wrapper instance + $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_gov_wrapper_class'); + + // Get result back + $resultInstance = $wrapperInstance->doSelectByCriteria($searchInstance); + + // Was the query fine? + if ($resultInstance->next()) { + // Get entry + $currEntry = $resultInstance->current(); + + // Entry found, so lets have a look if this government wants to again... + $maximumPayed = true; + } // END - if + + // Return the result + return $maximumPayed; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/login/.htaccess b/application/shipsimu/classes/login/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/login/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/login/class_ShipSimuGuestLogin.php b/application/shipsimu/classes/login/class_ShipSimuGuestLogin.php new file mode 100644 index 0000000..9725449 --- /dev/null +++ b/application/shipsimu/classes/login/class_ShipSimuGuestLogin.php @@ -0,0 +1,128 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class ShipSimuGuestLogin extends BaseFrameworkSystem implements LoginableUser, Registerable { + /** + * The hashed password + */ + private $hashedPassword = ''; + + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this login class + * + * @return $loginInstance An instance of this login class + */ + public static final function createShipSimuGuestLogin () { + // Get a new instance + $loginInstance = new ShipSimuGuestLogin(); + + // Return the instance + return $loginInstance; + } + + /** + * Logins the user with the given request containing the credential. The + * result of the login can be thrown by exception or, if prefered stored + * in a boolean attribute which is then readable by a matching getter. + * + * @param $requestInstance An instance of a Requestable class + * @param $responseInstance An instance of a Responseable class + * @return void + * @throws UserPasswordMismatchException If the supplied password did not + * match with the stored password + */ + public function doLogin (Requestable $requestInstance, Responseable $responseInstance) { + // Get a user instance + $userInstance = LoginFactory::createLoginObjectByRequest($requestInstance); + + // Remember this new instance in registry + Registry::getRegistry()->addInstance('user', $userInstance); + + // Is the password correct? + if ($userInstance->ifPasswordHashMatches($requestInstance) === false) { + // Mismatching password + throw new UserPasswordMismatchException(array($this, $userInstance), BaseUser::EXCEPTION_USER_PASS_MISMATCH); + } // END - if + + // Now do the real login. This can be cookie- or session-based login + // which depends on the admins setting then on the user's taste. + // 1) Get a login helper instance + $helperInstance = ObjectFactory::createObjectByConfiguredName('login_helper_class', array($requestInstance)); + + // 2) Execute the login. This will now login... + $helperInstance->executeLogin($responseInstance); + } + + /** + * Determines wether the login was fine. This is done by checking if 'login' instance is in registry + * + * @return $loginDone Wether the login was fine or not + */ + public function ifLoginWasSuccessfull () { + // Is the registry key there? + $loginDone = (Registry::getRegistry()->getInstance('login') instanceof Registerable); + + // Return the result + return $loginDone; + } + + /** + * Encrypt given request key or throw an exception if key was not found in + * request + * + * @param $requestKey Key in request class + * @return void + */ + public function encryptPassword ($requestKey) { + // Check if password is found in request + if ($this->getRequestInstance()->isRequestElementSet($requestKey)) { + // So encrypt the password and store it for later usage in + // the request: + + // Get the plain password + $plainPassword = $this->getRequestInstance()->getRequestElement($requestKey); + + // Get user instance + $userInstance = Registry::getRegistry()->getInstance('user'); + + // Get a crypto helper and hash the password + $this->hashedPassword = ObjectFactory::createObjectByConfiguredName('crypto_class')->hashString($plainPassword, $userInstance->getPasswordHash()); + + // Store the hash back in request + $this->getRequestInstance()->setRequestElement('pass_hash', $this->hashedPassword); + } // END - if + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/login/class_ShipSimuUserLogin.php b/application/shipsimu/classes/login/class_ShipSimuUserLogin.php new file mode 100644 index 0000000..0b3cf7c --- /dev/null +++ b/application/shipsimu/classes/login/class_ShipSimuUserLogin.php @@ -0,0 +1,133 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class ShipSimuUserLogin extends BaseFrameworkSystem implements LoginableUser, Registerable { + /** + * The hashed password + */ + private $hashedPassword = ''; + + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this login class + * + * @return $loginInstance An instance of this login class + */ + public static final function createShipSimuUserLogin () { + // Get a new instance + $loginInstance = new ShipSimuUserLogin(); + + // Return the instance + return $loginInstance; + } + + /** + * Logins the user with the given request containing the credential. The + * result of the login can be thrown by exception or, if prefered stored + * in a boolean attribute which is then readable by a matching getter. + * + * @param $requestInstance An instance of a Requestable class + * @param $responseInstance An instance of a Responseable class + * @return void + * @throws UserPasswordMismatchException If the supplied password did not + * match with the stored password + * @todo We need to add something here which will make more than one + * @todo guest logins, users who are online but based on the same + * @todo user account. + */ + public function doLogin (Requestable $requestInstance, Responseable $responseInstance) { + // Get a user instance + $userInstance = LoginFactory::createLoginObjectByRequest($requestInstance); + + // Remember this new instance in registry + Registry::getRegistry()->addInstance('user', $userInstance); + + // Is the password correct? + if ($userInstance->ifPasswordHashMatches($requestInstance) === false) { + // Mismatching password + throw new UserPasswordMismatchException(array($this, $userInstance), BaseUser::EXCEPTION_USER_PASS_MISMATCH); + } // END - if + + // ToDo place + + // Now do the real login. This can be cookie- or session-based login + // which depends on the admins setting then on the user's taste. + // 1) Get a login helper instance + $helperInstance = ObjectFactory::createObjectByConfiguredName('login_helper_class', array($requestInstance)); + + // 2) Execute the login. This will now login... + $helperInstance->executeLogin($responseInstance); + } + + /** + * Determines wether the login was fine. This is done by checking if 'login' instance is in registry + * + * @return $loginDone Wether the login was fine or not + */ + public function ifLoginWasSuccessfull () { + // Is the registry key there? + $loginDone = (Registry::getRegistry()->getInstance('login') instanceof Registerable); + + // Return the result + return $loginDone; + } + + /** + * Encrypt given request key or throw an exception if key was not found in + * request + * + * @param $requestKey Key in request class + * @return void + */ + public function encryptPassword ($requestKey) { + // Check if password is found in request + if ($this->getRequestInstance()->isRequestElementSet($requestKey)) { + // So encrypt the password and store it for later usage in + // the request: + + // Get the plain password + $plainPassword = $this->getRequestInstance()->getRequestElement($requestKey); + + // Get user instance + $userInstance = Registry::getRegistry()->getInstance('user'); + + // Get a crypto helper and hash the password + $this->hashedPassword = ObjectFactory::createObjectByConfiguredName('crypto_class')->hashString($plainPassword, $userInstance->getPasswordHash()); + + // Store the hash back in request + $this->getRequestInstance()->setRequestElement('pass_hash', $this->hashedPassword); + } // END - if + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/login/helper/.htaccess b/application/shipsimu/classes/login/helper/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/login/helper/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/login/helper/class_ShipSimuLoginHelper.php b/application/shipsimu/classes/login/helper/class_ShipSimuLoginHelper.php new file mode 100644 index 0000000..b5c125e --- /dev/null +++ b/application/shipsimu/classes/login/helper/class_ShipSimuLoginHelper.php @@ -0,0 +1,114 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class ShipSimuLoginHelper extends BaseLoginHelper implements HelpableLogin { + /** + * The login method we shall choose + */ + private $authMethod = ""; + + // Exception constants + const EXCEPTION_INVALID_USER_INSTANCE = 0x190; + + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class by given request instance + * + * @param $requestInstance An instance of a Requestable class + * @return $helperInstance An instance of this helper class + * @throws UserInstanceMissingException If the user instance in registry + * is missing or invalid + */ + public static final function createShipSimuLoginHelper (Requestable $requestInstance) { + // Get a new instance first + $helperInstance = new ShipSimuLoginHelper(); + + // Get a user instance from registry + $userInstance = Registry::getRegistry()->getInstance('user'); + + // Is this instance valid? + if (!$userInstance instanceof ManageableAccount) { + // Thrown an exception here + throw new UserInstanceMissingException (array($helperInstance, 'user'), self::EXCEPTION_INVALID_USER_INSTANCE); + } // END - if + + // Set default login method from config + $helperInstance->setDefaultAuthMethod(); + + // Set request instance + $helperInstance->setRequestInstance($requestInstance); + + // Return the prepared instance + return $helperInstance; + } + + /** + * Setter for default login method from config + * + * @return void + */ + protected function setDefaultAuthMethod () { + $this->authMethod = $this->getConfigInstance()->getConfigEntry('auth_method_class'); + } + + /** + * Execute the login request by given response instance. This instance can + * be used for sending cookies or at least the session id out. + * + * @param $responseInstance An instance of a Responseable class + * @return void + */ + public function executeLogin (Responseable $responseInstance) { + // Get an instance from the login method + $loginInstance = ObjectFactory::createObjectByName($this->authMethod, array($responseInstance)); + + // Set user cookie + $loginInstance->setUserAuth($this->getRequestInstance()->getRequestElement('username')); + + // Set password cookie + $loginInstance->setPasswordAuth($this->getRequestInstance()->getRequestElement('pass_hash')); + + // Remember this login instance for later usage + Registry::getRegistry()->addInstance('login', $loginInstance); + } +} + +// +?> diff --git a/application/shipsimu/classes/menu/.htaccess b/application/shipsimu/classes/menu/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/menu/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/menu/class_ShipSimu b/application/shipsimu/classes/menu/class_ShipSimu new file mode 100644 index 0000000..93970de --- /dev/null +++ b/application/shipsimu/classes/menu/class_ShipSimu @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @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 . + */ +class ShipSimu???Menu extends BaseMenu implements RenderableMenu { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @return $menuInstance An instance of this class + */ + public final static function createShipSimu???Menu () { + // Get a new instance + $menuInstance = new ShipSimu???Menu(); + + // Return the prepared instance + return $menuInstance; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/menu/class_ShipSimuConfirmMenu.php b/application/shipsimu/classes/menu/class_ShipSimuConfirmMenu.php new file mode 100644 index 0000000..1dc56b7 --- /dev/null +++ b/application/shipsimu/classes/menu/class_ShipSimuConfirmMenu.php @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class ShipSimuConfirmMenu extends BaseMenu implements RenderableMenu { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @return $menuInstance An instance of this class + */ + public static final function createShipSimuConfirmMenu () { + // Get a new instance + $menuInstance = new ShipSimuConfirmMenu(); + + // Return the prepared instance + return $menuInstance; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/menu/class_ShipSimuHomeMenu.php b/application/shipsimu/classes/menu/class_ShipSimuHomeMenu.php new file mode 100644 index 0000000..ef01389 --- /dev/null +++ b/application/shipsimu/classes/menu/class_ShipSimuHomeMenu.php @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class ShipSimuHomeMenu extends BaseMenu implements RenderableMenu { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @return $menuInstance An instance of this class + */ + public static final function createShipSimuHomeMenu () { + // Get a new instance + $menuInstance = new ShipSimuHomeMenu(); + + // Return the prepared instance + return $menuInstance; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/menu/class_ShipSimuLoginAreaMenu.php b/application/shipsimu/classes/menu/class_ShipSimuLoginAreaMenu.php new file mode 100644 index 0000000..038b123 --- /dev/null +++ b/application/shipsimu/classes/menu/class_ShipSimuLoginAreaMenu.php @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class ShipSimuLoginAreaMenu extends BaseMenu implements RenderableMenu { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @return $menuInstance An instance of this class + */ + public static final function createShipSimuLoginAreaMenu () { + // Get a new instance + $menuInstance = new ShipSimuLoginAreaMenu(); + + // Return the prepared instance + return $menuInstance; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/menu/class_ShipSimuLoginFailedMenu.php b/application/shipsimu/classes/menu/class_ShipSimuLoginFailedMenu.php new file mode 100644 index 0000000..6978654 --- /dev/null +++ b/application/shipsimu/classes/menu/class_ShipSimuLoginFailedMenu.php @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class ShipSimuLoginFailedMenu extends BaseMenu implements RenderableMenu { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @return $menuInstance An instance of this class + */ + public static final function createShipSimuLoginFailedMenu () { + // Get a new instance + $menuInstance = new ShipSimuLoginFailedMenu(); + + // Return the prepared instance + return $menuInstance; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/menu/class_ShipSimuLoginMenu.php b/application/shipsimu/classes/menu/class_ShipSimuLoginMenu.php new file mode 100644 index 0000000..7aa83e9 --- /dev/null +++ b/application/shipsimu/classes/menu/class_ShipSimuLoginMenu.php @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class ShipSimuLoginMenu extends BaseMenu implements RenderableMenu { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @return $menuInstance An instance of this class + */ + public static final function createShipSimuLoginMenu () { + // Get a new instance + $menuInstance = new ShipSimuLoginMenu(); + + // Return the prepared instance + return $menuInstance; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/menu/class_ShipSimuLogoutMenu.php b/application/shipsimu/classes/menu/class_ShipSimuLogoutMenu.php new file mode 100644 index 0000000..76b6c68 --- /dev/null +++ b/application/shipsimu/classes/menu/class_ShipSimuLogoutMenu.php @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class ShipSimuLogoutMenu extends BaseMenu implements RenderableMenu { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @return $menuInstance An instance of this class + */ + public static final function createShipSimuLogoutMenu () { + // Get a new instance + $menuInstance = new ShipSimuLogoutMenu(); + + // Return the prepared instance + return $menuInstance; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/menu/class_ShipSimuRegisterMenu.php b/application/shipsimu/classes/menu/class_ShipSimuRegisterMenu.php new file mode 100644 index 0000000..d2438f2 --- /dev/null +++ b/application/shipsimu/classes/menu/class_ShipSimuRegisterMenu.php @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class ShipSimuRegisterMenu extends BaseMenu implements RenderableMenu { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @return $menuInstance An instance of this class + */ + public static final function createShipSimuRegisterMenu () { + // Get a new instance + $menuInstance = new ShipSimuRegisterMenu(); + + // Return the prepared instance + return $menuInstance; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/menu/class_ShipSimuStatusMenu.php b/application/shipsimu/classes/menu/class_ShipSimuStatusMenu.php new file mode 100644 index 0000000..fbc0434 --- /dev/null +++ b/application/shipsimu/classes/menu/class_ShipSimuStatusMenu.php @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class ShipSimuStatusMenu extends BaseMenu implements RenderableMenu { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @return $menuInstance An instance of this class + */ + public static final function createShipSimuStatusMenu () { + // Get a new instance + $menuInstance = new ShipSimuStatusMenu(); + + // Return the prepared instance + return $menuInstance; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/menu/government/.htaccess b/application/shipsimu/classes/menu/government/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/menu/government/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/menu/government/class_ShipSimuGovernmentFailedAreaMenu.php b/application/shipsimu/classes/menu/government/class_ShipSimuGovernmentFailedAreaMenu.php new file mode 100644 index 0000000..0d2112c --- /dev/null +++ b/application/shipsimu/classes/menu/government/class_ShipSimuGovernmentFailedAreaMenu.php @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class ShipSimuGovernmentFailedAreaMenu extends BaseMenu implements RenderableMenu { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @return $menuInstance An instance of this class + */ + public static final function createShipSimuGovernmentFailedAreaMenu () { + // Get a new instance + $menuInstance = new ShipSimuGovernmentFailedAreaMenu(); + + // Return the prepared instance + return $menuInstance; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/opening/.htaccess b/application/shipsimu/classes/opening/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/opening/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/opening/bank/.htaccess b/application/shipsimu/classes/opening/bank/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/opening/bank/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/opening/bank/class_MoneyBankRealtimeOpening.php b/application/shipsimu/classes/opening/bank/class_MoneyBankRealtimeOpening.php new file mode 100644 index 0000000..5136767 --- /dev/null +++ b/application/shipsimu/classes/opening/bank/class_MoneyBankRealtimeOpening.php @@ -0,0 +1,63 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class MoneyBankRealtimeOpening extends BaseOpening { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this opening time class + * + * @param $bankInstance An instance of a money bank + * @return $openeningInstance An instance of this class + */ + public static final function createMoneyBankRealtimeOpening (BaseBank $bankInstance) { + // Get a new instance + $openingInstance = new MoneyBankRealtimeOpening(); + + // Set the bank instance here + $openingInstance->setBankInstance($bankInstance); + + // Return the prepared instance + return $openingInstance; + } + + /** + * Checks wether we are within the opening times + * + * @return $withinOpeningTimes Wether we are within opening times + */ + public function ifWithinOpeningTimes () { + $this->partialStub(); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/opening/class_ b/application/shipsimu/classes/opening/class_ new file mode 100644 index 0000000..b9f1ce7 --- /dev/null +++ b/application/shipsimu/classes/opening/class_ @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @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 . + */ +class ???Opening extends BaseOpening { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this opening time class + * + * @return $openeningInstance An instance of this class + */ + public final static function create???Opening () { + // Get a new instance + $openeningInstance = new ???Opening(); + + // Return the prepared instance + return $openeningInstance; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/opening/class_BaseOpening.php b/application/shipsimu/classes/opening/class_BaseOpening.php new file mode 100644 index 0000000..78f8983 --- /dev/null +++ b/application/shipsimu/classes/opening/class_BaseOpening.php @@ -0,0 +1,60 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +abstract class BaseOpening extends BaseFrameworkSystem { + /** + * A bank instance + */ + private $bankInstance = null; + + /** + * Protected constructor + * + * @param $className The class' real name + * @return void + */ + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + } + + /** + * Setter for bank instance + * + * @param $bankInstance An instance of a bank + * @return void + */ + protected final function setBankInstance (BaseBank $bankInstance) { + $this->bankInstance = $bankInstance; + } + + /** + * Checks wether we are within the opening times + * + * @return $withinOpeningTimes Wether we are within opening times + */ + public abstract function ifWithinOpeningTimes (); +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/parts/.htaccess b/application/shipsimu/classes/parts/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/parts/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/parts/class_BaseShipPart.php b/application/shipsimu/classes/parts/class_BaseShipPart.php new file mode 100644 index 0000000..aca83a9 --- /dev/null +++ b/application/shipsimu/classes/parts/class_BaseShipPart.php @@ -0,0 +1,51 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class BaseShipPart extends BaseSimulator { + // Price of this ship part + private $price = 0.00; + + // Konstruktor + protected function __construct($className) { + // Call parent constructor + parent::__construct($className); + } + + // Setter for price + public final function setPrice ($price) { + $this->price = (float) $price; + } + + // Getter for price + public final function getPrice () { + return $this->price; + } + + // Remove price + public final function removePrice () { + unset($this->price); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/parts/maschineroom/.htaccess b/application/shipsimu/classes/parts/maschineroom/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/parts/maschineroom/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/parts/maschineroom/class_MaschineRoom.php b/application/shipsimu/classes/parts/maschineroom/class_MaschineRoom.php new file mode 100644 index 0000000..bcd7b30 --- /dev/null +++ b/application/shipsimu/classes/parts/maschineroom/class_MaschineRoom.php @@ -0,0 +1,47 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class MaschineRoom extends BaseShipPart { + // Constructor + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + // Maschinenraum erstellen + public static final function createMaschineRoom () { + // Get new instance + $roomInstance = new MaschineRoom(); + + // Umrechnungsfaktoren setzen + $roomInstance->setResizeFactorElement('width' , 1.3); + $roomInstance->setResizeFactorElement('height', 1.8); + $roomInstance->setResizeFactorElement('length', 1.3); + + // Instanz zurueckgeben + return $roomInstance; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/personell/.htaccess b/application/shipsimu/classes/personell/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/personell/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/personell/class_SimulatorPersonell.php b/application/shipsimu/classes/personell/class_SimulatorPersonell.php new file mode 100644 index 0000000..8ff01e7 --- /dev/null +++ b/application/shipsimu/classes/personell/class_SimulatorPersonell.php @@ -0,0 +1,327 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class SimulatorPersonell extends BasePersonell { + // Personell list + private $personellList = null; + + // A cache for lists + private $cacheList = null; + + // A string for cached conditions + private $cacheCond = null; + + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Magic wake-up method called when unserialize() is called. This is + * neccessary because in this case a personell does not need to know the + * min/max ages range and system classes. This would anyway use more RAM + * what is not required. + * + * @return void + */ + public function __wakeup () { + // Tidy up a little + $this->removePersonellList(); + $this->removeMinMaxAge(); + $this->removeCache(); + } + + /** + * Generate a specified amount of personell and return the prepared instance + * + * @param $amountPersonell Number of personell we shall + * generate + * @return $personellInstance An instance of this object with a + * list of personells + */ + public static final function createSimulatorPersonell ($amountPersonell) { + // Make sure only integer can pass + $amountPersonell = (int) $amountPersonell; + + // Get a new instance + $personellInstance = new SimulatorPersonell(); + + // Debug message + if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $personellInstance->debugOutput(sprintf("[%s:%d] Es werden %d Personal bereitgestellt.", + __CLASS__, + __LINE__, + $amountPersonell + )); + + // Initialize the personell list + $personellInstance->createPersonellList(); + + // Create requested amount of personell + for ($idx = 0; $idx < $amountPersonell; $idx++) { + $personellInstance->addRandomPersonell(); + } + + // Debug message + if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $personellInstance->debugOutput(sprintf("[%s:%d] %d Personal bereitgestellt.", + __CLASS__, + __LINE__, + $amountPersonell + )); + + // Tidy up a little + $personellInstance->removeGender(); + $personellInstance->removeNames(); + $personellInstance->removeBirthday(); + $personellInstance->removeSalary(); + $personellInstance->removeEmployed(); + $personellInstance->removeMarried(); + //$personellInstance->removeCache(); + + // Instanz zurueckgeben + return $personellInstance; + } + + /** + * Create a SimulatorPersonell object by loading the specified personell + * list from an existing database backend + * + * @param $idNumber The ID number (only right part) of the list + * @return $personellInstance An instance of this class + * @throws InvalidIDFormatException If the given id number + * $idNumber is invalid + * @throws MissingSimulatorIdException If an ID number was not found + * @deprecated + */ + public static final function createSimulatorPersonellByID ($idNumber) { + // Get instance + $personellInstance = new SimulatorPersonell(false); + $personellInstance->makeDeprecated(); + } + + // Create personell list + public function createPersonellList () { + // Is the list already created? + if ($this->personelllList instanceof FrameworkArrayObject) { + // Throw an exception + throw new PersonellListAlreadyCreatedException($this, self::EXCEPTION_DIMENSION_ARRAY_INVALID); + } // END - if + + // Initialize the array + $this->personellList = new FrameworkArrayObject("FakedPersonellList"); + } + + // Remove the personell list + private final function removePersonellList () { + unset($this->personellList); + } + + // Add new personell object to our list + public function addRandomPersonell () { + // Gender list... + $genders = array("M", "F"); + + // Create new personell members + $personellInstance = new SimulatorPersonell(); + + // Set a randomized gender + $personellInstance->setGender($genders[mt_rand(0, 1)]); + + // Set a randomized birthday (maximum age required, see const MAX_AGE) + $personellInstance->createBirthday(); + + // Married? Same values means: married + if (mt_rand(0, 5) == mt_rand(0, 5)) $personellInstance->setMarried(true); + + // Tidy up a little + $personellInstance->removePersonellList(); + $personellInstance->removeMinMaxAge(); + $personellInstance->removeCache(); + + // Add new member to the list + $this->personellList->append($personellInstance); + } + + /** + * Get a specifyable list of our people, null or empty string will be ignored! + * + * @return $cacheList A list of cached personells + */ + function getSpecialPersonellList ($isEmployed = null, $isMarried = null, $hasGender = "") { + // Serialize the conditions for checking if we can take the cache + $serialized = serialize(array($isEmployed, $isMarried, $hasGender)); + + // The same (last) conditions? + if (($serialized == $this->cacheCond) && (!is_null($this->cacheCond))) { + if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Gecachte Liste wird verwendet.", + __CLASS__, + __LINE__ + )); + + // Return cached list + return $this->cacheList; + } + + // Output debug message + if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Personalliste wird nach Kriterien durchsucht...", + __CLASS__, + __LINE__ + )); + + // Remember the conditions + $this->setCacheCond($serialized); + + // Create cached list + $this->setAllCacheList(new FrameworkArrayObject('FakedCacheList')); + + // Search all unemployed personells + for ($idx = $this->personellList->getIterator(); $idx->valid(); $idx->next()) { + // Element holen + $el = $idx->current(); + + // Check currenylt all single conditions (combined conditions are not yet supported) + if ((!is_null($isEmployed)) && ($el->isEmployed() == $isEmployed)) { + // Add this one (employed status asked) + $this->cacheList->append($el); + } elseif ((!is_null($isMarried)) && ($el->isMarried() == $isMarried)) { + // Add this one (marrital status asked) + $this->cacheList->append($el); + } elseif ((!empty($hasGender)) && ($el->getGender() == $hasGender)) { + // Add this one (specified gender) + $this->cacheList->append($el); + } + } + + // Return the completed list + return $this->cacheList; + } + + /** + * Get amount of unemployed personell + * + * @return $count Amount of unemployed personell + */ + public final function getAllUnemployed () { + // Get a temporary list + $list = $this->getSpecialPersonellList(false); + + // Anzahl zurueckliefern + return $list->count(); + } + + /** + * Remove cache things + * + * @return void + */ + private function removeCache () { + // Remove cache data + unset($this->cacheList); + unset($this->cacheCond); + } + + /** + * Setter for cache list + * + * @param $cacheList The new cache list to set or null for initialization/reset + * @return void + */ + private final function setAllCacheList (FrameworkArrayObject $cacheList = null) { + $this->cacheList = $cacheList; + } + + /** + * Setter for cache conditions + * + * @param $cacheCond The new cache conditions to set + * @return void + */ + private final function setCacheCond ($cacheCond) { + $this->cacheCond = (string) $cacheCond; + } + + /** + * Reset cache list + * + * @return void + */ + public function resetCache () { + $this->setAllCacheList(null); + $this->setCacheCond(""); + } + + /** + * Getter for surname. If no surname is set then default surnames are set + * for male and female personells. + * + * @return $surname The personell' surname + */ + public final function getSurname () { + $surname = parent::getSurname(); + + // Make sure every one has a surname... + if (empty($surname)) { + if ($this->isMale()) { + // Typical male name + $surname = "John"; + } else { + // Typical female name + $surname = "Jennifer"; + } + + // Set typical family name + parent::setFamily("Smith"); + } // END - if + + // Return surname + return $surname; + } + + /** + * Getter for personell list + * + * @return $personellList The list of all personells + */ + public final function getPersonellList () { + return $this->personellList; + } + + /** + * Loads the mostly pre-cached personell list + * + * @param $idNumber The ID number we shall use for looking up + * the right data. + * @return void + * @deprecated + */ + public function loadPersonellList ($idNumber) { + $this->makeDeprecated(); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/personell/company/.htaccess b/application/shipsimu/classes/personell/company/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/personell/company/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/personell/company/class_CompanyEmployee.php b/application/shipsimu/classes/personell/company/class_CompanyEmployee.php new file mode 100644 index 0000000..472692e --- /dev/null +++ b/application/shipsimu/classes/personell/company/class_CompanyEmployee.php @@ -0,0 +1,85 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class CompanyEmployee extends SimulatorPersonell { + // Employeee list + private $employeeList = null; + + // Constructor + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + // Generate a specified amount of personell + public static final function createCompanyEmployee ($surname, $family, $gender, $year, $month, $day, $married, $salary) { + // Get instance + $personellInstance = new CompanyEmployee(); + + // Debug message + if (((defined('DEBUG_COMPANY_EMPLOYEE')) && (defined('DEBUG_PERSONELL'))) || (defined('DEBUG_ALL'))) { + $personellInstance->debugOutput(sprintf("[%s:%d] Der/Die Angestellte %s %s wird angelegt.", + __CLASS__, + __LINE__, + $surname, + $family + )); + } + + // Ist the given birthday valid? + 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); + + // Set as employed/marrital status + $personellInstance->setEmployed(true); + $personellInstance->setMarried($married); + + // Set surname/family/gender + $personellInstance->setSurname($surname); + $personellInstance->setFamily($family); + $personellInstance->setGender($gender); + + // Set salary + $personellInstance->increaseSalary($salary); + + // Tidy up a little + $personellInstance->removeEmployeeList(); + $personellInstance->removeMinMaxAge(); + + // Return prepared instance + return $personellInstance; + } + + // Remove the employee list + private function removeEmployeeList () { + unset($this->employeeList); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/registration/.htaccess b/application/shipsimu/classes/registration/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/registration/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/registration/class_ShipSimuRegistration.php b/application/shipsimu/classes/registration/class_ShipSimuRegistration.php new file mode 100644 index 0000000..674d189 --- /dev/null +++ b/application/shipsimu/classes/registration/class_ShipSimuRegistration.php @@ -0,0 +1,207 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class ShipSimuRegistration extends BaseRegistration implements UserRegister { + /** + * Hashed password + */ + private $hashedPassword = ''; + + /** + * Elements for criteria + */ + private $criteriaElements = array( + 'username', + 'pass_hash', + 'email' => 'email1', + 'surname', + 'family', + 'street', + 'zip', + 'city', + 'icq', + 'jabber', + 'yahoo', + 'aol', + 'msn', + 'birth_day', + 'birth_month', + 'birth_year' + ); + + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Create a new instance + * + * @return $registrationInstance An instance of this registration class + */ + public static final function createShipSimuRegistration () { + // Get a new instance + $registrationInstance = new ShipSimuRegistration(); + + // Initialize the filter chains + $registrationInstance->initFilterChains(); + + // And return it + return $registrationInstance; + } + + /** + * Encrypt given request key or throw an exception if key was not found in + * request + * + * @param $requestKey Key in request class + * @return void + */ + public function encryptPassword ($requestKey) { + // Check if password is found in request + if ($this->getRequestInstance()->isRequestElementSet($requestKey)) { + // So encrypt the password and store it for later usage in + // the request: + + // 1.: Get the plain password + $plainPassword = $this->getRequestInstance()->getRequestElement($requestKey); + + // 2. Get a crypto helper and hash the password + $this->hashedPassword = ObjectFactory::createObjectByConfiguredName('crypto_class')->hashString($plainPassword); + + // 3. Store the hash back in request + $this->getRequestInstance()->setRequestElement('pass_hash', $this->hashedPassword); + } + } + + /** + * Perform things like informing assigned affilates about new registration + * before registration + * + * @return void + * @todo Maybe add more things to perform + */ + public function doPreRegistration () { + // First run all pre filters + $this->executePreFilters(); + } + + /** + * Registers the new user account by insterting the request data into the + * database and paying some start credits or throw exceptions if this fails + * + * @return void + * @todo Maybe add more things to perform + */ + public function registerNewUser () { + // Get a user database wrapper + $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class'); + + // Use this instance to insert the whole registration instance + $wrapperInstance->insertRegistrationObject($this); + } + + /** + * Perform things like notifying partner websites after registration is done + * + * @return void + * @todo Maybe add more things to perform + */ + public function doPostRegistration () { + // First run all post filters + $this->executePostFilters(); + } + + /** + * Do the action which is required after all registration steps are done. + * This can be a simple redirect to another webpage or displaying a message + * to the user. Or this can be a login step into the newly created account. + * + * @return void + */ + public function doPostAction () { + // Get an action instance from our factory + $actionInstance = ObjectFactory::createObjectByConfiguredName('post_registration_class'); + + // Execute the action + $actionInstance->execute($this->getRequestInstance(), $this->getResponseInstance()); + } + + /** + * Adds registration elements to a given dataset instance + * + * @param $criteriaInstance An instance of a storeable criteria + * @return void + */ + public function addElementsToDataSet (StoreableCriteria $criteriaInstance) { + // Default is unconfirmed! + $configEntry = 'user_status_unconfirmed'; + + // Is the confirmation process entirely disabled? + if ($this->getConfigInstance()->getConfigEntry('confirm_email_enabled') === 'N') { + // No confirmation of email needed + $configEntry = 'user_status_confirmed'; + } // END - if + + // Add a lot elements to the dataset criteria + foreach ($this->criteriaElements as $alias => $element) { + // Do we have an alias? + if (is_string($alias)) { + // Yes, so use it + $criteriaInstance->addCriteria($alias, $this->getRequestInstance()->getRequestElement($element)); + + // Debug message + //* DEBUG: */ $this->debugOutput('ALIAS: alias='.$alias.',element='.$element.'='.$this->getRequestInstance()->getRequestElement($element)); + } else { + // No, default entry + $criteriaInstance->addCriteria($element, $this->getRequestInstance()->getRequestElement($element)); + + // Debug message + //* DEBUG: */ $this->debugOutput('DEFAULT: element='.$element.'='.$this->getRequestInstance()->getRequestElement($element)); + } + + // Is this a guest account? + if ((($element == 'username') || ($alias == 'username')) && ($this->getRequestInstance()->getRequestElement($element) == $this->getConfigInstance()->getConfigEntry('guest_login_user'))) { + // Yes, then set the config entry to guest status + $configEntry = 'user_status_guest'; + } // END - if + } // END - foreach + + // Mark the username as unique key + $criteriaInstance->setUniqueKey(UserDatabaseWrapper::DB_COLUMN_USERNAME); + + // Add account status as configured + $criteriaInstance->addConfiguredCriteria(UserDatabaseWrapper::DB_COLUMN_USER_STATUS, $configEntry); + + // Include registration timestamp + $criteriaInstance->addCriteria('registered', date('Y-m-d H:i:s', time())); + } +} + +// +?> diff --git a/application/shipsimu/classes/resolver/.htaccess b/application/shipsimu/classes/resolver/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/resolver/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/resolver/command/.htaccess b/application/shipsimu/classes/resolver/command/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/resolver/command/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/resolver/command/html/.htaccess b/application/shipsimu/classes/resolver/command/html/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/resolver/command/html/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/resolver/command/html/class_HtmlCompanyCommandResolver.php b/application/shipsimu/classes/resolver/command/html/class_HtmlCompanyCommandResolver.php new file mode 100644 index 0000000..5b5fd9c --- /dev/null +++ b/application/shipsimu/classes/resolver/command/html/class_HtmlCompanyCommandResolver.php @@ -0,0 +1,77 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class HtmlCompanyCommandResolver extends BaseCommandResolver implements CommandResolver { + /** + * Last successfull resolved command + */ + private $lastCommandInstance = null; + + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + + // Set prefix to "Html" + $this->setCommandPrefix('html'); + } + + /** + * Creates an instance of a Html command resolver with a given default command + * + * @param $commandName The default command we shall execute + * @param $appInstance An instance of a manageable application helper class + * @return $resolverInstance The prepared command resolver instance + * @throws EmptyVariableException Thrown if default command is not set + * @throws InvalidInterfaceException Thrown if command does not implement interface Commandable + */ + public static final function createHtmlCompanyCommandResolver ($commandName, ManageableApplication $appInstance) { + // Create the new instance + $resolverInstance = new HtmlCompanyCommandResolver(); + + // Get request instance + $requestInstance = $appInstance->getRequestInstance(); + + // Is the variable $commandName set and the command is valid? + if (empty($commandName)) { + // Then thrown an exception here + throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); + } elseif (!$resolverInstance->resolveCommandByRequest($requestInstance) instanceof Commandable) { + // Invalid command found (missing interface?) + throw new InvalidInterfaceException(array($userInstance, 'ManageableMember'), self::EXCEPTION_REQUIRED_INTERFACE_MISSING); + } + + // Set the application instance + $resolverInstance->setApplicationInstance($appInstance); + + // Return the prepared instance + return $resolverInstance; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/resolver/command/html/class_HtmlGovernmentFailedCommandResolver.php b/application/shipsimu/classes/resolver/command/html/class_HtmlGovernmentFailedCommandResolver.php new file mode 100644 index 0000000..16edb50 --- /dev/null +++ b/application/shipsimu/classes/resolver/command/html/class_HtmlGovernmentFailedCommandResolver.php @@ -0,0 +1,77 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class HtmlGovernmentFailedCommandResolver extends BaseCommandResolver implements CommandResolver { + /** + * Last successfull resolved command + */ + private $lastCommandInstance = null; + + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + + // Set prefix to "Html" + $this->setCommandPrefix('html'); + } + + /** + * Creates an instance of a Html command resolver with a given default command + * + * @param $commandName The default command we shall execute + * @param $appInstance An instance of a manageable application helper class + * @return $resolverInstance The prepared command resolver instance + * @throws EmptyVariableException Thrown if default command is not set + * @throws InvalidInterfaceException Thrown if command does not implement interface Commandable + */ + public static final function createHtmlGovernmentFailedCommandResolver ($commandName, ManageableApplication $appInstance) { + // Create the new instance + $resolverInstance = new HtmlGovernmentFailedCommandResolver(); + + // Get request instance + $requestInstance = $appInstance->getRequestInstance(); + + // Is the variable $commandName set and the command is valid? + if (empty($commandName)) { + // Then thrown an exception here + throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); + } elseif (!$resolverInstance->resolveCommandByRequest($requestInstance) instanceof Commandable) { + // Invalid command found (missing interface?) + throw new InvalidInterfaceException(array($userInstance, 'ManageableMember'), self::EXCEPTION_REQUIRED_INTERFACE_MISSING); + } + + // Set the application instance + $resolverInstance->setApplicationInstance($appInstance); + + // Return the prepared instance + return $resolverInstance; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/resolver/controller/.htaccess b/application/shipsimu/classes/resolver/controller/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/resolver/controller/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/resolver/controller/html/.htaccess b/application/shipsimu/classes/resolver/controller/html/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/resolver/controller/html/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/resolver/controller/html/class_ShipSimuHtmlControllerResolver.php b/application/shipsimu/classes/resolver/controller/html/class_ShipSimuHtmlControllerResolver.php new file mode 100644 index 0000000..dc57483 --- /dev/null +++ b/application/shipsimu/classes/resolver/controller/html/class_ShipSimuHtmlControllerResolver.php @@ -0,0 +1,104 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class ShipSimuHtmlControllerResolver extends BaseControllerResolver implements ControllerResolver { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + + // Set prefix to 'html' + $this->setClassPrefix('html'); + } + + /** + * Creates an instance of a resolver class with a given command + * + * @param $controllerName The controller we shall resolve + * @param $applicationInstance An instance of a manageable application helper class + * @return $resolverInstance The prepared controller resolver instance + * @throws EmptyVariableException Thrown if default command is not set + * @throws InvalidControllerException Thrown if default controller is invalid + */ + public static final function createShipSimuHtmlControllerResolver ($controllerName, ManageableApplication $applicationInstance) { + // Create the new instance + $resolverInstance = new ShipSimuHtmlControllerResolver(); + + // Is the variable $controllerName set and the command is valid? + if (empty($controllerName)) { + // Then thrown an exception here + throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); + } elseif ($resolverInstance->isControllerValid($controllerName) === FALSE) { + // Invalid command found + throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER); + } + + // Set the application instance + $resolverInstance->setApplicationInstance($applicationInstance); + + // Set command name + $resolverInstance->setControllerName($controllerName); + + // Return the prepared instance + return $resolverInstance; + } + + /** + * Resolves the default controller of the given command + * + * @return $controllerInstance A controller instance for the default + * command + * @throws InvalidControllerInstanceException Thrown if $controllerInstance + * is invalid + */ + public function resolveController () { + // Init variables + $controllerName = ''; + $controllerInstance = NULL; + + // Get the command name + $controllerName = $this->getControllerName(); + + // Get the command + $controllerInstance = $this->loadController($controllerName); + + // And validate it + if ((!is_object($controllerInstance)) || (!$controllerInstance instanceof Controller)) { + // This command has an invalid instance! + throw new InvalidControllerInstanceException(array($this, $controllerName), self::EXCEPTION_INVALID_CONTROLLER); + } // END - if + + // Set last controller + $this->setResolvedInstance($controllerInstance); + + // Return the maybe resolved instance + return $controllerInstance; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/ships/.htaccess b/application/shipsimu/classes/ships/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/ships/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/ships/class_BaseShip.php b/application/shipsimu/classes/ships/class_BaseShip.php new file mode 100644 index 0000000..ae22ca3 --- /dev/null +++ b/application/shipsimu/classes/ships/class_BaseShip.php @@ -0,0 +1,167 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class BaseShip extends BaseSimulator { + // Name des Shipes + private $shipName = "Unbekanntes Schiff"; + + // Anzahl Anker + private $numAnchor = 0; + + // Tiefgang in Meter + private $draught = 0; + + // Besatzung-Objekte + private $crewList = null; + + // Aufbauten-Objekte + private $structures = null; + + // Namenloses Ship generieren + protected function __construct($className) { + // Call parent constructor + parent::__construct($className); + + // Prepare array object for all structures + $this->createStructuresArray(); + + // Clean-up a little + $this->removePartInstance(); + } + + // Array-Objekt anlegen + private function createStructuresArray () { + $this->structures = new FrameworkArrayObject("FakedShipStructures"); + } + + // Schiffsteil generieren (kann alles sein) + // buildInstance = Das was in das Schiffsteil evtl. eingebaut werden soll (null = kein besonderes Teil einbauen!) + // partClass = Das zu konstruierende Schiffsteil + public function createShipPart (ConstructableShipPart $buildInstance, $partClass) { + if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiff %s erhält ein neues Schiffsteil (%s).", + __CLASS__, + __LINE__, + $this->getShipName(), + $partClass + )); + + // Ist die gewuenschte Klasse vorhanden? + if (!class_exists($partClass)) { + // Nicht vorhanden, dann Ausnahme werfen! + throw new NoClassException($partClass, self::EXCEPTION_CLASS_NOT_FOUND); + } // END - if + + // Get an instance back from our object factory + $partInstance = ObjectFactory::createObjectByName($partClass); + + // Das Einbauen versuchen... + try { + $partInstance->addShipPartToShip($this, $buildInstance); + } catch (MotorShipMismatchException $e) { + if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiff %s hat keinen Motor erhalten! Grund: %s", + __CLASS__, + __LINE__, + $this->getShipName(), + $e->getMessage() + )); + return false; + } catch (RoomShipMismatchException $e) { + if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiff %s hat keinen Maschinenraum erhalten! Grund: %s", + __CLASS__, + __LINE__, + $this->getShipName(), + $e->getMessage() + )); + return false; + + } catch (StructureShipMismatchException $e) { + if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiff %s hat keine Aufbauten erhalten! Grund: %s", + __CLASS__, + __LINE__, + $this->getShipName(), + $e->getMessage() + )); + return false; + } catch (CabinShipMismatchException $e) { + if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiff %s hat keine Kabine erhalten! Grund: %s", + __CLASS__, + __LINE__, + $this->getShipName(), + $e->getMessage() + )); + return false; + } catch (DeckShipMismatchException $e) { + if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiff %s hat kein Deck erhalten! Grund: %s", + __CLASS__, + __LINE__, + $this->getShipName(), + $e->getMessage() + )); + return false; + } + + // Instanz im Aufbauten-Array vermerken + $this->structures->append($partInstance); + + // Alles klar! + return true; + } + + // Getter-Methode fuer Strukturen-Array + public final function getStructuresArray () { + return $this->structures; + } + + // STUB: Getter-Methode Anzahl Betten + public function calcTotalBeds () { + $this->partialStub("Please implement this stub in your ship!"); + } + + // Setter-Methode fuer Schiffsnamen + public final function setShipName ($shipName) { + $this->shipName = (string) $shipName; + } + + // Getter-Methode fuer Schiffsnamen + public final function getShipName () { + return $this->shipName; + } + + // Setter-Methode fuer Tiefgang + public final function setDraught ($draught) { + $this->draught = (int) $draught; + } + + // Getter-Methode fuer Tiefgang + public final function getDraught() { + return $this->draught; + } + + // Setter-Methode fuer Anzahl Anker + public final function setNumAnchor ($numAnchor) { + $this->numAnchor = (int) $numAnchor; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/ships/passenger/.htaccess b/application/shipsimu/classes/ships/passenger/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/ships/passenger/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/ships/passenger/class_PassengerShip.php b/application/shipsimu/classes/ships/passenger/class_PassengerShip.php new file mode 100644 index 0000000..70fa5ed --- /dev/null +++ b/application/shipsimu/classes/ships/passenger/class_PassengerShip.php @@ -0,0 +1,87 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class PassengerShip extends BaseShip implements ConstructableShip { + // Konstruktor + protected function __construct () { + // Eltern-Kontruktor aufrufen + parent::__construct(__CLASS__); + } + + // Passagier-Schiff erstellen + public static final function createPassengerShip ($shipName) { + // Get new instance + $passInstance = new PassengerShip(); + + // Set ship name + $passInstance->setShipName($shipName); + + // Instanz zurueckgeben + return $passInstance; + } + + // Anzahl Betten ermitteln + public final function calcTotalBeds () { + // Struktur-Array holen + $struct = $this->getStructuresArray(); + + if (is_null($struct)) { + // Empty structures list! + throw new EmptyStructuresListException($this, self::EXCEPTION_EMPTY_STRUCTURES_ARRAY); + } // END - if + + // Anzahl Betten auf 0 setzen + $numBeds = 0; + + // Alle Strukturen nach Kabinen durchsuchen + for ($idx = $struct->getIterator(); $idx->valid(); $idx->next()) { + // Element holen + $el = $idx->current(); + + // Ist es eine Kabine? + if ($el->isCabin()) { + // Anzahl Betten ermitteln + $total = $el->calcTotalBedsByCabin(); + $numBeds += $total; + + // Debug-Meldung ausgeben? + if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) { + // Get new instance + $cabType = "Kabine ohne Namen"; + $cab = $el->getPartInstance(); + if (!is_null($cab)) { + // Kabinenbeschreibung holen + $cabType = $cab->getObjectDescription(); + } // END - if + } // END - if + } // END - if + } // END - for + + // Anzahl zurueckliefern + return $numBeds; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/structures/.htaccess b/application/shipsimu/classes/structures/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/structures/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/structures/class_BaseStructure.php b/application/shipsimu/classes/structures/class_BaseStructure.php new file mode 100644 index 0000000..59318cb --- /dev/null +++ b/application/shipsimu/classes/structures/class_BaseStructure.php @@ -0,0 +1,51 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class BaseStructure extends BaseSimulator { + // Price of this structure + private $price = 0.00; + + // Konstruktor (hier keine Exceptions aendern!) + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + } + + // Setter for price + public final function setPrice ($price) { + $this->price = (float) $price; + } + + // Getter for price + public final function getPrice () { + return $this->price; + } + + // Remove price + public final function removePrice () { + unset($this->price); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/structures/extended/.htaccess b/application/shipsimu/classes/structures/extended/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/structures/extended/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/structures/extended/cabines/.htaccess b/application/shipsimu/classes/structures/extended/cabines/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/structures/extended/cabines/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/structures/extended/cabines/class_BaseCabin.php b/application/shipsimu/classes/structures/extended/cabines/class_BaseCabin.php new file mode 100644 index 0000000..b513944 --- /dev/null +++ b/application/shipsimu/classes/structures/extended/cabines/class_BaseCabin.php @@ -0,0 +1,38 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class BaseCabin extends BaseCabinStructure { + // Konstruktor + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + } + + // Is this a cabin? + public final function isCabin () { + return ($this->isClass("BaseCabin")); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/structures/extended/cabines/ship/.htaccess b/application/shipsimu/classes/structures/extended/cabines/ship/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/structures/extended/cabines/ship/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/structures/extended/cabines/ship/class_EconomyCabin.php b/application/shipsimu/classes/structures/extended/cabines/ship/class_EconomyCabin.php new file mode 100644 index 0000000..beceae8 --- /dev/null +++ b/application/shipsimu/classes/structures/extended/cabines/ship/class_EconomyCabin.php @@ -0,0 +1,58 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class EconomyCabin extends BaseCabin implements TradeableItem, ConstructableShipPart { + // Konstruktor + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + // Economy-Kabine erstellen + public static final function createEconomyCabin ($numLuxury, $numRooms, $numBeds, $dim) { + // Get new instance + $ecoInstance = new EconomyCabin(); + + // Abmasse extrahieren + $ecoInstance->extractDimensions($dim); + + // Den Rest auch setzen + $ecoInstance->setNumCabin($numLuxury); + $ecoInstance->setNumRooms($numRooms); + $ecoInstance->setNumBeds($numBeds); + + // Nicht noetig! + $ecoInstance->removePartInstance(); + + // Instanz zurueckgeben + return $ecoInstance; + } + + // Overwritten method for tradeable items + public function isTradeable () { + return true; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/structures/extended/cabines/ship/class_LowCabin.php b/application/shipsimu/classes/structures/extended/cabines/ship/class_LowCabin.php new file mode 100644 index 0000000..23b877c --- /dev/null +++ b/application/shipsimu/classes/structures/extended/cabines/ship/class_LowCabin.php @@ -0,0 +1,58 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class LowCabin extends BaseCabin implements TradeableItem, ConstructableShipPart { + // Konstruktor + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + // 2-Sterne-Klasse erstellen + public static final function createLowCabin ($numLuxury, $numRooms, $numBeds, $dim) { + // Get new instance + $lowInstance = new LowCabin(); + + // Abmasse extrahieren + $lowInstance->extractDimensions($dim); + + // Den Rest auch setzen + $lowInstance->setNumCabin($numLuxury); + $lowInstance->setNumRooms($numRooms); + $lowInstance->setNumBeds($numBeds); + + // Nicht noetig! + $lowInstance->removePartInstance(); + + // Instanz zurueckgeben + return $lowInstance; + } + + // Overwritten method for tradeable items + public function isTradeable () { + return true; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/structures/extended/cabines/ship/class_LuxuryCabin.php b/application/shipsimu/classes/structures/extended/cabines/ship/class_LuxuryCabin.php new file mode 100644 index 0000000..78cb9c4 --- /dev/null +++ b/application/shipsimu/classes/structures/extended/cabines/ship/class_LuxuryCabin.php @@ -0,0 +1,58 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class LuxuryCabin extends BaseCabin implements TradeableItem, ConstructableShipPart { + // Konstruktor + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + // Eine Luxuskabine erstellen + public static final function createLuxuryCabin ($numLuxury, $numRooms, $numBeds, $dim) { + // Get new instance + $luxuryInstance = new LuxuryCabin(); + + // Abmasse extrahieren + $luxuryInstance->extractDimensions($dim); + + // Den Rest auch setzen + $luxuryInstance->setNumCabin($numLuxury); + $luxuryInstance->setNumRooms($numRooms); + $luxuryInstance->setNumBeds($numBeds); + + // Nicht noetig! + $luxuryInstance->removePartInstance(); + + // Instanz zurueckgeben + return $luxuryInstance; + } + + // Overwritten method for tradeable items + public function isTradeable () { + return true; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/structures/extended/cabines/ship/class_PremierCabin.php b/application/shipsimu/classes/structures/extended/cabines/ship/class_PremierCabin.php new file mode 100644 index 0000000..522e301 --- /dev/null +++ b/application/shipsimu/classes/structures/extended/cabines/ship/class_PremierCabin.php @@ -0,0 +1,58 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class PremierCabin extends BaseCabin implements TradeableItem, ConstructableShipPart { + // Konstruktor + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + // Premier-Kabine erstellen + public static final function createPremierCabin ($numLuxury, $numRooms, $numBeds, $dim) { + // Get new instance + $premierInstance = new PremierCabin(); + + // Abmasse extrahieren + $premierInstance->extractDimensions($dim); + + // Den Rest auch setzen + $premierInstance->setNumCabin($numLuxury); + $premierInstance->setNumRooms($numRooms); + $premierInstance->setNumBeds($numBeds); + + // Nicht noetig! + $premierInstance->removePartInstance(); + + // Instanz zurueckgeben + return $premierInstance; + } + + // Overwritten method for tradeable items + public function isTradeable () { + return true; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/structures/extended/class_ b/application/shipsimu/classes/structures/extended/class_ new file mode 100644 index 0000000..9644fd5 --- /dev/null +++ b/application/shipsimu/classes/structures/extended/class_ @@ -0,0 +1,7 @@ + + /** + * Limits this object with an ObjectLimits instance + */ + public function limitObject (ObjectLimits $limitInstance) { + die("limitObject() reached! Stub!"); + } diff --git a/application/shipsimu/classes/structures/extended/class_BaseCabinStructure.php b/application/shipsimu/classes/structures/extended/class_BaseCabinStructure.php new file mode 100644 index 0000000..77a81ae --- /dev/null +++ b/application/shipsimu/classes/structures/extended/class_BaseCabinStructure.php @@ -0,0 +1,135 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class BaseCabinStructure extends BaseStructure { + // --- Besondere Eigenschaften dazufuegen: --- + // Anzahl der Kabinen im Schiff + private $numCabin = 0; + + // Anzahl Raeume pro Kabine (kann auch nur 1 sein) + private $numRooms = 0; + + // Anzahl Betten, verallgemeinert + private $numBeds = 0; + + // Konstruktor + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + } + + // Kabine hinzufuegen + public function addShipPartToShip (ConstructableShip $shipInstance, ConstructableShipPart $cabinInstance) { + // Eltern-Methode aufrufen + parent::addShipPartToShip ($shipInstance, $cabinInstance); + + // Restlichen Daten ebenfalls + $this->setNumCabin($cabinInstance->numCabin); + $this->setNumRooms($cabinInstance->numRooms); + $this->setNumBeds($cabinInstance->numBeds); + + // Unnoetige Attribute entfernen + $cabinInstance->removeNumCabin(); + $cabinInstance->removeNumRooms(); + $cabinInstance->removeNumBeds(); + + // Instanz setzen + $this->setDeckInstance($cabinInstance); + } + + // Wrapper fuer setDeckInstance->setPartInstance + public final function setDeckInstance ($deck) { + parent::setPartInstance($deck); + } + + // Getter-Methode fuer Anzahl Betten + public final function getNumBeds () { + return $this->numBeds; + } + + // Getter-Methode fuer Anzahl Kabinen + public final function getNumCabin () { + return $this->numCabin; + } + + // Setter-Methode fuer Anzahl Betten + public final function setNumBeds ($numBeds) { + $this->numBeds = $numBeds; + } + + // Setter-Methode fuer Anzahl Raeume + public final function setNumRooms ($numRooms) { + $this->numRooms = $numRooms; + } + + // Setter-Methode fuer Anzahl Kabinen + public final function setNumCabin ($numCabin) { + $this->numCabin = $numCabin; + } + + // Loesch-Methode fuer Anzahl Betten + public final function removeNumBeds() { + unset($this->numBeds); + } + + // Loesch-Methode fuer Anzahl Kabinen + public final function removeNumCabin() { + unset($this->numCabin); + } + + // Loesch-Methode fuer Anzahl Raeume + public final function removeNumRooms() { + unset($this->numRooms); + } + + // Bettenanzahl pro Kabine berechnen + public function calcTotalBedsByCabin () { + // Dann Bettenanzahl holen und aufaddieren + $beds = $this->getNumBeds(); + $num = $this->getNumCabin(); + $cabinBeds = $beds * $num; + if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) { + // Get new instance + $cabType = "Kabine ohne Namen"; + $cab = $this->getPartInstance(); + if (!is_null($cab)) { + // Kabinenbeschreibung holen + $cabType = $cab->__toString(); + } + + // Debug-Meldung ausgeben + $this->debugOutput(sprintf("[%s:%d] Es exisitieren %d Kabinen vom Typ %s zu je %d Betten. Das sind %d Betten.", + __CLASS__, + __LINE__, + $num, + $cabType, + $beds, + $cabinBeds + )); + } + return $cabinBeds; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/structures/extended/class_BaseDeckStructure.php b/application/shipsimu/classes/structures/extended/class_BaseDeckStructure.php new file mode 100644 index 0000000..0f44a55 --- /dev/null +++ b/application/shipsimu/classes/structures/extended/class_BaseDeckStructure.php @@ -0,0 +1,61 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class BaseDeckStructure extends BaseStructure { + // Anzahl Decks + private $numDecks = 0; + + // Konstruktor + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + } + + // Deckstruktur dem Schiff hinzufuegen + public function addShipPartToShip (ConstructableShip $shipInstance, ConstructableShipPart $deckInstance) { + // Eltern-Methode aufrufen + parent::addShipPartToShip($shipInstance, $deckInstance); + + // Andere Daten uebertragen und von der Quelle loeschen + $this->setNumDecks($deckInstance->getNumDecks()); + $deckInstance->removeNumDecks(); + } + + // Deckanzahl entfernen + public final function removeNumDecks() { + unset($this->numDecks); + } + + // Setter-Methode fuer Anzahl Decks + public final function setNumDecks($numDecks) { + $this->numDecks = (int) $numDecks; + } + + // Getter-Methode fuer Anzahl Decks + public final function getNumDecks() { + return $this->numDecks; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/structures/extended/class_BaseUpperStructure.php b/application/shipsimu/classes/structures/extended/class_BaseUpperStructure.php new file mode 100644 index 0000000..dd6934c --- /dev/null +++ b/application/shipsimu/classes/structures/extended/class_BaseUpperStructure.php @@ -0,0 +1,37 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class BaseUpperStructure extends BaseStructure { + /** + * Constructor for all super structures on a ship + * + * @return void + */ + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/structures/extended/decks/.htaccess b/application/shipsimu/classes/structures/extended/decks/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/structures/extended/decks/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/structures/extended/decks/cargo/.htaccess b/application/shipsimu/classes/structures/extended/decks/cargo/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/structures/extended/decks/cargo/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/structures/extended/decks/cargo/class_CarDeck.php b/application/shipsimu/classes/structures/extended/decks/cargo/class_CarDeck.php new file mode 100644 index 0000000..d87dd09 --- /dev/null +++ b/application/shipsimu/classes/structures/extended/decks/cargo/class_CarDeck.php @@ -0,0 +1,56 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class CarDeck extends BaseDeck implements TradeableItem, ConstructableShipPart { + // Konstruktor + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + // Autodeck erstellen + public static final function createCarDeck ($numDecks, $dim) { + // Get new instance + $carInstance = new CarDeck(); + + // Abmasse extrahieren + $carInstance->extractDimensions($dim); + + // Andere Daten uebetragen + $carInstance->setNumDecks($numDecks); + + // Nicht noetige Instanz + $carInstance->removePartInstance(); + + // Instanz zurueckgeben + return $carInstance; + } + + // Overwritten method for tradeable items + public function isTradeable () { + return true; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/structures/extended/decks/cargo/class_TrainDeck.php b/application/shipsimu/classes/structures/extended/decks/cargo/class_TrainDeck.php new file mode 100644 index 0000000..07410ea --- /dev/null +++ b/application/shipsimu/classes/structures/extended/decks/cargo/class_TrainDeck.php @@ -0,0 +1,56 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class TrainDeck extends BaseDeck implements TradeableItem, ConstructableShipPart { + // Konstruktor + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + // LKW-Deck erstellen + public static final function createTrainDeck ($numDecks, $dim) { + // Get new instance + $trainInstance = new TrainDeck(); + + // Abmasse extrahieren + $trainInstance->extractDimensions($dim); + + // Andere Daten uebetragen + $trainInstance->setNumDecks($numDecks); + + // Nicht noetige Instanz + $trainInstance->removePartInstance(); + + // Instanz zurueckliefern + return $trainInstance; + } + + // Overwritten method for tradeable items + public function isTradeable () { + return true; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/structures/extended/decks/cargo/class_TruckDeck.php b/application/shipsimu/classes/structures/extended/decks/cargo/class_TruckDeck.php new file mode 100644 index 0000000..6a87d85 --- /dev/null +++ b/application/shipsimu/classes/structures/extended/decks/cargo/class_TruckDeck.php @@ -0,0 +1,57 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class TruckDeck extends BaseDeck implements TradeableItem, ConstructableShipPart { + // Konstruktor + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + // LKW-Deck erstellen + public static final function createTruckDeck ($numDecks, $dim) { + // Get new instance + $truckInstance = new TruckDeck(); + + // Abmasse extrahieren + $truckInstance->extractDimensions($dim); + + // Andere Daten uebetragen + $truckInstance->setNumDecks($numDecks); + + // Nicht noetige Instanz + $truckInstance->removePartInstance(); + + // Instanz zurueckliefern + return $truckInstance; + } + + // Overwritten method for tradeable items + public function isTradeable () { + return true; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/structures/extended/decks/class_BaseDeck.php b/application/shipsimu/classes/structures/extended/decks/class_BaseDeck.php new file mode 100644 index 0000000..7b92d68 --- /dev/null +++ b/application/shipsimu/classes/structures/extended/decks/class_BaseDeck.php @@ -0,0 +1,37 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class BaseDeck extends BaseDeckStructure { + /** + * Constructor for cargo decks in general + * + * @return void + */ + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/structures/extended/lower/.htaccess b/application/shipsimu/classes/structures/extended/lower/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/structures/extended/lower/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/structures/extended/upper/.htaccess b/application/shipsimu/classes/structures/extended/upper/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/structures/extended/upper/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/structures/extended/upper/class_Bridge.php b/application/shipsimu/classes/structures/extended/upper/class_Bridge.php new file mode 100644 index 0000000..1c3b674 --- /dev/null +++ b/application/shipsimu/classes/structures/extended/upper/class_Bridge.php @@ -0,0 +1,55 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class Bridge extends BaseUpperStructure implements TradeableItem, ConstructableShipPart { + // Constructor + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + + // Clean up a little + $this->removePartInstance(); + } + + // Eine Kommandobruecke erstellen + public static final function createBridge ($width, $height, $length) { + // Get new instance + $bridgeInstance = new Bridge(); + + // Abmasse setzen + $bridgeInstance->setWidth($width); + $bridgeInstance->setHeight($height); + $bridgeInstance->setLength($length); + + // Instanz zurueckgeben + return $bridgeInstance; + } + + // Overwritten method for tradeable items + public function isTradeable () { + return true; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/user/.htaccess b/application/shipsimu/classes/user/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/user/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/user/class_ShipSimuBaseUser.php b/application/shipsimu/classes/user/class_ShipSimuBaseUser.php new file mode 100644 index 0000000..75de2c7 --- /dev/null +++ b/application/shipsimu/classes/user/class_ShipSimuBaseUser.php @@ -0,0 +1,261 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class ShipSimuBaseUser extends BaseUser implements Registerable, Updateable { + /** + * Protected constructor + * + * @param $className Name of the class + * @return void + */ + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + } + + /** + * Initializes the bank instance + * + * @return $bankInstance A bank instance wether just created or from registry + */ + protected function initBankInstance () { + // Init instance + $bankInstance = null; + + try { + // Get a money bank instance from registry + $bankInstance = Registry::getRegistry()->getInstance('money_bank'); + } catch (NullPointerException $e) { + // Instance not found in registry + // @TODO We should log this exception later + } + + // Is it there? + if (is_null($bankInstance)) { + // Then create a new one + $bankInstance = ObjectFactory::createObjectByConfiguredName('bank_class', array($this)); + + // Store it in registry + Registry::getRegistry()->addInstance('money_bank', $bankInstance); + } // END - if + + // Return the instance + return $bankInstance; + } + + /** + * Initializes the government instance + * + * @return $governmentInstance A government instance + */ + protected function initGovernmentInstance () { + // Init instance + $governmentInstance = null; + + try { + // First get a government instance from registry + $governmentInstance = Registry::getRegistry()->getInstance('government'); + } catch (NullPointerException $e) { + // Instance not found in registry + // @TODO We should log this exception later + } + + // Is it there? + if (is_null($governmentInstance)) { + // Then create a new one + $governmentInstance = ObjectFactory::createObjectByConfiguredName('government_class', array($this)); + + // Store it in registry + Registry::getRegistry()->addInstance('government', $governmentInstance); + } // END - if + + // Return the prepared instance + return $governmentInstance; + } + + /** + * Checks wether the user has reached maximum allowed companies to found + * + * @return $reached Wether the user has reached maximum allowed companies to found + */ + public function ifUserCreatedMaximumAllowedCompanies () { + // Get max allowed companies to found + $maxFound = $this->getConfigInstance()->getConfigEntry('max_allowed_companies_found'); + + // Now get a search criteria and set the user's name as criteria + $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); + $searchInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUserName()); + $searchInstance->setLimit($maxFound); + + // Get a company wrapper + $wrapperInstance = ObjectFactory::createObjectByConfiguredName('company_db_wrapper_class'); + + // Do the count-select by criteria + $totalRows = $wrapperInstance->doSelectCountByCriteria($searchInstance); + + // Does the user have reached maximum? + $reached = ($totalRows >= $maxFound); + + // Return the result + return $reached; + } + + /** + * Checks wether the user has the required amount of points left for the specified action + * + * @param $action The action or configuration entry plus prefix the user wants to perform + * @return $hasRequired Wether the user has the required points + */ + public function ifUserHasRequiredPoints ($action) { + // Default is that everyone is poor... ;-) + $hasRequired = false; + + // Init instance + $pointsInstance = null; + + try { + // Get a points instance from registry + $pointsInstance = Registry::getRegistry()->getInstance('points'); + } catch (NullPointerException $e) { + // Instance not found in registry + // @TODO We should log this exception later + } + + // Is there an instance? + if (is_null($pointsInstance)) { + // Then create one + $pointsInstance = ObjectFactory::createObjectByConfiguredName('user_points_class', array($this)); + + // And store it in registry + Registry::getRegistry()->addInstance('points', $pointsInstance); + } // END - if + + // Just forward this request to the user points class + $hasRequired = $pointsInstance->ifUserHasRequiredPoints($action); + + // Return the result + return $hasRequired; + } + + /** + * Determines if government can still pay a "virtual training course" in general + * + * @return $ifGovHelps Wether if government helps the user with a virtual training course + */ + public function ifGovernmentPaysTraining () { + // By default they want to help. + $ifGovHelps = true; + + // Initialize government instance + $governmentInstance = $this->initGovernmentInstance(); + + // Then ask the government if they want to pay a "startup help" to the user + $ifGovHelps = ($governmentInstance->ifGovernmentAlreadyPayedTraining()); + + // Return result here + return $ifGovHelps; + } + + /** + * Determines if government can still pay a "startup help" to the user + * + * @return $ifGovHelps Wether if government helps the user with some startup money + */ + public function ifGovernmentPaysStartupHelp () { + // By default they want to help. + $ifGovHelps = true; + + // Initialize government instance + $governmentInstance = $this->initGovernmentInstance(); + + // Then ask the government if they want to pay a "startup help" to the user + $ifGovHelps = ($governmentInstance->ifGovernmentPayedMaxmimumStartupHelp()); + + // Return result here + return $ifGovHelps; + } + + /** + * Checks wether the user can take points from the money bank + * + * @return $bankLends Wether the money bank is able to lend money + * @todo Need to implement MoneyBank::ifBankLendsMoreMoney() + */ + public function ifUserAllowedTakeCreditsFromMoneyBank () { + // Per default the money bank cannot pay + $bankLends = false; + + // Initialize bank instance + $bankInstance->initBankInstance(); + + // Does the money bank lend more money? + $bankLends = ($bankInstance->ifBankLendsMoreMoney()); + + // Return result + return $bankLends; + } + + /** + * Checks wether the user has maximum credits with the money bank. This + * should be done seperately from checking if the user is allowed to take + * credits from the bank. + * + * @return $hasMaxCredits Wether the user has maximum credits with the bank + * @todo Need to check the bank if they can lend more money + */ + public function ifUserHasMaximumCreditsWithMoneyBank () { + // For default he can still get money + $hasMaxCredits = false; + + // Initialize the bank instance + $bankInstance = $this->initBankInstance(); + + // Now check if the user has maximum credits + $hasMaxCredits = ($bankInstance->ifUserHasMaxCredits()); + + // Return the result + return $hasMaxCredits; + } + + /** + * Checks wether the money bank has opened + * + * @return $hasOpened Wether the money bank has opened + */ + public function ifMoneyBankHasOpened () { + // Default is not opened + $hasOpened = false; + + // Initialize the bank instance + $bankInstance = $this->initBankInstance(); + + // Has this bank opened? + $hasOpened = ($bankInstance->ifMoneyBankHasOpened()); + + // Return result + return $hasOpened; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/user/extended/.htaccess b/application/shipsimu/classes/user/extended/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/user/extended/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/user/extended/class_ShipSimuGuest.php b/application/shipsimu/classes/user/extended/class_ShipSimuGuest.php new file mode 100644 index 0000000..a66de18 --- /dev/null +++ b/application/shipsimu/classes/user/extended/class_ShipSimuGuest.php @@ -0,0 +1,108 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class ShipSimuGuest extends ShipSimuBaseUser implements ManageableGuest { + // Exceptions + const EXCEPTION_USERNAME_NOT_FOUND = 0x170; + const EXCEPTION_USER_EMAIL_NOT_FOUND = 0x171; + const EXCEPTION_USER_PASS_MISMATCH = 0x172; + + /** + * Protected constructor + * + * @param $className Name of the class + * @return void + */ + protected function __construct ($className = __CLASS__) { + // Call parent constructor + parent::__construct($className); + } + + /** + * Creates an instance of this user class by a provided username. This + * factory method will check if username is already taken and if not + * so it will throw an exception. + * + * @param $userName Username we need a class instance for + * @return $userInstance An instance of this user class + * @throws UsernameMissingException If the username does not exist + */ + public static final function createGuestByUsername ($userName) { + // Get a new instance + $userInstance = new ShipSimuGuest(); + + // Set the username + $userInstance->setUserName($userName); + + // Check if username exists + 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; + } + + /** + * Creates an instance of this user class by a provided email address. This + * factory method will not check if email address is there. + * + * @param $email Email address of the user + * @return $userInstance An instance of this user class + */ + public static final function createGuestByEmail ($email) { + // Get a new instance + $userInstance = new ShipSimuGuest(); + + // Set the username + $userInstance->setEmail($email); + + // Return the instance + return $userInstance; + } + + /** + * Updates the last activity timestamp and last performed action in the + * database result. You should call flushPendingUpdates() to flush these updates + * to the database layer. + * + * @param $requestInstance A requestable class instance + * @return void + */ + public function updateLastActivity (Requestable $requestInstance) { + // No activity will be logged for guest accounts + } + + /** + * Flushs all pending updates to the database layer + * + * @return void + */ + public function flushPendingUpdates () { + // No updates will be flushed to database! + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/user/extended/class_ShipSimuMember.php b/application/shipsimu/classes/user/extended/class_ShipSimuMember.php new file mode 100644 index 0000000..a37ef16 --- /dev/null +++ b/application/shipsimu/classes/user/extended/class_ShipSimuMember.php @@ -0,0 +1,220 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class ShipSimuMember extends ShipSimuBaseUser implements ManageableMember, BookableAccount { + /** + * Protected constructor + * + * @param $className Name of the class + * @return void + */ + protected function __construct ($className = __CLASS__) { + // Call parent constructor + parent::__construct($className); + } + + /** + * Destructor for e.g. flushing pending updates to the database + * + * @return void + */ + public function __destruct () { + // Flush any updated entries to the database + $this->flushPendingUpdates(); + + // Call parent destructor + parent::__destruct(); + } + + /** + * Creates an instance of this user class by a provided username. This + * factory method will check if username is already taken and if not + * so it will throw an exception. + * + * @param $userName Username we need a class instance for + * @return $userInstance An instance of this user class + * @throws UsernameMissingException If the username does not exist + */ + public static final function createMemberByUsername ($userName) { + // Get a new instance + $userInstance = new ShipSimuMember(); + + // Set the username + $userInstance->setUserName($userName); + + // Check if username exists + 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; + } + + /** + * Creates an instance of this user class by a provided email address. This + * factory method will not check if email address is there. + * + * @param $email Email address of the user + * @return $userInstance An instance of this user class + */ + public static final function createMemberByEmail ($email) { + // Get a new instance + $userInstance = new ShipSimuMember(); + + // Set the username + $userInstance->setEmail($email); + + // Return the instance + return $userInstance; + } + + /** + * Creates a user by a given request instance + * + * @param $requestInstance An instance of a Requestable class + * @return $userInstance An instance of this user class + * @todo Add more ways of creating user instances + */ + public static final function createMemberByRequest (Requestable $requestInstance) { + // Determine if by email or username + if (!is_null($requestInstance->getRequestElement('username'))) { + // Username supplied + $userInstance = self::createMemberByUserName($requestInstance->getRequestElement('username')); + } elseif (!is_null($requestInstance->getRequestElement('email'))) { + // Email supplied + $userInstance = self::createMemberByEmail($requestInstance->getRequestElement('email')); + } else { + // Unsupported mode + $userInstance = new ShipSimuMember(); + $userInstance->partialStub("We need to add more ways of creating user classes here."); + $userInstance->debugBackTrace(); + exit(); + } + + // Return the prepared instance + return $userInstance; + } + + /** + * Updates the last activity timestamp and last performed action in the + * database result. You should call flushPendingUpdates() to flush these updates + * to the database layer. + * + * @param $requestInstance A requestable class instance + * @return void + */ + public function updateLastActivity (Requestable $requestInstance) { + // Set last action + $lastAction = $requestInstance->getRequestElement('action'); + + // If there is no action use the default on + if (is_null($lastAction)) { + $lastAction = $this->getConfigInstance()->getConfigEntry('login_default_action'); + } // END - if + + // Get a critieria instance + $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); + + // Add search criteria + $searchInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUserName()); + $searchInstance->setLimit(1); + + // Now get another criteria + $updateInstance = ObjectFactory::createObjectByConfiguredName('update_criteria_class'); + + // And add our both entries + $updateInstance->addCriteria('last_activity', date('Y-m-d H:i:s', time())); + $updateInstance->addCriteria('last_action', $lastAction); + + // Add the search criteria for searching for the right entry + $updateInstance->setSearchInstance($searchInstance); + + // Set wrapper class name + $updateInstance->setWrapperConfigEntry('user_db_wrapper_class'); + + // Remember the update in database result + $this->getResultInstance()->add2UpdateQueue($updateInstance); + } + + /** + * Books the given 'amount' in the request instance on the users 'points + * account' + * + * @param $requestInstance An instance of a Requestable class + * @return void + */ + public function bookAmountDirectly (Requestable $requestInstance) { + // Init points instance + $pointsInstance = null; + + try { + // Get the points class from registry + $pointsInstance = Registry::getRegistry()->getInstance('points'); + } catch (NullPointerException $e) { + // Instance not found in registry + // @TODO We should log this later + } + + // Is the points instance null? + if (is_null($pointsInstance)) { + // Then get a new one + $pointsInstance = ObjectFactory::createObjectByConfiguredName('user_points_class', array($this)); + + // And store it in registry + Registry::getRegistry()->addInstance('points', $pointsInstance); + } // END - if + + // Get the amount + $amount = $requestInstance->getRequestElement('amount'); + + // Call the method for booking points + $pointsInstance->bookPointsDirectly($amount); + } + + /** + * Flushs all pending updates to the database layer + * + * @return void + */ + public function flushPendingUpdates () { + // Is the object valid? + if (!$this->getResultInstance() instanceof SearchableResult) { + // Abort here + return; + } // END - if + + // Do we have data to update? + if ($this->getResultInstance()->ifDataNeedsFlush()) { + // Get a database wrapper + $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class'); + + // Yes, then send the whole result to the database layer + $wrapperInstance->doUpdateByResult($this->getResultInstance()); + } // END - if + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/wrapper/.htaccess b/application/shipsimu/classes/wrapper/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/shipsimu/classes/wrapper/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/shipsimu/classes/wrapper/class_CompanyDatabaseWrapper.php b/application/shipsimu/classes/wrapper/class_CompanyDatabaseWrapper.php new file mode 100644 index 0000000..1552e67 --- /dev/null +++ b/application/shipsimu/classes/wrapper/class_CompanyDatabaseWrapper.php @@ -0,0 +1,129 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class CompanyDatabaseWrapper extends BaseDatabaseWrapper { + /** + * Company instance + */ + private $companyInstance = null; + + // Constants for database tables + const DB_TABLE_COMPANY_DATA = 'company'; + const DB_TABLE_COMPANY_USER = 'company_user'; + + // Constants for database columns + const DB_COLUMN_PARTICIPANT_ID = 'participant_id'; + + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this wrapper class + * + * @param $companyInstance An instance of a generic company class or null if no specific + * @return $wrapperInstance An instance of this wrapper class + * @todo Find an interface which is suitable for all companies + */ + public static final function createCompanyDatabaseWrapper (ShippingCompany $companyInstance = null) { + // Create a new instance + $wrapperInstance = new CompanyDatabaseWrapper(); + + // Set (primary!) table name + $wrapperInstance->setTableName(self::DB_TABLE_COMPANY_DATA); + + // Set the company instance if not null + if (!is_null($companyInstance)) { + $wrapperInstance->setCompanyInstance($companyInstance); + } // END - if + + // Return the instance + return $wrapperInstance; + } + + /** + * Checks wether the given user participates in a company + * + * @param $userInstance An instance of a user class + * @return $participates Wether the user participates at lease in one company + */ + public function ifUserParticipatesInCompany (ManageableAccount $userInstance) { + // By default no user owns any company... ;) + $participates = false; + + // Get a search criteria class + $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); + + // Add the user primary key as a search criteria + $searchInstance->addCriteria(self::DB_COLUMN_PARTICIPANT_ID, $userInstance->getPrimaryKey()); + $searchInstance->setLimit(1); + + // Set company->user table + $this->setTableName(self::DB_TABLE_COMPANY_USER); + + // Get the result back + $resultInstance = $this->doSelectByCriteria($searchInstance); + + // Is there a result? + if ($resultInstance->next()) { + // Then cache it + $this->setResultInstance($resultInstance); + + // Entry found for further analysis/processing + $participates = true; + } // END - if + + // Return the result + return $participates; + } + + /** + * Setter for company instance + * + * @param $companyInstance An instance of a generic company + * @return void + * @todo Find an interface suitable for all types of companies + */ + protected final function setCompanyInstance (ShippingCompany $companyInstance) { + $this->companyInstance = $companyInstance; + } + + /** + * Getter for company instance + * + * @return $companyInstance An instance of a generic company + * @todo Find an interface suitable for all types of companies + */ + public final function getCompanyInstance () { + return $this->companyInstance; + } +} + +// [EOF] +?> diff --git a/application/shipsimu/classes/wrapper/class_UserGovernmentDatabaseWrapper.php b/application/shipsimu/classes/wrapper/class_UserGovernmentDatabaseWrapper.php new file mode 100644 index 0000000..6392d6b --- /dev/null +++ b/application/shipsimu/classes/wrapper/class_UserGovernmentDatabaseWrapper.php @@ -0,0 +1,70 @@ +user data + * + * @author Roland Haeder + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +class UserGovernmentDatabaseWrapper extends BaseDatabaseWrapper { + // Constants for database tables + const DB_TABLE_USER_GOVERNMENT = 'gov_user'; + + // Database columns + const DB_COLUMN_GOV_USERID = 'gov_uid'; + const DB_COLUMN_GOV_ACTIVITY = 'gov_activity_status'; + + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this wrapper class + * + * @return $wrapperInstance An instance of this wrapper class + */ + public static final function createUserGovernmentDatabaseWrapper () { + // Create a new instance + $wrapperInstance = new UserGovernmentDatabaseWrapper(); + + // Set (primary!) table name + $wrapperInstance->setTableName(self::DB_TABLE_USER_GOVERNMENT); + + // Return the instance + return $wrapperInstance; + } + + /** + * Registers the given startup help request with the government + * + * @param $requestInstance A Requestable instance + * @return void + */ + public function registerStartupHelpByRequest (Requestable $requestInstance) { + $requestInstance->debugInstance(); + } +} + +// [EOF] +?> diff --git a/application/shipsimu/main/.htaccess b/application/shipsimu/main/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/actions/.htaccess b/application/shipsimu/main/actions/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/actions/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/actions/class_ b/application/shipsimu/main/actions/class_ deleted file mode 100644 index d84fab7..0000000 --- a/application/shipsimu/main/actions/class_ +++ /dev/null @@ -1,82 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @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 . - */ -class ???Action extends BaseShipSimuAction 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 create???Action (ActionResolver $resolverInstance) { - // Get a new instance - $actionInstance = new ???Action(); - - // 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) { - // Call parent execute method - parent::execute($requestInstance, $responseInstance); - - // Add your code here - $this->partialStub("You have to implement me."); - } - - /** - * 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 filters here - */ - public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { - // Call parent addExtraFilters method - parent::addExtraFilters($controllerInstance, $requestInstance); - - // Unfinished method - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/actions/class_BaseShipSimuAction.php b/application/shipsimu/main/actions/class_BaseShipSimuAction.php deleted file mode 100644 index 41dcce0..0000000 --- a/application/shipsimu/main/actions/class_BaseShipSimuAction.php +++ /dev/null @@ -1,62 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class BaseShipSimuAction extends BaseAction { - /** - * Protected constructor - * - * @param $className Name of the class - * @return void - */ - protected function __construct ($className) { - // Call parent constructor - parent::__construct($className); - } - - /** - * 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 - */ - protected function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Add code here executed with every action - } - - /** - * 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 filters here - */ - public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { - // Unfinished method - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/actions/ship-simu/.htaccess b/application/shipsimu/main/actions/ship-simu/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/actions/ship-simu/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/actions/ship-simu/class_ShipSimuLoginAction.php b/application/shipsimu/main/actions/ship-simu/class_ShipSimuLoginAction.php deleted file mode 100644 index 2fbee37..0000000 --- a/application/shipsimu/main/actions/ship-simu/class_ShipSimuLoginAction.php +++ /dev/null @@ -1,65 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class ShipSimuLoginAction extends BaseShipSimuAction implements PerformableAction { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this action - * - * @return $actionInstance An instance of this action class - */ - public static final function createShipSimuLoginAction () { - // Get a new instance - $actionInstance = new ShipSimuLoginAction(); - - // 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 Maybe we need to do something later here - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Call parent execute method - parent::execute($requestInstance, $responseInstance); - - // Add your code here - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/actions/ship-simu/class_ShipSimuProfileAction.php b/application/shipsimu/main/actions/ship-simu/class_ShipSimuProfileAction.php deleted file mode 100644 index 56090bf..0000000 --- a/application/shipsimu/main/actions/ship-simu/class_ShipSimuProfileAction.php +++ /dev/null @@ -1,65 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class ShipSimuProfileAction extends BaseShipSimuAction implements PerformableAction { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this action - * - * @return $actionInstance An instance of this action class - */ - public static final function createShipSimuProfileAction () { - // Get a new instance - $actionInstance = new ShipSimuProfileAction(); - - // 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 Maybe we need to do something later here - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Call parent execute method - parent::execute($requestInstance, $responseInstance); - - // Add your code here... - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/actions/web/.htaccess b/application/shipsimu/main/actions/web/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/actions/web/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/actions/web/class_WebShipSimuLogin b/application/shipsimu/main/actions/web/class_WebShipSimuLogin deleted file mode 100644 index d60f442..0000000 --- a/application/shipsimu/main/actions/web/class_WebShipSimuLogin +++ /dev/null @@ -1,82 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @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 . - */ -class WebShipSimuLogin???Action extends BaseShipSimuAction 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 createWebShipSimuLogin???Action (ActionResolver $resolverInstance) { - // Get a new instance - $actionInstance = new WebShipSimuLogin???Action(); - - // 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) { - // Execute parent method - parent::execute($requestInstance, $responseInstance); - - // Add your code here - } - - /** - * 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 filters here - */ - public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { - // Check for user status by default - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/actions/web/class_WebShipSimuLoginCompanyAction.php b/application/shipsimu/main/actions/web/class_WebShipSimuLoginCompanyAction.php deleted file mode 100644 index 842d6cb..0000000 --- a/application/shipsimu/main/actions/web/class_WebShipSimuLoginCompanyAction.php +++ /dev/null @@ -1,82 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class WebShipSimuLoginCompanyAction extends BaseShipSimuAction 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 static final function createWebShipSimuLoginCompanyAction (ActionResolver $resolverInstance) { - // Get a new instance - $actionInstance = new WebShipSimuLoginCompanyAction(); - - // 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 Maybe add fetching company list of current user here? - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Call parent execute method - parent::execute($requestInstance, $responseInstance); - - // Add your code here... - } - - /** - * 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')); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/actions/web/class_WebShipSimuLoginGovernmentStartupHelpAction.php b/application/shipsimu/main/actions/web/class_WebShipSimuLoginGovernmentStartupHelpAction.php deleted file mode 100644 index fa62481..0000000 --- a/application/shipsimu/main/actions/web/class_WebShipSimuLoginGovernmentStartupHelpAction.php +++ /dev/null @@ -1,85 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class WebShipSimuLoginGovernmentStartupHelpAction extends BaseShipSimuAction 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 static final function createWebShipSimuLoginGovernmentStartupHelpAction (ActionResolver $resolverInstance) { - // Get a new instance - $actionInstance = new WebShipSimuLoginGovernmentStartupHelpAction(); - - // 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) { - // Call parent execute method - parent::execute($requestInstance, $responseInstance); - - // Add your code here... - } - - /** - * 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 filters here - */ - public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { - // Check for user status by default - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); - - // Check if government can pay startup help - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('government_pays_startup_help_filter')); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/actions/web/class_WebShipSimuLoginGovernmentTrainingAction.php b/application/shipsimu/main/actions/web/class_WebShipSimuLoginGovernmentTrainingAction.php deleted file mode 100644 index fcbc711..0000000 --- a/application/shipsimu/main/actions/web/class_WebShipSimuLoginGovernmentTrainingAction.php +++ /dev/null @@ -1,85 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class WebShipSimuLoginGovernmentTrainingAction extends BaseShipSimuAction 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 static final function createWebShipSimuLoginGovernmentTrainingAction (ActionResolver $resolverInstance) { - // Get a new instance - $actionInstance = new WebShipSimuLoginGovernmentTrainingAction(); - - // 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) { - // Call parent execute method - parent::execute($requestInstance, $responseInstance); - - // Add your code here... - } - - /** - * 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 government can pay a training - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('government_pays_training_filter')); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/actions/web/class_WebShipSimuLoginLogoutAction.php b/application/shipsimu/main/actions/web/class_WebShipSimuLoginLogoutAction.php deleted file mode 100644 index 9b066a9..0000000 --- a/application/shipsimu/main/actions/web/class_WebShipSimuLoginLogoutAction.php +++ /dev/null @@ -1,81 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class WebShipSimuLoginLogoutAction extends BaseShipSimuAction 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 static final function createWebShipSimuLoginLogoutAction (ActionResolver $resolverInstance) { - // Get a new instance - $actionInstance = new WebShipSimuLoginLogoutAction(); - - // 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) { - // Call parent execute method - parent::execute($requestInstance, $responseInstance); - - // Add your code here - } - - /** - * 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 - */ - public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { - // Check for user status by default - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/actions/web/class_WebShipSimuLoginProfileAction.php b/application/shipsimu/main/actions/web/class_WebShipSimuLoginProfileAction.php deleted file mode 100644 index 58d6745..0000000 --- a/application/shipsimu/main/actions/web/class_WebShipSimuLoginProfileAction.php +++ /dev/null @@ -1,82 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class WebShipSimuLoginProfileAction extends BaseShipSimuAction 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 static final function createWebShipSimuLoginProfileAction (ActionResolver $resolverInstance) { - // Get a new instance - $actionInstance = new WebShipSimuLoginProfileAction(); - - // 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) { - // Call parent execute method - parent::execute($requestInstance, $responseInstance); - - // Add your code here... - } - - /** - * 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 filters here - */ - public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { - // Check for user status by default - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/actions/web/class_WebShipSimuLoginRefillAction.php b/application/shipsimu/main/actions/web/class_WebShipSimuLoginRefillAction.php deleted file mode 100644 index 31c7337..0000000 --- a/application/shipsimu/main/actions/web/class_WebShipSimuLoginRefillAction.php +++ /dev/null @@ -1,87 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class WebShipSimuLoginRefillAction extends BaseShipSimuAction 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 static final function createWebShipSimuLoginRefillAction (ActionResolver $resolverInstance) { - // Get a new instance - $actionInstance = new WebShipSimuLoginRefillAction(); - - // 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) { - // Call parent execute method - parent::execute($requestInstance, $responseInstance); - - // Add your code here... - } - - /** - * 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 - */ - 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')); - - // Add payment discovery filter - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('payment_discovery_filter', array($this))); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/actions/web/class_WebShipSimuLoginStatusProblemAction.php b/application/shipsimu/main/actions/web/class_WebShipSimuLoginStatusProblemAction.php deleted file mode 100644 index 8b26b8f..0000000 --- a/application/shipsimu/main/actions/web/class_WebShipSimuLoginStatusProblemAction.php +++ /dev/null @@ -1,82 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class WebShipSimuLoginStatusProblemAction extends BaseShipSimuAction 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 static final function createWebShipSimuLoginStatusProblemAction (ActionResolver $resolverInstance) { - // Get a new instance - $actionInstance = new WebShipSimuLoginStatusProblemAction(); - - // 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) { - // Call parent method - parent::execute($requestInstance, $responseInstance); - - // Add your code - } - - /** - * 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 filters here - */ - public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { - // Check for user status by default - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/actions/web/class_WebShipSimuLoginWelcomeAction.php b/application/shipsimu/main/actions/web/class_WebShipSimuLoginWelcomeAction.php deleted file mode 100644 index d839bd1..0000000 --- a/application/shipsimu/main/actions/web/class_WebShipSimuLoginWelcomeAction.php +++ /dev/null @@ -1,81 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class WebShipSimuLoginWelcomeAction extends BaseShipSimuAction 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 static final function createWebShipSimuLoginWelcomeAction (ActionResolver $resolverInstance) { - // Get a new instance - $actionInstance = new WebShipSimuLoginWelcomeAction(); - - // 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) { - // Call parent execute method - parent::execute($requestInstance, $responseInstance); - - // Add your code here... - } - - /** - * 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 filters here - */ - public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { - // Unfinished method - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/bank/.htaccess b/application/shipsimu/main/bank/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/bank/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/bank/class_BaseBank.php b/application/shipsimu/main/bank/class_BaseBank.php deleted file mode 100644 index 21ae0d5..0000000 --- a/application/shipsimu/main/bank/class_BaseBank.php +++ /dev/null @@ -1,60 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.org - * @todo Find an instance for all banks and move the abstract functions there - * - * 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 . - */ -abstract class BaseBank extends BaseFrameworkSystem { - /** - * Protected constructor - * - * @param $className The class' real name - * @return void - */ - protected function __construct ($className) { - // Call parent constructor - parent::__construct($className); - } - - /** - * Checks wether the bank lends more money to the current user - * - * @return $lendsMoreMoney Wether this bank lends more money to the user - */ - public abstract function ifBankLendsMoreMoney (); - - /** - * Checks wethert the current user has maximum allowed credits with this bank - * - * @return $hasMaximumCredits Wether the user has maximum allowed credits - */ - public abstract function ifUserHasMaxCredits (); - - /** - * Checks wether this money bank has opened - * - * @return $hasOpened Wether this money bank has opened - */ - public abstract function ifMoneyBankHasOpened (); -} - -// [EOF] -?> diff --git a/application/shipsimu/main/bank/money/class_MoneyBank.php b/application/shipsimu/main/bank/money/class_MoneyBank.php deleted file mode 100644 index 11d4d9e..0000000 --- a/application/shipsimu/main/bank/money/class_MoneyBank.php +++ /dev/null @@ -1,94 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class MoneyBank extends BaseBank implements Registerable { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this money bank class - * - * @param $userInstance A class instance of a user object - * @return $bankInstance An instance of this class - */ - public static final function createMoneyBank (ManageableAccount $userInstance) { - // Get a new instance - $moneyInstance = new MoneyBank(); - - // Set the user instance - $moneyInstance->setUserInstance($userInstance); - - // Return the prepared instance - return $moneyInstance; - } - - /** - * Checks wether the bank lends more money to the current user - * - * @return $lendsMoreMoney Wether this bank lends more money to the user - */ - public function ifBankLendsMoreMoney () { - $this->partialStub(); - } - - /** - * Checks wethert the current user has maximum allowed credits with this bank - * - * @return $hasMaximumCredits Wether the user has maximum allowed credits - */ - public function ifUserHasMaxCredits () { - $this->partialStub(); - } - - /** - * Checks wether this money bank has opened - * - * @return $hasOpened Wether this money bank has opened - */ - public function ifMoneyBankHasOpened () { - // Has not opened by default - $hasOpened = false; - - // Is the money bank activated in config? - if ($this->getConfigInstance()->getConfigEntry('moneybank_activated')) { - // Okay, does the user ask within the opening times? To find this out we need a OpeningTimes class - $openingInstance = ObjectFactory::createObjectByConfiguredName('moneybank_opening_class', array($this)); - - // Then we simply "ask" the opening time instance if the user asks within the opening time - $hasOpened = $openingInstance->ifWithinOpeningTimes(); - } // END - if - - // Return status - return $hasOpened; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/class_ b/application/shipsimu/main/class_ deleted file mode 100644 index 956f6c5..0000000 --- a/application/shipsimu/main/class_ +++ /dev/null @@ -1,50 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @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 . - */ -class ??? extends BaseFrameworkSystem { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this money bank class - * - * @return $???Instance An instance of this class - */ - public final static function create??? () { - // Get a new instance - $???Instance = new ???(); - - // Return the prepared instance - return $???Instance; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/class_BasePersonell.php b/application/shipsimu/main/class_BasePersonell.php deleted file mode 100644 index 8e08ec3..0000000 --- a/application/shipsimu/main/class_BasePersonell.php +++ /dev/null @@ -1,246 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class BasePersonell extends BaseFrameworkSystem implements Personellizer { - // Maximum/minimum age - private $MIN_AGE = 21; - private $MAX_AGE = 40; - - // Male/female - private $gender = ""; // M=Male, F=Female, empty=uninitialized - - // Year/month/day of birth - private $yearBirth = 0; - private $monthBirth = 0; - private $dayBirth = 0; - - // Surname/family name - private $surname = ""; - private $family = ""; - - // Employed? - private $employed = false; - - // Married? - private $married = false; - - // Her/his salary - private $salary = 0.00; - - // Constructor - protected function __construct ($className) { - // Call parent constructor - parent::__construct($className); - } - - // Remove min/max ages - public final function removeMinMaxAge () { - unset($this->MIN_AGE); - unset($this->MAX_AGE); - } - - // Generates a birthday based on MAX_AGE/MIN_AGE and the current date - public final function createBirthday () { - // Is the birthday already set? - if ($this->isDateValid($this->yearBirth, $this->monthBirth, $this->dayBirth)) return false; - - // Get current year - $currYear = date("Y", time()); - - // Generate random year/month/day - $year = mt_rand(($currYear - $this->MIN_AGE), ($currYear - $this->MAX_AGE)); - $month = 0; - $day = 0; - while ($this->isDateValid($year, $month, $day) === false) { - $month = mt_rand(1, 12); - switch ($month) { - case 1: - case 3: - case 5: - case 7: - case 8: - case 10: - case 12: - $day = mt_rand(1, 31); - break; - - case 4: - case 6: - case 9: - case 11: - $day = mt_rand(1, 30); - break; - - case 2: // February - if ($year % 4 == 0) { - // Is a "Schaltjahr" - $day = mt_rand(1, 29); - } else { - // Regular year - $day = mt_rand(1, 28); - } - break; - } // END - switch - } // END - while - - // Set the new birthday - $this->setBirthday($year, $month, $day); - } - - // Is the current day valid? - public final function isDateValid ($year, $month, $day) { - // Create timestamp - $stamp = mktime(0, 0, 0, $month, $day, $year); - - // Get year/month/day back - $y = date("Y", $stamp); - $m = date("m", $stamp); - $d = date("d", $stamp); - - // Compare all - return (($y == $year) && ($m == $month) && ($d == $day)); - } - - // Employed? - public final function isEmployed () { - return $this->employed; - } - - // Married? - public final function isMarried () { - return $this->married; - } - - // Male? - public final function isMale () { - return ($this->gender == "M"); - } - - // Female - public final function isFemale () { - return ($this->gender == "F"); - } - - // Setter for surname - public final function setSurname ($surname) { - $this->surname = (string) $surname; - } - - // Getter for surname - public function getSurname () { - return $this->surname; - } - - // Setter for family name - public final function setFamily ($family) { - $this->family = (string) $family; - } - - // Getter for family name - public final function getFamily () { - return $this->family; - } - - // Setter for gender - public final function setGender ($gender) { - // Set random gender here - if (($gender == "M") || ($gender == "F") || ((empty($gender)) && ($this->getSurname() == ""))) { - $this->gender = $gender; - } else { - throw new WrongGenderSpecifiedException($gender, self::EXCEPTION_GENDER_IS_WRONG); - } - } - - // Getter for gender - public final function getGender () { - return $this->gender; - } - - // Setter for employment status - public final function setEmployed ($employed) { - $this->employed = (boolean) $employed; - } - - // Setter for marriage status - public final function setMarried ($married) { - $this->married = (boolean) $married; - } - - // Getter for salary - public final function getSalary () { - return $this->salary; - } - - // Increase salary - public final function increaseSalary ($add) { - $this->salary += (float) abs($add); - } - - // Decrease salary - public final function decreaseSalary ($sub) { - $this->salary -= (float) abs($sub); - } - - // Setter for birthday - public final function setBirthday ($year, $month, $day) { - $this->yearBirth = (int) abs($year); - $this->monthBirth = (int) abs($month); - $this->dayBirth = (int) abs($day); - } - - // Remove gender - public final function removeGender () { - unset($this->gender); - } - - // Remove both names - public final function removeNames () { - unset($this->surname); - unset($this->family); - } - - // Remove complete birthday - public final function removeBirthday () { - unset($this->yearBirth); - unset($this->monthBirth); - unset($this->dayBirth); - } - - // Remove salary - public final function removeSalary () { - unset($this->salary); - } - - // Remove employment status - public final function removeEmployed () { - unset($this->employed); - } - - // Remove marrital status - public final function removeMarried () { - unset($this->married); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/class_BaseSimulator.php b/application/shipsimu/main/class_BaseSimulator.php deleted file mode 100644 index e460013..0000000 --- a/application/shipsimu/main/class_BaseSimulator.php +++ /dev/null @@ -1,302 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class BaseSimulator extends BaseFrameworkSystem { - // Schiffsteilinstanz - private $partInstance = null; - - // Abmasse (Breite/Hoehe/Laenge) - private $width = 0; - private $height = 0; - private $length = 0; - - // Aktuelles Schiff und Schiffsteil - private $currShip = null; - private $currPart = null; - - // Faktoren zur Erweiterung der Masse. Beispielsweise soll der Maschinenraum groesser wie der Motor sein - private $resizeFactorArray = array( - 'width' => 1, - 'height' => 1, - 'length' => 1 - ); - - // Konstruktor - protected function __construct ($className) { - // Call highest constructor - parent::__construct($className); - - // Clean up a little, dies sollte ganz zum Schluss erfolgen! - $this->removeResizeFactorArray(); - $this->removeCurrPart(); - $this->removeCurrShip(); - } - - // Setter-Methode fuer Laenge - public final function setLength ($length) { - $this->length = (float) $length; - } - - // Setter-Methode fuer Breite - public final function setWidth ($width) { - $this->width = (float) $width; - } - - // Setter-Methode fuer Hoehe - public final function setHeight ($height) { - $this->height = (float) $height; - } - - // Getter-Methode fuer Laenge - public final function getLength () { - return $this->length; - } - - // Getter-Methode fuer Breite - public final function getWidth () { - return $this->width; - } - - // Getter-Methode fuer Hoehe - public final function getHeight () { - return $this->height; - } - - // Setter-Methode fuer Teil-Instanz - public final function setPartInstance (ConstructableShipPart $partInstance) { - $this->partInstance = $partInstance; - } - - // Getter-Methode fuer Teil-Instanz - public final function getPartInstance () { - if (!isset($this->partInstance)) { - return null; - } - return $this->partInstance; - } - - // Remover-Methode fuer die Teil-Instanz - public final function removePartInstance () { - unset($this->partInstance); - } - - // Prueft ob all Umberechnungsfaktoren gesetzt sind - private function isResizeFactorValid () { - return (($this->getResizeFactorElement('width') > 1) - || ($this->getResizeFactorElement('height') > 1) - || ($this->getResizeFactorElement('length') > 1) - ); - } - - // Baut einen Motor in das Schiff ein - public function addShipPartToShip (ConstructableShip $shipInstance, ConstructableShipPart $partInstance) { - // Schiff/-steil merken - $this->currShip = $shipInstance; - $this->currPart = $partInstance; - - // Passt ueberhaupt das Schiffsteil in's Schiff? - if ($this->isShipPartSizeValid()) { - // Muessen die Masse angepasst werden? - if ($this->isResizeFactorValid()) { - // Neue Angaben berechnen (wir lassen etwas Lust fuer Kabelbaeume, Roehren, Maschinisten, etc.) - $this->newWidth = (float) $this->getCurrPart()->getWidth() * $this->resizeFactorArray['width']; - $this->newHeight = (float) $this->getCurrPart()->getHeight() * $this->resizeFactorArray['height']; - $this->newLength = (float) $this->getCurrPart()->getLength() * $this->resizeFactorArray['length']; - - // Passt dies nun immer noch? - if ($this->isNewSizeValid()) { - // Das passt auch, dann Werte setzen und Motor-Instanz merken - $this->setWidth($this->newWidth); - $this->setHeight($this->newHeight); - $this->setLength($this->newLength); - - // Einige Dinge entfernen... - $this->removeAllNewAttr(); - } else { - // Passt nicht! Also wieder Exception werfen... - throw new StructureShipMismatchException(sprintf("[%s:] Das Schiffsteil %s vom Typ %s ist zu gross für das Schiff!", - $this->getCurrPart()->__toString(), - $this->getCurrPart()->getObjectDescription(), - $this->getCurrPart()->__toString() - ), 2); - } - } elseif ($this->currPart != null) { - // Aktuelle Masse setzen - $this->setWidth($this->getCurrPart()->getWidth()); - $this->setHeight($this->getCurrPart()->getHeight()); - $this->setLength($this->getCurrPart()->getLength()); - } - - // Existiert ein Schiffsteil? - if (!is_null($this->currPart)) { - // Schiffsteil-Instanz setzen - $this->setPartInstance($this->currPart); - - // Instanzen entfernen - $this->getCurrPart()->removeCurrShip(); - $this->getCurrPart()->removeCurrPart(); - $this->getCurrPart()->removePartInstance(); - $this->getCurrPart()->removeResizeFactorArray(); - } - } else { - // Exception werfen! - throw new StructureShipMismatchException(sprintf("[%s:] Das Schiffsteil %s vom Typ %s passt nicht in das Schiff!", - $this->getCurrPart()->realClass, - $this->getCurrPart()->getObjectDescription(), - $this->getCurrPart()->__toString() - ), 1); - } - - // Nochmals Clean up a little - $this->removeResizeFactorArray(); - $this->removeCurrShip(); - $this->removeCurrPart(); - } - - // Array fuer Umrechnungstabelle entfernen - public final function removeResizeFactorArray () { - unset($this->resizeFactorArray); - } - - /** - * Remove all new*** attributes - * - * @return void - */ - public final function removeAllNewAttr () { - unset($this->newWidth); - unset($this->newHeight); - unset($this->newLength); - } - - /** - * Remove current ship instance - * - * @return void - */ - public final function removeCurrShip () { - unset($this->currShip); - } - - // Aktuelle Schiffsteil-Instanz entfernen - public final function removeCurrPart () { - unset($this->currPart); - } - - // Breite entfernen - public final function removeWidth () { - unset($this->width); - } - - // Hoehe entfernen - public final function removeHeight () { - unset($this->height); - } - - // Laenge entfernen - public final function removeLength () { - unset($this->length); - } - - // Tiefgang entfernen - public final function removeDraught () { - unset($this->draught); - } - - // Getter-Methode fuer Element aus resizeFactor - public final function getResizeFactorElement ($el) { - if (isset($this->resizeFactorArray[$el])) { - // Element gefunden - return $this->resizeFactorArray[$el]; - } else { - // Element nicht gefunden! - return null; - } - } - - // Setter-Methode fuer Element in resizeFactor - public final function setResizeFactorElement ($el, $value) { - $this->resizeFactorArray[$el] = (float) $value; - } - - // Kontrolliert, ob die Abmasse Schiffsteil->Schiff stimmen - public function isShipPartSizeValid () { - return ( - ( - ( // Already defined ship messurings - ($this->getCurrPart()->getWidth() < $this->currShip->getWidth()) - && ($this->getCurrPart()->getHeight() < $this->currShip->getDraught()) - && ($this->getCurrPart()->getLength() < $this->currShip->getLength()) - ) || ( // Ship messurings shall be calculated - ($this->currShip->getWidth() == 0) - && ($this->currShip->getHeight() == 0) - && ($this->currShip->getLength() == 0) - ) - // The inserted part must be messured! - ) && ($this->getCurrPart()->getWidth() > 0) - && ($this->getCurrPart()->getHeight() > 0) - && ($this->getCurrPart()->getLength() > 0) - ); - } - - // Kontrolliert, ob die Abmasse Maschinenraum->Schiff stimmen - public function isNewSizeValid () { - return ( - ( // Already defined ship messurings - ($this->newWidth < $this->currShip->getWidth()) - && ($this->newHeight < $this->currShip->getDraught()) - && ($this->newLength < $this->currShip->getLength()) - ) || ( // Ship messurings shall be calculated - ($this->currShip->getWidth() == 0) - && ($this->currShip->getHeight() == 0) - && ($this->currShip->getLength() == 0) - ) - ); - } - - // Masse extrahieren - public function extractDimensions ($dim) { - // Abmasse setzen - if ((isset($dim)) && (is_array($dim)) && (count($dim) == 3)) { - // Abmasse aus Array holen - $this->setWidth($dim[0]); - $this->setHeight($dim[1]); - $this->setLength($dim[2]); - } else { - // Nicht gefundene Abmasse! - throw new DimNotFoundInArrayException($this, self::EXCEPTION_DIMENSION_ARRAY_INVALID); - } - } - - /** - * Getter for current part instance - * - * @return $currPart Instance of the current ship part object - */ - public final function getCurrPart () { - return $this->currPart; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/class_Merchant.php b/application/shipsimu/main/class_Merchant.php deleted file mode 100644 index 648e299..0000000 --- a/application/shipsimu/main/class_Merchant.php +++ /dev/null @@ -1,109 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class Merchant extends BaseFrameworkSystem { - // Name des Haendlers - private $merchantName = "Namenloser Händler"; - - // Preislite (Objekte wiedermal!) - private $priceList = null; - - // Zugewiesener Hafen - private $harborInstance = null; - - // Konstruktor - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - // Haendler mit Namen erzeugen - public static final function createMerchant ($merchantName, Harbor $harborInstance) { - // String absichern - $merchantName = (string) $merchantName; - - // Get new instance - $merchantInstance = new Merchant(); - - // Debug message - if ((defined('DEBUG_MERCHANT')) || (defined('DEBUG_ALL'))) { - $merchantInstance->debugOutput(sprintf("[%s:%d] Ein Händler %s wird angelegt und soll sich am %s niederlassen.", - __CLASS__, - __LINE__, - $merchantName, - $harborInstance->getHarborName() - )); - } - - // Haendlernamen setzen - $merchantInstance->setMerchantName($merchantName); - - // In dem angegebenen Hafen den Haendler ansiedeln - $merchantInstance->setHarborInstance($harborInstance); - - // Preisliste initialisieren - $merchantInstance->createPriceList(); - - // Instanz zurueckliefern - return $merchantInstance; - } - - // Initialize pricing list - private function createPriceList () { - $this->priceList = new FrameworkArrayObject("FakedPriceList"); - } - - // Setter for merchant name - public final function setMerchantName ($merchantName) { - // Debug message - $this->merchantName = (string) $merchantName; - } - - // Getter for merchant name - public final function getMerchantName () { - return $this->merchantName; - } - - // Setter for harbor instance - public final function setHarborInstance (Harbor $harborInstance) { - $this->harborInstance = $harborInstance; - } - - // Getter for harbor instance - public final function getHarborInstance () { - return $this->harborInstance; - } - - // Add new item to merchant's price list - public function addItemToPriceList (TradeableItem $itemInstance, $price) { - $this->makeDeprecated(); - } - - // Get a price from the merchant's list - public final function getPriceFromList (TradeableItem $itemInstance) { - $this->makeDeprecated(); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/class_WorksContract.php b/application/shipsimu/main/class_WorksContract.php deleted file mode 100644 index bbe2f35..0000000 --- a/application/shipsimu/main/class_WorksContract.php +++ /dev/null @@ -1,329 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class WorksContract extends BaseFrameworkSystem implements SignableContract { - // Zukuenftiger Schiffsname - private $shipName = ""; - - // Instanz zum Schiffstypen - private $shipInstance = null; - - // Contract partner - private $contractPartner = null; - - // Other contract partner - private $contractParty = null; - - // Is the contract signed? - private $signed = false; - - // Merchant instance - private $merchantInstance = null; - - // Konstruktor - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - // Neuen Bauvertrag generieren - public static final function createWorksContract ($shipType, $shipName, ContractPartner $partnerInstance) { - // Strings absichern - $shipType = (string) $shipType; - $shipName = (string) $shipName; - - // Get new instance - $contractInstance = new WorksContract(); - - // Schiffsnamen setzen - $contractInstance->setShipName($shipName); - - // Existiert die Klasse ueberhaupt? - if (!class_exists($shipType)) { - // Klasse nicht gefunden - throw new NoClassException ($shipType, self::EXCEPTION_CLASS_NOT_FOUND); - } - - // Schiff-Instanz temporaer erzeugen und in den Bauvertrag einfuegen - $shipInstance = ObjectFactory::createObjectByName($shipType, array($shipName)); - $contractInstance->setShipInstance($shipInstance); - - // Remove the ship instance - unset($shipInstance); - - // Set itself as contract partner - $contractInstance->setContractPartner($partnerInstance); - - // Instanz zurueckgeben - return $contractInstance; - } - - // Setter for ship instance - private final function setShipInstance (ConstructableShip $shipInstance) { - $this->shipInstance = $shipInstance; - } - - // Setter for ship name - private final function setShipName ($shipName) { - $this->shipName = (string) $shipName; - } - - // Getter for ship name - public final function getShipName () { - return $this->shipName; - } - - // Getter for ship instance - public final function getShipInstance () { - return $this->shipInstance; - } - - // Add detail to the contract - public function addContractDetails ($shipPart, $parentPart, array $dataArray) { - // Secure strings - $shipPart = (string) $shipPart; - $parentPart = (string) $parentPart; - - // Debug message - if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiffsteil %s wird zusammen mit dem Konstruktionsteil %s in den Bauvertrag aufgenommen.", - __CLASS__, - __LINE__, - $shipPart, - $parentPart - )); - - // Initialize the instance (shall not be done within dynamic part) - $partInstance = null; - - // Try to get an instance for this ship part - try { - $partInstance = ObjectFactory::createObjectByName($shipPart, $dataArray); - } catch (DimNotFoundInArrayException $e) { - $this->debugOutput(sprintf("[main:] Die %s konnte nicht vervollständigt werden. Grund: %s
", - $this->getShipInstance()->getShipName(), - $e->getMessage() - )); - - // Debug message - if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Versuche ein Schiffsteil in den Bauvertrag aufzunehmen.", - __CLASS__, - __LINE__ - )); - - // Is this ship part constructable? - if (!$partInstance instanceof ConstructableShipPart) { - // Ship part not constructable! - throw new ShipPartNotConstructableException(array($shipPart), self::EXCEPTION_NOT_CONSTRUCTABLE); - } elseif ($this->getShipInstance()->createShipPart($partInstance, $parentPart) === false) { - // Schiff konnte nicht gebaut werden! - throw new ShipNotConstructedException(sprintf("Das Schiff %s konnte wegen eines Fehlers nicht gebaut werden. Siehe obere Meldungen.", - $this->getShipInstance()->getShipName() - )); - } - } catch (NoClassException $e) { - // Throw it again... - throw new NoClassException($e->getMessage(), $e->getCode()); - } - - // Get price for this item - $price = $this->getMerchantInstance()->getPriceFromList($partInstance); - - // Add price - $partInstance->setPrice($price); - } - - // Setter for contract partner - public final function setContractPartner (ContractPartner $partnerInstance) { - $this->contractPartner = $partnerInstance; - } - - // Getter for contract partner - public final function getContractPartner () { - return $this->contractPartner; - } - - // Setter for contract party - public final function setContractParty (ContractPartner $partyInstance) { - $this->contractParty = $partyInstance; - } - - // Getter for contract party - public final function getContractParty () { - return $this->contractParty; - } - - // Setter for signature - public final function setSigned ($signed) { - $this->signed = (boolean) $signed; - } - - // Getter for signature - public function isSigned () { - return $this->signed; - } - - // Sign the contract - public function signContract (ContractPartner $partnerInstance, ContractPartner $partyInstance) { - // Is this contract already signed? - if ($this->isSigned()) { - // Throw an exception - throw new ContractAllreadySignedException(array($this, $this->getContractPartner(), $this->getContractParty()), self::EXCEPTION_CONTRACT_ALREADY_SIGNED); - } - - // Is the first contract partner still the same? - if ($partnerInstance->equals($this->getContractPartner())) { - // Set contract party (other partner is already set) - $this->setContractParty($partyInstance); - - // Finally sign it - $this->setSigned(true); - } else { - // Throw an exception - throw new ContractPartnerMismatchException(array($this, $this->getContractPartner(), $partyInstance), self::EXCEPTION_CONTRACT_PARTNER_MISMATCH); - } - - // Debug message - if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) { - if ($partnerInstance->equals($partyInstance)) { - // With itself - $this->debugOutput(sprintf("[%s:%d] Die %s %s stimmt einem Bauvertrag über das %s %s zu.", - __CLASS__, - __LINE__, - $partnerInstance->getObjectDescription(), - $partnerInstance->getCompanyName(), - $this->getShipInstance()->getObjectDescription(), - $this->getShipInstance()->getShipName() - )); - } else { - // Other contract party - $this->debugOutput(sprintf("[%s:%d] Die %s %s geht mit der %s %s einen Bauvertrag über das %s %s ein.", - __CLASS__, - __LINE__, - $partnerInstance->getObjectDescription(), - $partnerInstance->getCompanyName(), - $partyInstance->getObjectDescription(), - $partyInstance->getCompanyName(), - $this->getShipInstance()->getObjectDescription(), - $this->getShipInstance()->getShipName() - )); - } - } - } - - // Setter for merchant instance - public final function setMerchantInstance (Merchant $merchantInstance) { - $this->merchantInstance = $merchantInstance; - } - - // Getter for merchant instance - public final function getMerchantInstance () { - return $this->merchantInstance; - } - - // Getter for total price - public final function getTotalPrice () { - // Get ship instance - $shipInstance = $this->getShipInstance(); - - // Is this a ship? - if (is_null($shipInstance)) { - // Opps! Empty partner instance? - throw new NullPointerException($shipInstance, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($shipInstance)) { - // Not an object! ;-( - throw new InvalidObjectException($shipInstance, self::EXCEPTION_IS_NO_OBJECT); - } elseif (!$shipInstance instanceof ConstructableShip) { - // Does not have the required feature (method) - throw new ShipIsInvalidException(array($shipInstance), self::EXCEPTION_INVALID_SHIP_INSTANCE); - } - - // Get the structure array - $struct = $shipInstance->getStructuresArray(); - - // Is this a ship? - if (is_null($struct)) { - // Opps! Empty partner instance? - throw new EmptyStructuresListException($this, self::EXCEPTION_EMPTY_STRUCTURES_ARRAY); - } - - // Init total price - $totalPrice = 0; - - // Iterate through the list - for ($iter = $struct->getIterator(); $iter->valid(); $iter->next()) { - // Get item - $item = $iter->current(); - - // Is this a ship? - if (is_null($item)) { - // Opps! Empty partner instance? - throw new NullPointerException($item, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($item)) { - // Not an object! ;-( - throw new InvalidObjectException($item, self::EXCEPTION_IS_NO_OBJECT); - } elseif (!$item instanceof BaseSimulator) { - // Does not have the required feature (method) - throw new MissingMethodException(array($item, 'getPartInstance'), self::EXCEPTION_MISSING_METHOD); - } - - // Get part instance - $part = $item->getPartInstance(); - - // Is this a ship? - if (is_null($part)) { - // Opps! Empty partner instance? - throw new NullPointerException($part, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($part)) { - // Not an object! ;-( - throw new InvalidObjectException($part, self::EXCEPTION_IS_NO_OBJECT); - } elseif (!method_exists($part, 'getPrice')) { - // Does not have the required feature (method) - throw new MissingMethodException(array($part, 'getPrice'), self::EXCEPTION_MISSING_METHOD); - } - - // Get price for one item - $price = $part->getPrice(); - - // Is there numCabin() available? - if (method_exists($item, 'getNumCabin')) { - // Get total cabin and multiply it with the price - $price = $price * $item->getNumCabin(); - } - - // Add price to total price - $totalPrice += $price; - } - - // Total price calculated? - if ($totalPrice === 0) { - // Throw exception - throw new TotalPriceNotCalculatedException($this, self::EXCEPTION_TOTAL_PRICE_NOT_CALCULATED); - } - - // Return total price - return $totalPrice; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/commands/.htaccess b/application/shipsimu/main/commands/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/commands/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/commands/web/.htaccess b/application/shipsimu/main/commands/web/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/commands/web/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/commands/web/class_WebShipsimuGuestLoginCommand.php b/application/shipsimu/main/commands/web/class_WebShipsimuGuestLoginCommand.php deleted file mode 100644 index 14015a3..0000000 --- a/application/shipsimu/main/commands/web/class_WebShipsimuGuestLoginCommand.php +++ /dev/null @@ -1,112 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class WebShipsimuGuestLoginCommand extends BaseCommand implements Commandable { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this command and sets the resolver instance - * - * @param $resolverInstance An instance of a command resolver - * @return $commandInstance The created command instance - */ - public static final function createWebShipsimuGuestLoginCommand (CommandResolver $resolverInstance) { - // Get a new instance - $commandInstance = new WebShipsimuGuestLoginCommand(); - - // Set the resolver instance - $commandInstance->setResolverInstance($resolverInstance); - - // Return the prepared instance - return $commandInstance; - } - - /** - * 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 - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // First get a GuestLogin instance - $loginInstance = ObjectFactory::createObjectByConfiguredName('guest_login_class'); - - // First set request and response instance - $loginInstance->setRequestInstance($requestInstance); - - // Encrypt the password - $loginInstance->encryptPassword('passwd'); - - // Do the login here - $loginInstance->doLogin($requestInstance, $responseInstance); - - // Was the login fine? Then redirect here - if ($loginInstance->ifLoginWasSuccessfull()) { - // Try to redirect here - try { - // Redirect... - $responseInstance->redirectToConfiguredUrl('app_login'); - - // Exit here - exit(); - } catch (FrameworkException $e) { - // Something went wrong here! - $responseInstance->addFatalMessage($e->getMessage()); - } - } else { - // Attach error message to the response - $responseInstance->addFatalMessage('failed_user_login'); - } - } - - /** - * 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 more filters - */ - public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { - // Add username verifier filter - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_guest_verifier_filter')); - - // Add password verifier filter - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('passwd_guest_verifier_filter')); - - // Add CAPTCHA verifier code - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_guest_verifier_filter')); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/commands/web/class_WebShipsimuProfileCommand.php b/application/shipsimu/main/commands/web/class_WebShipsimuProfileCommand.php deleted file mode 100644 index a266f26..0000000 --- a/application/shipsimu/main/commands/web/class_WebShipsimuProfileCommand.php +++ /dev/null @@ -1,153 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class WebShipsimuProfileCommand extends BaseCommand implements Commandable { - /** - * Filtered request data - */ - private $requestData = array(); - - /** - * Allowed profile data to pass through - */ - private $allowedData = array( - 'pass' => 'pass1', - 'email' => 'email1', - 'surname', - 'family', - 'street', - 'city', - 'zip', - 'icq', - 'jabber', - 'yahoo', - 'aol', - 'msn', - 'rules', - 'birth_day', - 'birth_month', - 'birth_year' - ); - - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this command and sets the resolver instance - * - * @param $resolverInstance An instance of a command resolver - * @return $commandInstance The created command instance - */ - public static final function createWebShipsimuProfileCommand (CommandResolver $resolverInstance) { - // Get a new instance - $commandInstance = new WebShipsimuProfileCommand(); - - // Set the resolver instance - $commandInstance->setResolverInstance($resolverInstance); - - // Return the prepared instance - return $commandInstance; - } - - /** - * 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 Add functionality here - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Make sure only allowed values are comming through - foreach ($this->allowedData as $alias => $element) { - // Get data - $data = $requestInstance->getRequestElement($element); - - // Silently skip empty fields - if (empty($data)) continue; - - // Do we have an alias? - if (is_string($alias)) { - // Yes, so use it - $this->requestData[$alias] = $data; - } else { - // No, default entry - $this->requestData[$element] = $data; - } - } // END - foreach - - // Remove the array, we don't need it anymore - unset($this->allowedData); - - // Unfinished! - $this->partialStub("Unfinished work."); - $this->debugBackTrace(); - } - - /** - * 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 pre/post filters to the controller - */ - public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { - // 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')); - - // User status filter - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); - - // User status if not 'guest' filter - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_guest_filter')); - - // Updated rules accepted - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('rules_accepted_filter')); - - // Account password validation - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('account_password_filter')); - - // Validate CAPTCHA input - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_profile_verifier_filter')); - - // Validate birthday input - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('birthday_profile_verifier_filter')); - - // Email changed - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_change_filter')); - - // Password changed - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_change_filter')); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/commands/web/class_WebShipsimuRefillCommand.php b/application/shipsimu/main/commands/web/class_WebShipsimuRefillCommand.php deleted file mode 100644 index 1c9bd8e..0000000 --- a/application/shipsimu/main/commands/web/class_WebShipsimuRefillCommand.php +++ /dev/null @@ -1,112 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class WebShipsimuRefillCommand extends BaseCommand implements Commandable { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this command and sets the resolver instance - * - * @param $resolverInstance An instance of a command resolver - * @return $commandInstance The created command instance - */ - public static final function createWebShipsimuRefillCommand (CommandResolver $resolverInstance) { - // Get a new instance - $commandInstance = new WebShipsimuRefillCommand(); - - // Set the resolver instance - $commandInstance->setResolverInstance($resolverInstance); - - // Return the prepared instance - return $commandInstance; - } - - /** - * 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 - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Get template instance - $templateInstance = $responseInstance->getTemplateInstance(); - - // Set amount and type as variables - $templateInstance->assignVariable('refill_done', $requestInstance->getRequestElement('type')); - $templateInstance->assignVariable('amount' , $requestInstance->getRequestElement('amount')); - - // This method does currently redirect if all goes right. Booking is done in filters - $responseInstance->redirectToConfiguredUrl('refill_page_done'); - } - - /** - * 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 - */ - public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { - // 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')); - - // Add user status filter here - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); - - // Is the refill page active? - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('refill_page_filter')); - - // Verify password - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('account_password_filter')); - - // Verify CAPTCHA code - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_refill_verifier_filter')); - - // Verify refill request - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('refill_request_validator_filter')); - - // Construct config entry for wether automatic payment from API or waiting for approval - $paymentTypeConfig = sprintf("refill_request_%s_payment_type", $requestInstance->getRequestElement('type')); - - // Prepare a filter based on the requested type we shall refill - $filterName = sprintf("refill_request_%s_%s_book_filter", - $requestInstance->getRequestElement('type'), - $this->getConfigInstance()->getConfigEntry($paymentTypeConfig) - ); - - // Now, try to load that filter - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName($filterName)); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/commands/web/class_WebShipsimuRegisterCommand.php b/application/shipsimu/main/commands/web/class_WebShipsimuRegisterCommand.php deleted file mode 100644 index 181ce2f..0000000 --- a/application/shipsimu/main/commands/web/class_WebShipsimuRegisterCommand.php +++ /dev/null @@ -1,117 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class WebShipsimuRegisterCommand extends BaseCommand implements Commandable { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this command and sets the resolver instance - * - * @param $resolverInstance An instance of a command resolver - * @return $commandInstance The created command instance - */ - public static final function createWebShipsimuRegisterCommand (CommandResolver $resolverInstance) { - // Get a new instance - $commandInstance = new WebShipsimuRegisterCommand(); - - // Set the resolver instance - $commandInstance->setResolverInstance($resolverInstance); - - // Return the prepared instance - return $commandInstance; - } - - /** - * 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 - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // First get a UserRegistration instance - $registerInstance = ObjectFactory::createObjectByConfiguredName('user_registration_class'); - - // First set request and response instance - $registerInstance->setRequestInstance($requestInstance); - $registerInstance->setResponseInstance($responseInstance); - - // Encrypt the password - $registerInstance->encryptPassword('pass1'); - - // Do things before registration - $registerInstance->doPreRegistration(); - - // Register the new user - $registerInstance->registerNewUser(); - - // Do things after registration like notifying partner pages or queueing - // them for notification - $registerInstance->doPostRegistration(); - - // Redirect or login after registration - $registerInstance->doPostAction(); - } - - /** - * 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 pre/post filters to the controller - */ - public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { - // Validate email address (if configured: check on double email addresses) - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_validator_filter')); - - // Validate username and check if it does not exist - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_validator_filter')); - - // Validate if username is "guest" and not taken - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_is_guest_filter')); - - // Validate if password is set - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_validator_filter')); - - // Check if rules where accepted - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('rules_accepted_filter')); - - // Validate CAPTCHA input - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_register_verifier_filter')); - - // Validate birthday - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('birthday_register_verifier_filter')); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/commands/web/class_WebShipsimuUserLoginCommand.php b/application/shipsimu/main/commands/web/class_WebShipsimuUserLoginCommand.php deleted file mode 100644 index 2a33a8f..0000000 --- a/application/shipsimu/main/commands/web/class_WebShipsimuUserLoginCommand.php +++ /dev/null @@ -1,124 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class WebShipsimuUserLoginCommand extends BaseCommand implements Commandable { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this command and sets the resolver instance - * - * @param $resolverInstance An instance of a command resolver - * @return $commandInstance The created command instance - */ - public static final function createWebShipsimuUserLoginCommand (CommandResolver $resolverInstance) { - // Get a new instance - $commandInstance = new WebShipsimuUserLoginCommand(); - - // Set the resolver instance - $commandInstance->setResolverInstance($resolverInstance); - - // Return the prepared instance - return $commandInstance; - } - - /** - * 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 - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // First get a UserLogin instance - $loginInstance = ObjectFactory::createObjectByConfiguredName('user_login_class'); - - // First set request and response instance - $loginInstance->setRequestInstance($requestInstance); - - // Encrypt the password - $loginInstance->encryptPassword('pass'); - - // Do the login here - $loginInstance->doLogin($requestInstance, $responseInstance); - - // Was the login fine? Then redirect here - if ($loginInstance->ifLoginWasSuccessfull()) { - // Try to redirect here - try { - // Redirect... - $responseInstance->redirectToConfiguredUrl('app_login'); - - // Exit here - exit(); - } catch (FrameworkException $e) { - // Something went wrong here! - $responseInstance->addFatalMessage($e->getMessage()); - } - } else { - // Attach error message to the response - $responseInstance->addFatalMessage('failed_user_login'); - } - } - - /** - * 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 more filters - */ - public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { - // Which login type do we have? - switch ($this->getConfigInstance()->getConfigEntry('login_type')) { - case 'username': // Login via username - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_verifier_filter')); - break; - - case 'email': // Login via email - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_verifier_filter')); - break; - - default: // Wether username or email is set - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_email_verifier_filter')); - break; - } - - // Password verifier filter - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_verifier_filter')); - - // Add filter for CAPTCHA - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_user_verifier_filter')); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/commands/web/company/.htaccess b/application/shipsimu/main/commands/web/company/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/commands/web/company/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/commands/web/company/class_WebShipSimuCompanyCommand.php b/application/shipsimu/main/commands/web/company/class_WebShipSimuCompanyCommand.php deleted file mode 100644 index 7fed46f..0000000 --- a/application/shipsimu/main/commands/web/company/class_WebShipSimuCompanyCommand.php +++ /dev/null @@ -1,88 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class WebShipSimuCompanyCommand extends BaseCommand implements Commandable { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this command and sets the resolver instance - * - * @param $resolverInstance An instance of a command resolver - * @return $commandInstance The created command instance - */ - public static final function createWebShipSimuCompanyCommand (CommandResolver $resolverInstance) { - // Get a new instance - $commandInstance = new WebShipSimuCompanyCommand(); - - // Set the resolver instance - $commandInstance->setResolverInstance($resolverInstance); - - // Return the prepared instance - return $commandInstance; - } - - /** - * 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 - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Get template instance - $templateInstance = $responseInstance->getTemplateInstance(); - - // Set amount and type as variables - $templateInstance->assignVariable('refill_done', $requestInstance->getRequestElement('type')); - $templateInstance->assignVariable('amount' , $requestInstance->getRequestElement('amount')); - - // This method does currently redirect if all goes right - $responseInstance->redirectToConfiguredUrl('refill_page_done'); - } - - /** - * 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 - */ - public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { - // 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')); - - // Add user status filter here - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/commands/web/government/.htaccess b/application/shipsimu/main/commands/web/government/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/commands/web/government/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/commands/web/government/class_WebGovernmentFailedStartupCommand.php b/application/shipsimu/main/commands/web/government/class_WebGovernmentFailedStartupCommand.php deleted file mode 100644 index 54ddb05..0000000 --- a/application/shipsimu/main/commands/web/government/class_WebGovernmentFailedStartupCommand.php +++ /dev/null @@ -1,146 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class WebGovernmentFailedStartupCommand extends BaseCommand implements Commandable { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this class - * - * @param $resolverInstance An instance of a command resolver class - * @return $commandInstance An instance a prepared command class - */ - public static final function createWebGovernmentFailedStartupCommand (CommandResolver $resolverInstance) { - // Get new instance - $commandInstance = new WebGovernmentFailedStartupCommand(); - - // Set the application instance - $commandInstance->setResolverInstance($resolverInstance); - - // Return the prepared instance - return $commandInstance; - } - - /** - * Executes the given 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) { - // Get the action instance from registry - $actionInstance = Registry::getRegistry()->getInstance('action'); - - // Do we have an action here? - if ($actionInstance instanceof PerformableAction) { - // Execute the action (shall not output anything, see below why) - $actionInstance->execute($requestInstance, $responseInstance); - } // END - if - - // Get the application instance - $appInstance = $this->getResolverInstance()->getApplicationInstance(); - - // Prepare a template instance - $templateInstance = $this->prepareTemplateInstance($appInstance); - - // Assign base URL - $templateInstance->assignConfigVariable('base_url'); - - // Assign all the application's data with template variables - $templateInstance->assignApplicationData($appInstance); - - // Load the master template - $masterTemplate = $appInstance->buildMasterTemplateName(); - - // Load header template - $templateInstance->loadCodeTemplate('header'); - - // Compile and assign it with a variable - $templateInstance->compileTemplate(); - $templateInstance->assignTemplateWithVariable('header', 'header'); - - // Load footer template - $templateInstance->loadCodeTemplate('footer'); - - // Compile and assign it with a variable - $templateInstance->compileTemplate(); - $templateInstance->assignTemplateWithVariable('footer', 'footer'); - - // Load main template - $templateInstance->loadCodeTemplate('government_failed_main'); - - // Assign the main template with the master template as a content ... ;) - $templateInstance->compileTemplate(); - $templateInstance->assignTemplateWithVariable('government_failed_main', 'main_content'); - - // Load the master template - $templateInstance->loadCodeTemplate($masterTemplate); - - // Set title - $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage($requestInstance->getRequestElement('page') . '_' . $requestInstance->getRequestElement('failed') . '_title')); - - // Construct the menu in every command. We could do this in BaseCommand class. But this means - // *every* command has a navigation system and that is want we don't want. - $menuInstance = ObjectFactory::createObjectByConfiguredName('government_failed_area_menu_class', array($appInstance)); - - // Render the menu - $menuInstance->renderMenu(); - - // Transfer it to the template engine instance - $menuInstance->transferContentToTemplateEngine(); - - // ... and all variables. This should be merged together in a pattern - // to make things easier. A cache mechanism should be added between - // these two calls to cache compiled templates. - $templateInstance->compileVariables(); - - // Get the content back from the template engine and put it in response class - $templateInstance->transferToResponse($responseInstance); - } - - /** - * 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 Maybe we need some filters here? - */ - public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { - // Empty for now - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/commands/web/government/class_WebGovernmentFailedTrainingCommand.php b/application/shipsimu/main/commands/web/government/class_WebGovernmentFailedTrainingCommand.php deleted file mode 100644 index 7119196..0000000 --- a/application/shipsimu/main/commands/web/government/class_WebGovernmentFailedTrainingCommand.php +++ /dev/null @@ -1,146 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class WebGovernmentFailedTrainingCommand extends BaseCommand implements Commandable { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this class - * - * @param $resolverInstance An instance of a command resolver class - * @return $commandInstance An instance a prepared command class - */ - public static final function createWebGovernmentFailedTrainingCommand (CommandResolver $resolverInstance) { - // Get new instance - $commandInstance = new WebGovernmentFailedTrainingCommand(); - - // Set the application instance - $commandInstance->setResolverInstance($resolverInstance); - - // Return the prepared instance - return $commandInstance; - } - - /** - * Executes the given 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) { - // Get the action instance from registry - $actionInstance = Registry::getRegistry()->getInstance('action'); - - // Do we have an action here? - if ($actionInstance instanceof PerformableAction) { - // Execute the action (shall not output anything, see below why) - $actionInstance->execute($requestInstance, $responseInstance); - } // END - if - - // Get the application instance - $appInstance = $this->getResolverInstance()->getApplicationInstance(); - - // Prepare a template instance - $templateInstance = $this->prepareTemplateInstance($appInstance); - - // Assign base URL - $templateInstance->assignConfigVariable('base_url'); - - // Assign all the application's data with template variables - $templateInstance->assignApplicationData($appInstance); - - // Load the master template - $masterTemplate = $appInstance->buildMasterTemplateName(); - - // Load header template - $templateInstance->loadCodeTemplate('header'); - - // Compile and assign it with a variable - $templateInstance->compileTemplate(); - $templateInstance->assignTemplateWithVariable('header', 'header'); - - // Load footer template - $templateInstance->loadCodeTemplate('footer'); - - // Compile and assign it with a variable - $templateInstance->compileTemplate(); - $templateInstance->assignTemplateWithVariable('footer', 'footer'); - - // Load main template - $templateInstance->loadCodeTemplate('government_failed_main'); - - // Assign the main template with the master template as a content ... ;) - $templateInstance->compileTemplate(); - $templateInstance->assignTemplateWithVariable('government_failed_main', 'main_content'); - - // Load the master template - $templateInstance->loadCodeTemplate($masterTemplate); - - // Set title - $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage($requestInstance->getRequestElement('command') . '_' . $requestInstance->getRequestElement('failed') . '_title')); - - // Construct the menu in every command. We could do this in BaseCommand class. But this means - // *every* command has a navigation system and that is want we don't want. - $menuInstance = ObjectFactory::createObjectByConfiguredName('government_failed_area_menu_class', array($appInstance)); - - // Render the menu - $menuInstance->renderMenu(); - - // Transfer it to the template engine instance - $menuInstance->transferContentToTemplateEngine(); - - // ... and all variables. This should be merged together in a pattern - // to make things easier. A cache mechanism should be added between - // these two calls to cache compiled templates. - $templateInstance->compileVariables(); - - // Get the content back from the template engine and put it in response class - $templateInstance->transferToResponse($responseInstance); - } - - /** - * 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 Maybe we need some filters here? - */ - public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { - // Empty for now - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/commands/web/government/class_WebShipsimuGovernmentStartupCommand.php b/application/shipsimu/main/commands/web/government/class_WebShipsimuGovernmentStartupCommand.php deleted file mode 100644 index 3153962..0000000 --- a/application/shipsimu/main/commands/web/government/class_WebShipsimuGovernmentStartupCommand.php +++ /dev/null @@ -1,96 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class WebShipsimuGovernmentStartupCommand extends BaseCommand implements Commandable { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this class - * - * @param $resolverInstance An instance of a command resolver class - * @return $commandInstance An instance a prepared command class - */ - public static final function createWebShipsimuGovernmentStartupCommand (CommandResolver $resolverInstance) { - // Get new instance - $commandInstance = new WebShipsimuGovernmentStartupCommand(); - - // Set the application instance - $commandInstance->setResolverInstance($resolverInstance); - - // Return the prepared instance - return $commandInstance; - } - - /** - * Executes the given 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) { - // Get a wrapper instance - $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_gov_wrapper_class'); - - // Register the startup help - $wrapperInstance->registerStartupHelpByRequest($requestInstance); - } - - /** - * 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 Maybe we need some filters here? - */ - public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { - // 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')); - - // Add user status filter here - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); - - // Check if government can pay startup help - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('government_pays_startup_help_filter')); - - // Verify password - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('account_password_filter')); - - // Verify CAPTCHA code - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_government_verifier_filter')); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/commands/web/government/class_WebShipsimuGovernmentTrainingCommand.php b/application/shipsimu/main/commands/web/government/class_WebShipsimuGovernmentTrainingCommand.php deleted file mode 100644 index 035e5e8..0000000 --- a/application/shipsimu/main/commands/web/government/class_WebShipsimuGovernmentTrainingCommand.php +++ /dev/null @@ -1,94 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class WebShipsimuGovernmentTrainingCommand extends BaseCommand implements Commandable { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this class - * - * @param $resolverInstance An instance of a command resolver class - * @return $commandInstance An instance a prepared command class - */ - public static final function createWebShipsimuGovernmentTrainingCommand (CommandResolver $resolverInstance) { - // Get new instance - $commandInstance = new WebShipsimuGovernmentTrainingCommand(); - - // Set the application instance - $commandInstance->setResolverInstance($resolverInstance); - - // Return the prepared instance - return $commandInstance; - } - - /** - * Executes the given 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) { - // Get a wrapper instance - $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_gov_wrapper_class'); - - // Register the training - $wrapperInstance->registerTrainingByRequest($requestInstance); - } - - /** - * 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 Maybe we need some filters here? - */ - public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { - // 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')); - - // Add user status filter here - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter')); - - // Check if government can pay training help - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('government_pays_training_filter')); - - // Verify password - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('account_password_filter')); - - // Verify CAPTCHA code - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_refill_verifier_filter')); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/companies/.htaccess b/application/shipsimu/main/companies/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/companies/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/companies/class_ShippingCompany.php b/application/shipsimu/main/companies/class_ShippingCompany.php deleted file mode 100644 index cee5ccc..0000000 --- a/application/shipsimu/main/companies/class_ShippingCompany.php +++ /dev/null @@ -1,666 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class ShippingCompany extends BaseSimulator implements Customer, ContractPartner { - /** - * Full name of this company - */ - private $companyName = "Namenlose Reederei"; - - /** - * Shorted name of this company - */ - private $shortName = ""; - - /** - * Instance of the founder - */ - private $founderInstance = null; - - /** - * Headquarter harbor instance - */ - private $hqInstance = null; - - /** - * Employed people by this company - */ - private $employeeList = null; - - /** - * List of all assigned shipyards - */ - private $shipyardList = null; - - /** - * List of owned ships - */ - private $ownedShips = null; - - /** - * Work constracts this company is currently working on - */ - private $contractList = null; - - // Exception constants - const EXCEPTION_USER_OWNS_NO_COMPANY = 0x200; - - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this company class or throws an exception if the - * given user owns no company. - * - * @param $userInstance A user class - * @return $companyInstance Prepared company instance - * @todo Add functionality if user participates in a company - */ - public static final function createShippingCompany (ManageableAccount $userInstance) { - // Get new instance - $companyInstance = new ShippingCompany(); - - // Does the given user owns a company? - if ($companyInstance->ifUserParticipatesInCompany($userInstance)) { - // Then do some nasty caching here but don't throw an exception - // because then you will hurt our web helpers... :/ - $companyInstance->partialStub("Don't throw exceptions here."); - } // END - if - - // Init all lists - $companyInstance->initCompanyLists(); - - // Return instance - return $companyInstance; - } - - /** - * Checks wether the given user participates in a company - * - * @param $userInstance An instance of a user class - * @return $participates Wether the user participates at lease in one company - */ - protected function ifUserParticipatesInCompany (ManageableAccount $userInstance) { - // By default no user owns any company... ;) - $participates = false; - - // Get a company database wrapper class - $wrapperInstance = ObjectFactory::createObjectByConfiguredName('company_db_wrapper_class', array($this)); - - // Ask the wrapper if this user participates - $participates = $wrapperInstance->ifUserParticipatesInCompany($userInstance); - - // Get the result instance - $resultInstance = $wrapperInstance->getResultInstance(); - - // Caches the result instance here, if set (we don't the wrapper anymore!) - if ($resultInstance instanceof SearchableResult) { - // Set the result instance - $this->setResultInstance($resultInstance); - } // END - if - - // Return result - return $participates; - } - - /** - * Checks wether the current user in registry is the company founder - * - * @return $isFounder Wether the current user is the company founder - * @todo Check if user is company founder - */ - public function ifUserIsFounder () { - // Default is not the founder - $isFounder = false; - - // Get result instance - $resultInstance = $this->getResultInstance(); - - // Is it set? - if ($resultInstance instanceof SearchableResult) { - // Result found so analyse it - $this->partialStub("Check if user is company founder."); - } // END - if - - // Return result - return $isFounder; - } - - /** - * Checks wether the current user in registry is the company owner - * - * @return $isOwner Wether the current user is the company owner - * @todo Check if user is company owner - */ - public function ifUserIsOwner () { - // Default is not the owner - $isOwner = false; - - // Get result instance - $resultInstance = $this->getResultInstance(); - - // Is it set? - if ($resultInstance instanceof SearchableResult) { - // Result found so analyse it - $this->partialStub("Check if user is company owner."); - } // END - if - - // Return result - return $isOwner; - } - - /** - * Checks wether the current user in registry is an employee in this company - * - * @return $isOwner Wether the current user is an employee in this company - */ - public function ifUserIsEmployee () { - // Default is no employee - $isEmployee = false; - - // Get result instance - $resultInstance = $this->getResultInstance(); - - // Is it set? - if ($resultInstance instanceof SearchableResult) { - // Result found so he is employee - $isEmployee = true; - } // END - if - - // Return result - return $isEmployee; - } - - //------------------------------------------------------------------------------\ - // Below here is very old code which needs to be translated and changed heavily | - //------------------------------------------------------------------------------/ - - /** - * Intialize all lists - * - * @return void - * @todo Maybe we don't need these big lists anymore?! So we can deprecate/remove it - */ - protected function initCompanyLists () { - // Employees - $this->employeeList = new FrameworkArrayObject("FakedEmployeeList"); - - // Ship yards - $this->shipyardList = new FrameworkArrayObject("FakedShipyardList"); - - // Contracts - $this->contractList = new FrameworkArrayObject("FakedContractList"); - } - - // Setter-Methode fuer Firmennamen - public final function setCompanyName ($companyName) { - $this->companyName = (string) $companyName; - } - - // Getter-Methode fuer Firmennamen - public final function getCompanyName () { - return $this->companyName; - } - - // Setter-Methode fuer Firmensitz - public final function setHQInstance (Harbor $hqInstance) { - $this->hqInstance = $hqInstance; - } - - // Kuerzel setzen - private function initShortName () { - // Mindestens eine Leerstelle? - $dummy = explode(" ", $this->getCompanyName()); - foreach ($dummy as $part) { - $this->shortName .= substr($part, 0, 1); - } // END - if - } - - // Reedereien Werften bauen lassen - public function createShipyardInHarbor($shipyardName, Harbor $harborInstance) { - if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei %s baut im %s eine Werft %s.", - __CLASS__, - __LINE__, - $this->getCompanyName(), - $harborInstance->getHarborName(), - $shipyardName - )); - - // Wird im HQ gebaut? - if ($this->hqInstance->equals($harborInstance)) { - // Die neue Werft wird im HQ gebaut! - $this->hqInstance->addNewShipyardNotify($shipyardName, $this); - // Die Werft drueber in Kenntnis setzen, welcher Reederei sie angehoert - } else { - // Ausserhalb des Heimathafens soll eine Werft gebaut werden - $harborInstance->addNewShipyardNotify($shipyardName, $this); - } - } - - // Setter fuer Reederei-Gruender - public final function setCompanyFounder(CompanyEmployee $founderInstance) { - $this->founderInstance = $founderInstance; - } - - // Getter for founder instance - public final function getFounderInstance () { - return $this->founderInstance; - } - - // Neue(n) Angestellte(n) in Angestellten-Liste aufnehmen - public function addNewEmployee (SimulatorPersonell $employeeInstance) { - $this->employeeList->append($employeeInstance); - } - - // Neue Werft in Liste aufnehmen - public function addNewShipyard (Shipyard $shipyardInstance) { - $this->shipyardList->append($shipyardInstance); - } - - // Neue Mitarbeiter per Zufall einstellen/rekrutieren - public function recruitRandomEmployees($amount, SimulatorPersonell $personellInstance) { - // Anzahl Mitarbeiter absichern - $amount = (int) $amount; - - // Debug-Meldung ausgeben - if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei %s stellt per Zufall %d neue Mitarbeiter ein.", - __CLASS__, - __LINE__, - $this->getCompanyName(), - $amount - )); - - // Gesamtanzahl verfuegbarer Erwerbsloser holen - $totalUnemployed = $personellInstance->getAllUnemployed(); - - // Existiert die gewuenschte Anzahl freier Arbeiter? (doppelt geht derzeit nicht) - if ($totalUnemployed < $amount) { - // Reichte nicht aus! - throw new ToMuchEmployeesException(array($amount, $personellInstance->getAllUnemployed()), self::EXCEPTION_NOT_ENOUGTH_UNEMPLOYEES); - } // END - if - - // Get list for all unemployed people - $list = $personellInstance->getSpecialPersonellList(false); // Should be cached - - // Get iterator of the list - $iterator = $list->getIterator(); - - // Get the requested amount of personell - for ($idx = 0; $idx < $amount; $idx++) { - $employee = null; - // Is this personl unemployed? - while (is_null($employee) || $employee->isEmployed()) { - // Generate random number - $pos = mt_rand(0, ($totalUnemployed - 1)); // Don't remove the -1 here: - // E.g. 100 entries means latest position is 99... - - // Seek for the position - $iterator->seek($pos); - - // Is the current position valid? - if ($iterator->valid() === false) { - // Should normally not happen... :( - throw new StructuresOutOfBoundsException($idx, self::EXCEPTION_INDEX_OUT_OF_BOUNDS); - } // END - if - - // Get current element - $employee = $iterator->current(); - } // END - while - - // A dummy just for the description and real class - $dummy = CompanyEmployee::createCompanyEmployee("", "", "M", 1970, 1, 1, $employee->isMarried(), 0); - - // Make this person employed and give him some money to work - $employee->setEmployed(true); - $employee->setRealClass($dummy->__toString()); - $employee->increaseSalary((mt_rand(7, 14) * 100)); // Are 700 to 1400 EUR for the begin okay? - - // Debug message - if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei %s stellt den/die Angestellte(n) %s %s ein.", - __CLASS__, - __LINE__, - $this->getCompanyName(), - $employee->getSurname(), - $employee->getFamily() - )); - - // Add this employee - $this->addNewEmployee($employee); - } // End - for - - // Cache resetten - $personellInstance->resetCache(); - - // Debug-Meldung ausgeben - if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei %s hat per Zufall %d neue Mitarbeiter eingestellt.", - __CLASS__, - __LINE__, - $this->getCompanyName(), - $amount - )); - } // End - method - - // Distribute all personells on all shipyards - public function distributeAllPersonellOnShipyards () { - if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei %s verteilt alle ihre %d Mitarbeiter auf alle %d Werft(en).", - __CLASS__, - __LINE__, - $this->getCompanyName(), - $this->getTotalEmployee(), - $this->getTotalShipyards() - )); - - // Do we have some shipyards? - if (is_null($this->shipyardList)) { - // No shipyards created - throw new NoShipyardsConstructedException($this, self::EXCEPTION_HARBOR_HAS_NO_SHIPYARDS); - } - - // Get iterator for shipyards - $shipyardIter = $this->shipyardList->getIterator(); - - // Iterate through all employees - for ($idx = $this->employeeList->getIterator(); $idx->valid(); $idx->next()) { - // Is the shipyard iterator still okay? - if ($shipyardIter->valid() === false) { - // Rewind to first position - $shipyardIter->seek(0); - } // END - if - - // Get Shipyard object - $shipyard = $shipyardIter->current(); - - // Is this a Shipyard object? - if (is_null($shipyard)) { - // No class returned - throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($shipyard)) { - // Not an object! ;-( - throw new InvalidObjectException($shipyard, self::EXCEPTION_IS_NO_OBJECT); - } elseif ($shipyard->isClass("Shipyard") === false) { - // Nope, so throw exception - throw new ClassMismatchException(array($shipyard->__toString(), "Shipyard"), self::EXCEPTION_CLASSES_NOT_MATCHING); - } - - // Add employee to the shipyard - $shipyard->addNewPersonell($idx->current()); - - // Continue to next shipyard - $shipyardIter->next(); - } - } - - // Getter for total employees - public final function getTotalEmployee () { - // Count all... - $total = $this->employeeList->count(); - - // Debug message - if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei %s hat %d Mitarbeiter.", - __CLASS__, - __LINE__, - $this->getCompanyName(), - $total - )); - - // Return amount - return $total; - } - - // Getter for total shipyards - public final function getTotalShipyards () { - if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Für die Reederei %s werden die Anzahl der Werften in allen Häfen ermittelt.", - __CLASS__, - __LINE__, - $this->getCompanyName() - )); - - // Do we have some shipyards? - if (is_null($this->shipyardList)) { - // No shipyards created - throw new NoShipyardsConstructedException($this, self::EXCEPTION_HARBOR_HAS_NO_SHIPYARDS); - } - - // Get iterator - $total = $this->shipyardList->count(); - - // Debug message - if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei %s hat %d Werft(en).", - __CLASS__, - __LINE__, - $this->getCompanyName(), - $total - )); - - // Return amount - return $total; - } - - // Add a ship type (class) to all shipyards - public function addShipTypeToAllShipyards ($shipType) { - // Secure strings - $shipType = (string) $shipType; - - // Is the class there? - if (!class_exists($shipType)) { - // Throw exception - throw new NoClassException($shipType, self::EXCEPTION_CLASS_NOT_FOUND); - } - - // Create dummy ship - eval(sprintf("\$shipInstance = %s::create%s(\"M/S Dummy\");", - $shipType, - $shipType - )); - - // Iterate shipyard list - for ($idx = $this->shipyardList->getIterator(); $idx->valid(); $idx->next()) { - // Get current element - $shipyard = $idx->current(); - - // Is this a shipyard? - if (is_null($shipyard)) { - // Opps! Empty list? - throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($shipyard)) { - // Not an object! ;-( - throw new InvalidObjectException($shipyard, self::EXCEPTION_IS_NO_OBJECT); - } 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 - public function validateWorksContractShipType (SignableContract $contractInstance) { - // First get the ship type - $shipInstance = $contractInstance->getShipInstance(); - - // Ist there a ship instance? - if (is_null($shipInstance)) { - // Opps! Empty entry? - throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($shipInstance)) { - // Not an object! ;-( - throw new InvalidObjectException($shipInstance, self::EXCEPTION_IS_NO_OBJECT); - } - - // Get it's real class name - $shipType = $shipInstance->__toString(); - - // Now check if ship type is in any list and return the result - return ($this->isShipTypeConstructable($shipType)); - } - - // Is the ship type constructable? - public function isShipTypeConstructable ($shipType) { - // The type must be a string! - $shipType = (string) $shipType; - - // Debug message - if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei %s fragt alle Werften ab, ob diese Schiffe vom Typ %s bauen können.", - __CLASS__, - __LINE__, - $this->getCompanyName(), - $shipType - )); - - // First everthing is failed... - $result = false; - - // Iterate through all shipyards - for ($idx = $this->shipyardList->getIterator(); $idx->valid(); $idx->next()) { - // Get current Shipyard instance - $shipyard = $idx->current(); - - // Is this a shipyard? - if (is_null($shipyard)) { - // Opps! Empty list? - throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($shipyard)) { - // Not an object! ;-( - throw new InvalidObjectException($shipyard, self::EXCEPTION_IS_NO_OBJECT); - } elseif ($shipyard->isClass("Shipyard") === false) { - // Class is not a shipyard - throw new ClassMismatchException(array($shipyard->__toString(), "Shipyard"), self::EXCEPTION_CLASSES_NOT_MATCHING); - } - - // Validate if first found shipyard can construct the requested type - $result = $shipyard->isShipTypeConstructable($shipType); - - // 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 %s hat die Suche nach einer Werft beendet, die Schiffe vom Typ %s bauen kann.", - __CLASS__, - __LINE__, - $this->getCompanyName(), - $shipType - )); - - // Return result - return $result; - } - - // As a customer the shipping company can add new contracts - public function addNewWorksContract (SignableContract $contractInstance) { - $this->contractList->append($contractInstance); - } - - // As a customer the shippng company can withdraw from a contract - public function withdrawFromContract (SignableContract $contractInstance) { - ApplicationEntryPoint::app_exit("WITHDRAW:
".print_r($contractInstance, true)."
"); - } - - // Get latest added contract instance - public final function getLastContractInstance () { - // Get iterator - $iter = $this->contractList->getIterator(); - - // Get latest entry (total - 1) - $iter->seek($iter->count() - 1); - - // Return entry - return $iter->current(); - } - - // 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) === 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)) { - // With itself - if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei %s erteilt an sich selbst einen Bauauftrag für das %s "%s".", - __CLASS__, - __LINE__, - $this->getCompanyName(), - $contractInstance->getShipInstance()->getObjectDescription(), - $contractInstance->getShipInstance()->getShipName() - )); - } else { - // Other external company - if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei %s unterzeichnet einen Bauauftrag für das %s "%s" mit der %s.", - __CLASS__, - __LINE__, - $this->getCompanyName(), - $contractInstance->getShipInstance()->getObjectDescription(), - $contractInstance->getShipInstance()->getShipName(), - $partnerInstance->getCompanyName() - )); - } - - // Sign the contract - $contractInstance->signContract($this, $partnerInstance); - - /** - * @todo Maybe do something more here... - */ - } - - // Is this the right contract partner? - public function isContractPartner (SignableContract $contractInstance) { - // Get contract partner instance and compare it with $this contract partner - return ($this->equals($contractInstance->getContractPartner())); - } - - // Setter for merchant instance - public final function setMerchantInstance (Merchant $merchantInstance) { - // Get contract - $contractInstance = $this->getLastContractInstance(); - - if (is_null($contractInstance)) { - // Opps! Empty contract instance? - throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($contractInstance)) { - // Not an object! ;-( - throw new InvalidObjectException($contractInstance, self::EXCEPTION_IS_NO_OBJECT); - } elseif ($contractInstance->isClass("WorksContract") === false) { - // Is not a merchant - throw new ClassMismatchException(array($contractInstance->__toString(), "WorksContract"), self::EXCEPTION_CLASSES_NOT_MATCHING); - } - - // Set the merchant in the contract (for getting prices) - $contractInstance->setMerchantInstance($merchantInstance); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/constructions/.htaccess b/application/shipsimu/main/constructions/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/constructions/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/constructions/berths/.htaccess b/application/shipsimu/main/constructions/berths/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/constructions/berths/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/constructions/berths/class_Berth.php b/application/shipsimu/main/constructions/berths/class_Berth.php deleted file mode 100644 index c96ba10..0000000 --- a/application/shipsimu/main/constructions/berths/class_Berth.php +++ /dev/null @@ -1,39 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class Berth extends BaseConstruction { - // Durchlaufende Nummer der Liegeplaetze - private $berthIndex = 0; - - // Zugewiesener Hafen - private $harborInstance = null; - - // Konstruktor - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/constructions/class_BaseConstruction.php b/application/shipsimu/main/constructions/class_BaseConstruction.php deleted file mode 100644 index af08a39..0000000 --- a/application/shipsimu/main/constructions/class_BaseConstruction.php +++ /dev/null @@ -1,36 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class BaseConstruction extends BaseSimulator { - // Tiefgang fuer z.B. Trockdocks - private $draught = 0; - - // Konstruktor - protected function __construct ($className) { - // Eltern-Konstrutor aufrufen - parent::__construct($className); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/constructions/docks/.htaccess b/application/shipsimu/main/constructions/docks/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/constructions/docks/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/constructions/docks/class_DryDock.php b/application/shipsimu/main/constructions/docks/class_DryDock.php deleted file mode 100644 index c9d6f8e..0000000 --- a/application/shipsimu/main/constructions/docks/class_DryDock.php +++ /dev/null @@ -1,36 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class DryDock extends BaseConstruction { - // Zugewiesener Hafen - private $harborInstance = null; - - // Konstruktor - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/constructions/harbors/.htaccess b/application/shipsimu/main/constructions/harbors/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/constructions/harbors/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/constructions/harbors/class_Harbor.php b/application/shipsimu/main/constructions/harbors/class_Harbor.php deleted file mode 100644 index cf350ce..0000000 --- a/application/shipsimu/main/constructions/harbors/class_Harbor.php +++ /dev/null @@ -1,87 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class Harbor extends BaseConstruction { - // Namen des Hafens (z.B. Hamburger Hafen) - private $harborName = "Unbekannter Hafen"; - - // Schiffsliste aller gebauten Schiffe - private $constructedShips = null; - - // Liegeplatz-Liste - private $berthList = null; - - // List of all assigned shipyards - private $shipyardList = null; - - // Constructor - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - // Creates a harbor - public static final function createHarbor ($harborName) { - // Hafen-Instanz holen - $harborInstance = new Harbor(); - - // Hafenname setzen - $harborInstance->setHarborName($harborName); - - // Werftliste initialisieren - $harborInstance->createshipyardList(); - - // Instanz zurueckliefern - return $harborInstance; - } - - // Werft-Liste generieren - public function createshipyardList () { - $this->shipyardList = new FrameworkArrayObject("FakedShipyardList"); - } - - // Setter fuer Hafennamen - public final function setHarborName ($harborName) { - $this->harborName = (string) $harborName; - } - - // Getter fuer Hafennamen - public final function getHarborName () { - return $this->harborName; - } - - // Werft in den Hafen einbauen und Werft->Reederei zuweisen - public function addNewShipyardNotify ($shipyardName, ShippingCompany $companyInstance) { - // Werft generieren und in die Werftliste aufnehmen - $this->shipyardList->append(Shipyard::createShipyardNotify($this, $shipyardName, $companyInstance)); - } - - // Werft in den Hafen einbauen ohne Zuweisung einer Reederei (gehoert der "Stadt" dann) - public function addNewShipyard ($shipyardName) { - // Werft generieren und in die Werftliste aufnehmen - $this->shipyardList->append(Shipyard::createShipyard($this, $shipyardName)); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/constructions/terminals/.htaccess b/application/shipsimu/main/constructions/terminals/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/constructions/terminals/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/constructions/terminals/class_Terminal.php b/application/shipsimu/main/constructions/terminals/class_Terminal.php deleted file mode 100644 index 9ae9985..0000000 --- a/application/shipsimu/main/constructions/terminals/class_Terminal.php +++ /dev/null @@ -1,36 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class Terminal extends BaseConstruction { - // Zugewiesener Hafen - private $harborInstance = null; - - // Konstruktor - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/constructions/yards/.htaccess b/application/shipsimu/main/constructions/yards/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/constructions/yards/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/constructions/yards/class_Shipyard.php b/application/shipsimu/main/constructions/yards/class_Shipyard.php deleted file mode 100644 index 1959f83..0000000 --- a/application/shipsimu/main/constructions/yards/class_Shipyard.php +++ /dev/null @@ -1,215 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class Shipyard extends BaseConstruction { - // Werft-Name - private $shipyardName = "Namenlose Werft"; - - // Arbeiter-Liste - private $staffList = null; - - // Queue-Liste fuer zu bauende Schiffe - private $queueList = null; - - // Aktuell im Bau befindliches Schiff - private $currShipInConst = null; - - // Liste konstruierbarer Schiffstypen - private $shipTypeList = null; - - // Zugewiesener Hafen - private $harborInstance = null; - - // Zugewiesene Reederei - private $shippingCompany = null; - - // Constructor - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - - // Staff-Liste/Schiffstyp-Liste erzeugen - $this->createStaffList(); - $this->createShipTypeList(); - } - - // Create a shipyard and notify it about it's owner - public static final function createShipyardNotify (Harbor $harborInstance, $shipyardName, ShippingCompany $companyInstance) { - // Werft-Instanz holen - $shipyardInstance = self::createShipyard($harborInstance, $shipyardName); - - // Reederei der Werft zuweisen - $shipyardInstance->setCompanyInstance($companyInstance); - - // Die Reederei ueber ihre Werft informieren - $companyInstance->addNewShipyard($shipyardInstance); - - // Instanz zurueckgeben - return $shipyardInstance; - } - - // Create a shipyard, first we need to create a harbor - public static final function createShipyard (Harbor $harborInstance, $shipyardName) { - // Instanz temporaer holen - $shipyardInstance = new Shipyard(); - - // Debug message - if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $shipyardInstance->debugOutput(sprintf("[%s:%d] Eine Werft mit dem Namen %s wird im Hafen %s konstruiert.", - __CLASS__, - __LINE__, - $shipyardName, - $harborInstance->getHarborName() - )); - - // Werft-Name setzen - $shipyardInstance->setShipyardName($shipyardName); - - // Hafen-Instanz setzen - $shipyardInstance->setHarborInstance($harborInstance); - - // Abmasse setzen in Meter - $shipyardInstance->setWidth(30); - $shipyardInstance->setHeight(30); - $shipyardInstance->setLength(100); - - // Clean up a little - $shipyardInstance->removeDraught(); - - // Debug-Meldung - if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $shipyardInstance->debugOutput(sprintf("[%s:%d] Die Werft %s wurde gebaut.", - __CLASS__, - __LINE__, - $shipyardName - )); - - // Instanz zurueckliefern - return $shipyardInstance; - } - - // Create staff list - private function createStaffList () { - $this->staffList = new FrameworkArrayObject("FakedStaffList"); - } - - // Create ship type list - private function createShipTypeList () { - $this->shipTypeList = new FrameworkArrayObject("FakedShipTypeList"); - } - - // Setter-Methode fuer Werft-Name - public final function setShipyardName ($shipyardName) { - $this->shipyardName = (string) $shipyardName; - } - - // Getter-Methode fuer Werft-Name - public final function getShipyardName () { - return $this->shipyardName; - } - - // Setter-Methode fuer Hafen-Instanz - public final function setHarborInstance (Harbor $harborInstance) { - $this->harborInstance = $harborInstance; - } - - // Getter-Methode fuer Hafen-Instanz - public final function getHarborInstance () { - return $this->harborInstance; - } - - // Setter fuer Reederei-Instanz - public final function setCompanyInstance (ShippingCompany $companyInstance) { - $this->shippingCompany = $companyInstance; - } - - // Getter fuer Reederei-Instanz - public final function getCompanyInstance () { - return $this->shippingCompany; - } - - // Add new personell - public function addNewPersonell ($personell) { - // Add to list - $this->staffList->append($personell); - } - - // Add a new ship type to our list - public function addNewConstructableShipType ($shipType) { - // This must be a string! - $shipType = (string) $shipType; - - // Debug message - if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Werft %s kann bald Schiffe vom Typ %s bauen.", - __CLASS__, - __LINE__, - $this->getShipyardName(), - $shipType - )); - - // Add to list - $this->shipTypeList->append($shipType); - } - - // Is the specified ship type in our list? - public function isShipTypeConstructable ($shipType) { - // First we can't build this ship - $result = false; - - // This must be a string! - $shipType = (string) $shipType; - - // Debug message - if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Werft %s prüft, ob Schiffe vom Typ %s baubar sind.", - __CLASS__, - __LINE__, - $this->getShipyardName(), - $shipType - )); - - // Iterate through all types - for ($idx = $this->shipTypeList->getIterator(); $idx->valid(); $idx->next()) { - // Get current ship type - $type = (string) $idx->current(); - - // Is both the same? - $result = ($type == $shipType); - - // Type is found? - if ($result) break; // Then abort the search! - } - - // Debug message - if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Werft %s hat die Suche nach dem Schiffstyp %s abgeschlossen.", - __CLASS__, - __LINE__, - $this->getShipyardName(), - $shipType - )); - - // Return result - return $result; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/controller/.htaccess b/application/shipsimu/main/controller/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/controller/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/controller/html/.htaccess b/application/shipsimu/main/controller/html/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/controller/html/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/controller/html/class_HtmlCompanyController.php b/application/shipsimu/main/controller/html/class_HtmlCompanyController.php deleted file mode 100644 index 741cc5a..0000000 --- a/application/shipsimu/main/controller/html/class_HtmlCompanyController.php +++ /dev/null @@ -1,106 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class HtmlCompanyController extends BaseController implements Controller { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this class - * - * @param $resolverInstance An instance of a command resolver class - * @return $controllerInstance A prepared instance of this class - * @todo Add some filters to this controller - */ - public static final function createHtmlCompanyController (CommandResolver $resolverInstance) { - // Create the instance - $controllerInstance = new HtmlCompanyController(); - - // Set the command resolver - $controllerInstance->setResolverInstance($resolverInstance); - - // User auth filter - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_filter')); - - // User update filter - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_update_filter')); - - // News fetcher filter - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_filter')); - - // News proccess/display-preparation - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_filter')); - - // Return the prepared instance - return $controllerInstance; - } - - /** - * Handles the given request and response - * - * @param $requestInstance An instance of a request class - * @param $responseInstance An instance of a response class - * @return void - */ - public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) { - // Get the command instance from the resolver by sending a request instance to the resolver - $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance); - - // Add more filters by the command - $commandInstance->addExtraFilters($this, $requestInstance); - - // Try to run the pre filters, if auth exceptions come through redirect here - try { - // Run the pre filters - $this->executePreFilters($requestInstance, $responseInstance); - } catch (UserAuthorizationException $e) { - // Redirect to main page - $responseInstance->redirectToConfiguredUrl('login_failed'); - - // Exit here - exit(); - } - - // This request was valid! :-D - $requestInstance->requestIsValid(); - - // Execute the command - $commandInstance->execute($requestInstance, $responseInstance); - - // Run the pre filters - $this->executePostFilters($requestInstance, $responseInstance); - - // Flush the response out - $responseInstance->flushBuffer(); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/controller/html/class_HtmlGovernmentFailedController.php b/application/shipsimu/main/controller/html/class_HtmlGovernmentFailedController.php deleted file mode 100644 index 217b6b5..0000000 --- a/application/shipsimu/main/controller/html/class_HtmlGovernmentFailedController.php +++ /dev/null @@ -1,106 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class HtmlGovernmentFailedController extends BaseController implements Controller { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this class - * - * @param $resolverInstance An instance of a command resolver class - * @return $controllerInstance A prepared instance of this class - * @todo Add some filters to this controller - */ - public static final function createHtmlGovernmentFailedController (CommandResolver $resolverInstance) { - // Create the instance - $controllerInstance = new HtmlGovernmentFailedController(); - - // Set the command resolver - $controllerInstance->setResolverInstance($resolverInstance); - - // User auth filter - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_filter')); - - // User update filter - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_update_filter')); - - // News fetcher filter - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_filter')); - - // News proccess/display-preparation - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_filter')); - - // Return the prepared instance - return $controllerInstance; - } - - /** - * Handles the given request and response - * - * @param $requestInstance An instance of a request class - * @param $responseInstance An instance of a response class - * @return void - */ - public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) { - // Get the command instance from the resolver by sending a request instance to the resolver - $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance); - - // Add more filters by the command - $commandInstance->addExtraFilters($this, $requestInstance); - - // Try to run the pre filters, if auth exceptions come through redirect here - try { - // Run the pre filters - $this->executePreFilters($requestInstance, $responseInstance); - } catch (UserAuthorizationException $e) { - // Redirect to main page - $responseInstance->redirectToConfiguredUrl('login_failed'); - - // Exit here - exit(); - } - - // This request was valid! :-D - $requestInstance->requestIsValid(); - - // Execute the command - $commandInstance->execute($requestInstance, $responseInstance); - - // Run the pre filters - $this->executePostFilters($requestInstance, $responseInstance); - - // Flush the response out - $responseInstance->flushBuffer(); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/drives/.htaccess b/application/shipsimu/main/drives/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/drives/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/drives/class_BaseDrive.php b/application/shipsimu/main/drives/class_BaseDrive.php deleted file mode 100644 index 56f9802..0000000 --- a/application/shipsimu/main/drives/class_BaseDrive.php +++ /dev/null @@ -1,64 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class BaseDrive extends BaseSimulator { - // Price of this drive - private $price = 0.00; - // PS-Zahl - private $horsePower = 0; - // Anzahl Nocken - private $numCams = 0; - - // Konstruktor - protected function __construct ($className) { - // Call parent constructor - parent::__construct($className); - } - - // Setter-Methode fuert PS-Zahl - public final function setHorsePower ($hp) { - $this->horsePower = (int) $hp; - } - - // Setter-Methode fuer Nockenanzahl - public final function setNumCams ($cams) { - $this->numCams = (int) $cams; - } - - // Setter for price - public final function setPrice ($price) { - $this->price = (float) $price; - } - - // Getter for price - public final function getPrice () { - return $this->price; - } - - public final function removePrice () { - unset($this->price); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/drives/motor/.htaccess b/application/shipsimu/main/drives/motor/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/drives/motor/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/drives/motor/class_Motor.php b/application/shipsimu/main/drives/motor/class_Motor.php deleted file mode 100644 index 2f3479e..0000000 --- a/application/shipsimu/main/drives/motor/class_Motor.php +++ /dev/null @@ -1,56 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class Motor extends BaseDrive implements TradeableItem, ConstructableShipPart { - // Constructor - protected function __construct() { - // Call parent constructor - parent::__construct(__CLASS__); - } - - // Einen Motor erstellen - public static final function createMotor ($descr, $hp, $cams, $w, $h, $l) { - // Get new instance - $motorInstance = new Motor(); - - // Beschreibung und Abmasse setzen - $motorInstance->setWidth($w); - $motorInstance->setHeight($h); - $motorInstance->setLength($l); - - // Weitere Daten setzen - $motorInstance->setHorsePower($hp); - $motorInstance->setNumCams($cams); - - // Instanz zurueckgeben - return $motorInstance; - } - - // Overwritten method for tradeable items - public function isTradeable () { - return true; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/factories/.htaccess b/application/shipsimu/main/factories/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/factories/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/factories/class_ShipSimuWebNewsFactory.php b/application/shipsimu/main/factories/class_ShipSimuWebNewsFactory.php deleted file mode 100644 index e42b021..0000000 --- a/application/shipsimu/main/factories/class_ShipSimuWebNewsFactory.php +++ /dev/null @@ -1,60 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class ShipSimuWebNewsFactory extends BaseFrameworkSystem { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this class - * - * @return $factoryInstance An instance of this class - */ - public static final function createShipSimuWebNewsFactory () { - // Get a new instance - $factoryInstance = new ShipSimuWebNewsFactory(); - - // Return the prepared instance - return $factoryInstance; - } - - /** - * Create the news object itself here depending on the request - * - * @param $requestInstance An instance of a request class - * @return $newsInstance An instance of a news class - */ - public function createNewObject (Requestable $requestInstance) { - // Do some stuff here - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/filter/.htaccess b/application/shipsimu/main/filter/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/filter/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/filter/book/.htaccess b/application/shipsimu/main/filter/book/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/filter/book/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/filter/book/refill/.htaccess b/application/shipsimu/main/filter/book/refill/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/filter/book/refill/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/filter/book/refill/class_RefillRequestCurrencyTestBookFilter.php b/application/shipsimu/main/filter/book/refill/class_RefillRequestCurrencyTestBookFilter.php deleted file mode 100644 index b7ff113..0000000 --- a/application/shipsimu/main/filter/book/refill/class_RefillRequestCurrencyTestBookFilter.php +++ /dev/null @@ -1,72 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class RefillRequestCurrencyTestBookFilter extends BaseShipSimuFilter implements Filterable { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this filter class - * - * @return $filterInstance An instance of this filter class - */ - public static final function createRefillRequestCurrencyTestBookFilter () { - // Get a new instance - $filterInstance = new RefillRequestCurrencyTestBookFilter(); - - // 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 Add code being executed in this filter - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Execute the parent execute method - parent::execute($requestInstance, $responseInstance); - - // Get the user instance from registry - $userInstance = Registry::getRegistry()->getInstance('user'); - - // Run the update - $userInstance->bookAmountDirectly($requestInstance); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/filter/class_ b/application/shipsimu/main/filter/class_ deleted file mode 100644 index 20653ff..0000000 --- a/application/shipsimu/main/filter/class_ +++ /dev/null @@ -1,65 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @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 . - */ -class ???Filter extends BaseShipSimuFilter implements Filterable { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this filter class - * - * @return $filterInstance An instance of this filter class - */ - public final static function create???Filter () { - // Get a new instance - $filterInstance = new ???Filter(); - - // 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 Add code being executed in this filter - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Execute the parent execute method - parent::execute($requestInstance, $responseInstance); - - $this->partialStub("Add code here for your specific filter."); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/filter/class_BaseShipSimuFilter.php b/application/shipsimu/main/filter/class_BaseShipSimuFilter.php deleted file mode 100644 index 7a80cf2..0000000 --- a/application/shipsimu/main/filter/class_BaseShipSimuFilter.php +++ /dev/null @@ -1,50 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class BaseShipSimuFilter extends BaseFilter { - /** - * Protected constructor - * - * @param $className Name of the filter class - * @return void - */ - protected function __construct ($className) { - // Call parent constructor - parent::__construct($className); - } - - /** - * 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 Add something to do on every filter - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Add something to do on every filter - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/filter/government/.htaccess b/application/shipsimu/main/filter/government/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/filter/government/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/filter/government/class_ShipSimuGovernmentPaysStartupHelpFilter.php b/application/shipsimu/main/filter/government/class_ShipSimuGovernmentPaysStartupHelpFilter.php deleted file mode 100644 index 7becf12..0000000 --- a/application/shipsimu/main/filter/government/class_ShipSimuGovernmentPaysStartupHelpFilter.php +++ /dev/null @@ -1,78 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class ShipSimuGovernmentPaysStartupHelpFilter extends BaseShipSimuFilter implements Filterable { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this filter class - * - * @return $filterInstance An instance of this filter class - */ - public static final function createShipSimuGovernmentPaysStartupHelpFilter () { - // Get a new instance - $filterInstance = new ShipSimuGovernmentPaysStartupHelpFilter(); - - // 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) { - // Execute the parent execute method - parent::execute($requestInstance, $responseInstance); - - // Get the user instance from registry - $userInstance = Registry::getRegistry()->getInstance('user'); - - // Now simply check for it - if ((!$userInstance instanceof ManageableMember) || ($userInstance->ifGovernmentPaysStartupHelp() === false)) { - // Request is invalid - $requestInstance->requestIsValid(false); - - // Redirect to configured URL - $responseInstance->redirectToConfiguredUrl('login_government_startup_failed'); - - // Stop processing here - exit(); - } // END - if - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/filter/government/class_ShipSimuGovernmentPaysTrainingFilter.php b/application/shipsimu/main/filter/government/class_ShipSimuGovernmentPaysTrainingFilter.php deleted file mode 100644 index 75eb1cc..0000000 --- a/application/shipsimu/main/filter/government/class_ShipSimuGovernmentPaysTrainingFilter.php +++ /dev/null @@ -1,78 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class ShipSimuGovernmentPaysTrainingFilter extends BaseShipSimuFilter implements Filterable { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this filter class - * - * @return $filterInstance An instance of this filter class - */ - public static final function createShipSimuGovernmentPaysTrainingFilter () { - // Get a new instance - $filterInstance = new ShipSimuGovernmentPaysTrainingFilter(); - - // 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) { - // Execute the parent execute method - parent::execute($requestInstance, $responseInstance); - - // Get the user instance from registry - $userInstance = Registry::getRegistry()->getInstance('user'); - - // Now simply check for it - if ((!$userInstance instanceof ManageableMember) || ($userInstance->ifGovernmentPaysTraining() === false)) { - // Request is invalid - $requestInstance->requestIsValid(false); - - // Redirect to configured URL - $responseInstance->redirectToConfiguredUrl('login_government_training_failed'); - - // Stop processing here - exit(); - } // END - if - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/filter/page/.htaccess b/application/shipsimu/main/filter/page/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/filter/page/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/filter/page/class_RefillPageFilter.php b/application/shipsimu/main/filter/page/class_RefillPageFilter.php deleted file mode 100644 index d4680ba..0000000 --- a/application/shipsimu/main/filter/page/class_RefillPageFilter.php +++ /dev/null @@ -1,75 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class RefillPageFilter extends BaseShipSimuFilter implements Filterable { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this filter class - * - * @return $filterInstance An instance of this filter class - */ - public static final function createRefillPageFilter () { - // Get a new instance - $filterInstance = new RefillPageFilter(); - - // 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 - * @throws FilterChainException If this filter fails to operate - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Execute the parent execute method - parent::execute($requestInstance, $responseInstance); - - // Is the configuration variable set? - if ($this->getConfigInstance()->getConfigEntry('refill_page_active') === "N") { - // Password is empty - $requestInstance->requestIsValid(false); - - // Add a message to the response - $responseInstance->addFatalMessage('refill_page_not_active'); - - // Abort here - throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); - } // END - if - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/filter/validator/.htaccess b/application/shipsimu/main/filter/validator/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/filter/validator/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/filter/validator/class_RefillRequestValidatorFilter.php b/application/shipsimu/main/filter/validator/class_RefillRequestValidatorFilter.php deleted file mode 100644 index 3abd7ba..0000000 --- a/application/shipsimu/main/filter/validator/class_RefillRequestValidatorFilter.php +++ /dev/null @@ -1,76 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class RefillRequestValidatorFilter extends BaseShipSimuFilter implements Filterable { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this filter class - * - * @return $filterInstance An instance of this filter class - */ - public static final function createRefillRequestValidatorFilter () { - // Get a new instance - $filterInstance = new RefillRequestValidatorFilter(); - - // 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 Maybe we need to added some more generic tests on the request here? - * @throws FilterChainException If this filter fails to operate - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Execute the parent execute method - parent::execute($requestInstance, $responseInstance); - - // Are all required request fields set? - if (($requestInstance->isRequestElementSet('type') === false) || ($requestInstance->isRequestElementSet('amount') === false)) { - // Something important is missing - $requestInstance->requestIsValid(false); - - // Add a message to the response - $responseInstance->addFatalMessage('refill_page_required_fields_missing'); - - // Abort here - throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); - } // END - if - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/filter/validator/class_ShipSimuUserStatusGuestFilter.php b/application/shipsimu/main/filter/validator/class_ShipSimuUserStatusGuestFilter.php deleted file mode 100644 index 989e1d4..0000000 --- a/application/shipsimu/main/filter/validator/class_ShipSimuUserStatusGuestFilter.php +++ /dev/null @@ -1,79 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class ShipSimuUserStatusGuestFilter extends BaseShipSimuFilter implements Filterable { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this filter class - * - * @return $filterInstance An instance of this filter class - */ - public static final function createShipSimuUserStatusGuestFilter () { - // Get a new instance - $filterInstance = new ShipSimuUserStatusGuestFilter(); - - // 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 Maybe we need to added some more generic tests on the request here? - * @throws FilterChainException If this filter fails to operate - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Execute the parent execute method - parent::execute($requestInstance, $responseInstance); - - // Get a user instance for comparison - $userInstance = Registry::getRegistry()->getInstance('user'); - - // Is the user account confirmed? - if ($userInstance->getField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS) == $this->getConfigInstance()->getConfigEntry('user_status_guest')) { - // Request is invalid! - $requestInstance->requestIsValid(false); - - // Redirect to configured URL - $responseInstance->redirectToConfiguredUrl('login_user_status_guest'); - - // Stop processing here - exit(); - } // END - if - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/government/.htaccess b/application/shipsimu/main/government/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/government/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/government/class_SimplifiedGovernment.php b/application/shipsimu/main/government/class_SimplifiedGovernment.php deleted file mode 100644 index 8999153..0000000 --- a/application/shipsimu/main/government/class_SimplifiedGovernment.php +++ /dev/null @@ -1,137 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.org - * @todo Find an interface for governments - * - * 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 . - */ -class SimplifiedGovernment extends BaseFrameworkSystem implements Registerable { - // Constants - const STATUS_STARTER_HELP = 'STARTER_HELP'; - const STATUS_TRAINING = 'TRAINING'; - - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this government class by given user instance - * - * @param $userInstance The user instance - * @return $governmentInstance Instance of the prepared government instance - */ - public static final function createSimplifiedGovernment (ManageableAccount $userInstance) { - // Get a new instance - $governmentInstance = new SimplifiedGovernment(); - - // Set the user instance - $governmentInstance->setUserInstance($userInstance); - - // Return the prepared instance - return $governmentInstance; - } - - /** - * Checks wether the government has already payed a training course for te - * current user - * - * @return $alreadyPayed Wether the government has already payed - * @todo Needs do check training limit - */ - public function ifGovernmentAlreadyPayedTraining () { - // Default is not payed - $alreadyPayed = false; - - // Cache startup training limit - $trainingLimit = $this->getConfigInstance()->getConfigEntry('government_training_limit'); - - // Now get a search criteria and set the user's name as criteria - $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); - $searchInstance->addCriteria(UserGovernmentDatabaseWrapper::DB_COLUMN_GOV_USERID , $this->getUserInstance()->getUserId()); - $searchInstance->addCriteria(UserGovernmentDatabaseWrapper::DB_COLUMN_GOV_ACTIVITY, self::STATUS_TRAINING); - $searchInstance->setLimit(1); - - // Get a wrapper instance - $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_gov_wrapper_class'); - - // Get result back - $resultInstance = $wrapperInstance->doSelectByCriteria($searchInstance); - - // Was the query fine? - if ($resultInstance->next()) { - // Get entry - $currEntry = $resultInstance->current(); - - // Entry was found so the government can no more pay a training - $alreadyPayed = true; - } // END - if - - // Return the result - return $alreadyPayed; - } - - /** - * Checks wether the government has payed maximum of startup helps to the - * current user - * - * @return $maximumPayed Wether the government has already payed - * @todo Needs do check help limit - */ - public function ifGovernmentPayedMaxmimumStartupHelp () { - // Default is not payed - $maximumPayed = false; - - // Cache startup help limit - $helpLimit = $this->getConfigInstance()->getConfigEntry('government_startup_help_limit'); - - // Now get a search criteria and set the user's name as criteria - $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); - $searchInstance->addCriteria(UserGovernmentDatabaseWrapper::DB_COLUMN_GOV_USERID , $this->getUserInstance()->getUserId()); - $searchInstance->addCriteria(UserGovernmentDatabaseWrapper::DB_COLUMN_GOV_ACTIVITY, self::STATUS_STARTER_HELP); - $searchInstance->setLimit($helpLimit); - - // Get a wrapper instance - $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_gov_wrapper_class'); - - // Get result back - $resultInstance = $wrapperInstance->doSelectByCriteria($searchInstance); - - // Was the query fine? - if ($resultInstance->next()) { - // Get entry - $currEntry = $resultInstance->current(); - - // Entry found, so lets have a look if this government wants to again... - $maximumPayed = true; - } // END - if - - // Return the result - return $maximumPayed; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/login/.htaccess b/application/shipsimu/main/login/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/login/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/login/class_ShipSimuGuestLogin.php b/application/shipsimu/main/login/class_ShipSimuGuestLogin.php deleted file mode 100644 index 9725449..0000000 --- a/application/shipsimu/main/login/class_ShipSimuGuestLogin.php +++ /dev/null @@ -1,128 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class ShipSimuGuestLogin extends BaseFrameworkSystem implements LoginableUser, Registerable { - /** - * The hashed password - */ - private $hashedPassword = ''; - - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this login class - * - * @return $loginInstance An instance of this login class - */ - public static final function createShipSimuGuestLogin () { - // Get a new instance - $loginInstance = new ShipSimuGuestLogin(); - - // Return the instance - return $loginInstance; - } - - /** - * Logins the user with the given request containing the credential. The - * result of the login can be thrown by exception or, if prefered stored - * in a boolean attribute which is then readable by a matching getter. - * - * @param $requestInstance An instance of a Requestable class - * @param $responseInstance An instance of a Responseable class - * @return void - * @throws UserPasswordMismatchException If the supplied password did not - * match with the stored password - */ - public function doLogin (Requestable $requestInstance, Responseable $responseInstance) { - // Get a user instance - $userInstance = LoginFactory::createLoginObjectByRequest($requestInstance); - - // Remember this new instance in registry - Registry::getRegistry()->addInstance('user', $userInstance); - - // Is the password correct? - if ($userInstance->ifPasswordHashMatches($requestInstance) === false) { - // Mismatching password - throw new UserPasswordMismatchException(array($this, $userInstance), BaseUser::EXCEPTION_USER_PASS_MISMATCH); - } // END - if - - // Now do the real login. This can be cookie- or session-based login - // which depends on the admins setting then on the user's taste. - // 1) Get a login helper instance - $helperInstance = ObjectFactory::createObjectByConfiguredName('login_helper_class', array($requestInstance)); - - // 2) Execute the login. This will now login... - $helperInstance->executeLogin($responseInstance); - } - - /** - * Determines wether the login was fine. This is done by checking if 'login' instance is in registry - * - * @return $loginDone Wether the login was fine or not - */ - public function ifLoginWasSuccessfull () { - // Is the registry key there? - $loginDone = (Registry::getRegistry()->getInstance('login') instanceof Registerable); - - // Return the result - return $loginDone; - } - - /** - * Encrypt given request key or throw an exception if key was not found in - * request - * - * @param $requestKey Key in request class - * @return void - */ - public function encryptPassword ($requestKey) { - // Check if password is found in request - if ($this->getRequestInstance()->isRequestElementSet($requestKey)) { - // So encrypt the password and store it for later usage in - // the request: - - // Get the plain password - $plainPassword = $this->getRequestInstance()->getRequestElement($requestKey); - - // Get user instance - $userInstance = Registry::getRegistry()->getInstance('user'); - - // Get a crypto helper and hash the password - $this->hashedPassword = ObjectFactory::createObjectByConfiguredName('crypto_class')->hashString($plainPassword, $userInstance->getPasswordHash()); - - // Store the hash back in request - $this->getRequestInstance()->setRequestElement('pass_hash', $this->hashedPassword); - } // END - if - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/login/class_ShipSimuUserLogin.php b/application/shipsimu/main/login/class_ShipSimuUserLogin.php deleted file mode 100644 index 0b3cf7c..0000000 --- a/application/shipsimu/main/login/class_ShipSimuUserLogin.php +++ /dev/null @@ -1,133 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class ShipSimuUserLogin extends BaseFrameworkSystem implements LoginableUser, Registerable { - /** - * The hashed password - */ - private $hashedPassword = ''; - - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this login class - * - * @return $loginInstance An instance of this login class - */ - public static final function createShipSimuUserLogin () { - // Get a new instance - $loginInstance = new ShipSimuUserLogin(); - - // Return the instance - return $loginInstance; - } - - /** - * Logins the user with the given request containing the credential. The - * result of the login can be thrown by exception or, if prefered stored - * in a boolean attribute which is then readable by a matching getter. - * - * @param $requestInstance An instance of a Requestable class - * @param $responseInstance An instance of a Responseable class - * @return void - * @throws UserPasswordMismatchException If the supplied password did not - * match with the stored password - * @todo We need to add something here which will make more than one - * @todo guest logins, users who are online but based on the same - * @todo user account. - */ - public function doLogin (Requestable $requestInstance, Responseable $responseInstance) { - // Get a user instance - $userInstance = LoginFactory::createLoginObjectByRequest($requestInstance); - - // Remember this new instance in registry - Registry::getRegistry()->addInstance('user', $userInstance); - - // Is the password correct? - if ($userInstance->ifPasswordHashMatches($requestInstance) === false) { - // Mismatching password - throw new UserPasswordMismatchException(array($this, $userInstance), BaseUser::EXCEPTION_USER_PASS_MISMATCH); - } // END - if - - // ToDo place - - // Now do the real login. This can be cookie- or session-based login - // which depends on the admins setting then on the user's taste. - // 1) Get a login helper instance - $helperInstance = ObjectFactory::createObjectByConfiguredName('login_helper_class', array($requestInstance)); - - // 2) Execute the login. This will now login... - $helperInstance->executeLogin($responseInstance); - } - - /** - * Determines wether the login was fine. This is done by checking if 'login' instance is in registry - * - * @return $loginDone Wether the login was fine or not - */ - public function ifLoginWasSuccessfull () { - // Is the registry key there? - $loginDone = (Registry::getRegistry()->getInstance('login') instanceof Registerable); - - // Return the result - return $loginDone; - } - - /** - * Encrypt given request key or throw an exception if key was not found in - * request - * - * @param $requestKey Key in request class - * @return void - */ - public function encryptPassword ($requestKey) { - // Check if password is found in request - if ($this->getRequestInstance()->isRequestElementSet($requestKey)) { - // So encrypt the password and store it for later usage in - // the request: - - // Get the plain password - $plainPassword = $this->getRequestInstance()->getRequestElement($requestKey); - - // Get user instance - $userInstance = Registry::getRegistry()->getInstance('user'); - - // Get a crypto helper and hash the password - $this->hashedPassword = ObjectFactory::createObjectByConfiguredName('crypto_class')->hashString($plainPassword, $userInstance->getPasswordHash()); - - // Store the hash back in request - $this->getRequestInstance()->setRequestElement('pass_hash', $this->hashedPassword); - } // END - if - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/login/helper/.htaccess b/application/shipsimu/main/login/helper/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/login/helper/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/login/helper/class_ShipSimuLoginHelper.php b/application/shipsimu/main/login/helper/class_ShipSimuLoginHelper.php deleted file mode 100644 index b5c125e..0000000 --- a/application/shipsimu/main/login/helper/class_ShipSimuLoginHelper.php +++ /dev/null @@ -1,114 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class ShipSimuLoginHelper extends BaseLoginHelper implements HelpableLogin { - /** - * The login method we shall choose - */ - private $authMethod = ""; - - // Exception constants - const EXCEPTION_INVALID_USER_INSTANCE = 0x190; - - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this class by given request instance - * - * @param $requestInstance An instance of a Requestable class - * @return $helperInstance An instance of this helper class - * @throws UserInstanceMissingException If the user instance in registry - * is missing or invalid - */ - public static final function createShipSimuLoginHelper (Requestable $requestInstance) { - // Get a new instance first - $helperInstance = new ShipSimuLoginHelper(); - - // Get a user instance from registry - $userInstance = Registry::getRegistry()->getInstance('user'); - - // Is this instance valid? - if (!$userInstance instanceof ManageableAccount) { - // Thrown an exception here - throw new UserInstanceMissingException (array($helperInstance, 'user'), self::EXCEPTION_INVALID_USER_INSTANCE); - } // END - if - - // Set default login method from config - $helperInstance->setDefaultAuthMethod(); - - // Set request instance - $helperInstance->setRequestInstance($requestInstance); - - // Return the prepared instance - return $helperInstance; - } - - /** - * Setter for default login method from config - * - * @return void - */ - protected function setDefaultAuthMethod () { - $this->authMethod = $this->getConfigInstance()->getConfigEntry('auth_method_class'); - } - - /** - * Execute the login request by given response instance. This instance can - * be used for sending cookies or at least the session id out. - * - * @param $responseInstance An instance of a Responseable class - * @return void - */ - public function executeLogin (Responseable $responseInstance) { - // Get an instance from the login method - $loginInstance = ObjectFactory::createObjectByName($this->authMethod, array($responseInstance)); - - // Set user cookie - $loginInstance->setUserAuth($this->getRequestInstance()->getRequestElement('username')); - - // Set password cookie - $loginInstance->setPasswordAuth($this->getRequestInstance()->getRequestElement('pass_hash')); - - // Remember this login instance for later usage - Registry::getRegistry()->addInstance('login', $loginInstance); - } -} - -// -?> diff --git a/application/shipsimu/main/menu/.htaccess b/application/shipsimu/main/menu/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/menu/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/menu/class_ShipSimu b/application/shipsimu/main/menu/class_ShipSimu deleted file mode 100644 index 93970de..0000000 --- a/application/shipsimu/main/menu/class_ShipSimu +++ /dev/null @@ -1,50 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @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 . - */ -class ShipSimu???Menu extends BaseMenu implements RenderableMenu { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this class - * - * @return $menuInstance An instance of this class - */ - public final static function createShipSimu???Menu () { - // Get a new instance - $menuInstance = new ShipSimu???Menu(); - - // Return the prepared instance - return $menuInstance; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/menu/class_ShipSimuConfirmMenu.php b/application/shipsimu/main/menu/class_ShipSimuConfirmMenu.php deleted file mode 100644 index 1dc56b7..0000000 --- a/application/shipsimu/main/menu/class_ShipSimuConfirmMenu.php +++ /dev/null @@ -1,50 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class ShipSimuConfirmMenu extends BaseMenu implements RenderableMenu { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this class - * - * @return $menuInstance An instance of this class - */ - public static final function createShipSimuConfirmMenu () { - // Get a new instance - $menuInstance = new ShipSimuConfirmMenu(); - - // Return the prepared instance - return $menuInstance; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/menu/class_ShipSimuHomeMenu.php b/application/shipsimu/main/menu/class_ShipSimuHomeMenu.php deleted file mode 100644 index ef01389..0000000 --- a/application/shipsimu/main/menu/class_ShipSimuHomeMenu.php +++ /dev/null @@ -1,50 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class ShipSimuHomeMenu extends BaseMenu implements RenderableMenu { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this class - * - * @return $menuInstance An instance of this class - */ - public static final function createShipSimuHomeMenu () { - // Get a new instance - $menuInstance = new ShipSimuHomeMenu(); - - // Return the prepared instance - return $menuInstance; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/menu/class_ShipSimuLoginAreaMenu.php b/application/shipsimu/main/menu/class_ShipSimuLoginAreaMenu.php deleted file mode 100644 index 038b123..0000000 --- a/application/shipsimu/main/menu/class_ShipSimuLoginAreaMenu.php +++ /dev/null @@ -1,50 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class ShipSimuLoginAreaMenu extends BaseMenu implements RenderableMenu { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this class - * - * @return $menuInstance An instance of this class - */ - public static final function createShipSimuLoginAreaMenu () { - // Get a new instance - $menuInstance = new ShipSimuLoginAreaMenu(); - - // Return the prepared instance - return $menuInstance; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/menu/class_ShipSimuLoginFailedMenu.php b/application/shipsimu/main/menu/class_ShipSimuLoginFailedMenu.php deleted file mode 100644 index 6978654..0000000 --- a/application/shipsimu/main/menu/class_ShipSimuLoginFailedMenu.php +++ /dev/null @@ -1,50 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class ShipSimuLoginFailedMenu extends BaseMenu implements RenderableMenu { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this class - * - * @return $menuInstance An instance of this class - */ - public static final function createShipSimuLoginFailedMenu () { - // Get a new instance - $menuInstance = new ShipSimuLoginFailedMenu(); - - // Return the prepared instance - return $menuInstance; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/menu/class_ShipSimuLoginMenu.php b/application/shipsimu/main/menu/class_ShipSimuLoginMenu.php deleted file mode 100644 index 7aa83e9..0000000 --- a/application/shipsimu/main/menu/class_ShipSimuLoginMenu.php +++ /dev/null @@ -1,50 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class ShipSimuLoginMenu extends BaseMenu implements RenderableMenu { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this class - * - * @return $menuInstance An instance of this class - */ - public static final function createShipSimuLoginMenu () { - // Get a new instance - $menuInstance = new ShipSimuLoginMenu(); - - // Return the prepared instance - return $menuInstance; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/menu/class_ShipSimuLogoutMenu.php b/application/shipsimu/main/menu/class_ShipSimuLogoutMenu.php deleted file mode 100644 index 76b6c68..0000000 --- a/application/shipsimu/main/menu/class_ShipSimuLogoutMenu.php +++ /dev/null @@ -1,50 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class ShipSimuLogoutMenu extends BaseMenu implements RenderableMenu { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this class - * - * @return $menuInstance An instance of this class - */ - public static final function createShipSimuLogoutMenu () { - // Get a new instance - $menuInstance = new ShipSimuLogoutMenu(); - - // Return the prepared instance - return $menuInstance; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/menu/class_ShipSimuRegisterMenu.php b/application/shipsimu/main/menu/class_ShipSimuRegisterMenu.php deleted file mode 100644 index d2438f2..0000000 --- a/application/shipsimu/main/menu/class_ShipSimuRegisterMenu.php +++ /dev/null @@ -1,50 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class ShipSimuRegisterMenu extends BaseMenu implements RenderableMenu { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this class - * - * @return $menuInstance An instance of this class - */ - public static final function createShipSimuRegisterMenu () { - // Get a new instance - $menuInstance = new ShipSimuRegisterMenu(); - - // Return the prepared instance - return $menuInstance; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/menu/class_ShipSimuStatusMenu.php b/application/shipsimu/main/menu/class_ShipSimuStatusMenu.php deleted file mode 100644 index fbc0434..0000000 --- a/application/shipsimu/main/menu/class_ShipSimuStatusMenu.php +++ /dev/null @@ -1,50 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class ShipSimuStatusMenu extends BaseMenu implements RenderableMenu { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this class - * - * @return $menuInstance An instance of this class - */ - public static final function createShipSimuStatusMenu () { - // Get a new instance - $menuInstance = new ShipSimuStatusMenu(); - - // Return the prepared instance - return $menuInstance; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/menu/government/.htaccess b/application/shipsimu/main/menu/government/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/menu/government/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/menu/government/class_ShipSimuGovernmentFailedAreaMenu.php b/application/shipsimu/main/menu/government/class_ShipSimuGovernmentFailedAreaMenu.php deleted file mode 100644 index 0d2112c..0000000 --- a/application/shipsimu/main/menu/government/class_ShipSimuGovernmentFailedAreaMenu.php +++ /dev/null @@ -1,50 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class ShipSimuGovernmentFailedAreaMenu extends BaseMenu implements RenderableMenu { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this class - * - * @return $menuInstance An instance of this class - */ - public static final function createShipSimuGovernmentFailedAreaMenu () { - // Get a new instance - $menuInstance = new ShipSimuGovernmentFailedAreaMenu(); - - // Return the prepared instance - return $menuInstance; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/opening/.htaccess b/application/shipsimu/main/opening/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/opening/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/opening/bank/.htaccess b/application/shipsimu/main/opening/bank/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/opening/bank/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/opening/bank/class_MoneyBankRealtimeOpening.php b/application/shipsimu/main/opening/bank/class_MoneyBankRealtimeOpening.php deleted file mode 100644 index 5136767..0000000 --- a/application/shipsimu/main/opening/bank/class_MoneyBankRealtimeOpening.php +++ /dev/null @@ -1,63 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class MoneyBankRealtimeOpening extends BaseOpening { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this opening time class - * - * @param $bankInstance An instance of a money bank - * @return $openeningInstance An instance of this class - */ - public static final function createMoneyBankRealtimeOpening (BaseBank $bankInstance) { - // Get a new instance - $openingInstance = new MoneyBankRealtimeOpening(); - - // Set the bank instance here - $openingInstance->setBankInstance($bankInstance); - - // Return the prepared instance - return $openingInstance; - } - - /** - * Checks wether we are within the opening times - * - * @return $withinOpeningTimes Wether we are within opening times - */ - public function ifWithinOpeningTimes () { - $this->partialStub(); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/opening/class_ b/application/shipsimu/main/opening/class_ deleted file mode 100644 index b9f1ce7..0000000 --- a/application/shipsimu/main/opening/class_ +++ /dev/null @@ -1,50 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @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 . - */ -class ???Opening extends BaseOpening { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this opening time class - * - * @return $openeningInstance An instance of this class - */ - public final static function create???Opening () { - // Get a new instance - $openeningInstance = new ???Opening(); - - // Return the prepared instance - return $openeningInstance; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/opening/class_BaseOpening.php b/application/shipsimu/main/opening/class_BaseOpening.php deleted file mode 100644 index 78f8983..0000000 --- a/application/shipsimu/main/opening/class_BaseOpening.php +++ /dev/null @@ -1,60 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -abstract class BaseOpening extends BaseFrameworkSystem { - /** - * A bank instance - */ - private $bankInstance = null; - - /** - * Protected constructor - * - * @param $className The class' real name - * @return void - */ - protected function __construct ($className) { - // Call parent constructor - parent::__construct($className); - } - - /** - * Setter for bank instance - * - * @param $bankInstance An instance of a bank - * @return void - */ - protected final function setBankInstance (BaseBank $bankInstance) { - $this->bankInstance = $bankInstance; - } - - /** - * Checks wether we are within the opening times - * - * @return $withinOpeningTimes Wether we are within opening times - */ - public abstract function ifWithinOpeningTimes (); -} - -// [EOF] -?> diff --git a/application/shipsimu/main/parts/.htaccess b/application/shipsimu/main/parts/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/parts/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/parts/class_BaseShipPart.php b/application/shipsimu/main/parts/class_BaseShipPart.php deleted file mode 100644 index aca83a9..0000000 --- a/application/shipsimu/main/parts/class_BaseShipPart.php +++ /dev/null @@ -1,51 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class BaseShipPart extends BaseSimulator { - // Price of this ship part - private $price = 0.00; - - // Konstruktor - protected function __construct($className) { - // Call parent constructor - parent::__construct($className); - } - - // Setter for price - public final function setPrice ($price) { - $this->price = (float) $price; - } - - // Getter for price - public final function getPrice () { - return $this->price; - } - - // Remove price - public final function removePrice () { - unset($this->price); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/parts/maschineroom/.htaccess b/application/shipsimu/main/parts/maschineroom/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/parts/maschineroom/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/parts/maschineroom/class_MaschineRoom.php b/application/shipsimu/main/parts/maschineroom/class_MaschineRoom.php deleted file mode 100644 index bcd7b30..0000000 --- a/application/shipsimu/main/parts/maschineroom/class_MaschineRoom.php +++ /dev/null @@ -1,47 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class MaschineRoom extends BaseShipPart { - // Constructor - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - // Maschinenraum erstellen - public static final function createMaschineRoom () { - // Get new instance - $roomInstance = new MaschineRoom(); - - // Umrechnungsfaktoren setzen - $roomInstance->setResizeFactorElement('width' , 1.3); - $roomInstance->setResizeFactorElement('height', 1.8); - $roomInstance->setResizeFactorElement('length', 1.3); - - // Instanz zurueckgeben - return $roomInstance; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/personell/.htaccess b/application/shipsimu/main/personell/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/personell/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/personell/class_SimulatorPersonell.php b/application/shipsimu/main/personell/class_SimulatorPersonell.php deleted file mode 100644 index 8ff01e7..0000000 --- a/application/shipsimu/main/personell/class_SimulatorPersonell.php +++ /dev/null @@ -1,327 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class SimulatorPersonell extends BasePersonell { - // Personell list - private $personellList = null; - - // A cache for lists - private $cacheList = null; - - // A string for cached conditions - private $cacheCond = null; - - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Magic wake-up method called when unserialize() is called. This is - * neccessary because in this case a personell does not need to know the - * min/max ages range and system classes. This would anyway use more RAM - * what is not required. - * - * @return void - */ - public function __wakeup () { - // Tidy up a little - $this->removePersonellList(); - $this->removeMinMaxAge(); - $this->removeCache(); - } - - /** - * Generate a specified amount of personell and return the prepared instance - * - * @param $amountPersonell Number of personell we shall - * generate - * @return $personellInstance An instance of this object with a - * list of personells - */ - public static final function createSimulatorPersonell ($amountPersonell) { - // Make sure only integer can pass - $amountPersonell = (int) $amountPersonell; - - // Get a new instance - $personellInstance = new SimulatorPersonell(); - - // Debug message - if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $personellInstance->debugOutput(sprintf("[%s:%d] Es werden %d Personal bereitgestellt.", - __CLASS__, - __LINE__, - $amountPersonell - )); - - // Initialize the personell list - $personellInstance->createPersonellList(); - - // Create requested amount of personell - for ($idx = 0; $idx < $amountPersonell; $idx++) { - $personellInstance->addRandomPersonell(); - } - - // Debug message - if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $personellInstance->debugOutput(sprintf("[%s:%d] %d Personal bereitgestellt.", - __CLASS__, - __LINE__, - $amountPersonell - )); - - // Tidy up a little - $personellInstance->removeGender(); - $personellInstance->removeNames(); - $personellInstance->removeBirthday(); - $personellInstance->removeSalary(); - $personellInstance->removeEmployed(); - $personellInstance->removeMarried(); - //$personellInstance->removeCache(); - - // Instanz zurueckgeben - return $personellInstance; - } - - /** - * Create a SimulatorPersonell object by loading the specified personell - * list from an existing database backend - * - * @param $idNumber The ID number (only right part) of the list - * @return $personellInstance An instance of this class - * @throws InvalidIDFormatException If the given id number - * $idNumber is invalid - * @throws MissingSimulatorIdException If an ID number was not found - * @deprecated - */ - public static final function createSimulatorPersonellByID ($idNumber) { - // Get instance - $personellInstance = new SimulatorPersonell(false); - $personellInstance->makeDeprecated(); - } - - // Create personell list - public function createPersonellList () { - // Is the list already created? - if ($this->personelllList instanceof FrameworkArrayObject) { - // Throw an exception - throw new PersonellListAlreadyCreatedException($this, self::EXCEPTION_DIMENSION_ARRAY_INVALID); - } // END - if - - // Initialize the array - $this->personellList = new FrameworkArrayObject("FakedPersonellList"); - } - - // Remove the personell list - private final function removePersonellList () { - unset($this->personellList); - } - - // Add new personell object to our list - public function addRandomPersonell () { - // Gender list... - $genders = array("M", "F"); - - // Create new personell members - $personellInstance = new SimulatorPersonell(); - - // Set a randomized gender - $personellInstance->setGender($genders[mt_rand(0, 1)]); - - // Set a randomized birthday (maximum age required, see const MAX_AGE) - $personellInstance->createBirthday(); - - // Married? Same values means: married - if (mt_rand(0, 5) == mt_rand(0, 5)) $personellInstance->setMarried(true); - - // Tidy up a little - $personellInstance->removePersonellList(); - $personellInstance->removeMinMaxAge(); - $personellInstance->removeCache(); - - // Add new member to the list - $this->personellList->append($personellInstance); - } - - /** - * Get a specifyable list of our people, null or empty string will be ignored! - * - * @return $cacheList A list of cached personells - */ - function getSpecialPersonellList ($isEmployed = null, $isMarried = null, $hasGender = "") { - // Serialize the conditions for checking if we can take the cache - $serialized = serialize(array($isEmployed, $isMarried, $hasGender)); - - // The same (last) conditions? - if (($serialized == $this->cacheCond) && (!is_null($this->cacheCond))) { - if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Gecachte Liste wird verwendet.", - __CLASS__, - __LINE__ - )); - - // Return cached list - return $this->cacheList; - } - - // Output debug message - if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Personalliste wird nach Kriterien durchsucht...", - __CLASS__, - __LINE__ - )); - - // Remember the conditions - $this->setCacheCond($serialized); - - // Create cached list - $this->setAllCacheList(new FrameworkArrayObject('FakedCacheList')); - - // Search all unemployed personells - for ($idx = $this->personellList->getIterator(); $idx->valid(); $idx->next()) { - // Element holen - $el = $idx->current(); - - // Check currenylt all single conditions (combined conditions are not yet supported) - if ((!is_null($isEmployed)) && ($el->isEmployed() == $isEmployed)) { - // Add this one (employed status asked) - $this->cacheList->append($el); - } elseif ((!is_null($isMarried)) && ($el->isMarried() == $isMarried)) { - // Add this one (marrital status asked) - $this->cacheList->append($el); - } elseif ((!empty($hasGender)) && ($el->getGender() == $hasGender)) { - // Add this one (specified gender) - $this->cacheList->append($el); - } - } - - // Return the completed list - return $this->cacheList; - } - - /** - * Get amount of unemployed personell - * - * @return $count Amount of unemployed personell - */ - public final function getAllUnemployed () { - // Get a temporary list - $list = $this->getSpecialPersonellList(false); - - // Anzahl zurueckliefern - return $list->count(); - } - - /** - * Remove cache things - * - * @return void - */ - private function removeCache () { - // Remove cache data - unset($this->cacheList); - unset($this->cacheCond); - } - - /** - * Setter for cache list - * - * @param $cacheList The new cache list to set or null for initialization/reset - * @return void - */ - private final function setAllCacheList (FrameworkArrayObject $cacheList = null) { - $this->cacheList = $cacheList; - } - - /** - * Setter for cache conditions - * - * @param $cacheCond The new cache conditions to set - * @return void - */ - private final function setCacheCond ($cacheCond) { - $this->cacheCond = (string) $cacheCond; - } - - /** - * Reset cache list - * - * @return void - */ - public function resetCache () { - $this->setAllCacheList(null); - $this->setCacheCond(""); - } - - /** - * Getter for surname. If no surname is set then default surnames are set - * for male and female personells. - * - * @return $surname The personell' surname - */ - public final function getSurname () { - $surname = parent::getSurname(); - - // Make sure every one has a surname... - if (empty($surname)) { - if ($this->isMale()) { - // Typical male name - $surname = "John"; - } else { - // Typical female name - $surname = "Jennifer"; - } - - // Set typical family name - parent::setFamily("Smith"); - } // END - if - - // Return surname - return $surname; - } - - /** - * Getter for personell list - * - * @return $personellList The list of all personells - */ - public final function getPersonellList () { - return $this->personellList; - } - - /** - * Loads the mostly pre-cached personell list - * - * @param $idNumber The ID number we shall use for looking up - * the right data. - * @return void - * @deprecated - */ - public function loadPersonellList ($idNumber) { - $this->makeDeprecated(); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/personell/company/.htaccess b/application/shipsimu/main/personell/company/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/personell/company/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/personell/company/class_CompanyEmployee.php b/application/shipsimu/main/personell/company/class_CompanyEmployee.php deleted file mode 100644 index 472692e..0000000 --- a/application/shipsimu/main/personell/company/class_CompanyEmployee.php +++ /dev/null @@ -1,85 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class CompanyEmployee extends SimulatorPersonell { - // Employeee list - private $employeeList = null; - - // Constructor - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - // Generate a specified amount of personell - public static final function createCompanyEmployee ($surname, $family, $gender, $year, $month, $day, $married, $salary) { - // Get instance - $personellInstance = new CompanyEmployee(); - - // Debug message - if (((defined('DEBUG_COMPANY_EMPLOYEE')) && (defined('DEBUG_PERSONELL'))) || (defined('DEBUG_ALL'))) { - $personellInstance->debugOutput(sprintf("[%s:%d] Der/Die Angestellte %s %s wird angelegt.", - __CLASS__, - __LINE__, - $surname, - $family - )); - } - - // Ist the given birthday valid? - 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); - - // Set as employed/marrital status - $personellInstance->setEmployed(true); - $personellInstance->setMarried($married); - - // Set surname/family/gender - $personellInstance->setSurname($surname); - $personellInstance->setFamily($family); - $personellInstance->setGender($gender); - - // Set salary - $personellInstance->increaseSalary($salary); - - // Tidy up a little - $personellInstance->removeEmployeeList(); - $personellInstance->removeMinMaxAge(); - - // Return prepared instance - return $personellInstance; - } - - // Remove the employee list - private function removeEmployeeList () { - unset($this->employeeList); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/registration/.htaccess b/application/shipsimu/main/registration/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/registration/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/registration/class_ShipSimuRegistration.php b/application/shipsimu/main/registration/class_ShipSimuRegistration.php deleted file mode 100644 index 674d189..0000000 --- a/application/shipsimu/main/registration/class_ShipSimuRegistration.php +++ /dev/null @@ -1,207 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class ShipSimuRegistration extends BaseRegistration implements UserRegister { - /** - * Hashed password - */ - private $hashedPassword = ''; - - /** - * Elements for criteria - */ - private $criteriaElements = array( - 'username', - 'pass_hash', - 'email' => 'email1', - 'surname', - 'family', - 'street', - 'zip', - 'city', - 'icq', - 'jabber', - 'yahoo', - 'aol', - 'msn', - 'birth_day', - 'birth_month', - 'birth_year' - ); - - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Create a new instance - * - * @return $registrationInstance An instance of this registration class - */ - public static final function createShipSimuRegistration () { - // Get a new instance - $registrationInstance = new ShipSimuRegistration(); - - // Initialize the filter chains - $registrationInstance->initFilterChains(); - - // And return it - return $registrationInstance; - } - - /** - * Encrypt given request key or throw an exception if key was not found in - * request - * - * @param $requestKey Key in request class - * @return void - */ - public function encryptPassword ($requestKey) { - // Check if password is found in request - if ($this->getRequestInstance()->isRequestElementSet($requestKey)) { - // So encrypt the password and store it for later usage in - // the request: - - // 1.: Get the plain password - $plainPassword = $this->getRequestInstance()->getRequestElement($requestKey); - - // 2. Get a crypto helper and hash the password - $this->hashedPassword = ObjectFactory::createObjectByConfiguredName('crypto_class')->hashString($plainPassword); - - // 3. Store the hash back in request - $this->getRequestInstance()->setRequestElement('pass_hash', $this->hashedPassword); - } - } - - /** - * Perform things like informing assigned affilates about new registration - * before registration - * - * @return void - * @todo Maybe add more things to perform - */ - public function doPreRegistration () { - // First run all pre filters - $this->executePreFilters(); - } - - /** - * Registers the new user account by insterting the request data into the - * database and paying some start credits or throw exceptions if this fails - * - * @return void - * @todo Maybe add more things to perform - */ - public function registerNewUser () { - // Get a user database wrapper - $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class'); - - // Use this instance to insert the whole registration instance - $wrapperInstance->insertRegistrationObject($this); - } - - /** - * Perform things like notifying partner websites after registration is done - * - * @return void - * @todo Maybe add more things to perform - */ - public function doPostRegistration () { - // First run all post filters - $this->executePostFilters(); - } - - /** - * Do the action which is required after all registration steps are done. - * This can be a simple redirect to another webpage or displaying a message - * to the user. Or this can be a login step into the newly created account. - * - * @return void - */ - public function doPostAction () { - // Get an action instance from our factory - $actionInstance = ObjectFactory::createObjectByConfiguredName('post_registration_class'); - - // Execute the action - $actionInstance->execute($this->getRequestInstance(), $this->getResponseInstance()); - } - - /** - * Adds registration elements to a given dataset instance - * - * @param $criteriaInstance An instance of a storeable criteria - * @return void - */ - public function addElementsToDataSet (StoreableCriteria $criteriaInstance) { - // Default is unconfirmed! - $configEntry = 'user_status_unconfirmed'; - - // Is the confirmation process entirely disabled? - if ($this->getConfigInstance()->getConfigEntry('confirm_email_enabled') === 'N') { - // No confirmation of email needed - $configEntry = 'user_status_confirmed'; - } // END - if - - // Add a lot elements to the dataset criteria - foreach ($this->criteriaElements as $alias => $element) { - // Do we have an alias? - if (is_string($alias)) { - // Yes, so use it - $criteriaInstance->addCriteria($alias, $this->getRequestInstance()->getRequestElement($element)); - - // Debug message - //* DEBUG: */ $this->debugOutput('ALIAS: alias='.$alias.',element='.$element.'='.$this->getRequestInstance()->getRequestElement($element)); - } else { - // No, default entry - $criteriaInstance->addCriteria($element, $this->getRequestInstance()->getRequestElement($element)); - - // Debug message - //* DEBUG: */ $this->debugOutput('DEFAULT: element='.$element.'='.$this->getRequestInstance()->getRequestElement($element)); - } - - // Is this a guest account? - if ((($element == 'username') || ($alias == 'username')) && ($this->getRequestInstance()->getRequestElement($element) == $this->getConfigInstance()->getConfigEntry('guest_login_user'))) { - // Yes, then set the config entry to guest status - $configEntry = 'user_status_guest'; - } // END - if - } // END - foreach - - // Mark the username as unique key - $criteriaInstance->setUniqueKey(UserDatabaseWrapper::DB_COLUMN_USERNAME); - - // Add account status as configured - $criteriaInstance->addConfiguredCriteria(UserDatabaseWrapper::DB_COLUMN_USER_STATUS, $configEntry); - - // Include registration timestamp - $criteriaInstance->addCriteria('registered', date('Y-m-d H:i:s', time())); - } -} - -// -?> diff --git a/application/shipsimu/main/resolver/.htaccess b/application/shipsimu/main/resolver/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/resolver/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/resolver/command/.htaccess b/application/shipsimu/main/resolver/command/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/resolver/command/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/resolver/command/html/.htaccess b/application/shipsimu/main/resolver/command/html/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/resolver/command/html/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/resolver/command/html/class_HtmlCompanyCommandResolver.php b/application/shipsimu/main/resolver/command/html/class_HtmlCompanyCommandResolver.php deleted file mode 100644 index 5b5fd9c..0000000 --- a/application/shipsimu/main/resolver/command/html/class_HtmlCompanyCommandResolver.php +++ /dev/null @@ -1,77 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class HtmlCompanyCommandResolver extends BaseCommandResolver implements CommandResolver { - /** - * Last successfull resolved command - */ - private $lastCommandInstance = null; - - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - - // Set prefix to "Html" - $this->setCommandPrefix('html'); - } - - /** - * Creates an instance of a Html command resolver with a given default command - * - * @param $commandName The default command we shall execute - * @param $appInstance An instance of a manageable application helper class - * @return $resolverInstance The prepared command resolver instance - * @throws EmptyVariableException Thrown if default command is not set - * @throws InvalidInterfaceException Thrown if command does not implement interface Commandable - */ - public static final function createHtmlCompanyCommandResolver ($commandName, ManageableApplication $appInstance) { - // Create the new instance - $resolverInstance = new HtmlCompanyCommandResolver(); - - // Get request instance - $requestInstance = $appInstance->getRequestInstance(); - - // Is the variable $commandName set and the command is valid? - if (empty($commandName)) { - // Then thrown an exception here - throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } elseif (!$resolverInstance->resolveCommandByRequest($requestInstance) instanceof Commandable) { - // Invalid command found (missing interface?) - throw new InvalidInterfaceException(array($userInstance, 'ManageableMember'), self::EXCEPTION_REQUIRED_INTERFACE_MISSING); - } - - // Set the application instance - $resolverInstance->setApplicationInstance($appInstance); - - // Return the prepared instance - return $resolverInstance; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/resolver/command/html/class_HtmlGovernmentFailedCommandResolver.php b/application/shipsimu/main/resolver/command/html/class_HtmlGovernmentFailedCommandResolver.php deleted file mode 100644 index 16edb50..0000000 --- a/application/shipsimu/main/resolver/command/html/class_HtmlGovernmentFailedCommandResolver.php +++ /dev/null @@ -1,77 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class HtmlGovernmentFailedCommandResolver extends BaseCommandResolver implements CommandResolver { - /** - * Last successfull resolved command - */ - private $lastCommandInstance = null; - - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - - // Set prefix to "Html" - $this->setCommandPrefix('html'); - } - - /** - * Creates an instance of a Html command resolver with a given default command - * - * @param $commandName The default command we shall execute - * @param $appInstance An instance of a manageable application helper class - * @return $resolverInstance The prepared command resolver instance - * @throws EmptyVariableException Thrown if default command is not set - * @throws InvalidInterfaceException Thrown if command does not implement interface Commandable - */ - public static final function createHtmlGovernmentFailedCommandResolver ($commandName, ManageableApplication $appInstance) { - // Create the new instance - $resolverInstance = new HtmlGovernmentFailedCommandResolver(); - - // Get request instance - $requestInstance = $appInstance->getRequestInstance(); - - // Is the variable $commandName set and the command is valid? - if (empty($commandName)) { - // Then thrown an exception here - throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } elseif (!$resolverInstance->resolveCommandByRequest($requestInstance) instanceof Commandable) { - // Invalid command found (missing interface?) - throw new InvalidInterfaceException(array($userInstance, 'ManageableMember'), self::EXCEPTION_REQUIRED_INTERFACE_MISSING); - } - - // Set the application instance - $resolverInstance->setApplicationInstance($appInstance); - - // Return the prepared instance - return $resolverInstance; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/resolver/controller/.htaccess b/application/shipsimu/main/resolver/controller/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/resolver/controller/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/resolver/controller/html/.htaccess b/application/shipsimu/main/resolver/controller/html/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/resolver/controller/html/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/resolver/controller/html/class_ShipSimuHtmlControllerResolver.php b/application/shipsimu/main/resolver/controller/html/class_ShipSimuHtmlControllerResolver.php deleted file mode 100644 index dc57483..0000000 --- a/application/shipsimu/main/resolver/controller/html/class_ShipSimuHtmlControllerResolver.php +++ /dev/null @@ -1,104 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class ShipSimuHtmlControllerResolver extends BaseControllerResolver implements ControllerResolver { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - - // Set prefix to 'html' - $this->setClassPrefix('html'); - } - - /** - * Creates an instance of a resolver class with a given command - * - * @param $controllerName The controller we shall resolve - * @param $applicationInstance An instance of a manageable application helper class - * @return $resolverInstance The prepared controller resolver instance - * @throws EmptyVariableException Thrown if default command is not set - * @throws InvalidControllerException Thrown if default controller is invalid - */ - public static final function createShipSimuHtmlControllerResolver ($controllerName, ManageableApplication $applicationInstance) { - // Create the new instance - $resolverInstance = new ShipSimuHtmlControllerResolver(); - - // Is the variable $controllerName set and the command is valid? - if (empty($controllerName)) { - // Then thrown an exception here - throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } elseif ($resolverInstance->isControllerValid($controllerName) === FALSE) { - // Invalid command found - throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER); - } - - // Set the application instance - $resolverInstance->setApplicationInstance($applicationInstance); - - // Set command name - $resolverInstance->setControllerName($controllerName); - - // Return the prepared instance - return $resolverInstance; - } - - /** - * Resolves the default controller of the given command - * - * @return $controllerInstance A controller instance for the default - * command - * @throws InvalidControllerInstanceException Thrown if $controllerInstance - * is invalid - */ - public function resolveController () { - // Init variables - $controllerName = ''; - $controllerInstance = NULL; - - // Get the command name - $controllerName = $this->getControllerName(); - - // Get the command - $controllerInstance = $this->loadController($controllerName); - - // And validate it - if ((!is_object($controllerInstance)) || (!$controllerInstance instanceof Controller)) { - // This command has an invalid instance! - throw new InvalidControllerInstanceException(array($this, $controllerName), self::EXCEPTION_INVALID_CONTROLLER); - } // END - if - - // Set last controller - $this->setResolvedInstance($controllerInstance); - - // Return the maybe resolved instance - return $controllerInstance; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/ships/.htaccess b/application/shipsimu/main/ships/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/ships/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/ships/class_BaseShip.php b/application/shipsimu/main/ships/class_BaseShip.php deleted file mode 100644 index ae22ca3..0000000 --- a/application/shipsimu/main/ships/class_BaseShip.php +++ /dev/null @@ -1,167 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class BaseShip extends BaseSimulator { - // Name des Shipes - private $shipName = "Unbekanntes Schiff"; - - // Anzahl Anker - private $numAnchor = 0; - - // Tiefgang in Meter - private $draught = 0; - - // Besatzung-Objekte - private $crewList = null; - - // Aufbauten-Objekte - private $structures = null; - - // Namenloses Ship generieren - protected function __construct($className) { - // Call parent constructor - parent::__construct($className); - - // Prepare array object for all structures - $this->createStructuresArray(); - - // Clean-up a little - $this->removePartInstance(); - } - - // Array-Objekt anlegen - private function createStructuresArray () { - $this->structures = new FrameworkArrayObject("FakedShipStructures"); - } - - // Schiffsteil generieren (kann alles sein) - // buildInstance = Das was in das Schiffsteil evtl. eingebaut werden soll (null = kein besonderes Teil einbauen!) - // partClass = Das zu konstruierende Schiffsteil - public function createShipPart (ConstructableShipPart $buildInstance, $partClass) { - if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiff %s erhält ein neues Schiffsteil (%s).", - __CLASS__, - __LINE__, - $this->getShipName(), - $partClass - )); - - // Ist die gewuenschte Klasse vorhanden? - if (!class_exists($partClass)) { - // Nicht vorhanden, dann Ausnahme werfen! - throw new NoClassException($partClass, self::EXCEPTION_CLASS_NOT_FOUND); - } // END - if - - // Get an instance back from our object factory - $partInstance = ObjectFactory::createObjectByName($partClass); - - // Das Einbauen versuchen... - try { - $partInstance->addShipPartToShip($this, $buildInstance); - } catch (MotorShipMismatchException $e) { - if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiff %s hat keinen Motor erhalten! Grund: %s", - __CLASS__, - __LINE__, - $this->getShipName(), - $e->getMessage() - )); - return false; - } catch (RoomShipMismatchException $e) { - if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiff %s hat keinen Maschinenraum erhalten! Grund: %s", - __CLASS__, - __LINE__, - $this->getShipName(), - $e->getMessage() - )); - return false; - - } catch (StructureShipMismatchException $e) { - if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiff %s hat keine Aufbauten erhalten! Grund: %s", - __CLASS__, - __LINE__, - $this->getShipName(), - $e->getMessage() - )); - return false; - } catch (CabinShipMismatchException $e) { - if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiff %s hat keine Kabine erhalten! Grund: %s", - __CLASS__, - __LINE__, - $this->getShipName(), - $e->getMessage() - )); - return false; - } catch (DeckShipMismatchException $e) { - if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiff %s hat kein Deck erhalten! Grund: %s", - __CLASS__, - __LINE__, - $this->getShipName(), - $e->getMessage() - )); - return false; - } - - // Instanz im Aufbauten-Array vermerken - $this->structures->append($partInstance); - - // Alles klar! - return true; - } - - // Getter-Methode fuer Strukturen-Array - public final function getStructuresArray () { - return $this->structures; - } - - // STUB: Getter-Methode Anzahl Betten - public function calcTotalBeds () { - $this->partialStub("Please implement this stub in your ship!"); - } - - // Setter-Methode fuer Schiffsnamen - public final function setShipName ($shipName) { - $this->shipName = (string) $shipName; - } - - // Getter-Methode fuer Schiffsnamen - public final function getShipName () { - return $this->shipName; - } - - // Setter-Methode fuer Tiefgang - public final function setDraught ($draught) { - $this->draught = (int) $draught; - } - - // Getter-Methode fuer Tiefgang - public final function getDraught() { - return $this->draught; - } - - // Setter-Methode fuer Anzahl Anker - public final function setNumAnchor ($numAnchor) { - $this->numAnchor = (int) $numAnchor; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/ships/passenger/.htaccess b/application/shipsimu/main/ships/passenger/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/ships/passenger/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/ships/passenger/class_PassengerShip.php b/application/shipsimu/main/ships/passenger/class_PassengerShip.php deleted file mode 100644 index 70fa5ed..0000000 --- a/application/shipsimu/main/ships/passenger/class_PassengerShip.php +++ /dev/null @@ -1,87 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class PassengerShip extends BaseShip implements ConstructableShip { - // Konstruktor - protected function __construct () { - // Eltern-Kontruktor aufrufen - parent::__construct(__CLASS__); - } - - // Passagier-Schiff erstellen - public static final function createPassengerShip ($shipName) { - // Get new instance - $passInstance = new PassengerShip(); - - // Set ship name - $passInstance->setShipName($shipName); - - // Instanz zurueckgeben - return $passInstance; - } - - // Anzahl Betten ermitteln - public final function calcTotalBeds () { - // Struktur-Array holen - $struct = $this->getStructuresArray(); - - if (is_null($struct)) { - // Empty structures list! - throw new EmptyStructuresListException($this, self::EXCEPTION_EMPTY_STRUCTURES_ARRAY); - } // END - if - - // Anzahl Betten auf 0 setzen - $numBeds = 0; - - // Alle Strukturen nach Kabinen durchsuchen - for ($idx = $struct->getIterator(); $idx->valid(); $idx->next()) { - // Element holen - $el = $idx->current(); - - // Ist es eine Kabine? - if ($el->isCabin()) { - // Anzahl Betten ermitteln - $total = $el->calcTotalBedsByCabin(); - $numBeds += $total; - - // Debug-Meldung ausgeben? - if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) { - // Get new instance - $cabType = "Kabine ohne Namen"; - $cab = $el->getPartInstance(); - if (!is_null($cab)) { - // Kabinenbeschreibung holen - $cabType = $cab->getObjectDescription(); - } // END - if - } // END - if - } // END - if - } // END - for - - // Anzahl zurueckliefern - return $numBeds; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/structures/.htaccess b/application/shipsimu/main/structures/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/structures/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/structures/class_BaseStructure.php b/application/shipsimu/main/structures/class_BaseStructure.php deleted file mode 100644 index 59318cb..0000000 --- a/application/shipsimu/main/structures/class_BaseStructure.php +++ /dev/null @@ -1,51 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class BaseStructure extends BaseSimulator { - // Price of this structure - private $price = 0.00; - - // Konstruktor (hier keine Exceptions aendern!) - protected function __construct ($className) { - // Call parent constructor - parent::__construct($className); - } - - // Setter for price - public final function setPrice ($price) { - $this->price = (float) $price; - } - - // Getter for price - public final function getPrice () { - return $this->price; - } - - // Remove price - public final function removePrice () { - unset($this->price); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/structures/extended/.htaccess b/application/shipsimu/main/structures/extended/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/structures/extended/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/structures/extended/cabines/.htaccess b/application/shipsimu/main/structures/extended/cabines/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/structures/extended/cabines/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/structures/extended/cabines/class_BaseCabin.php b/application/shipsimu/main/structures/extended/cabines/class_BaseCabin.php deleted file mode 100644 index b513944..0000000 --- a/application/shipsimu/main/structures/extended/cabines/class_BaseCabin.php +++ /dev/null @@ -1,38 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class BaseCabin extends BaseCabinStructure { - // Konstruktor - protected function __construct ($className) { - // Call parent constructor - parent::__construct($className); - } - - // Is this a cabin? - public final function isCabin () { - return ($this->isClass("BaseCabin")); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/structures/extended/cabines/ship/.htaccess b/application/shipsimu/main/structures/extended/cabines/ship/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/structures/extended/cabines/ship/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/structures/extended/cabines/ship/class_EconomyCabin.php b/application/shipsimu/main/structures/extended/cabines/ship/class_EconomyCabin.php deleted file mode 100644 index beceae8..0000000 --- a/application/shipsimu/main/structures/extended/cabines/ship/class_EconomyCabin.php +++ /dev/null @@ -1,58 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class EconomyCabin extends BaseCabin implements TradeableItem, ConstructableShipPart { - // Konstruktor - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - // Economy-Kabine erstellen - public static final function createEconomyCabin ($numLuxury, $numRooms, $numBeds, $dim) { - // Get new instance - $ecoInstance = new EconomyCabin(); - - // Abmasse extrahieren - $ecoInstance->extractDimensions($dim); - - // Den Rest auch setzen - $ecoInstance->setNumCabin($numLuxury); - $ecoInstance->setNumRooms($numRooms); - $ecoInstance->setNumBeds($numBeds); - - // Nicht noetig! - $ecoInstance->removePartInstance(); - - // Instanz zurueckgeben - return $ecoInstance; - } - - // Overwritten method for tradeable items - public function isTradeable () { - return true; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/structures/extended/cabines/ship/class_LowCabin.php b/application/shipsimu/main/structures/extended/cabines/ship/class_LowCabin.php deleted file mode 100644 index 23b877c..0000000 --- a/application/shipsimu/main/structures/extended/cabines/ship/class_LowCabin.php +++ /dev/null @@ -1,58 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class LowCabin extends BaseCabin implements TradeableItem, ConstructableShipPart { - // Konstruktor - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - // 2-Sterne-Klasse erstellen - public static final function createLowCabin ($numLuxury, $numRooms, $numBeds, $dim) { - // Get new instance - $lowInstance = new LowCabin(); - - // Abmasse extrahieren - $lowInstance->extractDimensions($dim); - - // Den Rest auch setzen - $lowInstance->setNumCabin($numLuxury); - $lowInstance->setNumRooms($numRooms); - $lowInstance->setNumBeds($numBeds); - - // Nicht noetig! - $lowInstance->removePartInstance(); - - // Instanz zurueckgeben - return $lowInstance; - } - - // Overwritten method for tradeable items - public function isTradeable () { - return true; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/structures/extended/cabines/ship/class_LuxuryCabin.php b/application/shipsimu/main/structures/extended/cabines/ship/class_LuxuryCabin.php deleted file mode 100644 index 78cb9c4..0000000 --- a/application/shipsimu/main/structures/extended/cabines/ship/class_LuxuryCabin.php +++ /dev/null @@ -1,58 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class LuxuryCabin extends BaseCabin implements TradeableItem, ConstructableShipPart { - // Konstruktor - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - // Eine Luxuskabine erstellen - public static final function createLuxuryCabin ($numLuxury, $numRooms, $numBeds, $dim) { - // Get new instance - $luxuryInstance = new LuxuryCabin(); - - // Abmasse extrahieren - $luxuryInstance->extractDimensions($dim); - - // Den Rest auch setzen - $luxuryInstance->setNumCabin($numLuxury); - $luxuryInstance->setNumRooms($numRooms); - $luxuryInstance->setNumBeds($numBeds); - - // Nicht noetig! - $luxuryInstance->removePartInstance(); - - // Instanz zurueckgeben - return $luxuryInstance; - } - - // Overwritten method for tradeable items - public function isTradeable () { - return true; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/structures/extended/cabines/ship/class_PremierCabin.php b/application/shipsimu/main/structures/extended/cabines/ship/class_PremierCabin.php deleted file mode 100644 index 522e301..0000000 --- a/application/shipsimu/main/structures/extended/cabines/ship/class_PremierCabin.php +++ /dev/null @@ -1,58 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class PremierCabin extends BaseCabin implements TradeableItem, ConstructableShipPart { - // Konstruktor - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - // Premier-Kabine erstellen - public static final function createPremierCabin ($numLuxury, $numRooms, $numBeds, $dim) { - // Get new instance - $premierInstance = new PremierCabin(); - - // Abmasse extrahieren - $premierInstance->extractDimensions($dim); - - // Den Rest auch setzen - $premierInstance->setNumCabin($numLuxury); - $premierInstance->setNumRooms($numRooms); - $premierInstance->setNumBeds($numBeds); - - // Nicht noetig! - $premierInstance->removePartInstance(); - - // Instanz zurueckgeben - return $premierInstance; - } - - // Overwritten method for tradeable items - public function isTradeable () { - return true; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/structures/extended/class_ b/application/shipsimu/main/structures/extended/class_ deleted file mode 100644 index 9644fd5..0000000 --- a/application/shipsimu/main/structures/extended/class_ +++ /dev/null @@ -1,7 +0,0 @@ - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - die("limitObject() reached! Stub!"); - } diff --git a/application/shipsimu/main/structures/extended/class_BaseCabinStructure.php b/application/shipsimu/main/structures/extended/class_BaseCabinStructure.php deleted file mode 100644 index 77a81ae..0000000 --- a/application/shipsimu/main/structures/extended/class_BaseCabinStructure.php +++ /dev/null @@ -1,135 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class BaseCabinStructure extends BaseStructure { - // --- Besondere Eigenschaften dazufuegen: --- - // Anzahl der Kabinen im Schiff - private $numCabin = 0; - - // Anzahl Raeume pro Kabine (kann auch nur 1 sein) - private $numRooms = 0; - - // Anzahl Betten, verallgemeinert - private $numBeds = 0; - - // Konstruktor - protected function __construct ($className) { - // Call parent constructor - parent::__construct($className); - } - - // Kabine hinzufuegen - public function addShipPartToShip (ConstructableShip $shipInstance, ConstructableShipPart $cabinInstance) { - // Eltern-Methode aufrufen - parent::addShipPartToShip ($shipInstance, $cabinInstance); - - // Restlichen Daten ebenfalls - $this->setNumCabin($cabinInstance->numCabin); - $this->setNumRooms($cabinInstance->numRooms); - $this->setNumBeds($cabinInstance->numBeds); - - // Unnoetige Attribute entfernen - $cabinInstance->removeNumCabin(); - $cabinInstance->removeNumRooms(); - $cabinInstance->removeNumBeds(); - - // Instanz setzen - $this->setDeckInstance($cabinInstance); - } - - // Wrapper fuer setDeckInstance->setPartInstance - public final function setDeckInstance ($deck) { - parent::setPartInstance($deck); - } - - // Getter-Methode fuer Anzahl Betten - public final function getNumBeds () { - return $this->numBeds; - } - - // Getter-Methode fuer Anzahl Kabinen - public final function getNumCabin () { - return $this->numCabin; - } - - // Setter-Methode fuer Anzahl Betten - public final function setNumBeds ($numBeds) { - $this->numBeds = $numBeds; - } - - // Setter-Methode fuer Anzahl Raeume - public final function setNumRooms ($numRooms) { - $this->numRooms = $numRooms; - } - - // Setter-Methode fuer Anzahl Kabinen - public final function setNumCabin ($numCabin) { - $this->numCabin = $numCabin; - } - - // Loesch-Methode fuer Anzahl Betten - public final function removeNumBeds() { - unset($this->numBeds); - } - - // Loesch-Methode fuer Anzahl Kabinen - public final function removeNumCabin() { - unset($this->numCabin); - } - - // Loesch-Methode fuer Anzahl Raeume - public final function removeNumRooms() { - unset($this->numRooms); - } - - // Bettenanzahl pro Kabine berechnen - public function calcTotalBedsByCabin () { - // Dann Bettenanzahl holen und aufaddieren - $beds = $this->getNumBeds(); - $num = $this->getNumCabin(); - $cabinBeds = $beds * $num; - if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) { - // Get new instance - $cabType = "Kabine ohne Namen"; - $cab = $this->getPartInstance(); - if (!is_null($cab)) { - // Kabinenbeschreibung holen - $cabType = $cab->__toString(); - } - - // Debug-Meldung ausgeben - $this->debugOutput(sprintf("[%s:%d] Es exisitieren %d Kabinen vom Typ %s zu je %d Betten. Das sind %d Betten.", - __CLASS__, - __LINE__, - $num, - $cabType, - $beds, - $cabinBeds - )); - } - return $cabinBeds; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/structures/extended/class_BaseDeckStructure.php b/application/shipsimu/main/structures/extended/class_BaseDeckStructure.php deleted file mode 100644 index 0f44a55..0000000 --- a/application/shipsimu/main/structures/extended/class_BaseDeckStructure.php +++ /dev/null @@ -1,61 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class BaseDeckStructure extends BaseStructure { - // Anzahl Decks - private $numDecks = 0; - - // Konstruktor - protected function __construct ($className) { - // Call parent constructor - parent::__construct($className); - } - - // Deckstruktur dem Schiff hinzufuegen - public function addShipPartToShip (ConstructableShip $shipInstance, ConstructableShipPart $deckInstance) { - // Eltern-Methode aufrufen - parent::addShipPartToShip($shipInstance, $deckInstance); - - // Andere Daten uebertragen und von der Quelle loeschen - $this->setNumDecks($deckInstance->getNumDecks()); - $deckInstance->removeNumDecks(); - } - - // Deckanzahl entfernen - public final function removeNumDecks() { - unset($this->numDecks); - } - - // Setter-Methode fuer Anzahl Decks - public final function setNumDecks($numDecks) { - $this->numDecks = (int) $numDecks; - } - - // Getter-Methode fuer Anzahl Decks - public final function getNumDecks() { - return $this->numDecks; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/structures/extended/class_BaseUpperStructure.php b/application/shipsimu/main/structures/extended/class_BaseUpperStructure.php deleted file mode 100644 index dd6934c..0000000 --- a/application/shipsimu/main/structures/extended/class_BaseUpperStructure.php +++ /dev/null @@ -1,37 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class BaseUpperStructure extends BaseStructure { - /** - * Constructor for all super structures on a ship - * - * @return void - */ - protected function __construct ($className) { - // Call parent constructor - parent::__construct($className); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/structures/extended/decks/.htaccess b/application/shipsimu/main/structures/extended/decks/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/structures/extended/decks/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/structures/extended/decks/cargo/.htaccess b/application/shipsimu/main/structures/extended/decks/cargo/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/structures/extended/decks/cargo/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/structures/extended/decks/cargo/class_CarDeck.php b/application/shipsimu/main/structures/extended/decks/cargo/class_CarDeck.php deleted file mode 100644 index d87dd09..0000000 --- a/application/shipsimu/main/structures/extended/decks/cargo/class_CarDeck.php +++ /dev/null @@ -1,56 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class CarDeck extends BaseDeck implements TradeableItem, ConstructableShipPart { - // Konstruktor - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - // Autodeck erstellen - public static final function createCarDeck ($numDecks, $dim) { - // Get new instance - $carInstance = new CarDeck(); - - // Abmasse extrahieren - $carInstance->extractDimensions($dim); - - // Andere Daten uebetragen - $carInstance->setNumDecks($numDecks); - - // Nicht noetige Instanz - $carInstance->removePartInstance(); - - // Instanz zurueckgeben - return $carInstance; - } - - // Overwritten method for tradeable items - public function isTradeable () { - return true; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/structures/extended/decks/cargo/class_TrainDeck.php b/application/shipsimu/main/structures/extended/decks/cargo/class_TrainDeck.php deleted file mode 100644 index 07410ea..0000000 --- a/application/shipsimu/main/structures/extended/decks/cargo/class_TrainDeck.php +++ /dev/null @@ -1,56 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class TrainDeck extends BaseDeck implements TradeableItem, ConstructableShipPart { - // Konstruktor - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - // LKW-Deck erstellen - public static final function createTrainDeck ($numDecks, $dim) { - // Get new instance - $trainInstance = new TrainDeck(); - - // Abmasse extrahieren - $trainInstance->extractDimensions($dim); - - // Andere Daten uebetragen - $trainInstance->setNumDecks($numDecks); - - // Nicht noetige Instanz - $trainInstance->removePartInstance(); - - // Instanz zurueckliefern - return $trainInstance; - } - - // Overwritten method for tradeable items - public function isTradeable () { - return true; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/structures/extended/decks/cargo/class_TruckDeck.php b/application/shipsimu/main/structures/extended/decks/cargo/class_TruckDeck.php deleted file mode 100644 index 6a87d85..0000000 --- a/application/shipsimu/main/structures/extended/decks/cargo/class_TruckDeck.php +++ /dev/null @@ -1,57 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class TruckDeck extends BaseDeck implements TradeableItem, ConstructableShipPart { - // Konstruktor - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - // LKW-Deck erstellen - public static final function createTruckDeck ($numDecks, $dim) { - // Get new instance - $truckInstance = new TruckDeck(); - - // Abmasse extrahieren - $truckInstance->extractDimensions($dim); - - // Andere Daten uebetragen - $truckInstance->setNumDecks($numDecks); - - // Nicht noetige Instanz - $truckInstance->removePartInstance(); - - // Instanz zurueckliefern - return $truckInstance; - } - - // Overwritten method for tradeable items - public function isTradeable () { - return true; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/structures/extended/decks/class_BaseDeck.php b/application/shipsimu/main/structures/extended/decks/class_BaseDeck.php deleted file mode 100644 index 7b92d68..0000000 --- a/application/shipsimu/main/structures/extended/decks/class_BaseDeck.php +++ /dev/null @@ -1,37 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class BaseDeck extends BaseDeckStructure { - /** - * Constructor for cargo decks in general - * - * @return void - */ - protected function __construct ($className) { - // Call parent constructor - parent::__construct($className); - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/structures/extended/lower/.htaccess b/application/shipsimu/main/structures/extended/lower/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/structures/extended/lower/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/structures/extended/upper/.htaccess b/application/shipsimu/main/structures/extended/upper/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/structures/extended/upper/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/structures/extended/upper/class_Bridge.php b/application/shipsimu/main/structures/extended/upper/class_Bridge.php deleted file mode 100644 index 1c3b674..0000000 --- a/application/shipsimu/main/structures/extended/upper/class_Bridge.php +++ /dev/null @@ -1,55 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class Bridge extends BaseUpperStructure implements TradeableItem, ConstructableShipPart { - // Constructor - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - - // Clean up a little - $this->removePartInstance(); - } - - // Eine Kommandobruecke erstellen - public static final function createBridge ($width, $height, $length) { - // Get new instance - $bridgeInstance = new Bridge(); - - // Abmasse setzen - $bridgeInstance->setWidth($width); - $bridgeInstance->setHeight($height); - $bridgeInstance->setLength($length); - - // Instanz zurueckgeben - return $bridgeInstance; - } - - // Overwritten method for tradeable items - public function isTradeable () { - return true; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/user/.htaccess b/application/shipsimu/main/user/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/user/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/user/class_ShipSimuBaseUser.php b/application/shipsimu/main/user/class_ShipSimuBaseUser.php deleted file mode 100644 index 75de2c7..0000000 --- a/application/shipsimu/main/user/class_ShipSimuBaseUser.php +++ /dev/null @@ -1,261 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class ShipSimuBaseUser extends BaseUser implements Registerable, Updateable { - /** - * Protected constructor - * - * @param $className Name of the class - * @return void - */ - protected function __construct ($className) { - // Call parent constructor - parent::__construct($className); - } - - /** - * Initializes the bank instance - * - * @return $bankInstance A bank instance wether just created or from registry - */ - protected function initBankInstance () { - // Init instance - $bankInstance = null; - - try { - // Get a money bank instance from registry - $bankInstance = Registry::getRegistry()->getInstance('money_bank'); - } catch (NullPointerException $e) { - // Instance not found in registry - // @TODO We should log this exception later - } - - // Is it there? - if (is_null($bankInstance)) { - // Then create a new one - $bankInstance = ObjectFactory::createObjectByConfiguredName('bank_class', array($this)); - - // Store it in registry - Registry::getRegistry()->addInstance('money_bank', $bankInstance); - } // END - if - - // Return the instance - return $bankInstance; - } - - /** - * Initializes the government instance - * - * @return $governmentInstance A government instance - */ - protected function initGovernmentInstance () { - // Init instance - $governmentInstance = null; - - try { - // First get a government instance from registry - $governmentInstance = Registry::getRegistry()->getInstance('government'); - } catch (NullPointerException $e) { - // Instance not found in registry - // @TODO We should log this exception later - } - - // Is it there? - if (is_null($governmentInstance)) { - // Then create a new one - $governmentInstance = ObjectFactory::createObjectByConfiguredName('government_class', array($this)); - - // Store it in registry - Registry::getRegistry()->addInstance('government', $governmentInstance); - } // END - if - - // Return the prepared instance - return $governmentInstance; - } - - /** - * Checks wether the user has reached maximum allowed companies to found - * - * @return $reached Wether the user has reached maximum allowed companies to found - */ - public function ifUserCreatedMaximumAllowedCompanies () { - // Get max allowed companies to found - $maxFound = $this->getConfigInstance()->getConfigEntry('max_allowed_companies_found'); - - // Now get a search criteria and set the user's name as criteria - $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); - $searchInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUserName()); - $searchInstance->setLimit($maxFound); - - // Get a company wrapper - $wrapperInstance = ObjectFactory::createObjectByConfiguredName('company_db_wrapper_class'); - - // Do the count-select by criteria - $totalRows = $wrapperInstance->doSelectCountByCriteria($searchInstance); - - // Does the user have reached maximum? - $reached = ($totalRows >= $maxFound); - - // Return the result - return $reached; - } - - /** - * Checks wether the user has the required amount of points left for the specified action - * - * @param $action The action or configuration entry plus prefix the user wants to perform - * @return $hasRequired Wether the user has the required points - */ - public function ifUserHasRequiredPoints ($action) { - // Default is that everyone is poor... ;-) - $hasRequired = false; - - // Init instance - $pointsInstance = null; - - try { - // Get a points instance from registry - $pointsInstance = Registry::getRegistry()->getInstance('points'); - } catch (NullPointerException $e) { - // Instance not found in registry - // @TODO We should log this exception later - } - - // Is there an instance? - if (is_null($pointsInstance)) { - // Then create one - $pointsInstance = ObjectFactory::createObjectByConfiguredName('user_points_class', array($this)); - - // And store it in registry - Registry::getRegistry()->addInstance('points', $pointsInstance); - } // END - if - - // Just forward this request to the user points class - $hasRequired = $pointsInstance->ifUserHasRequiredPoints($action); - - // Return the result - return $hasRequired; - } - - /** - * Determines if government can still pay a "virtual training course" in general - * - * @return $ifGovHelps Wether if government helps the user with a virtual training course - */ - public function ifGovernmentPaysTraining () { - // By default they want to help. - $ifGovHelps = true; - - // Initialize government instance - $governmentInstance = $this->initGovernmentInstance(); - - // Then ask the government if they want to pay a "startup help" to the user - $ifGovHelps = ($governmentInstance->ifGovernmentAlreadyPayedTraining()); - - // Return result here - return $ifGovHelps; - } - - /** - * Determines if government can still pay a "startup help" to the user - * - * @return $ifGovHelps Wether if government helps the user with some startup money - */ - public function ifGovernmentPaysStartupHelp () { - // By default they want to help. - $ifGovHelps = true; - - // Initialize government instance - $governmentInstance = $this->initGovernmentInstance(); - - // Then ask the government if they want to pay a "startup help" to the user - $ifGovHelps = ($governmentInstance->ifGovernmentPayedMaxmimumStartupHelp()); - - // Return result here - return $ifGovHelps; - } - - /** - * Checks wether the user can take points from the money bank - * - * @return $bankLends Wether the money bank is able to lend money - * @todo Need to implement MoneyBank::ifBankLendsMoreMoney() - */ - public function ifUserAllowedTakeCreditsFromMoneyBank () { - // Per default the money bank cannot pay - $bankLends = false; - - // Initialize bank instance - $bankInstance->initBankInstance(); - - // Does the money bank lend more money? - $bankLends = ($bankInstance->ifBankLendsMoreMoney()); - - // Return result - return $bankLends; - } - - /** - * Checks wether the user has maximum credits with the money bank. This - * should be done seperately from checking if the user is allowed to take - * credits from the bank. - * - * @return $hasMaxCredits Wether the user has maximum credits with the bank - * @todo Need to check the bank if they can lend more money - */ - public function ifUserHasMaximumCreditsWithMoneyBank () { - // For default he can still get money - $hasMaxCredits = false; - - // Initialize the bank instance - $bankInstance = $this->initBankInstance(); - - // Now check if the user has maximum credits - $hasMaxCredits = ($bankInstance->ifUserHasMaxCredits()); - - // Return the result - return $hasMaxCredits; - } - - /** - * Checks wether the money bank has opened - * - * @return $hasOpened Wether the money bank has opened - */ - public function ifMoneyBankHasOpened () { - // Default is not opened - $hasOpened = false; - - // Initialize the bank instance - $bankInstance = $this->initBankInstance(); - - // Has this bank opened? - $hasOpened = ($bankInstance->ifMoneyBankHasOpened()); - - // Return result - return $hasOpened; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/user/extended/.htaccess b/application/shipsimu/main/user/extended/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/user/extended/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/user/extended/class_ShipSimuGuest.php b/application/shipsimu/main/user/extended/class_ShipSimuGuest.php deleted file mode 100644 index a66de18..0000000 --- a/application/shipsimu/main/user/extended/class_ShipSimuGuest.php +++ /dev/null @@ -1,108 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class ShipSimuGuest extends ShipSimuBaseUser implements ManageableGuest { - // Exceptions - const EXCEPTION_USERNAME_NOT_FOUND = 0x170; - const EXCEPTION_USER_EMAIL_NOT_FOUND = 0x171; - const EXCEPTION_USER_PASS_MISMATCH = 0x172; - - /** - * Protected constructor - * - * @param $className Name of the class - * @return void - */ - protected function __construct ($className = __CLASS__) { - // Call parent constructor - parent::__construct($className); - } - - /** - * Creates an instance of this user class by a provided username. This - * factory method will check if username is already taken and if not - * so it will throw an exception. - * - * @param $userName Username we need a class instance for - * @return $userInstance An instance of this user class - * @throws UsernameMissingException If the username does not exist - */ - public static final function createGuestByUsername ($userName) { - // Get a new instance - $userInstance = new ShipSimuGuest(); - - // Set the username - $userInstance->setUserName($userName); - - // Check if username exists - 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; - } - - /** - * Creates an instance of this user class by a provided email address. This - * factory method will not check if email address is there. - * - * @param $email Email address of the user - * @return $userInstance An instance of this user class - */ - public static final function createGuestByEmail ($email) { - // Get a new instance - $userInstance = new ShipSimuGuest(); - - // Set the username - $userInstance->setEmail($email); - - // Return the instance - return $userInstance; - } - - /** - * Updates the last activity timestamp and last performed action in the - * database result. You should call flushPendingUpdates() to flush these updates - * to the database layer. - * - * @param $requestInstance A requestable class instance - * @return void - */ - public function updateLastActivity (Requestable $requestInstance) { - // No activity will be logged for guest accounts - } - - /** - * Flushs all pending updates to the database layer - * - * @return void - */ - public function flushPendingUpdates () { - // No updates will be flushed to database! - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/user/extended/class_ShipSimuMember.php b/application/shipsimu/main/user/extended/class_ShipSimuMember.php deleted file mode 100644 index a37ef16..0000000 --- a/application/shipsimu/main/user/extended/class_ShipSimuMember.php +++ /dev/null @@ -1,220 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class ShipSimuMember extends ShipSimuBaseUser implements ManageableMember, BookableAccount { - /** - * Protected constructor - * - * @param $className Name of the class - * @return void - */ - protected function __construct ($className = __CLASS__) { - // Call parent constructor - parent::__construct($className); - } - - /** - * Destructor for e.g. flushing pending updates to the database - * - * @return void - */ - public function __destruct () { - // Flush any updated entries to the database - $this->flushPendingUpdates(); - - // Call parent destructor - parent::__destruct(); - } - - /** - * Creates an instance of this user class by a provided username. This - * factory method will check if username is already taken and if not - * so it will throw an exception. - * - * @param $userName Username we need a class instance for - * @return $userInstance An instance of this user class - * @throws UsernameMissingException If the username does not exist - */ - public static final function createMemberByUsername ($userName) { - // Get a new instance - $userInstance = new ShipSimuMember(); - - // Set the username - $userInstance->setUserName($userName); - - // Check if username exists - 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; - } - - /** - * Creates an instance of this user class by a provided email address. This - * factory method will not check if email address is there. - * - * @param $email Email address of the user - * @return $userInstance An instance of this user class - */ - public static final function createMemberByEmail ($email) { - // Get a new instance - $userInstance = new ShipSimuMember(); - - // Set the username - $userInstance->setEmail($email); - - // Return the instance - return $userInstance; - } - - /** - * Creates a user by a given request instance - * - * @param $requestInstance An instance of a Requestable class - * @return $userInstance An instance of this user class - * @todo Add more ways of creating user instances - */ - public static final function createMemberByRequest (Requestable $requestInstance) { - // Determine if by email or username - if (!is_null($requestInstance->getRequestElement('username'))) { - // Username supplied - $userInstance = self::createMemberByUserName($requestInstance->getRequestElement('username')); - } elseif (!is_null($requestInstance->getRequestElement('email'))) { - // Email supplied - $userInstance = self::createMemberByEmail($requestInstance->getRequestElement('email')); - } else { - // Unsupported mode - $userInstance = new ShipSimuMember(); - $userInstance->partialStub("We need to add more ways of creating user classes here."); - $userInstance->debugBackTrace(); - exit(); - } - - // Return the prepared instance - return $userInstance; - } - - /** - * Updates the last activity timestamp and last performed action in the - * database result. You should call flushPendingUpdates() to flush these updates - * to the database layer. - * - * @param $requestInstance A requestable class instance - * @return void - */ - public function updateLastActivity (Requestable $requestInstance) { - // Set last action - $lastAction = $requestInstance->getRequestElement('action'); - - // If there is no action use the default on - if (is_null($lastAction)) { - $lastAction = $this->getConfigInstance()->getConfigEntry('login_default_action'); - } // END - if - - // Get a critieria instance - $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); - - // Add search criteria - $searchInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUserName()); - $searchInstance->setLimit(1); - - // Now get another criteria - $updateInstance = ObjectFactory::createObjectByConfiguredName('update_criteria_class'); - - // And add our both entries - $updateInstance->addCriteria('last_activity', date('Y-m-d H:i:s', time())); - $updateInstance->addCriteria('last_action', $lastAction); - - // Add the search criteria for searching for the right entry - $updateInstance->setSearchInstance($searchInstance); - - // Set wrapper class name - $updateInstance->setWrapperConfigEntry('user_db_wrapper_class'); - - // Remember the update in database result - $this->getResultInstance()->add2UpdateQueue($updateInstance); - } - - /** - * Books the given 'amount' in the request instance on the users 'points - * account' - * - * @param $requestInstance An instance of a Requestable class - * @return void - */ - public function bookAmountDirectly (Requestable $requestInstance) { - // Init points instance - $pointsInstance = null; - - try { - // Get the points class from registry - $pointsInstance = Registry::getRegistry()->getInstance('points'); - } catch (NullPointerException $e) { - // Instance not found in registry - // @TODO We should log this later - } - - // Is the points instance null? - if (is_null($pointsInstance)) { - // Then get a new one - $pointsInstance = ObjectFactory::createObjectByConfiguredName('user_points_class', array($this)); - - // And store it in registry - Registry::getRegistry()->addInstance('points', $pointsInstance); - } // END - if - - // Get the amount - $amount = $requestInstance->getRequestElement('amount'); - - // Call the method for booking points - $pointsInstance->bookPointsDirectly($amount); - } - - /** - * Flushs all pending updates to the database layer - * - * @return void - */ - public function flushPendingUpdates () { - // Is the object valid? - if (!$this->getResultInstance() instanceof SearchableResult) { - // Abort here - return; - } // END - if - - // Do we have data to update? - if ($this->getResultInstance()->ifDataNeedsFlush()) { - // Get a database wrapper - $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class'); - - // Yes, then send the whole result to the database layer - $wrapperInstance->doUpdateByResult($this->getResultInstance()); - } // END - if - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/wrapper/.htaccess b/application/shipsimu/main/wrapper/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/shipsimu/main/wrapper/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/shipsimu/main/wrapper/class_CompanyDatabaseWrapper.php b/application/shipsimu/main/wrapper/class_CompanyDatabaseWrapper.php deleted file mode 100644 index 1552e67..0000000 --- a/application/shipsimu/main/wrapper/class_CompanyDatabaseWrapper.php +++ /dev/null @@ -1,129 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class CompanyDatabaseWrapper extends BaseDatabaseWrapper { - /** - * Company instance - */ - private $companyInstance = null; - - // Constants for database tables - const DB_TABLE_COMPANY_DATA = 'company'; - const DB_TABLE_COMPANY_USER = 'company_user'; - - // Constants for database columns - const DB_COLUMN_PARTICIPANT_ID = 'participant_id'; - - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this wrapper class - * - * @param $companyInstance An instance of a generic company class or null if no specific - * @return $wrapperInstance An instance of this wrapper class - * @todo Find an interface which is suitable for all companies - */ - public static final function createCompanyDatabaseWrapper (ShippingCompany $companyInstance = null) { - // Create a new instance - $wrapperInstance = new CompanyDatabaseWrapper(); - - // Set (primary!) table name - $wrapperInstance->setTableName(self::DB_TABLE_COMPANY_DATA); - - // Set the company instance if not null - if (!is_null($companyInstance)) { - $wrapperInstance->setCompanyInstance($companyInstance); - } // END - if - - // Return the instance - return $wrapperInstance; - } - - /** - * Checks wether the given user participates in a company - * - * @param $userInstance An instance of a user class - * @return $participates Wether the user participates at lease in one company - */ - public function ifUserParticipatesInCompany (ManageableAccount $userInstance) { - // By default no user owns any company... ;) - $participates = false; - - // Get a search criteria class - $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); - - // Add the user primary key as a search criteria - $searchInstance->addCriteria(self::DB_COLUMN_PARTICIPANT_ID, $userInstance->getPrimaryKey()); - $searchInstance->setLimit(1); - - // Set company->user table - $this->setTableName(self::DB_TABLE_COMPANY_USER); - - // Get the result back - $resultInstance = $this->doSelectByCriteria($searchInstance); - - // Is there a result? - if ($resultInstance->next()) { - // Then cache it - $this->setResultInstance($resultInstance); - - // Entry found for further analysis/processing - $participates = true; - } // END - if - - // Return the result - return $participates; - } - - /** - * Setter for company instance - * - * @param $companyInstance An instance of a generic company - * @return void - * @todo Find an interface suitable for all types of companies - */ - protected final function setCompanyInstance (ShippingCompany $companyInstance) { - $this->companyInstance = $companyInstance; - } - - /** - * Getter for company instance - * - * @return $companyInstance An instance of a generic company - * @todo Find an interface suitable for all types of companies - */ - public final function getCompanyInstance () { - return $this->companyInstance; - } -} - -// [EOF] -?> diff --git a/application/shipsimu/main/wrapper/class_UserGovernmentDatabaseWrapper.php b/application/shipsimu/main/wrapper/class_UserGovernmentDatabaseWrapper.php deleted file mode 100644 index 6392d6b..0000000 --- a/application/shipsimu/main/wrapper/class_UserGovernmentDatabaseWrapper.php +++ /dev/null @@ -1,70 +0,0 @@ -user data - * - * @author Roland Haeder - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class UserGovernmentDatabaseWrapper extends BaseDatabaseWrapper { - // Constants for database tables - const DB_TABLE_USER_GOVERNMENT = 'gov_user'; - - // Database columns - const DB_COLUMN_GOV_USERID = 'gov_uid'; - const DB_COLUMN_GOV_ACTIVITY = 'gov_activity_status'; - - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this wrapper class - * - * @return $wrapperInstance An instance of this wrapper class - */ - public static final function createUserGovernmentDatabaseWrapper () { - // Create a new instance - $wrapperInstance = new UserGovernmentDatabaseWrapper(); - - // Set (primary!) table name - $wrapperInstance->setTableName(self::DB_TABLE_USER_GOVERNMENT); - - // Return the instance - return $wrapperInstance; - } - - /** - * Registers the given startup help request with the government - * - * @param $requestInstance A Requestable instance - * @return void - */ - public function registerStartupHelpByRequest (Requestable $requestInstance) { - $requestInstance->debugInstance(); - } -} - -// [EOF] -?> diff --git a/core b/core index a0551c3..7bc4014 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit a0551c30b2e11aadba3f0513ef67c36ca7e60552 +Subproject commit 7bc4014657a70dedfc38b9b28d134aa7c3a6158c