createUniqueID -> generateUniqueId renamed, dataset criteria added, registration...
[shipsimu.git] / application / ship-simu / main / registration / class_ShipSimuRegistration.php
index 9909c3d6d128af731c9771b8940013cdd2b1017e..01235f7e60558402c0fc87fdcdabb3d5f96730b8 100644 (file)
@@ -27,6 +27,25 @@ class ShipSimuRegistration extends BaseRegistration {
         */
        private $hashedPassword = "";
 
+       /**
+        * Elements for criteria
+        */
+       private $criteriaElements = array(
+               'username',
+               'pass_hash',
+               'email' => 'email1',
+               'surname',
+               'family',
+               'street',
+               'zip',
+               'city',
+               'icq',
+               'jabber',
+               'yahoo',
+               'aol',
+               'msn'
+       );
+
        /**
         * Protected constructor
         *
@@ -40,7 +59,7 @@ class ShipSimuRegistration extends BaseRegistration {
                $this->setObjectDescription("Ship-Simu registration class");
 
                // Create unique ID number
-               $this->createUniqueID();
+               $this->generateUniqueId();
        }
 
        /**
@@ -125,6 +144,32 @@ class ShipSimuRegistration extends BaseRegistration {
        public function doPostAction () {
                $this->partialStub();
        }
+
+       /**
+        * Adds registration elements to a given dataset instance
+        *
+        * @param       $criteriaInstance       An instance of a storeable criteria
+        * @return      void
+        */
+       public function addElementsToDataSet (StoreableCriteria $criteriaInstance) {
+               // 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));
+                       } else {
+                               // No, default entry
+                               $criteriaInstance->addCriteria($element, $this->getRequestInstance()->getRequestElement($element));
+                       }
+               } // END - foreach
+
+               // Mark the username as unique key
+               $criteriaInstance->setUniqueKey('username');
+
+               // Add account status as configured
+               $criteriaInstance->addConfiguredCriteria('user_status', 'user_status_register');
+       }
 }
 
 //