UserPoints.ifUserHasRequiredPoints ( action  ) 

Checks wether the user has the required amount of points left for the specified action.

Parameters:
$action The action or configuration entry plus prefix the user wants to perform
Returns:
$hasRequired Wether the user has the required points
Todo:
Finish loading part of points

Definition at line 63 of file class_UserPoints.php.

References BaseFrameworkSystem.$resultInstance, ObjectFactory.createObjectByConfiguredName(), BaseFrameworkSystem.getConfigInstance(), BaseFrameworkSystem.getUserInstance(), and BaseFrameworkSystem.partialStub().

00063                                                           {
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         }

Here is the call graph for this function:


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