More game classes added:
authorRoland Häder <roland@mxchange.org>
Tue, 1 Jul 2008 20:08:45 +0000 (20:08 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 1 Jul 2008 20:08:45 +0000 (20:08 +0000)
- Class for simplified goverment added (all-in-one goverment!)
- Special classes for Ship-Simu added with game-specific methods
- Template for company page rewritten
- Method moved from FrameworkInterface to Updateable
- Database wrapper classes added for user points
- Generic class UserPoints added

24 files changed:
.gitattributes
application/ship-simu/config.php
application/ship-simu/main/bank/.htaccess [new file with mode: 0644]
application/ship-simu/main/bank/class_MoneyBank.php [new file with mode: 0644]
application/ship-simu/main/class_
application/ship-simu/main/companies/class_ShippingCompany.php
application/ship-simu/main/goverment/.htaccess [new file with mode: 0644]
application/ship-simu/main/goverment/class_SimpleGoverment.php [new file with mode: 0644]
application/ship-simu/main/user/class_ShipSimuBaseUser.php [new file with mode: 0644]
application/ship-simu/main/user/extended/.htaccess [new file with mode: 0644]
application/ship-simu/main/user/extended/class_ShipSimuGuest.php [new file with mode: 0644]
application/ship-simu/main/user/extended/class_ShipSimuMember.php [new file with mode: 0644]
application/ship-simu/main/wrapper/class_CompanyDatabaseWrapper.php
application/ship-simu/templates/de/code/action_login_company.ctp
db/user_points/.htaccess [new file with mode: 0644]
inc/classes/interfaces/class_FrameworkInterface.php
inc/classes/interfaces/database/class_Updateable.php
inc/classes/main/class_BaseFrameworkSystem.php
inc/classes/main/database/wrapper/class_NewsDatabaseWrapper.php
inc/classes/main/database/wrapper/class_UserPointsDatabaseWrapper.php [new file with mode: 0644]
inc/classes/main/helper/web/class_BaseWebHelper.php
inc/classes/main/points/.htaccess [new file with mode: 0644]
inc/classes/main/points/class_UserPoints.php [new file with mode: 0644]
inc/classes/main/user/class_BaseUser.php

index 4efc684fd25dc03e2cd3318d43804c6f45408e7c..b3e20355e0580516659b8a4b8eac10781efdbc95 100644 (file)
@@ -103,6 +103,8 @@ application/ship-simu/main/actions/ship-simu/class_ShipSimuLoginAction.php -text
 application/ship-simu/main/actions/ship-simu/class_ShipSimuProfileAction.php -text
 application/ship-simu/main/actions/web/.htaccess -text
 application/ship-simu/main/actions/web/class_WebLoginCompanyAction.php -text
+application/ship-simu/main/bank/.htaccess -text
+application/ship-simu/main/bank/class_MoneyBank.php -text
 application/ship-simu/main/class_ -text
 application/ship-simu/main/class_BasePersonell.php -text
 application/ship-simu/main/class_BaseSimulator.php -text
@@ -134,6 +136,8 @@ application/ship-simu/main/drives/motor/.htaccess -text
 application/ship-simu/main/drives/motor/class_Motor.php -text
 application/ship-simu/main/factories/.htaccess -text
 application/ship-simu/main/factories/class_ShipSimuWebNewsFactory.php -text
+application/ship-simu/main/goverment/.htaccess -text
+application/ship-simu/main/goverment/class_SimpleGoverment.php -text
 application/ship-simu/main/login/.htaccess -text
 application/ship-simu/main/login/class_ShipSimuGuestLogin.php -text
 application/ship-simu/main/login/class_ShipSimuUserLogin.php -text
@@ -177,8 +181,12 @@ application/ship-simu/main/structures/extended/lower/.htaccess -text
 application/ship-simu/main/structures/extended/upper/.htaccess -text
 application/ship-simu/main/structures/extended/upper/class_Bridge.php -text
 application/ship-simu/main/user/.htaccess -text
+application/ship-simu/main/user/class_ShipSimuBaseUser.php -text
 application/ship-simu/main/user/class_ShipSimuGuest.php -text
 application/ship-simu/main/user/class_ShipSimuMember.php -text
+application/ship-simu/main/user/extended/.htaccess -text
+application/ship-simu/main/user/extended/class_ShipSimuGuest.php -text
+application/ship-simu/main/user/extended/class_ShipSimuMember.php -text
 application/ship-simu/main/wrapper/.htaccess -text
 application/ship-simu/main/wrapper/class_CompanyDatabaseWrapper.php -text
 application/ship-simu/starter.php -text
@@ -219,6 +227,7 @@ db/.htaccess -text
 db/company_user/.htaccess -text
 db/news/.htaccess -text
 db/user/.htaccess -text
+db/user_points/.htaccess -text
 devel/.htaccess -text
 devel/class_Debug.php -text
 docs/COPYING -text
@@ -495,6 +504,7 @@ inc/classes/main/database/databases/class_LocalFileDatabase.php -text
 inc/classes/main/database/wrapper/.htaccess -text
 inc/classes/main/database/wrapper/class_NewsDatabaseWrapper.php -text
 inc/classes/main/database/wrapper/class_UserDatabaseWrapper.php -text
+inc/classes/main/database/wrapper/class_UserPointsDatabaseWrapper.php -text
 inc/classes/main/debug/.htaccess -text
 inc/classes/main/debug/class_DebugConsoleOutput.php -text
 inc/classes/main/debug/class_DebugErrorLogOutput.php -text
@@ -589,6 +599,8 @@ inc/classes/main/mailer/debug/class_DebugMailer.php -text
 inc/classes/main/output/.htaccess -text
 inc/classes/main/output/class_ConsoleOutput.php -text
 inc/classes/main/output/class_WebOutput.php -text
+inc/classes/main/points/.htaccess -text
+inc/classes/main/points/class_UserPoints.php -text
 inc/classes/main/reader/.htaccess -text
 inc/classes/main/reader/class_DefaultNewsReader.php -text
 inc/classes/main/registration/.htaccess -text
index 242de41c0b7c12d07dfd5eea84388197dbca6806..51e2695acef07ac2766b40e4b363961810b7173a 100644 (file)
@@ -232,6 +232,9 @@ $cfg->setConfigEntry('company_class', "ShippingCompany");
 // CFG: COMPANY-DB-WRAPPER-CLASS
 $cfg->setConfigEntry('company_db_wrapper_class', "CompanyDatabaseWrapper");
 
+// CFG: USER-POINTS-DB-WRAPPER-CLASS
+$cfg->setConfigEntry('user_points_db_wrapper_class', "UserPointsDatabaseWrapper");
+
 // CFG EMAIl-TPL-RESEND-LINK
 $cfg->setConfigEntry('email_tpl_resend_link', "text");
 
@@ -250,5 +253,26 @@ $cfg->setConfigEntry('user_class', "ShipSimuMember");
 // CFG: GUEST-CLASS
 $cfg->setConfigEntry('guest_class', "ShipSimuGuest");
 
+// CFG: MAX-ALLOWED-COMPANIES-FOUND
+$cfg->setConfigEntry('max_allowed_companies_found', 10);
+
+// CFG: FOUND-NEW-COMPANY-ACTION-POINTS
+$cfg->setConfigEntry('found_new_company_action_points', 1000000);
+
+// CFG: WRITE-APPLICATION-ACTION-POINTS
+$cfg->setConfigEntry('write_applications_action_points', 10000);
+
+// CFG: USER-POINTS-CLASS
+$cfg->setConfigEntry('user_ppints_class', "UserPoints");
+
+// CFG: GOVERMENT-CLASS
+$cfg->setConfigEntry('goverment_class', "SimpleGoverment");
+
+// CFG: BANK-CLASS
+$cfg->setConfigEntry('bank_class', "MoneyBank");
+
+// CFG: REFILL-PAGE-ACTIVE
+$cfg->setConfigEntry('refill_page_active', "Y");
+
 // [EOF]
 ?>
diff --git a/application/ship-simu/main/bank/.htaccess b/application/ship-simu/main/bank/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/ship-simu/main/bank/class_MoneyBank.php b/application/ship-simu/main/bank/class_MoneyBank.php
new file mode 100644 (file)
index 0000000..0436549
--- /dev/null
@@ -0,0 +1,64 @@
+<?php
+/**
+ * A money bank which may lend points to the user
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class MoneyBank extends BaseFrameworkSystem implements Registerable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("A money bank class");
+
+               // Create unique ID number
+               $this->generateUniqueId();
+
+               // Clean up a little
+               $this->removeNumberFormaters();
+               $this->removeSystemArray();
+       }
+
+       /**
+        * 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 final static function createMoneyBank (ManageableAccount $userInstance) {
+               // Get a new instance
+               $moneyInstance = new MoneyBank();
+
+               // Set the user instance
+               $moneyInstance->setUserInstance($userInstance);
+
+               // Return the prepared instance
+               return $moneyInstance;
+       }
+}
+
+// [EOF]
+?>
index 4e1385b6ecba96ac1e5ce90532f21262dfe14fb6..2d6541c3d4624b59394ffe2275517fb8c7d6b53f 100644 (file)
@@ -21,7 +21,7 @@
  * 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 {
+class ??? extends BaseFrameworkSystem {
        /**
         * Protected constructor
         *
@@ -41,6 +41,23 @@ class  extends BaseFrameworkSystem {
                $this->removeNumberFormaters();
                $this->removeSystemArray();
        }
+
+       /**
+        * 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 final static function create??? (ManageableAccount $userInstance) {
+               // Get a new instance
+               $moneyInstance = new ???();
+
+               // Set the user instance
+               $moneyInstance->setUserInstance($userInstance);
+
+               // Return the prepared instance
+               return $moneyInstance;
+       }
 }
 
 // [EOF]
index 7549af4056c7d5ac0e58a13385f8d89b3d974848..971c578cf44974d5a7622d3d26f458f04ecdb46c 100644 (file)
@@ -120,7 +120,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                $participates = false;
 
                // Get a company database wrapper class
-               $wrapperInstance = ObjectFactory::createObjectByConfiguredName('company_db_wrapper_class');
+               $wrapperInstance = ObjectFactory::createObjectByConfiguredName('company_db_wrapper_class', array($this));
 
                // Ask the wrapper if this user participates
                $participates = $wrapperInstance->ifUserParticipatesInCompany($userInstance);
@@ -204,9 +204,9 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                return $isEmployee;
        }
 
-       //----------------------------------------------------------------------------
-       // From here is very old code which needs to be translated and changed heavily
-       //----------------------------------------------------------------------------
+       //------------------------------------------------------------------------------\
+       // Below here is very old code which needs to be translated and changed heavily |
+       //------------------------------------------------------------------------------/
 
        /**
         * Intialize all lists
diff --git a/application/ship-simu/main/goverment/.htaccess b/application/ship-simu/main/goverment/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/ship-simu/main/goverment/class_SimpleGoverment.php b/application/ship-simu/main/goverment/class_SimpleGoverment.php
new file mode 100644 (file)
index 0000000..68882be
--- /dev/null
@@ -0,0 +1,64 @@
+<?php
+/**
+ * A goverment class with simplified ways...
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class SimpleGoverment extends BaseFrameworkSystem implements Registerable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("A class for simplified goverment");
+
+               // Create unique ID number
+               $this->generateUniqueId();
+
+               // Clean up a little
+               $this->removeNumberFormaters();
+               $this->removeSystemArray();
+       }
+
+       /**
+        * Creates an instance of this goverment class by given user instance
+        *
+        * @param       $userInstance           The user instance
+        * @return      $govermentInstance      Instance of the prepared goverment instance
+        */
+       public final static function createSimpleGoverment (ManageableAccount $userInstance) {
+               // Get a new instance
+               $govermentInstance = new SimpleGoverment();
+
+               // Set the user instance
+               $govermentInstance->setUserInstance($userInstance);
+
+               // Return the prepared instance
+               return $govermentInstance;
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/ship-simu/main/user/class_ShipSimuBaseUser.php b/application/ship-simu/main/user/class_ShipSimuBaseUser.php
new file mode 100644 (file)
index 0000000..563c968
--- /dev/null
@@ -0,0 +1,189 @@
+<?php
+/**
+ * A special member class for Ship-Simu
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class 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);
+       }
+
+       /**
+        * 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()->readConfig('max_allowed_companies_found');
+
+               // Get a company wrapper
+               $wrapperInstance = ObjectFactory::createObjectByConfiguredName('company_db_wrapper_class');
+
+               // Now get a search criteria and set the user's name as criteria
+               $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
+               $criteriaInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUserName());
+               $criteriaInstance->setLimit($maxFound);
+
+               // Do the count-select by criteria
+               $totalRows = $wrapperInstance->doSelectCountByCriteria($criteriaInstance);
+
+               // 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;
+
+               // Get a points instance from registry
+               $pointsInstance = Registry::getRegistry()->getInstance('points');
+
+               // Is there an instance?
+               if (is_null($pointsInstance)) {
+                       // Then create one
+                       $pointsInstance = ObjectFactory::createObjectByConfiguredName('user_ppints_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 the goverment can still pay a "startup help" to the user
+        *
+        * @return      $ifGovHelped    Wether if the goverment has helped the user with startup
+        */
+       public function ifGovermentPaysStartupHelp () {
+               // By default they have not payed, which is indeed good. ;-)
+               $ifGovHelped = false;
+
+               // First get a goverment instance from registry
+               $govermentInstance = Registry::getRegistry()->getInstance('goverment');
+
+               // Is it there?
+               if (is_null($govermentInstance)) {
+                       // Then create a new one
+                       $govermentInstance = ObjectFactory::createObjectByConfiguredName('goverment_class', array($this));
+
+                       // Store it in registry
+                       Registry::getRegistry()->addInstance('goverment', $govermentInstance);
+               } // END - if
+
+               // Then ask the goverment if they want to pay a "startup help" to the user
+               if ($govermentInstance->ifGovermentAlreadyPayedsStartupHelp()) {
+                       // They can't pay anymore to the user (excited amount)
+                       $ifGovHelped = true;
+               } // END - if
+
+               // Return result here
+               return $ifGovHelped;
+       }
+
+       /**
+        * Checks wether the user can take points from the money bank
+        *
+        * @return      $bankLends      Wether the money bank is able to lend money
+        */
+       public function ifUserAllowTakeCreditsFromMoneyBank () {
+               // Per default the money bank cannot pay
+               $bankLends = false;
+
+               // Get a money bank instance from registry
+               $bankInstance = Registry::getRegistry()->getInstance('money_bank');
+
+               // 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
+
+               // Does the money bank lend more money?
+               if ($bankInstance->ifBankLendsMoreMoney()) {
+                       // Okay, that they will do
+                       $bankLends = true;
+               } // END - if
+
+               // 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
+        */
+       public function ifUserHasMaximumCreditsWithMoneyBank () {
+               // For default he can still get money
+               $hasMaxCredits = false;
+
+               // Get a money bank instance from registry
+               $bankInstance = Registry::getRegistry()->getInstance('money_bank');
+
+               // 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
+
+               // Now check if the user has maximum credits
+               if ($bankInstance->ifUserHasMaxCredits()) {
+                       // Yes, he does!
+                       $hasMaxCredits = true;
+               } // END - if
+
+               // Return the result
+               return $hasMaxCredits;
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/ship-simu/main/user/extended/.htaccess b/application/ship-simu/main/user/extended/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/ship-simu/main/user/extended/class_ShipSimuGuest.php b/application/ship-simu/main/user/extended/class_ShipSimuGuest.php
new file mode 100644 (file)
index 0000000..839e2d7
--- /dev/null
@@ -0,0 +1,117 @@
+<?php
+/**
+ * A special guest class for Ship-Simu
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class 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 = "") {
+               // Is the class name empty? Then this is not a specialized user class
+               if (empty($className)) $className = __CLASS__;
+
+               // Call parent constructor
+               parent::__construct($className);
+
+               // Set part description
+               $this->setObjectDescription("Special ship-simu class");
+
+               // Create unique ID number
+               $this->generateUniqueId();
+       }
+
+       /**
+        * Creates an instance of this user class by a provided username. This
+        * factory method will check if the 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 final static function createGuestByUsername ($userName) {
+               // Get a new instance
+               $userInstance = new ShipSimuGuest();
+
+               // Set the username
+               $userInstance->setUserName($userName);
+
+               // Check if the username exists
+               if (!$userInstance->ifUsernameExists()) {
+                       // Throw an exception here
+                       throw new UsernameMissingException(array($userInstance, $userName), self::EXCEPTION_USERNAME_NOT_FOUND);
+               }
+
+               // Return the instance
+               return $userInstance;
+       }
+
+       /**
+        * Creates an instance of this user class by a provided email address. This
+        * factory method will not check if the email address is there.
+        *
+        * @param       $email                  Email address of the user
+        * @return      $userInstance   An instance of this user class
+        */
+       public final static function createGuestByEmail ($email) {
+               // Get a new instance
+               $userInstance = new ShipSimuGuest();
+
+               // Set the username
+               $userInstance->setEmail($email);
+
+               // Return the instance
+               return $userInstance;
+       }
+
+       /**
+        * Updates the last activity timestamp and last performed action in the
+        * database result. You should call flushPendingUpdates() to flush these updates
+        * to the database layer.
+        *
+        * @param       $requestInstance        A requestable class instance
+        * @return      void
+        */
+       public function updateLastActivity (Requestable $requestInstance) {
+               // No activity will be logged for guest accounts
+       }
+
+       /**
+        * Flushs all pending updates to the database layer
+        *
+        * @return      void
+        */
+       public function flushPendingUpdates () {
+               // No updates will be flushed to database!
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/ship-simu/main/user/extended/class_ShipSimuMember.php b/application/ship-simu/main/user/extended/class_ShipSimuMember.php
new file mode 100644 (file)
index 0000000..25e76b7
--- /dev/null
@@ -0,0 +1,171 @@
+<?php
+/**
+ * A special member class for Ship-Simu
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class ShipSimuMember extends ShipSimuBaseUser implements ManageableMember {
+       /**
+        * Protected constructor
+        *
+        * @param       $className      Name of the class
+        * @return      void
+        */
+       protected function __construct ($className = "") {
+               // Is the class name empty? Then this is not a specialized user class
+               if (empty($className)) $className = __CLASS__;
+
+               // Call parent constructor
+               parent::__construct($className);
+
+               // Set part description
+               $this->setObjectDescription("Special member class for Ship-Simu");
+
+               // Create unique ID number
+               $this->generateUniqueId();
+       }
+
+       /**
+        * Creates an instance of this user class by a provided username. This
+        * factory method will check if the 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 final static function createMemberByUsername ($userName) {
+               // Get a new instance
+               $userInstance = new ShipSimuMember();
+
+               // Set the username
+               $userInstance->setUserName($userName);
+
+               // Check if the username exists
+               if (!$userInstance->ifUsernameExists()) {
+                       // Throw an exception here
+                       throw new UsernameMissingException(array($userInstance, $userName), self::EXCEPTION_USERNAME_NOT_FOUND);
+               }
+
+               // Return the instance
+               return $userInstance;
+       }
+
+       /**
+        * Creates an instance of this user class by a provided email address. This
+        * factory method will not check if the email address is there.
+        *
+        * @param       $email                  Email address of the user
+        * @return      $userInstance   An instance of this user class
+        */
+       public final static 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
+        */
+       public final static 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()->readConfig('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);
+
+               // Remember the update in database result
+               $this->getResultInstance()->add2UpdateQueue($updateInstance);
+       }
+
+       /**
+        * Flushs all pending updates to the database layer
+        *
+        * @return      void
+        */
+       public function flushPendingUpdates () {
+               // 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]
+?>
index 80bb0371954c3adb59b07db9ad763cd4feda9fd5..3f2ade62de02f73412f05700eef376130a5a0075 100644 (file)
  * 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";
@@ -45,15 +50,22 @@ class CompanyDatabaseWrapper extends BaseDatabaseWrapper {
        /**
         * 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 final static function createCompanyDatabaseWrapper () {
+       public final static 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;
        }
@@ -93,6 +105,27 @@ class CompanyDatabaseWrapper extends BaseDatabaseWrapper {
                // 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]
index 7eacc4b6d415421cacebb9d70147b5592ca08b5a..937cd448750d4da2b9962c7315158e52156d9ee1 100644 (file)
@@ -8,9 +8,9 @@ $linkInstance->prefetchValueInstance('user');
 // Maximum of allowed companies reached?
 if ($linkInstance->getValueInstance()->ifUserCreatedMaximumAllowedCompanies()) {
        // No more companies allowed to create
-} elseif ($linkInstance->getValueInstance()->ifUserPointsEnough('found_new_company')) {
+} elseif ($linkInstance->getValueInstance()->ifUserHasRequiredPoints('found_new_company')) {
        // Enough money to found company
-} elseif ($linkInstance->getValueInstance()->ifUserPointsEnough('write_applications')) {
+} elseif ($linkInstance->getValueInstance()->ifUserHasRequiredPoints('write_applications')) {
        // Enough money to write applications to other companies
 } elseif ($linkInstance->getValueInstance()->ifGovermentPaysStartupHelp()) {
        // Display link to goverment for startup help
@@ -24,7 +24,7 @@ if ($linkInstance->getValueInstance()->ifUserAllowTakeCreditsFromMoneyBank()) {
        // Money bank is closed!
 }
 
-if ($linkInstance->getValueInstance()->ifRefillPageActive()) {
+if ($linkInstance->ifRefillPageActive()) {
        // Display link to refill page
 } else {
        // Refill page not active
diff --git a/db/user_points/.htaccess b/db/user_points/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
index 8d808b4decfd9f9e5f0ed92ef30f717a9b6ef56f..bffb8743a1b63e43773d830a16c456b641898648 100644 (file)
@@ -31,16 +31,6 @@ interface FrameworkInterface {
         * @throws      NullPointerException    If the result instance is null
         */
        function getField ($fieldName);
-
-       /**
-        * Updates a given field with new value
-        *
-        * @param       $fieldName              Field to update
-        * @param       $fieldValue             New value to store
-        * @return      void
-        * @throws      DatabaseUpdateSupportException  If this class does not support database updates
-        */
-       function updateDatabaseField ($fieldName, $fieldValue);
 }
 
 //
index 61e64e38501af6b8a1bdc162b255a9c789ba7624..ba8de80fb7a9ad162d5ab94892c562bf5c11e8b7 100644 (file)
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 interface Updateable extends FrameworkInterface {
+       /**
+        * Updates a given field with new value
+        *
+        * @param       $fieldName              Field to update
+        * @param       $fieldValue             New value to store
+        * @return      void
+        * @throws      DatabaseUpdateSupportException  If this class does not support database updates
+        */
+       function updateDatabaseField ($fieldName, $fieldValue);
 }
 
 //
index 96338267adb4d54441d2007c7bff657c441b6610..e0716d7ade32f511558a1b5f28b25e56fd164c62 100644 (file)
@@ -73,6 +73,11 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         */
        private $resultInstance = null;
 
+       /**
+        * Instance for user class
+        */
+       private $userInstance = null;
+
        /**
         * The real class name
         */
@@ -238,42 +243,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                } elseif (is_array($args)) {
                        // Some arguments are there
                        foreach ($args as $arg) {
-                               // Check the type
-                               if (is_bool($arg)) {
-                                       // Boolean!
-                                       if ($arg) $argsString .= "true(bool)"; else $argsString .= "false(bool)";
-                               } elseif (is_int($arg)) {
-                                       // Integer
-                                       $argsString .= $arg."(int)";
-                               } elseif (is_float($arg)) {
-                                       // Floating point
-                                       $argsString .= $arg."(float)";
-                               } elseif ($arg instanceof BaseFrameworkSystem) {
-                                       // Own object instance
-                                       $argsString .= $arg->__toString()."(Object)";
-                               } elseif (is_object($arg)) {
-                                       // External object
-                                       $argsString .= "unknown object(!)";
-                               } elseif (is_array($arg)) {
-                                       // Array
-                                       $argsString .= "Array(array)";
-                               } elseif (is_string($arg)) {
-                                       // String
-                                       $argsString .= "\"".$arg."\"(string)";
-                               } elseif (is_null($arg)) {
-                                       // Null
-                                       $argsString .= "(null)";
-                               } elseif (is_resource($arg)) {
-                                       // Resource
-                                       $argsString .= "(resource)";
-                               } else {
-                                       // Unknown type (please report!)
-                                       $argsString .= $arg."(<em>unknown!</em>)";
-                               }
-
-                               // Add comma
-                               $argsString .= ", ";
-                       }
+                               // Add the type
+                               $argsString .= $arg." (".gettype($arg)."), ";
+                       } // END - foreach
 
                        // Remove last comma
                        if (substr($argsString, -2, 1) === ",") {
@@ -1235,38 +1207,22 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        }
 
        /**
-        * Updates a given field with new value
+        * Protected setter for user instance
         *
-        * @param       $fieldName              Field to update
-        * @param       $fieldValue             New value to store
+        * @param       $userInstance   An instance of a user class
         * @return      void
-        * @throws      DatabaseUpdateSupportException  If this class does not support database updates
         */
-       public function updateDatabaseField ($fieldName, $fieldValue) {
-               // Is updating database fields allowed by interface?
-               if (!$this instanceof Updateable) {
-                       // Update not supported!
-                       throw new DatabaseUpdateSupportException($this, self::EXCEPTION_DATABASE_UPDATED_NOT_ALLOWED);
-               } // 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($fieldName, $fieldValue);
-
-               // Add the search criteria for searching for the right entry
-               $updateInstance->setSearchInstance($searchInstance);
+       protected final function setUserInstance (ManageableAccount $userInstance) {
+               $this->userInstance = $userInstance;
+       }
 
-               // Remember the update in database result
-               $this->getResultInstance()->add2UpdateQueue($updateInstance);
+       /**
+        * Getter for user instance
+        *
+        * @return      $userInstance   An instance of a user class
+        */
+       public final function getUserInstance () {
+               return $this->userInstance;
        }
 }
 
index 73b7a21938105fe5a1c389a15eda197123603e09..f3753f3d43d8d01b84bcb71930c847c50919f961 100644 (file)
@@ -35,7 +35,7 @@ class NewsDatabaseWrapper extends BaseDatabaseWrapper {
                parent::__construct(__CLASS__);
 
                // Set part description
-               $this->setObjectDescription("Database wrapper for user objects");
+               $this->setObjectDescription("Database wrapper for news objects");
 
                // Create unique ID number
                $this->generateUniqueId();
diff --git a/inc/classes/main/database/wrapper/class_UserPointsDatabaseWrapper.php b/inc/classes/main/database/wrapper/class_UserPointsDatabaseWrapper.php
new file mode 100644 (file)
index 0000000..c5490d3
--- /dev/null
@@ -0,0 +1,62 @@
+<?php
+/**
+ * A database wrapper for user points classes
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class UserPointsDatabaseWrapper extends BaseDatabaseWrapper {
+       // Constants for database table names
+       const DB_TABLE_USER_POINTS = "user_points";
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct() {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("Database wrapper for user points objects");
+
+               // Create unique ID number
+               $this->generateUniqueId();
+       }
+
+       /**
+        * Creates an instance of this database wrapper by a provided user class
+        *
+        * @return      $wrapperInstance        An instance of the created wrapper class
+        */
+       public final static function createUserPointsDatabaseWrapper () {
+               // Get a new instance
+               $wrapperInstance = new UserPointsDatabaseWrapper();
+
+               // Set (primary!) table name
+               $wrapperInstance->setTableName(self::DB_TABLE_USER_POINTS);
+
+               // Return the instance
+               return $wrapperInstance;
+       }
+}
+
+// [EOF]
+?>
index e3030f7612a156e4fc47fb4c1fcf61772c1e06fe..19b5be3d85f46a04222ecec06db4552e9b948702 100644 (file)
@@ -183,6 +183,17 @@ class BaseWebHelper extends BaseHelper {
                $isUnconfirmed = ($this->getValueField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS) === $this->getConfigInstance()->readConfig('user_status_guest'));
                return $isUnconfirmed;
        }
+
+       /**
+        * Checks wether the refill page is active which should be not the default
+        * on non-web applications.
+        *
+        * @return      $refillActive   Wether the refill page is active
+        */
+       public function ifRefillPageActive () {
+               $refillActive = ($this->getConfigInstance()->readConfig('refill_page_active') === "Y");
+               return $refillActive;
+       }
 }
 
 // [EOF]
diff --git a/inc/classes/main/points/.htaccess b/inc/classes/main/points/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/main/points/class_UserPoints.php b/inc/classes/main/points/class_UserPoints.php
new file mode 100644 (file)
index 0000000..7a2aa20
--- /dev/null
@@ -0,0 +1,98 @@
+<?php
+/**
+ * A class for handling user points which can be real or Internet currency
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class UserPoints extends BaseFrameworkSystem implements Registerable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("Class for handling user points");
+
+               // Create unique ID number
+               $this->generateUniqueId();
+
+               // Clean up a little
+               $this->removeNumberFormaters();
+               $this->removeSystemArray();
+       }
+
+       /**
+        * Creates an instance of this points class
+        *
+        * @param       $userInstance           An instance of a user class
+        * @return      $pointsInstance         An instance of this class
+        */
+       public final static function createUserPoints (ManageableAccount $userInstance) {
+               // Get a new instance
+               $pointsInstance = new UserPoints();
+
+               // Set user instance
+               $pointsInstance->setUserInstance($userInstance);
+
+               // Return instance
+               return $pointsInstance;
+       }
+
+       /**
+        * 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;
+
+               // Get the required points entry
+               $requiredPoints = $this->getConfigInstance()->readConfig($action . '_action_points');
+
+               // Get a wrapper instance
+               $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_points_db_wrapper_class');
+
+               // Now get a search criteria and set the user's name as criteria
+               $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
+               $criteriaInstance->addCriteria('points_uid', $this->getUserInstance()->getUserName());
+               $criteriaInstance->setLimit(1);
+
+               // Get result back
+               $resultInstance = $wrapperInstance->doSelectByCriteria($criteriaInstance);
+
+               // Do we have an entry?
+               if ($resultInstance->next()) {
+                       // Load points here - TODO!
+                       $this->partialStub("Load points here for comparison.");
+               } // END - if
+
+               // Return the result
+               return $hasRequired;
+       }
+}
+
+// [EOF]
+?>
index ed832a9702025e7787bbd1c59ef92fc0be9f2d00..0a3432de390c06c6729bc4ff4760a5f6009b6071 100644 (file)
@@ -253,6 +253,41 @@ class BaseUser extends BaseFrameworkSystem {
                // Return the value
                return $primaryValue;
        }
+
+       /**
+        * Updates a given field with new value
+        *
+        * @param       $fieldName              Field to update
+        * @param       $fieldValue             New value to store
+        * @return      void
+        * @throws      DatabaseUpdateSupportException  If this class does not support database updates
+        */
+       public function updateDatabaseField ($fieldName, $fieldValue) {
+               // Is updating database fields allowed by interface?
+               if (!$this instanceof Updateable) {
+                       // Update not supported!
+                       throw new DatabaseUpdateSupportException($this, self::EXCEPTION_DATABASE_UPDATED_NOT_ALLOWED);
+               } // 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($fieldName, $fieldValue);
+
+               // Add the search criteria for searching for the right entry
+               $updateInstance->setSearchInstance($searchInstance);
+
+               // Remember the update in database result
+               $this->getResultInstance()->add2UpdateQueue($updateInstance);
+       }
 }
 
 // [EOF]