function facebookLoginAction(Request $request) { $session = $this->getRequest()->getSession(); $em = $this->getDoctrine()->getEntityManager(); $type = 1; $status = 1; $fbFirstName = $this->get('request')->request->get('fbFirstName'); $fbLastName = $this->get('request')->request->get('fbLastName'); $fbUserFullName = $this->get('request')->request->get('fbUserFullName'); $fbEmail = $this->get('request')->request->get('fbEmail'); $fbUserprofpic = $this->get('request')->request->get('fbpimage'); $fbId = $this->get('request')->request->get('user_form_email'); $session->set('fbId', $fbId); $session->set('fbUserprofpic', $fbUserprofpic); /*---Start - Add new Facebook User -----*/ $reviewer = new User(); $reviewer->setFirstName($fbFirstName); $reviewer->setLastName($fbLastName); $reviewer->setEmail($fbEmail); $reviewer->setImage($fbUserprofpic); $reviewer->setfacebookId($fbId); $reviewer->setType($type); $reviewer->setStatus($status); $em->persist($reviewer); $em->flush(); /*---End - Add new Facebook User -----*/ /*---Start - Facebook LoggedIn -----*/ $reviewerId = $reviewer->getId(); $session = $this->getRequest()->getSession(); $session->set('userId', $reviewerId); $session->set('userEmail', $fbEmail); $session->set('userName', $fbFirstName); $session->set('userType', $type); $facebookRepository = $em->getRepository('RAAAdminBundle:User'); $userLogin = $facebookRepository->findOneBy(array('email' => $fbEmail, 'facebook_id' => $fbId, 'type' => 3, 'status' => 1)); if ($userLogin) { return $this->redirect($this->generateUrl('raa_web_home')); } /*---End - Facebook LoggedIn -----*/ return $this->redirect($this->generateUrl('raa_web_home')); }
public function importRealtorsAction(Request $request) { $session = $this->getRequest()->getSession(); $loggedInUserId = $session->get('userId'); $currentTimestamp = new DateTime(); if ($request->getMethod() == 'POST') { //echo $_FILES['file']['type'];die(); if (!($_FILES['file']['type'] == "text/comma-separated-values") && !($_FILES['file']['type'] == "application/vnd.ms-excel")) { $error = 'Wrong file selected'; return $this->render('RAAAdminBundle:Airline:importAirlines.html.twig', array('error' => $error)); } else { if (is_uploaded_file($_FILES['file']['tmp_name'])) { //readfile($_FILES['file']['tmp_name']); } $handle = fopen($_FILES['file']['tmp_name'], "r"); while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $firstName = $data[0]; $lastName = $data[1]; $email = $data[2]; $password = $data[3]; $phone = $data[4]; $address = $data[5]; $address2 = $data[6]; $city = $data[7]; $state = $data[8]; $country = $data[9]; $pincode = $data[10]; $fax = $data[11]; $business = $data[12]; $overview = $data[13]; $twitter = $data[14]; $google = $data[15]; $linkedin = $data[16]; $video = $data[17]; $facebook = $data[18]; $realtor = new User(); $realtor->setFirstName($firstName); $realtor->setLastName($lastName); $realtor->setEmail($email); $realtor->setPassword(md5($password)); $realtor->setPhone($phone); $realtor->setAddress($address); $realtor->setAddress2($address2); $realtor->setCity($city); $realtor->setState($state); $realtor->setCountry($country); $realtor->setPinCode($pincode); $realtor->setFax($fax); $realtor->setBusinessName($business); $realtor->setOverview($overview); $realtor->setTwitter($twitter); $realtor->setGoogle($google); $realtor->setLinkedin($linkedin); $realtor->setFacebook($facebook); $realtor->setVideo($video); $realtor->setType(2); $realtor->setPlanId(1); $realtor->setStatus(1); $realtor->setCreatorId($loggedInUserId); $realtor->setModifierId($loggedInUserId); $realtor->setCreationTimestamp($currentTimestamp); $realtor->setModificationTimestamp($currentTimestamp); $em = $this->getDoctrine()->getEntityManager(); $em->persist($realtor); $em->flush(); } fclose($handle); //print "Import done"; } } return $this->render('RAAAdminBundle:Airline:importAirlines.html.twig'); }