示例#1
0
 /**
  * Kiem tra sau do tao new user neu user do chua tung dang ki vao he thong 
  * @param $user: bao gom cac du lieu ma nguoi dng dang ki: email, last name, first name, password
  * @return null: neu user da ton tai.
  *		   array: id va user name
  **/
 function createNewUser($user)
 {
     $user_id_created = UserFacade::createUser($user);
     if ($user_id_created == null) {
         return null;
     }
     $user_name = $user['last_name'] . " " . $user['first_name'];
     //tao user name cho user de luu vao session
     $result_create_user = array('id' => $user_id_created->id, 'user_name' => $user_name);
     return $result_create_user;
 }
 /**
  * Kiem tra sau do tao new user neu user do chua tung dang ki vao he thong 
  * @param $user: bao gom cac du lieu ma nguoi dng dang ki: email, last name, first name, password
  * @return null: neu user da ton tai.
  *		   array: id va user name
  **/
 function createNewUser($user)
 {
     $select = array(' id ');
     $result = UserFacade::findByProperty($select, 'email', $user['email'], 'User');
     if (count($result) > 0) {
         return null;
     }
     $user = UserFacade::createUser($user);
     $user_name = $user['last_name'] . " " . $user['first_name'];
     //tao user name cho user de luu vao session
     $result_create_user = array('id' => $user['id'], 'user_name' => $user_name);
     return $result_create_user;
 }