Esempio n. 1
0
 function facebookLoginAction(Request $request)
 {
     $session = $this->getRequest()->getSession();
     $em = $this->getDoctrine()->getEntityManager();
     $type = 3;
     $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('RARAdminBundle:User');
     $userLogin = $facebookRepository->findOneBy(array('email' => $fbEmail, 'facebook_id' => $fbId, 'type' => 3, 'status' => 1));
     if ($userLogin) {
         return $this->redirect($this->generateUrl('rar_web_homepage'));
     }
     /*---End - Facebook LoggedIn -----*/
     return $this->redirect($this->generateUrl('rar_web_homepage'));
 }
Esempio n. 2
0
 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('RARAdminBundle:Realtor:importRealtors.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('RARAdminBundle:Realtor:importRealtors.html.twig');
 }
Esempio n. 3
0
 public function importRealtorsAction(Request $request)
 {
     ini_set('max_execution_time', 10000000);
     $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('RARAdminBundle:Realtor:importRealtors.html.twig',array('error'=>$error)); 
         		}
         		else
         		{*/
         //echo"<pre>";print_r($_FILES);die;
         if (is_uploaded_file($_FILES['file']['tmp_name'])) {
             //readfile($_FILES['file']['tmp_name']);
         }
         $handle = fopen($_FILES['file']['tmp_name'], "r");
         /*$i=0;
         		while (($data = fgetcsv($handle, 10000000, ";")) !== FALSE) 
         		{
         			$arrFile[] = $data;
         			$i++;
         			if($i>50)
         				break;
         		}
         		echo "<PRE>";print_r($arrFile);die;*/
         $stateCode = '';
         $cityName = '';
         $companyName = '';
         $phone = '';
         $businessUrl = '';
         $address = '';
         $zipCode = '';
         $stateName = '';
         $category1 = '';
         $category2 = '';
         while (($data = fgetcsv($handle, 10000000, ";")) !== FALSE) {
             $data = explode(';', $data[0]);
             if (isset($data[0])) {
                 $stateCode = ltrim($data[0]);
             }
             if (isset($data[1])) {
                 $cityName = ltrim($data[1]);
             }
             if (isset($data[2])) {
                 $companyName = ltrim($data[2]);
             }
             if (isset($data[3])) {
                 $phone = ltrim($data[3]);
             }
             if (isset($data[4])) {
                 $businessUrl = ltrim($data[4]);
             }
             if (isset($data[5])) {
                 $address = ltrim($data[5]);
             }
             if (isset($data[6])) {
                 $zipCode = ltrim($data[6]);
             }
             if (isset($data[7])) {
                 $stateName = ltrim($data[7]);
             }
             if (isset($data[8])) {
                 $category1 = ltrim($data[8]);
             }
             if (isset($data[9])) {
                 $category2 = ltrim($data[9]);
             }
             $em = $this->getDoctrine()->getEntityManager();
             $city = $em->createQueryBuilder()->select('City')->from('RARAdminBundle:City', 'City')->where('City.city_name = :cityName')->setParameter('cityName', $cityName)->getQuery()->getArrayResult();
             //echo $cityName."<PRE>";print_r($data);die;
             $cityId = $city[0]['id'];
             $country = 'US';
             $arrCat = explode(',,,,,', $category2);
             $category2 = $arrCat[0];
             $realtor = new User();
             $realtor->setState($stateCode);
             $realtor->setCity($cityId);
             $realtor->setBusinessName($companyName);
             $realtor->setPhone($phone);
             $realtor->setBusinessUrl($businessUrl);
             $realtor->setAddress($address);
             $realtor->setPinCode($zipCode);
             //$realtor->setStateName($stateName);
             $realtor->setCountry($country);
             $realtor->setCategory1($category1);
             $realtor->setCategory2($category2);
             $realtor->setImage('default_user_image.jpeg');
             $realtor->setLogo('company.jpeg');
             $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);
         //}
     }
     return $this->render('RARAdminBundle:Realtor:importRealtors.html.twig');
 }