class_UserPoints.php

Go to the documentation of this file.
00001 <?php
00024 class UserPoints extends BaseFrameworkSystem implements Registerable {
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 createUserPoints (ManageableAccount $userInstance) {
00046                 // Get a new instance
00047                 $pointsInstance = new UserPoints();
00048 
00049                 // Set user instance
00050                 $pointsInstance->setUserInstance($userInstance);
00051 
00052                 // Return instance
00053                 return $pointsInstance;
00054         }
00055 
00063         public function ifUserHasRequiredPoints ($action) {
00064                 // Default is that everyone is poor... ;-)
00065                 $hasRequired = false;
00066 
00067                 // Get the required points entry
00068                 $requiredPoints = $this->getConfigInstance()->readConfig($action . '_action_points');
00069 
00070                 // Get a wrapper instance
00071                 $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_points_db_wrapper_class');
00072 
00073                 // Now get a search criteria and set the user's name as criteria
00074                 $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
00075                 $criteriaInstance->addCriteria("points_uid", $this->getUserInstance()->getUserName());
00076                 $criteriaInstance->setLimit(1);
00077 
00078                 // Get result back
00079                 $resultInstance = $wrapperInstance->doSelectByCriteria($criteriaInstance);
00080 
00081                 // Do we have an entry?
00082                 if ($resultInstance->next()) {
00083                         // @TODO Load points here
00084                         $this->partialStub("Load points here for comparison.");
00085                 } // END - if
00086 
00087                 // Return the result
00088                 return $hasRequired;
00089         }
00090 }
00091 
00092 // [EOF]
00093 ?>

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