Exemple #1
0
 public function registration()
 {
     $bookhouse = new Model_BookhouseModel();
     $bookhouse->loadActiveBookhouse();
     if ($bookhouse->getCanUserRegister() == 0) {
         $this->setValidationError('Bookhouse', 'Registration is disabled');
     }
     $userCheckModel = new Model_UserModel();
     $userCheckModel->load(array('user_name' => $this->getUserName()));
     $userId = $userCheckModel->getUserId();
     if (isset($userId)) {
         $this->setValidationError('username', 'Username already exist');
         return;
     }
     $userCheckModel->load(array('email' => $this->getEmail()));
     $userId = $userCheckModel->getUserId();
     if (isset($userId)) {
         $this->setValidationError('username', 'Email already exist');
         return;
     }
     $this->setLastLogin(date('Y-m-d H:i:s'));
     $this->setUserStatusIdFK(3);
     $this->setBanned(0);
     $this->setEmailValidated(0);
     $this->insert();
     $userIdFK = $this->getConnection()->getInsertId();
     $transaction = new Model_TransactionModel();
     $transaction->setUserIdFK($userIdFK);
     $transaction->setTransactionTypeIdFK(1);
     $transaction->setMoney($bookhouse->getDefaultMoneyValue());
     $transaction->setTransactionTypeIdendifier(null);
     $transaction->insert();
 }