Esempio n. 1
0
 /**
  * @param Register $user
  */
 public function register(Register $user)
 {
     $this->headerData();
     $this->view->showView();
     if (!empty($user)) {
         $username = $user->getUsername();
         $password = $user->getPassword();
         $firstName = $user->getFirstName();
         $lastName = $user->getLastName();
         $email = $user->getEmail();
         $gender = $user->getGender();
         $user = new UsersModel($username, $password);
         /**
          * Save only username and password in table users
          */
         $user->save();
         $userData = User::createInstance()->getOneByName($username);
         $id = $userData->getId();
         $userInfo = new User_infoModel($gender, $firstName, $lastName, $email, $id);
         /**
          * save UserInfoController in table user_info
          */
         $userInfo->save();
         if ($id != null) {
             $this->redirectControllers('user', 'index');
         }
     }
     $this->view->part('footer');
 }
Esempio n. 2
0
 public function save(User_infoModel $user)
 {
     $query = 'INSERT INTO user_info(user_id, gender, first_name, last_name, email)
             VALUE (?, ?, ?, ?, ?)';
     $param = [$user->getUserId(), $user->getGender(), $user->getFirstName(), $user->getLastName(), $user->getEmail()];
     $this->db->query($query, $param);
     return $this->db->row();
 }