class_ShipSimuBaseUser.php
Go to the documentation of this file.00001 <?php
00024 class ShipSimuBaseUser extends BaseUser implements Registerable, Updateable {
00031 protected function __construct ($className) {
00032
00033 parent::__construct($className);
00034 }
00035
00041 public function ifUserCreatedMaximumAllowedCompanies () {
00042
00043 $maxFound = $this->getConfigInstance()->readConfig('max_allowed_companies_found');
00044
00045
00046 $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
00047 $criteriaInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUserName());
00048 $criteriaInstance->setLimit($maxFound);
00049
00050
00051 $wrapperInstance = ObjectFactory::createObjectByConfiguredName('company_db_wrapper_class');
00052
00053
00054 $totalRows = $wrapperInstance->doSelectCountByCriteria($criteriaInstance);
00055
00056
00057 $reached = ($totalRows >= $maxFound);
00058
00059
00060 return $reached;
00061 }
00062
00069 public function ifUserHasRequiredPoints ($action) {
00070
00071 $hasRequired = false;
00072
00073
00074 $pointsInstance = Registry::getRegistry()->getInstance('points');
00075
00076
00077 if (is_null($pointsInstance)) {
00078
00079 $pointsInstance = ObjectFactory::createObjectByConfiguredName('user_ppints_class', array($this));
00080
00081
00082 Registry::getRegistry()->addInstance('points', $pointsInstance);
00083 }
00084
00085
00086 $hasRequired = $pointsInstance->ifUserHasRequiredPoints($action);
00087
00088
00089 return $hasRequired;
00090 }
00091
00097 public function ifGovernmentPaysTraining () {
00098
00099 $ifGovHelps = true;
00100
00101
00102 $governmentInstance = Registry::getRegistry()->getInstance('government');
00103
00104
00105 if (is_null($governmentInstance)) {
00106
00107 $governmentInstance = ObjectFactory::createObjectByConfiguredName('government_class', array($this));
00108
00109
00110 Registry::getRegistry()->addInstance('government', $governmentInstance);
00111 }
00112
00113
00114 if ($governmentInstance->ifGovernmentAlreadyPayedTraining()) {
00115
00116 $ifGovHelps = false;
00117 }
00118
00119
00120 return $ifGovHelps;
00121 }
00122
00128 public function ifGovernmentPaysStartupHelp () {
00129
00130 $ifGovHelps = true;
00131
00132
00133 $governmentInstance = Registry::getRegistry()->getInstance('government');
00134
00135
00136 if (is_null($governmentInstance)) {
00137
00138 $governmentInstance = ObjectFactory::createObjectByConfiguredName('government_class', array($this));
00139
00140
00141 Registry::getRegistry()->addInstance('government', $governmentInstance);
00142 }
00143
00144
00145 if ($governmentInstance->ifGovernmentPayedMaxmimumStartupHelp()) {
00146
00147 $ifGovHelps = false;
00148 }
00149
00150
00151 return $ifGovHelps;
00152 }
00153
00160 public function ifUserAllowedTakeCreditsFromMoneyBank () {
00161
00162 $bankLends = false;
00163
00164
00165 $bankInstance = Registry::getRegistry()->getInstance('money_bank');
00166
00167
00168 if (is_null($bankInstance)) {
00169
00170 $bankInstance = ObjectFactory::createObjectByConfiguredName('bank_class', array($this));
00171
00172
00173 Registry::getRegistry()->addInstance('money_bank', $bankInstance);
00174 }
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185 return $bankLends;
00186 }
00187
00196 public function ifUserHasMaximumCreditsWithMoneyBank () {
00197
00198 $hasMaxCredits = false;
00199
00200
00201 $bankInstance = Registry::getRegistry()->getInstance('money_bank');
00202
00203
00204 if (is_null($bankInstance)) {
00205
00206 $bankInstance = ObjectFactory::createObjectByConfiguredName('bank_class', array($this));
00207
00208
00209 Registry::getRegistry()->addInstance('money_bank', $bankInstance);
00210 }
00211
00212
00220
00221 return $hasMaxCredits;
00222 }
00223 }
00224
00225
00226 ?>