예제 #1
0
 public function newUserFb($aParam)
 {
     if (is_array($aParam) && count($aParam)) {
         $nUserId = $this->findUserByEmailAddress($aParam["email"]);
         if ($nUserId) {
             $this->editRow($nUserId, array("user_fb_id" => $aParam["id"]));
             $aRow = $this->findUser($nUserId);
             return $aRow;
         } else {
             $oModelUserParm = new Admin_Model_UserParam();
             try {
                 $this->_db->beginTransaction();
                 $oRow = $this->createRow();
                 if ($oRow instanceof Zend_Db_Table_Row_Abstract) {
                     $oRow->user_role_id = 5;
                     $oRow->user_fb_id = $aParam["id"];
                     $oRow->email_address = $aParam["email"];
                     $oRow->created_date = time();
                     $oRow->is_active = 2;
                     $nUserId = $oRow->save();
                     if ($oModelUserParm->newUserParam($nUserId, $aParam)) {
                         $this->_db->commit();
                         return $oRow->toArray();
                     }
                 }
             } catch (Zend_Exception $e) {
                 $this->_db->rollBack();
                 return null;
             }
         }
     }
     return null;
 }