Exemplo n.º 1
0
 public function renewPlanAction(Request $request)
 {
     $session = $this->getRequest()->getSession();
     if ($session->get('type') != 4) {
         //if user is login then it will be redirect to login page
         return $this->redirect($this->generateUrl('user_home'));
     }
     $session = $this->getRequest()->getSession();
     $em = $this->getDoctrine()->getEntityManager();
     $plans = $em->createQueryBuilder()->select('UserPlan')->from('DRPAdminBundle:UserPlan', 'UserPlan')->where('UserPlan.user_id=:id')->setParameter('id', $session->get('userId'))->SetMaxResults(1)->addOrderBy('UserPlan.id', 'DESC')->getQuery()->getArrayResult();
     //******update plan*******//
     $planDetail = $em->createQueryBuilder()->select('plan')->from('DRPAdminBundle:Plan', 'plan')->where('plan.id=:id')->setParameter('id', $plans[0]['plan_id'])->getQuery()->getArrayResult();
     $userDetail = $em->createQueryBuilder()->select('user')->from('DRPAdminBundle:User', 'user')->where('user.id=:id')->setParameter('id', $session->get('userId'))->getQuery()->getArrayResult();
     $newSearches = $userDetail[0]['search_count_total'] + $planDetail[0]['searches'];
     /*$renewPlan = $em->createQueryBuilder() 
     		->select('renewPlan')
     		->update('DRPAdminBundle:User',  'renewPlan')
     		->set('renewPlan.search_count_total', ':total')
     		->where('renewPlan.id = :id')
     		->setParameter('total', $newSearches)
     		->setParameter('id', $session->get('userId'))
     		->getQuery()
     		->getResult();*/
     //******update plan*******//
     $token = $this->generateRandomString(8);
     $plan = new UserPlan();
     $plan->setPlanId($plans[0]['plan_id']);
     $plan->setUserId($session->get('userId'));
     $plan->setStatus(0);
     $plan->setPaymentStatus(0);
     $plan->setToken($token);
     $em->persist($plan);
     $em->flush();
     $ipAddress = $_SERVER['REMOTE_ADDR'];
     $params['event'] = $this->getLogEventTitleAction('RENEW_PLAN');
     $params['description'] = $this->getLogEventDescriptionAction('RENEW_PLAN');
     $params['userId'] = $session->get('userId');
     $params['ipAddress'] = $ipAddress;
     $params['creatorId'] = $session->get('userId');
     $this->setLogAction($params);
     return $this->redirect($this->generateUrl('user_printRenewPlan'));
 }
Exemplo n.º 2
0
 public function addUserAction(Request $request)
 {
     $session = $this->getRequest()->getSession();
     if ($session->get('type') != 1) {
         //if user is login then it will be redirect to login page
         return $this->redirect($this->generateUrl('drp_adminLogin'));
     }
     $em = $this->getDoctrine()->getEntityManager();
     $plans = $em->createQueryBuilder()->select('plan')->from('DRPAdminBundle:Plan', 'plan')->getQuery()->getResult();
     $businessType = $em->createQueryBuilder()->select('businsess')->from('DRPAdminBundle:BusinessType', 'businsess')->getQuery()->getResult();
     //echo"<pre>";print_r($businessType);die;
     if ($request->getMethod() == 'POST') {
         $sourcePath = $file = $_FILES['image']['name'];
         $file1 = $_FILES['image']['tmp_name'];
         move_uploaded_file($_FILES["image"]["tmp_name"], "uploads/user/" . $_FILES["image"]["name"]);
         $company = $file = $_FILES['companyImage']['name'];
         $token = $this->generateRandomString(6);
         $file2 = $_FILES['companyImage']['tmp_name'];
         move_uploaded_file($_FILES["companyImage"]["tmp_name"], "uploads/company/" . $_FILES["companyImage"]["name"]);
         $firstName = $request->get('firstname');
         $password = $request->get('password');
         $middleName = $request->get('middlename');
         $lastName = $request->get('lastname');
         $email = $request->get('email');
         $userName = $request->get('username');
         $telephone1 = $request->get('tel1');
         $telephone2 = $request->get('tel2');
         $nin = $request->get('nin');
         $tin = $request->get('tin');
         $type = $request->get('business');
         $token = $this->generateRandomString(8);
         $name = $request->get('name');
         $description = $request->get('description');
         $emailCompany = $request->get('emailCompany');
         $address = $request->get('address');
         $tinCompany = $request->get('tinCompany');
         $telephone1Company = $request->get('tel1Company');
         $telephone2Company = $request->get('tel2Company');
         $planId = $request->get('plan');
         $addUser = new User();
         $addUser->setFirstName($firstName);
         $addUser->setMiddleName($middleName);
         $addUser->setLastName($lastName);
         $addUser->setEmail($email);
         $addUser->setUsername($userName);
         $addUser->setTelephone1($telephone1);
         $addUser->setTelephone2($telephone2);
         $addUser->setPassword(md5($password));
         $addUser->setNin($nin);
         $addUser->setTin($tin);
         $addUser->setStatus(1);
         $addUser->setType(4);
         $addUser->setPicture($sourcePath);
         $addUser->setToken($token);
         $addUser->setCreatorId($session->get('userId'));
         $em->persist($addUser);
         $em->flush();
         $userId = $addUser->getId();
         $addBusiness = new Business();
         $addBusiness->setName($name);
         $addBusiness->setDescription($description);
         $addBusiness->setEmail($emailCompany);
         $addBusiness->setType($type);
         $addBusiness->setAddress($address);
         $addBusiness->setPicture($company);
         $addBusiness->setTin($tinCompany);
         $addBusiness->setTelephone1($telephone1Company);
         $addBusiness->setTelephone2($telephone2Company);
         $addBusiness->setUserId($userId);
         $addUser->setCreatorId($session->get('userId'));
         $em->persist($addBusiness);
         $em->flush();
         $plan = new UserPlan();
         $plan->setPlanId($planId);
         $plan->setUserId($userId);
         $plan->setToken($token);
         $plan->setStatus(0);
         $em->persist($plan);
         $em->flush();
         $date = date("Y/m/d.");
         $headers = "MIME-Version: 1.0" . "\r\n";
         $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
         $headers .= 'From: <*****@*****.**>' . "\r\n";
         $to = $email;
         $subject = "User Registration";
         $txt = 'Hello ' . $firstName . ' ' . $lastName . ',<br><br>Your have created account on ' . $date . '<br><br>Email is: <b>' . $email . '</b>' . 'and your password is' . $password;
         mail($to, $subject, $txt, $headers);
         //echo $txt;die;
         $ipAddress = $_SERVER['REMOTE_ADDR'];
         $params['event'] = $this->getLogEventTitleAction('ADD_USER');
         $params['description'] = $this->getLogEventDescriptionAction('ADD_USER');
         $params['userId'] = $session->get('userId');
         $params['ipAddress'] = $ipAddress;
         $params['creatorId'] = $session->get('userId');
         $this->setLogAction($params);
         return $this->redirect($this->generateUrl('drp_users'));
     }
     return $this->render('DRPAdminBundle:Pages:addUser.html.twig', array('plans' => $plans, 'businessType' => $businessType));
 }
    public function addUserAction(Request $request)
    {
        $session = $this->getRequest()->getSession();
        if ($session->get('type') != 3) {
            //if user is login then it will be redirect to login page
            return $this->redirect($this->generateUrl('registrarAdmin_adminLogin'));
        }
        $em = $this->getDoctrine()->getEntityManager();
        $plans = $em->createQueryBuilder()->select('plan')->from('DRPAdminBundle:Plan', 'plan')->getQuery()->getResult();
        $businessType = $em->createQueryBuilder()->select('businsess')->from('DRPAdminBundle:BusinessType', 'businsess')->getQuery()->getResult();
        //echo"<pre>";print_r($businessType);die;
        if ($request->getMethod() == 'POST') {
            $sourcePath = $file = $_FILES['image']['name'];
            $file1 = $_FILES['image']['tmp_name'];
            move_uploaded_file($_FILES["image"]["tmp_name"], "uploads/user/" . $_FILES["image"]["name"]);
            $company = $file = $_FILES['companyImage']['name'];
            $token = $this->generateRandomString(6);
            $file2 = $_FILES['companyImage']['tmp_name'];
            move_uploaded_file($_FILES["companyImage"]["tmp_name"], "uploads/company/" . $_FILES["companyImage"]["name"]);
            $firstName = $request->get('firstname');
            $password = $request->get('password');
            $middleName = $request->get('middlename');
            $lastName = $request->get('lastname');
            $email = $request->get('email');
            $userName = $request->get('username');
            $telephone1 = $request->get('tel1');
            $telephone2 = $request->get('tel2');
            $nin = $request->get('nin');
            $tin = $request->get('tin');
            $type = $request->get('business');
            $token = $this->generateRandomString(8);
            $name = $request->get('name');
            $description = $request->get('description');
            $emailCompany = $request->get('emailCompany');
            $address = $request->get('address');
            $tinCompany = $request->get('tinCompany');
            $telephone1Company = $request->get('tel1Company');
            $telephone2Company = $request->get('tel2Company');
            $planId = $request->get('plan');
            $addUser = new User();
            $addUser->setFirstName($firstName);
            $addUser->setMiddleName($middleName);
            $addUser->setLastName($lastName);
            $addUser->setEmail($email);
            $addUser->setUsername($userName);
            $addUser->setTelephone1($telephone1);
            $addUser->setTelephone2($telephone2);
            $addUser->setPassword(md5($password));
            $addUser->setNin($nin);
            $addUser->setTin($tin);
            $addUser->setStatus(1);
            $addUser->setType(4);
            $addUser->setPicture($sourcePath);
            $addUser->setToken($token);
            $addUser->setCreatorId($session->get('userId'));
            $em->persist($addUser);
            $em->flush();
            $userId = $addUser->getId();
            $addBusiness = new Business();
            $addBusiness->setName($name);
            $addBusiness->setDescription($description);
            $addBusiness->setEmail($emailCompany);
            $addBusiness->setType($type);
            $addBusiness->setAddress($address);
            $addBusiness->setPicture($company);
            $addBusiness->setTin($tinCompany);
            $addBusiness->setTelephone1($telephone1Company);
            $addBusiness->setTelephone2($telephone2Company);
            $addBusiness->setUserId($userId);
            $em->persist($addBusiness);
            $em->flush();
            $plan = new UserPlan();
            $plan->setPlanId($planId);
            $plan->setUserId($userId);
            $plan->setToken($token);
            $plan->setStatus(0);
            $em->persist($plan);
            $em->flush();
            $date = date("Y/m/d.");
            $headers = "MIME-Version: 1.0" . "\r\n";
            $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
            $headers .= 'From: <*****@*****.**>' . "\r\n";
            $to = $email;
            $subject = "User Registration";
            $txt = '

<table width="100%" border="0" cellspacing="0" cellpadding="0" style="min-width: 320px;"><tr><td align="center" bgcolor="#eff3f8" >

<table border="0" cellspacing="0" cellpadding="0" class="table_width_100" width="100%" style="max-width: 680px; min-width: 300px;" >
	
	<!--header -->
	<tr><td align="center" >
		<!-- padding -->
		<table width="90%" border="0" cellspacing="0" cellpadding="0" style="margin: 30px 0 31px;">
			
	<!--header END-->

	<!--content 1 -->
	<tr><td align="center" bgcolor="#fbfcfd">
		<table width="90%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td align="left" valign="top" class="mob_center" >
									<a href="#" target="_blank" style="color: #596167; font-family: Arial, Helvetica, sans-serif; font-size: 13px; float:left;" >
									<font face="Arial, Helvetica, sans-seri; font-size: 13px;" size="3" color="#596167">
									<img src="http://www.gamregistry.com/images/logo.png" width="117" height="77px" alt="DRP" border="0" style="display: block;margin-top:10px;" /></font></a>



<p style=" color: #92171c;
    display: block;
    float: left;
    font-size: 24px;
    font-weight: bold;
    margin: 40px 0 0 63px;">Registrar of Deeds</p>



<a href="#" target="_blank" style="color: #596167; font-family: Arial, Helvetica, sans-serif; font-size: 13px;float:right;" >
									<font face="Arial, Helvetica, sans-seri; font-size: 13px;" size="3" color="#596167">
									<img src="http://www.gamregistry.com/images/flag.jpg" width="77" height="77px" alt="DRP" border="0" style="display: block; margin-top:10px;" /></font></a>




								</td>




</tr>

			<tr><td align="center">
				
				<div style="line-height: 44px; margin-top: 29px;">
					<font face="Arial, Helvetica, sans-serif" size="5" color="#57697e" style="font-size: 34px;">
					<span style="font-family: Arial, Helvetica, sans-serif; font-size: 34px; color: #57697e;">
						User Registration
					</span></font>
				</div>
				<!-- padding -->
			</td></tr>
			<tr><td align="center">
				<div style="line-height: 24px;">
					<font face="Arial, Helvetica, sans-serif" size="4" color="#57697e" style="font-size: 15px;">
					<span style="font-family: Arial, Helvetica, sans-serif; font-size: 15px; color: #57697e;">
						Hello ' . $firstName . ' ' . $lastName . ' you have created account on ' . $date . '.Your Account detalis are:<br>Username/Email:<b>' . $email . '</b><br>Password:<b>' . $password . '</b>
					</span></font>
				</div>
				<!-- padding --><div style="height: 40px; line-height: 40px; font-size: 10px;">&nbsp;</div>
			</td></tr>
			<tr><td align="center">
				<div style="line-height: 24px;">
					<a href="#" target="_blank" style="color: #596167; font-family: Arial, Helvetica, sans-serif; font-size: 13px;">
						<font face="Arial, Helvetica, sans-seri; font-size: 13px;" size="3" color="#596167">
							 <a href="http://www.gamregistry.com" style="background-color: #3598dc;
    color: #ffffff; font-size: 17px;
    outline: medium none !important;
    padding: 13px 42px;
    text-decoration: none;" >Click Here For Login</a></font></a>
				</div>
				<!-- padding --><div style="height: 60px; line-height: 60px; font-size: 10px;">&nbsp;</div>
			</td></tr>
		</table>		
	</td></tr>
	<!--content 1 END-->

	<!--content 2 -->
	
</table>

 
</td></tr>
</table>


			
';
            mail($to, $subject, $txt, $headers);
            //echo $txt;die;
            $ipAddress = $_SERVER['REMOTE_ADDR'];
            $params['event'] = $this->getLogEventTitleAction('ADD_USER');
            $params['description'] = $this->getLogEventDescriptionAction('ADD_USER');
            $params['userId'] = $session->get('userId');
            $params['ipAddress'] = $ipAddress;
            $params['creatorId'] = $session->get('userId');
            $this->setLogAction($params);
            return $this->redirect($this->generateUrl('registrarAdmin_users'));
        }
        return $this->render('DRPRegistrarAdminBundle:Pages:addUser.html.twig', array('plans' => $plans, 'businessType' => $businessType));
    }