--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ *
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A general action class for blog
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An action class for the login welcome page
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * An action class for the profile page
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An action for
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * An action for shipping company page
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * An action for government startup help form
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * An action for trainings payed by government
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * An action for logout
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * An action for profile (editing) page
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * An action for money refill page
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * An action for
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * An action for the welcome page
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A general bank class
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A money bank which may lend points to the user
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ *
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A general class for personell
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * The general simulator class
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <strong>%s</strong> vom Typ <strong>%s</strong> 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 <u>%s</u> vom Typ <u>%s</u> 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]
+?>
--- /dev/null
+<?php
+/**
+ * A class for merchants which can trade items
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <strong>%s</strong> wird angelegt und soll sich am <strong>%s</strong> 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]
+?>
--- /dev/null
+<?php
+/**
+ * The work constract class which can be used for contract parties
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <strong>%s</strong> wird zusammen mit dem Konstruktionsteil <strong>%s</strong> 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 <strong>%s</strong> konnte nicht vervollständigt werden. Grund: <strong>%s</strong><br />",
+ $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 <strong>%s</strong> 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 <strong>%s</strong> <em><strong>%s</strong></em> stimmt einem Bauvertrag über das <strong>%s</strong> <em><strong>%s</strong></em> zu.",
+ __CLASS__,
+ __LINE__,
+ $partnerInstance->getObjectDescription(),
+ $partnerInstance->getCompanyName(),
+ $this->getShipInstance()->getObjectDescription(),
+ $this->getShipInstance()->getShipName()
+ ));
+ } else {
+ // Other contract party
+ $this->debugOutput(sprintf("[%s:%d] Die <strong>%s</strong> <em><strong>%s</strong></em> geht mit der <strong>%s</strong> <em><strong>%s</strong></em> einen Bauvertrag über das <strong>%s</strong> <em><strong>%s</strong></em> 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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A command for guest logins
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A command for profile-update handling
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A command for the money refill page
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A command for registration handling
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A command for user login
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A command for the money refill page
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A command for a failed startup request. This may happen when the user
+ * "knows" the correct URL but government refuses to pay.
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A command for a failed training request. This may happen when the user
+ * "knows" the correct URL but government refuses to pay.
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A command for a failed startup request. This may happen when the user
+ * "knows" the correct URL but government refuses to pay.
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A shipping company may be founded with this class
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <strong>%s</strong> baut im <strong>%s</strong> eine Werft <strong>%s</strong>.",
+ __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 <strong>%s</strong> stellt per Zufall <strong>%d</strong> 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 <strong>%s</strong> stellt den/die Angestellte(n) <strong>%s %s</strong> 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 <strong>%s</strong> hat per Zufall <strong>%d</strong> 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 <strong>%s</strong> verteilt alle ihre <strong>%d</strong> Mitarbeiter auf alle <strong>%d</strong> 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 <strong>%s</strong> hat <strong>%d</strong> 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 <strong>%s</strong> 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 <strong>%s</strong> hat <strong>%d</strong> 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 <strong>%s</strong> fragt alle Werften ab, ob diese Schiffe vom Typ <strong>%s</strong> 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 <strong>%s</strong> hat die Suche nach einer Werft beendet, die Schiffe vom Typ <strong>%s</strong> 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:<pre>".print_r($contractInstance, true)."</pre>");
+ }
+
+ // 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 <strong>%s</strong> erteilt an sich selbst einen Bauauftrag für das <strong>%s</strong> "<strong>%s</strong>".",
+ __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 <strong>%s</strong> unterzeichnet einen Bauauftrag für das <strong>%s</strong> "<strong>%s</strong>" mit der <strong>%s</strong>.",
+ __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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A berth is a place where ships can wait for their next assignment
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A general construction (land) class
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+class BaseConstruction extends BaseSimulator {
+ // Tiefgang fuer z.B. Trockdocks
+ private $draught = 0;
+
+ // Konstruktor
+ protected function __construct ($className) {
+ // Eltern-Konstrutor aufrufen
+ parent::__construct($className);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A dry dock where ships can be repaired, repainted or modified in.
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+class DryDock extends BaseConstruction {
+ // Zugewiesener Hafen
+ private $harborInstance = null;
+
+ // Konstruktor
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A harbor class suitable for all kind of harbors
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A terminal class where ships can land and passengers can board the ship
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+class Terminal extends BaseConstruction {
+ // Zugewiesener Hafen
+ private $harborInstance = null;
+
+ // Konstruktor
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A shipyard construction class which can be used for constructing all kinds of
+ * ships.
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <strong>%s</strong> wird im Hafen <strong>%s</strong> 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 <strong>%s</strong> 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 <strong>%s</strong> kann bald Schiffe vom Typ <strong>%s</strong> 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 <strong>%s</strong> prüft, ob Schiffe vom Typ <strong>%s</strong> 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 <strong>%s</strong> hat die Suche nach dem Schiffstyp <strong>%s</strong> abgeschlossen.",
+ __CLASS__,
+ __LINE__,
+ $this->getShipyardName(),
+ $shipType
+ ));
+
+ // Return result
+ return $result;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * Controller for company requests
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * Controller for failed government requests
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A general drive class for all kind of "drives".
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A motorized drive for bigger ships
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A class for the special news object factory
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A filter for currency booking in refill requests. This filter shall "book" the
+ * requested amount of points directly on the users account. This filter is for
+ * testing/developing only and was needed for the first developement stage of the
+ * game. You should not really use this filter on your "live-system".
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A filter for money refill page
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A general filter class for Ship-Simu
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A filter for checking if government can pay startup helps
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A filter for checking if government can pay a training for current user
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A filter for money refill page
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A filter for validating the refill request
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A filter for validating the refill request
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A government class with simplified ways...
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A special guest login class for Ship-Simu
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A special login class for Ship-Simu
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A helper for Ship-Simu to login. This login helper first checks what setting
+ * (cookie or session) the admin has choosen then overwrites it with the setting
+ * from current user. The registry instance should hold an instance of this user
+ * class at key 'user' else an exception will be thrown. After this the setting
+ * from a login form will be taken as login method and be stored in database
+ * for later usage.
+ *
+ * The user shall be able to choose "Default login method" or similar to use his
+ * own login method.
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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);
+ }
+}
+
+//
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A ??? menu class for Ship-Simu
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A Confirm menu class for Ship-Simu
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A menu class for Ship-Simu
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A menu class for Ship-Simu
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A LoginFailed menu class for Ship-Simu
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A menu class for Ship-Simu
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A menu class for Ship-Simu
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A menu class for Ship-Simu
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A Status menu class for Ship-Simu
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A menu class for Ship-Simu
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A class for the money bank's opening times
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A ??? opening times class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A general opening time class
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * This is a general ship part which can be used for all other ship parts...
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A maschine room class for really huge ships
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * The general simulator personell class
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <strong>%d</strong> 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] <strong>%d</strong> 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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * Campany employees may be handled and payed within this class
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <strong>%s %s</strong> 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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A user registration class specially for Ship-Simu
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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()));
+ }
+}
+
+//
+?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A command resolver for local (non-hubbed) web commands including the failed government request
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A command resolver for local (non-hubbed) web commands including the failed government request
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A resolver for resolving controllers locally
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A general ship class for all other kinds of ships even small sail ships
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <strong>%s</strong> 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 <strong>%s</strong> hat keinen Motor erhalten! Grund: <strong>%s</strong>",
+ __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 <strong>%s</strong> hat keinen Maschinenraum erhalten! Grund: <strong>%s</strong>",
+ __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 <strong>%s</strong> hat keine Aufbauten erhalten! Grund: <strong>%s</strong>",
+ __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 <strong>%s</strong> hat keine Kabine erhalten! Grund: <strong>%s</strong>",
+ __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 <strong>%s</strong> hat kein Deck erhalten! Grund: <strong>%s</strong>",
+ __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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A passenger ship with one or more decks, cabins, bridge (replacement for the
+ * captain) and many more
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A general construction class
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A general cabin class
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * Cabins in the economy class may use this class
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * Cabins in the lower decks may use this class
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * Luxury class cabins resists here
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * So-called "premier class" cabins are constructed with this class (medium class)
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+
+ /**
+ * Limits this object with an ObjectLimits instance
+ */
+ public function limitObject (ObjectLimits $limitInstance) {
+ die("limitObject() reached! Stub!");
+ }
--- /dev/null
+<?php
+/**
+ * General cabin structure class
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <strong>%d</strong> Kabinen vom Typ <strong>%s</strong> zu je <strong>%d</strong> Betten. Das sind <strong>%d</strong> Betten.",
+ __CLASS__,
+ __LINE__,
+ $num,
+ $cabType,
+ $beds,
+ $cabinBeds
+ ));
+ }
+ return $cabinBeds;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A general deck structure class
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A general upper structure class.
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A deck class for cars with ramps and about 2.5 meters hich
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A train deck with rails constructed in it
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A truck and bus decks. Also other vehicle may be put in here if they don't
+ * match into the car deck.
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A general cabin class
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+class BaseDeck extends BaseDeckStructure {
+ /**
+ * Constructor for cargo decks in general
+ *
+ * @return void
+ */
+ protected function __construct ($className) {
+ // Call parent constructor
+ parent::__construct($className);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * The control bridge of the ship
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A special member class for Ship-Simu
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A special guest class for Ship-Simu
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A special member class for Ship-Simu
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A wrapper for database access to shipping company data
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A wrapper for database access to government->user data
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- *
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A general action class for blog
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * An action class for the login welcome page
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * An action class for the profile page
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * An action for
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * An action for shipping company page
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * An action for government startup help form
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * An action for trainings payed by government
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * An action for logout
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * An action for profile (editing) page
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * An action for money refill page
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * An action for
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * An action for the welcome page
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A general bank class
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A money bank which may lend points to the user
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- *
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A general class for personell
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * The general simulator class
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <strong>%s</strong> vom Typ <strong>%s</strong> 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 <u>%s</u> vom Typ <u>%s</u> 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]
-?>
+++ /dev/null
-<?php
-/**
- * A class for merchants which can trade items
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <strong>%s</strong> wird angelegt und soll sich am <strong>%s</strong> 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]
-?>
+++ /dev/null
-<?php
-/**
- * The work constract class which can be used for contract parties
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <strong>%s</strong> wird zusammen mit dem Konstruktionsteil <strong>%s</strong> 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 <strong>%s</strong> konnte nicht vervollständigt werden. Grund: <strong>%s</strong><br />",
- $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 <strong>%s</strong> 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 <strong>%s</strong> <em><strong>%s</strong></em> stimmt einem Bauvertrag über das <strong>%s</strong> <em><strong>%s</strong></em> zu.",
- __CLASS__,
- __LINE__,
- $partnerInstance->getObjectDescription(),
- $partnerInstance->getCompanyName(),
- $this->getShipInstance()->getObjectDescription(),
- $this->getShipInstance()->getShipName()
- ));
- } else {
- // Other contract party
- $this->debugOutput(sprintf("[%s:%d] Die <strong>%s</strong> <em><strong>%s</strong></em> geht mit der <strong>%s</strong> <em><strong>%s</strong></em> einen Bauvertrag über das <strong>%s</strong> <em><strong>%s</strong></em> 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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A command for guest logins
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A command for profile-update handling
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A command for the money refill page
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A command for registration handling
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A command for user login
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A command for the money refill page
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A command for a failed startup request. This may happen when the user
- * "knows" the correct URL but government refuses to pay.
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A command for a failed training request. This may happen when the user
- * "knows" the correct URL but government refuses to pay.
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A command for a failed startup request. This may happen when the user
- * "knows" the correct URL but government refuses to pay.
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A shipping company may be founded with this class
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <strong>%s</strong> baut im <strong>%s</strong> eine Werft <strong>%s</strong>.",
- __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 <strong>%s</strong> stellt per Zufall <strong>%d</strong> 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 <strong>%s</strong> stellt den/die Angestellte(n) <strong>%s %s</strong> 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 <strong>%s</strong> hat per Zufall <strong>%d</strong> 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 <strong>%s</strong> verteilt alle ihre <strong>%d</strong> Mitarbeiter auf alle <strong>%d</strong> 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 <strong>%s</strong> hat <strong>%d</strong> 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 <strong>%s</strong> 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 <strong>%s</strong> hat <strong>%d</strong> 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 <strong>%s</strong> fragt alle Werften ab, ob diese Schiffe vom Typ <strong>%s</strong> 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 <strong>%s</strong> hat die Suche nach einer Werft beendet, die Schiffe vom Typ <strong>%s</strong> 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:<pre>".print_r($contractInstance, true)."</pre>");
- }
-
- // 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 <strong>%s</strong> erteilt an sich selbst einen Bauauftrag für das <strong>%s</strong> "<strong>%s</strong>".",
- __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 <strong>%s</strong> unterzeichnet einen Bauauftrag für das <strong>%s</strong> "<strong>%s</strong>" mit der <strong>%s</strong>.",
- __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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A berth is a place where ships can wait for their next assignment
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A general construction (land) class
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-class BaseConstruction extends BaseSimulator {
- // Tiefgang fuer z.B. Trockdocks
- private $draught = 0;
-
- // Konstruktor
- protected function __construct ($className) {
- // Eltern-Konstrutor aufrufen
- parent::__construct($className);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A dry dock where ships can be repaired, repainted or modified in.
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-class DryDock extends BaseConstruction {
- // Zugewiesener Hafen
- private $harborInstance = null;
-
- // Konstruktor
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A harbor class suitable for all kind of harbors
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A terminal class where ships can land and passengers can board the ship
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-class Terminal extends BaseConstruction {
- // Zugewiesener Hafen
- private $harborInstance = null;
-
- // Konstruktor
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A shipyard construction class which can be used for constructing all kinds of
- * ships.
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <strong>%s</strong> wird im Hafen <strong>%s</strong> 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 <strong>%s</strong> 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 <strong>%s</strong> kann bald Schiffe vom Typ <strong>%s</strong> 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 <strong>%s</strong> prüft, ob Schiffe vom Typ <strong>%s</strong> 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 <strong>%s</strong> hat die Suche nach dem Schiffstyp <strong>%s</strong> abgeschlossen.",
- __CLASS__,
- __LINE__,
- $this->getShipyardName(),
- $shipType
- ));
-
- // Return result
- return $result;
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * Controller for company requests
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * Controller for failed government requests
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A general drive class for all kind of "drives".
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A motorized drive for bigger ships
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A class for the special news object factory
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A filter for currency booking in refill requests. This filter shall "book" the
- * requested amount of points directly on the users account. This filter is for
- * testing/developing only and was needed for the first developement stage of the
- * game. You should not really use this filter on your "live-system".
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A filter for money refill page
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A general filter class for Ship-Simu
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A filter for checking if government can pay startup helps
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A filter for checking if government can pay a training for current user
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A filter for money refill page
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A filter for validating the refill request
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A filter for validating the refill request
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A government class with simplified ways...
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A special guest login class for Ship-Simu
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A special login class for Ship-Simu
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A helper for Ship-Simu to login. This login helper first checks what setting
- * (cookie or session) the admin has choosen then overwrites it with the setting
- * from current user. The registry instance should hold an instance of this user
- * class at key 'user' else an exception will be thrown. After this the setting
- * from a login form will be taken as login method and be stored in database
- * for later usage.
- *
- * The user shall be able to choose "Default login method" or similar to use his
- * own login method.
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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);
- }
-}
-
-//
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A ??? menu class for Ship-Simu
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A Confirm menu class for Ship-Simu
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A menu class for Ship-Simu
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A menu class for Ship-Simu
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A LoginFailed menu class for Ship-Simu
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A menu class for Ship-Simu
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A menu class for Ship-Simu
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A menu class for Ship-Simu
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A Status menu class for Ship-Simu
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A menu class for Ship-Simu
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A class for the money bank's opening times
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A ??? opening times class
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A general opening time class
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * This is a general ship part which can be used for all other ship parts...
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A maschine room class for really huge ships
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * The general simulator personell class
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <strong>%d</strong> 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] <strong>%d</strong> 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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * Campany employees may be handled and payed within this class
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <strong>%s %s</strong> 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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A user registration class specially for Ship-Simu
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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()));
- }
-}
-
-//
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A command resolver for local (non-hubbed) web commands including the failed government request
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A command resolver for local (non-hubbed) web commands including the failed government request
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A resolver for resolving controllers locally
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A general ship class for all other kinds of ships even small sail ships
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <strong>%s</strong> 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 <strong>%s</strong> hat keinen Motor erhalten! Grund: <strong>%s</strong>",
- __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 <strong>%s</strong> hat keinen Maschinenraum erhalten! Grund: <strong>%s</strong>",
- __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 <strong>%s</strong> hat keine Aufbauten erhalten! Grund: <strong>%s</strong>",
- __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 <strong>%s</strong> hat keine Kabine erhalten! Grund: <strong>%s</strong>",
- __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 <strong>%s</strong> hat kein Deck erhalten! Grund: <strong>%s</strong>",
- __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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A passenger ship with one or more decks, cabins, bridge (replacement for the
- * captain) and many more
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A general construction class
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A general cabin class
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * Cabins in the economy class may use this class
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * Cabins in the lower decks may use this class
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * Luxury class cabins resists here
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * So-called "premier class" cabins are constructed with this class (medium class)
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-
- /**
- * Limits this object with an ObjectLimits instance
- */
- public function limitObject (ObjectLimits $limitInstance) {
- die("limitObject() reached! Stub!");
- }
+++ /dev/null
-<?php
-/**
- * General cabin structure class
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <strong>%d</strong> Kabinen vom Typ <strong>%s</strong> zu je <strong>%d</strong> Betten. Das sind <strong>%d</strong> Betten.",
- __CLASS__,
- __LINE__,
- $num,
- $cabType,
- $beds,
- $cabinBeds
- ));
- }
- return $cabinBeds;
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * A general deck structure class
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A general upper structure class.
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A deck class for cars with ramps and about 2.5 meters hich
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A train deck with rails constructed in it
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A truck and bus decks. Also other vehicle may be put in here if they don't
- * match into the car deck.
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A general cabin class
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-class BaseDeck extends BaseDeckStructure {
- /**
- * Constructor for cargo decks in general
- *
- * @return void
- */
- protected function __construct ($className) {
- // Call parent constructor
- parent::__construct($className);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * The control bridge of the ship
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A special member class for Ship-Simu
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A special guest class for Ship-Simu
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A special member class for Ship-Simu
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A wrapper for database access to shipping company data
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A wrapper for database access to government->user data
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
-Subproject commit a0551c30b2e11aadba3f0513ef67c36ca7e60552
+Subproject commit 7bc4014657a70dedfc38b9b28d134aa7c3a6158c