class_WebShipsimuRegisterCommand.php

Go to the documentation of this file.
00001 <?php
00024 class WebShipsimuRegisterCommand extends BaseCommand implements Commandable {
00030         protected function __construct () {
00031                 // Call parent constructor
00032                 parent::__construct(__CLASS__);
00033 
00034                 // Clean up a little
00035                 $this->removeNumberFormaters();
00036                 $this->removeSystemArray();
00037         }
00038 
00045         public final static function createWebShipsimuRegisterCommand (CommandResolver $resolverInstance) {
00046                 // Get a new instance
00047                 $commandInstance = new WebShipsimuRegisterCommand();
00048 
00049                 // Set the resolver instance
00050                 $commandInstance->setResolverInstance($resolverInstance);
00051 
00052                 // Return the prepared instance
00053                 return $commandInstance;
00054         }
00055 
00063         public function execute (Requestable $requestInstance, Responseable $responseInstance) {
00064                 // First get a UserRegistration instance
00065                 $registerInstance = ObjectFactory::createObjectByConfiguredName('user_registration_class');
00066 
00067                 // First set request and response instance
00068                 $registerInstance->setRequestInstance($requestInstance);
00069                 $registerInstance->setResponseInstance($responseInstance);
00070 
00071                 // Encrypt the password
00072                 $registerInstance->encryptPassword('pass1');
00073 
00074                 // Do things before registration
00075                 $registerInstance->doPreRegistration();
00076 
00077                 // Register the new user
00078                 $registerInstance->registerNewUser();
00079 
00080                 // Do things after registration like notifying partner pages or queueing
00081                 // them for notification
00082                 $registerInstance->doPostRegistration();
00083 
00084                 // Redirect or login after registration
00085                 $registerInstance->doPostAction();
00086         }
00087 
00096         public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
00097                 // Validate email address (if configured: check on double email addresses)
00098                 $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_validator_filter'));
00099 
00100                 // Validate username and check if it does not exist
00101                 $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_validator_filter'));
00102 
00103                 // Validate if username is "guest" and not taken
00104                 $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_is_guest_filter'));
00105 
00106                 // Validate if password is set
00107                 $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_validator_filter'));
00108 
00109                 // Check if rules where accepted
00110                 $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('rules_accepted_filter'));
00111 
00112                 // Validate CAPTCHA input
00113                 $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_register_verifier_filter'));
00114 
00115                 // Validate birthday
00116                 $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('birthday_register_verifier_filter'));
00117         }
00118 }
00119 
00120 // [EOF]
00121 ?>

Generated on Mon Dec 8 01:06:44 2008 for Ship-Simulator by  doxygen 1.5.6